Skip to content

Commit

Permalink
hwmon: Convert to using %pOFn instead of device_node.name
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
robherring authored and groeck committed Oct 11, 2018
1 parent 23d3f13 commit 0debe4d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion drivers/hwmon/aspeed-pwm-tacho.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ static int aspeed_create_pwm_cooling(struct device *dev,
dev_err(dev, "Property 'cooling-levels' cannot be read.\n");
return ret;
}
snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%s%d", child->name, pwm_port);
snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%pOFn%d", child, pwm_port);

cdev->tcdev = thermal_of_cooling_device_register(child,
cdev->name,
Expand Down
4 changes: 2 additions & 2 deletions drivers/hwmon/ibmpowernv.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,8 @@ static int create_device_attrs(struct platform_device *pdev)
if (of_property_read_u32(np, "sensor-id", &sensor_id) &&
of_property_read_u32(np, "sensor-data", &sensor_id)) {
dev_info(&pdev->dev,
"'sensor-id' missing in the node '%s'\n",
np->name);
"'sensor-id' missing in the node '%pOFn'\n",
np);
continue;
}

Expand Down
9 changes: 4 additions & 5 deletions drivers/hwmon/iio_hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/npcm750-pwm-fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ static int npcm7xx_create_pwm_cooling(struct device *dev,
dev_err(dev, "Property 'cooling-levels' cannot be read.\n");
return ret;
}
snprintf(cdev->name, THERMAL_NAME_LENGTH, "%s%d", child->name,
snprintf(cdev->name, THERMAL_NAME_LENGTH, "%pOFn%d", child,
pwm_port);

cdev->tcdev = thermal_of_cooling_device_register(child,
Expand Down

0 comments on commit 0debe4d

Please sign in to comment.