Skip to contentSkip to conversation

hwmon: (ad7314) Add 'name' sysfs attribute

PATCH In review Guenter Roeck 3 participants 4 messages Sep 11, 2012 – Sep 18, 2012 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 4/4 hwmon: (ad7314) Add 'name' sysfs attribute

The 'name' sysfs attribute is mandatory for hwmon devices, but was missing in this driver.

Cc Jonathan Cameron <[email protected]>

---
candidate for -stable

 drivers/hwmon/ad7314.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/hwmon/ad7314.c +8 -0
index 455294f..37c01e7 100644
@@ -87,10 +87,18 @@ static ssize_t ad7314_show_temperature(struct device *dev,
 	}
 }
 
+static ssize_t ad7314_show_name(struct device *dev,
+				struct device_attribute *devattr, char *buf)
+{
+	return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
+}
+
+static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL);
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
 			  ad7314_show_temperature, NULL, 0);
 
 static struct attribute *ad7314_attributes[] = {
+	&dev_attr_name.attr,
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	NULL,
 };
Signature · 7 lines
1.7.9.7


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author maintainer
#1 lore raw

ping

Quoted 38 lines · Guenter Roeck

The 'name' sysfs attribute is mandatory for hwmon devices, but was missing in this driver.

Cc Jonathan Cameron <[email protected]>

---
candidate for -stable

 drivers/hwmon/ad7314.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/hwmon/ad7314.c +8 -0
index 455294f..37c01e7 100644
@@ -87,10 +87,18 @@ static ssize_t ad7314_show_temperature(struct device *dev,
 	}
 }
 
+static ssize_t ad7314_show_name(struct device *dev,
+				struct device_attribute *devattr, char *buf)
+{
+	return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
+}
+
+static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL);
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
 			  ad7314_show_temperature, NULL, 0);
 
 static struct attribute *ad7314_attributes[] = {
+	&dev_attr_name.attr,
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	NULL,
 };
Signature · 1 line
1.7.9.7

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Acked-by on v1 4/4
#2 lore raw
In reply to Guenter Roeck
Quoted 24 lines · Guenter Roeck

The 'name' sysfs attribute is mandatory for hwmon devices, but was missing in this driver.

Cc Jonathan Cameron <[email protected]>

---
candidate for -stable

 drivers/hwmon/ad7314.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/hwmon/ad7314.c +5 -0
index 455294f..37c01e7 100644
@@ -87,10 +87,18 @@ static ssize_t ad7314_show_temperature(struct device *dev,
 	}
 }
 
+static ssize_t ad7314_show_name(struct device *dev,
+				struct device_attribute *devattr, char *buf)
+{
+	return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
+}

drivers/hwmon/ad7314.c static ssize_t ad7314_show_temperature(struct device *dev, · line 104

Quoted 10 lines
drivers/hwmon/ad7314.c +3 -0
+
+static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL);
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
 			  ad7314_show_temperature, NULL, 0);
 
 static struct attribute *ad7314_attributes[] = {
+	&dev_attr_name.attr,
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	NULL,
 };
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 4/4
#3 lore raw
In reply to Guenter Roeck
Quoted 5 lines · Guenter Roeck

ping

Quoted 2 lines · Guenter Roeck

The 'name' sysfs attribute is mandatory for hwmon devices, but was missing in this driver.

Sorry, completely forgot about this.

Quoted 27 lines
Quoted 27 lines
Cc Jonathan Cameron <[email protected]>

---
candidate for -stable

 drivers/hwmon/ad7314.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/hwmon/ad7314.c +7 -0
index 455294f..37c01e7 100644
@@ -87,10 +87,18 @@ static ssize_t ad7314_show_temperature(struct device *dev,
 	}
 }
 
+static ssize_t ad7314_show_name(struct device *dev,
+				struct device_attribute *devattr, char *buf)
+{
+	return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
+}
+
+static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL);
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
 			  ad7314_show_temperature, NULL, 0);
 
Quoted 9 lines
Quoted 9 lines
drivers/hwmon/ad7314.c +1 -0
 static struct attribute *ad7314_attributes[] = {
+	&dev_attr_name.attr,
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	NULL,
 };
Signature · 1 line
1.7.9.7

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors