From: Axel Lin <axel.lin@ingics.com>
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH] hwmon: (g762) Use of_property_read_u32 at appropriate place
Date: Fri, 01 Aug 2014 02:07:25 +0000 [thread overview]
Message-ID: <1406858845.21842.5.camel@phoenix> (raw)
Simplify the code a bit and also improve readability.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/hwmon/g762.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/hwmon/g762.c b/drivers/hwmon/g762.c
index 7dbc8c9..6aac695 100644
--- a/drivers/hwmon/g762.c
+++ b/drivers/hwmon/g762.c
@@ -649,15 +649,12 @@ static int g762_of_prop_import_one(struct i2c_client *client,
int (*psetter)(struct device *dev,
unsigned long val))
{
- const __be32 *prop;
- int len, ret;
+ int ret;
u32 pval;
- prop = of_get_property(client->dev.of_node, pname, &len);
- if (!prop || len != sizeof(u32))
+ if (of_property_read_u32(client->dev.of_node, pname, &pval))
return 0;
- pval = be32_to_cpu(prop[0]);
dev_dbg(&client->dev, "found %s (%d)\n", pname, pval);
ret = (*psetter)(&client->dev, pval);
if (ret)
--
1.9.1
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next reply other threads:[~2014-08-01 2:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-01 2:07 Axel Lin [this message]
2014-08-04 18:37 ` [lm-sensors] [PATCH] hwmon: (g762) Use of_property_read_u32 at appropriate place Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1406858845.21842.5.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.