diff options
| -rw-r--r-- | drivers/staging/iio/iio_hwmon.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/staging/iio/iio_hwmon.c b/drivers/staging/iio/iio_hwmon.c index 93af756ba48c..aafa4531b961 100644 --- a/drivers/staging/iio/iio_hwmon.c +++ b/drivers/staging/iio/iio_hwmon.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/err.h> | 13 | #include <linux/err.h> |
| 14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/hwmon.h> | 15 | #include <linux/hwmon.h> |
| 16 | #include <linux/of.h> | ||
| 16 | #include <linux/hwmon-sysfs.h> | 17 | #include <linux/hwmon-sysfs.h> |
| 17 | #include <linux/iio/consumer.h> | 18 | #include <linux/iio/consumer.h> |
| 18 | #include <linux/iio/types.h> | 19 | #include <linux/iio/types.h> |
| @@ -58,7 +59,12 @@ static ssize_t iio_hwmon_read_val(struct device *dev, | |||
| 58 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, | 59 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, |
| 59 | char *buf) | 60 | char *buf) |
| 60 | { | 61 | { |
| 61 | return sprintf(buf, "iio_hwmon\n"); | 62 | const char *name = "iio_hwmon"; |
| 63 | |||
| 64 | if (dev->of_node && dev->of_node->name) | ||
| 65 | name = dev->of_node->name; | ||
| 66 | |||
| 67 | return sprintf(buf, "%s\n", name); | ||
| 62 | } | 68 | } |
| 63 | 69 | ||
| 64 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | 70 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
