* Re: [lm-sensors] [PATCH 3/4] hwmon: (ads7871) Add 'name' sysfs attribute
2012-09-11 20:52 [lm-sensors] [PATCH 3/4] hwmon: (ads7871) Add 'name' sysfs attribute Guenter Roeck
@ 2012-09-17 16:38 ` Guenter Roeck
2012-09-17 19:05 ` Jean Delvare
2012-09-17 20:52 ` Paul Thomas
2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2012-09-17 16:38 UTC (permalink / raw)
To: lm-sensors
ping
On Tue, Sep 11, 2012 at 01:52:52PM -0700, Guenter Roeck wrote:
> The 'name' sysfs attribute is mandatory for hwmon devices, but was missing
> in this driver.
>
> Cc: Paul Thomas <pthomas8589@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Candidate for -stable
>
> drivers/hwmon/ads7871.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
> index e837707..1b53aa4 100644
> --- a/drivers/hwmon/ads7871.c
> +++ b/drivers/hwmon/ads7871.c
> @@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev,
> }
> }
>
> +static ssize_t ads7871_show_name(struct device *dev,
> + struct device_attribute *devattr, char *buf)
> +{
> + return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
> +}
> +
> static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0);
> static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1);
> static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);
> @@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5);
> static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6);
> static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7);
>
> +static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL);
> +
> static struct attribute *ads7871_attributes[] = {
> &sensor_dev_attr_in0_input.dev_attr.attr,
> &sensor_dev_attr_in1_input.dev_attr.attr,
> @@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = {
> &sensor_dev_attr_in5_input.dev_attr.attr,
> &sensor_dev_attr_in6_input.dev_attr.attr,
> &sensor_dev_attr_in7_input.dev_attr.attr,
> + &dev_attr_name.attr,
> NULL
> };
>
> --
> 1.7.9.7
>
>
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [lm-sensors] [PATCH 3/4] hwmon: (ads7871) Add 'name' sysfs attribute
2012-09-11 20:52 [lm-sensors] [PATCH 3/4] hwmon: (ads7871) Add 'name' sysfs attribute Guenter Roeck
2012-09-17 16:38 ` Guenter Roeck
@ 2012-09-17 19:05 ` Jean Delvare
2012-09-17 20:52 ` Paul Thomas
2 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2012-09-17 19:05 UTC (permalink / raw)
To: lm-sensors
On Tue, 11 Sep 2012 13:52:52 -0700, Guenter Roeck wrote:
> The 'name' sysfs attribute is mandatory for hwmon devices, but was missing
> in this driver.
>
> Cc: Paul Thomas <pthomas8589@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Candidate for -stable
>
> drivers/hwmon/ads7871.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
> index e837707..1b53aa4 100644
> --- a/drivers/hwmon/ads7871.c
> +++ b/drivers/hwmon/ads7871.c
> @@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev,
> }
> }
>
> +static ssize_t ads7871_show_name(struct device *dev,
> + struct device_attribute *devattr, char *buf)
> +{
> + return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
> +}
> +
> static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0);
> static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1);
> static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);
> @@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5);
> static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6);
> static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7);
>
> +static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL);
> +
> static struct attribute *ads7871_attributes[] = {
> &sensor_dev_attr_in0_input.dev_attr.attr,
> &sensor_dev_attr_in1_input.dev_attr.attr,
> @@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = {
> &sensor_dev_attr_in5_input.dev_attr.attr,
> &sensor_dev_attr_in6_input.dev_attr.attr,
> &sensor_dev_attr_in7_input.dev_attr.attr,
> + &dev_attr_name.attr,
> NULL
> };
>
Good catch.
Acked-by: Jean Delvare <khali@linux-fr.org>
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [lm-sensors] [PATCH 3/4] hwmon: (ads7871) Add 'name' sysfs attribute
2012-09-11 20:52 [lm-sensors] [PATCH 3/4] hwmon: (ads7871) Add 'name' sysfs attribute Guenter Roeck
2012-09-17 16:38 ` Guenter Roeck
2012-09-17 19:05 ` Jean Delvare
@ 2012-09-17 20:52 ` Paul Thomas
2 siblings, 0 replies; 4+ messages in thread
From: Paul Thomas @ 2012-09-17 20:52 UTC (permalink / raw)
To: lm-sensors
[-- Attachment #1.1: Type: text/plain, Size: 1885 bytes --]
Acked-by: Paul Thomas <pthomas8589@gmail.com>
On Tue, Sep 11, 2012 at 1:52 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> The 'name' sysfs attribute is mandatory for hwmon devices, but was missing
> in this driver.
>
> Cc: Paul Thomas <pthomas8589@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Candidate for -stable
>
> drivers/hwmon/ads7871.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
> index e837707..1b53aa4 100644
> --- a/drivers/hwmon/ads7871.c
> +++ b/drivers/hwmon/ads7871.c
> @@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev,
> }
> }
>
> +static ssize_t ads7871_show_name(struct device *dev,
> + struct device_attribute *devattr, char
> *buf)
> +{
> + return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
> +}
> +
> static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0);
> static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1);
> static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);
> @@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO,
> show_voltage, NULL, 5);
> static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6);
> static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7);
>
> +static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL);
> +
> static struct attribute *ads7871_attributes[] = {
> &sensor_dev_attr_in0_input.dev_attr.attr,
> &sensor_dev_attr_in1_input.dev_attr.attr,
> @@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = {
> &sensor_dev_attr_in5_input.dev_attr.attr,
> &sensor_dev_attr_in6_input.dev_attr.attr,
> &sensor_dev_attr_in7_input.dev_attr.attr,
> + &dev_attr_name.attr,
> NULL
> };
>
> --
> 1.7.9.7
>
>
[-- Attachment #1.2: Type: text/html, Size: 2523 bytes --]
[-- Attachment #2: Type: text/plain, Size: 153 bytes --]
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread