diff options
author | Rob Herring <robh@kernel.org> | 2018-08-27 21:52:21 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2018-10-10 23:37:13 -0400 |
commit | 0debe4d0b86afa5eb9192595c820ed980cabe38b (patch) | |
tree | edf7ba6d6303f13785251763131ec3e658d0e7d7 | |
parent | 23d3f131bf379b9460d2f079f0eb85ac669eded4 (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>
-rw-r--r-- | drivers/hwmon/aspeed-pwm-tacho.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/ibmpowernv.c | 4 | ||||
-rw-r--r-- | drivers/hwmon/iio_hwmon.c | 9 | ||||
-rw-r--r-- | drivers/hwmon/npcm750-pwm-fan.c | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c index 5e449eac788a..92de8139d398 100644 --- a/drivers/hwmon/aspeed-pwm-tacho.c +++ b/drivers/hwmon/aspeed-pwm-tacho.c | |||
@@ -852,7 +852,7 @@ static int aspeed_create_pwm_cooling(struct device *dev, | |||
852 | dev_err(dev, "Property 'cooling-levels' cannot be read.\n"); | 852 | dev_err(dev, "Property 'cooling-levels' cannot be read.\n"); |
853 | return ret; | 853 | return ret; |
854 | } | 854 | } |
855 | snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%s%d", child->name, pwm_port); | 855 | snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%pOFn%d", child, pwm_port); |
856 | 856 | ||
857 | cdev->tcdev = thermal_of_cooling_device_register(child, | 857 | cdev->tcdev = thermal_of_cooling_device_register(child, |
858 | cdev->name, | 858 | cdev->name, |
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c index 83472808c816..4935897f1527 100644 --- a/drivers/hwmon/ibmpowernv.c +++ b/drivers/hwmon/ibmpowernv.c | |||
@@ -603,8 +603,8 @@ static int create_device_attrs(struct platform_device *pdev) | |||
603 | if (of_property_read_u32(np, "sensor-id", &sensor_id) && | 603 | if (of_property_read_u32(np, "sensor-id", &sensor_id) && |
604 | of_property_read_u32(np, "sensor-data", &sensor_id)) { | 604 | of_property_read_u32(np, "sensor-data", &sensor_id)) { |
605 | dev_info(&pdev->dev, | 605 | dev_info(&pdev->dev, |
606 | "'sensor-id' missing in the node '%s'\n", | 606 | "'sensor-id' missing in the node '%pOFn'\n", |
607 | np->name); | 607 | np); |
608 | continue; | 608 | continue; |
609 | } | 609 | } |
610 | 610 | ||
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) | |||
65 | int in_i = 1, temp_i = 1, curr_i = 1, humidity_i = 1; | 65 | int in_i = 1, temp_i = 1, curr_i = 1, humidity_i = 1; |
66 | enum iio_chan_type type; | 66 | enum iio_chan_type type; |
67 | struct iio_channel *channels; | 67 | struct iio_channel *channels; |
68 | const char *name = "iio_hwmon"; | ||
69 | struct device *hwmon_dev; | 68 | struct device *hwmon_dev; |
70 | char *sname; | 69 | char *sname; |
71 | 70 | ||
72 | if (dev->of_node && dev->of_node->name) | ||
73 | name = dev->of_node->name; | ||
74 | |||
75 | channels = devm_iio_channel_get_all(dev); | 71 | channels = devm_iio_channel_get_all(dev); |
76 | if (IS_ERR(channels)) { | 72 | if (IS_ERR(channels)) { |
77 | if (PTR_ERR(channels) == -ENODEV) | 73 | if (PTR_ERR(channels) == -ENODEV) |
@@ -141,7 +137,10 @@ static int iio_hwmon_probe(struct platform_device *pdev) | |||
141 | st->attr_group.attrs = st->attrs; | 137 | st->attr_group.attrs = st->attrs; |
142 | st->groups[0] = &st->attr_group; | 138 | st->groups[0] = &st->attr_group; |
143 | 139 | ||
144 | sname = devm_kstrdup(dev, name, GFP_KERNEL); | 140 | if (dev->of_node) |
141 | sname = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", dev->of_node); | ||
142 | else | ||
143 | sname = devm_kstrdup(dev, "iio_hwmon", GFP_KERNEL); | ||
145 | if (!sname) | 144 | if (!sname) |
146 | return -ENOMEM; | 145 | return -ENOMEM; |
147 | 146 | ||
diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c index 8474d601aa63..96634fd54e0b 100644 --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c | |||
@@ -861,7 +861,7 @@ static int npcm7xx_create_pwm_cooling(struct device *dev, | |||
861 | dev_err(dev, "Property 'cooling-levels' cannot be read.\n"); | 861 | dev_err(dev, "Property 'cooling-levels' cannot be read.\n"); |
862 | return ret; | 862 | return ret; |
863 | } | 863 | } |
864 | snprintf(cdev->name, THERMAL_NAME_LENGTH, "%s%d", child->name, | 864 | snprintf(cdev->name, THERMAL_NAME_LENGTH, "%pOFn%d", child, |
865 | pwm_port); | 865 | pwm_port); |
866 | 866 | ||
867 | cdev->tcdev = thermal_of_cooling_device_register(child, | 867 | cdev->tcdev = thermal_of_cooling_device_register(child, |