aboutsummaryrefslogtreecommitdiff
path: root/drivers/hwmon/iio_hwmon.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2018-08-27 20:52:21 -0500
committerGuenter Roeck <linux@roeck-us.net>2018-10-10 20:37:13 -0700
commit0debe4d0b86afa5eb9192595c820ed980cabe38b (patch)
treeedf7ba6d6303f13785251763131ec3e658d0e7d7 /drivers/hwmon/iio_hwmon.c
parent23d3f131bf379b9460d2f079f0eb85ac669eded4 (diff)
hwmon: Convert to using %pOFn instead of device_node.name
In preparation to remove the node name pointer from struct device_node, convert printf users to use the %pOFn format specifier. Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-hwmon@vger.kernel.org Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/iio_hwmon.c')
-rw-r--r--drivers/hwmon/iio_hwmon.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c
index 2f3f875c06ac..7566991f1c04 100644
--- a/drivers/hwmon/iio_hwmon.c
+++ b/drivers/hwmon/iio_hwmon.c
@@ -65,13 +65,9 @@ static int iio_hwmon_probe(struct platform_device *pdev)
int in_i = 1, temp_i = 1, curr_i = 1, humidity_i = 1;
enum iio_chan_type type;
struct iio_channel *channels;
- const char *name = "iio_hwmon";
struct device *hwmon_dev;
char *sname;
- if (dev->of_node && dev->of_node->name)
- name = dev->of_node->name;
-
channels = devm_iio_channel_get_all(dev);
if (IS_ERR(channels)) {
if (PTR_ERR(channels) == -ENODEV)
@@ -141,7 +137,10 @@ static int iio_hwmon_probe(struct platform_device *pdev)
st->attr_group.attrs = st->attrs;
st->groups[0] = &st->attr_group;
- sname = devm_kstrdup(dev, name, GFP_KERNEL);
+ if (dev->of_node)
+ sname = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", dev->of_node);
+ else
+ sname = devm_kstrdup(dev, "iio_hwmon", GFP_KERNEL);
if (!sname)
return -ENOMEM;