aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm70.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-08-17 11:31:35 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-10-09 22:56:29 -0400
commit67f921d164a046c957f06fb456cabc23c48667ab (patch)
tree930ac484e2da2585f5a925a30103cd708f004196 /drivers/hwmon/lm70.c
parent471c606827394f59117cf45c808afd8fe638f902 (diff)
hwmon: (lm70) Add a name attribute
Add a name attribute to the lm70 devices. This is required for libsensors to recognize them. Also drop the "+" before the temperature value, even though it did not cause problems to libsensors, other hardware monitoring drivers don't print it, so it's more consistent that way. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl> Acked-by: Kaiwan <kaiwan@designergraphix.com> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/lm70.c')
-rw-r--r--drivers/hwmon/lm70.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index 275d392eca61..30b9b2be87b9 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -81,7 +81,7 @@ static ssize_t lm70_sense_temp(struct device *dev,
81 * So it's equivalent to multiplying by 0.25 * 1000 = 250. 81 * So it's equivalent to multiplying by 0.25 * 1000 = 250.
82 */ 82 */
83 val = ((int)raw/32) * 250; 83 val = ((int)raw/32) * 250;
84 status = sprintf(buf, "%+d\n", val); /* millidegrees Celsius */ 84 status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */
85out: 85out:
86 up(&p_lm70->sem); 86 up(&p_lm70->sem);
87 return status; 87 return status;
@@ -89,6 +89,14 @@ out:
89 89
90static DEVICE_ATTR(temp1_input, S_IRUGO, lm70_sense_temp, NULL); 90static DEVICE_ATTR(temp1_input, S_IRUGO, lm70_sense_temp, NULL);
91 91
92static ssize_t lm70_show_name(struct device *dev, struct device_attribute
93 *devattr, char *buf)
94{
95 return sprintf(buf, "lm70\n");
96}
97
98static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL);
99
92/*----------------------------------------------------------------------*/ 100/*----------------------------------------------------------------------*/
93 101
94static int __devinit lm70_probe(struct spi_device *spi) 102static int __devinit lm70_probe(struct spi_device *spi)
@@ -115,7 +123,8 @@ static int __devinit lm70_probe(struct spi_device *spi)
115 } 123 }
116 dev_set_drvdata(&spi->dev, p_lm70); 124 dev_set_drvdata(&spi->dev, p_lm70);
117 125
118 if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input))) { 126 if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input))
127 || (status = device_create_file(&spi->dev, &dev_attr_name))) {
119 dev_dbg(&spi->dev, "device_create_file failure.\n"); 128 dev_dbg(&spi->dev, "device_create_file failure.\n");
120 goto out_dev_create_file_failed; 129 goto out_dev_create_file_failed;
121 } 130 }
@@ -123,6 +132,7 @@ static int __devinit lm70_probe(struct spi_device *spi)
123 return 0; 132 return 0;
124 133
125out_dev_create_file_failed: 134out_dev_create_file_failed:
135 device_remove_file(&spi->dev, &dev_attr_temp1_input);
126 hwmon_device_unregister(p_lm70->cdev); 136 hwmon_device_unregister(p_lm70->cdev);
127out_dev_reg_failed: 137out_dev_reg_failed:
128 dev_set_drvdata(&spi->dev, NULL); 138 dev_set_drvdata(&spi->dev, NULL);
@@ -135,6 +145,7 @@ static int __devexit lm70_remove(struct spi_device *spi)
135 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); 145 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);
136 146
137 device_remove_file(&spi->dev, &dev_attr_temp1_input); 147 device_remove_file(&spi->dev, &dev_attr_temp1_input);
148 device_remove_file(&spi->dev, &dev_attr_name);
138 hwmon_device_unregister(p_lm70->cdev); 149 hwmon_device_unregister(p_lm70->cdev);
139 dev_set_drvdata(&spi->dev, NULL); 150 dev_set_drvdata(&spi->dev, NULL);
140 kfree(p_lm70); 151 kfree(p_lm70);