diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-22 14:19:57 +0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-22 14:19:57 +0400 |
commit | 930352862e9533fecc42c7ed20798a7c9e3aa874 (patch) | |
tree | f234d6eb69c077f898e375aef30c9550dcf069d7 /drivers/hwmon/ads1015.c | |
parent | b46882b6eb713245916100ac5b58664cd242a08d (diff) | |
parent | 7bbd03e0143b562ff7d96f7e71c016104020b550 (diff) | |
download | linux-930352862e9533fecc42c7ed20798a7c9e3aa874.tar.xz |
Merge branch 'topic/enum-info-cleanup' into for-next
this is a series of patches to just convert the plain info callback
for enum ctl elements to snd_ctl_elem_info(). Also, it includes the
extension of snd_ctl_elem_info(), for catching the unexpected string
cut-off and handling the zero items.
Diffstat (limited to 'drivers/hwmon/ads1015.c')
-rw-r--r-- | drivers/hwmon/ads1015.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c index 126516414c11..f155b8380481 100644 --- a/drivers/hwmon/ads1015.c +++ b/drivers/hwmon/ads1015.c @@ -184,20 +184,18 @@ static int ads1015_get_channels_config_of(struct i2c_client *client) return -EINVAL; for_each_child_of_node(client->dev.of_node, node) { - const __be32 *property; - int len; + u32 pval; unsigned int channel; unsigned int pga = ADS1015_DEFAULT_PGA; unsigned int data_rate = ADS1015_DEFAULT_DATA_RATE; - property = of_get_property(node, "reg", &len); - if (!property || len != sizeof(int)) { + if (of_property_read_u32(node, "reg", &pval)) { dev_err(&client->dev, "invalid reg on %s\n", node->full_name); continue; } - channel = be32_to_cpup(property); + channel = pval; if (channel >= ADS1015_CHANNELS) { dev_err(&client->dev, "invalid channel index %d on %s\n", @@ -205,20 +203,17 @@ static int ads1015_get_channels_config_of(struct i2c_client *client) continue; } - property = of_get_property(node, "ti,gain", &len); - if (property && len == sizeof(int)) { - pga = be32_to_cpup(property); + if (!of_property_read_u32(node, "ti,gain", &pval)) { + pga = pval; if (pga > 6) { - dev_err(&client->dev, - "invalid gain on %s\n", + dev_err(&client->dev, "invalid gain on %s\n", node->full_name); return -EINVAL; } } - property = of_get_property(node, "ti,datarate", &len); - if (property && len == sizeof(int)) { - data_rate = be32_to_cpup(property); + if (!of_property_read_u32(node, "ti,datarate", &pval)) { + data_rate = pval; if (data_rate > 7) { dev_err(&client->dev, "invalid data_rate on %s\n", |