devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: fixed: use of_property_read_{bool|u32}()
@ 2014-05-25 19:50 Sergei Shtylyov
       [not found] ` <201405252350.40402.sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2014-05-25 19:50 UTC (permalink / raw)
  To: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA

Use more compact of_property_read_{bool|u32}() calls instead of the
of_{find|get}_property() calls.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>

---
The patch is against Mark Brown's 'regulator.git' repo's 'for-next' branch.

 drivers/regulator/fixed.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Index: regulator/drivers/regulator/fixed.c
===================================================================
--- regulator.orig/drivers/regulator/fixed.c
+++ regulator/drivers/regulator/fixed.c
@@ -50,7 +50,6 @@ of_get_fixed_voltage_config(struct devic
 {
 	struct fixed_voltage_config *config;
 	struct device_node *np = dev->of_node;
-	const __be32 *delay;
 	struct regulator_init_data *init_data;
 
 	config = devm_kzalloc(dev, sizeof(struct fixed_voltage_config),
@@ -91,15 +90,11 @@ of_get_fixed_voltage_config(struct devic
 	if ((config->gpio == -ENODEV) || (config->gpio == -EPROBE_DEFER))
 		return ERR_PTR(-EPROBE_DEFER);
 
-	delay = of_get_property(np, "startup-delay-us", NULL);
-	if (delay)
-		config->startup_delay = be32_to_cpu(*delay);
+	of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
 
-	if (of_find_property(np, "enable-active-high", NULL))
-		config->enable_high = true;
-
-	if (of_find_property(np, "gpio-open-drain", NULL))
-		config->gpio_is_open_drain = true;
+	config->enable_high = of_property_read_bool(np, "enable-active-high");
+	config->gpio_is_open_drain = of_property_read_bool(np,
+							   "gpio-open-drain");
 
 	if (of_find_property(np, "vin-supply", NULL))
 		config->input_supply = "vin";
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-06-01 12:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-25 19:50 [PATCH] regulator: fixed: use of_property_read_{bool|u32}() Sergei Shtylyov
     [not found] ` <201405252350.40402.sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2014-05-26 15:19   ` Mark Brown
     [not found]     ` <20140526151958.GU22111-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-05-26 17:33       ` Sergei Shtylyov
     [not found]         ` <53837AEE.7030400-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2014-05-26 17:56           ` Mark Brown
     [not found]             ` <20140526175648.GG12304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-05-26 18:01               ` Sergei Shtylyov
     [not found]                 ` <53838184.9070401-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2014-05-26 18:07                   ` Fabio Estevam
     [not found]                     ` <CAOMZO5Dg-rU5qFSYJEK9h1PwuN6Y099LVjHWOqSwV0Ro6PxFTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-01 12:50                       ` Mark Brown
2014-05-26 18:12                   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).