Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=67f921d164a046c957f06fb456cabc23c48667ab
Commit:     67f921d164a046c957f06fb456cabc23c48667ab
Parent:     471c606827394f59117cf45c808afd8fe638f902
Author:     Jean Delvare <[EMAIL PROTECTED]>
AuthorDate: Fri Aug 17 17:31:35 2007 +0200
Committer:  Mark M. Hoffman <[EMAIL PROTECTED]>
CommitDate: Tue Oct 9 22:56:29 2007 -0400

    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 <[EMAIL PROTECTED]>
    Acked-by: Hans de Goede <[EMAIL PROTECTED]>
    Acked-by: Kaiwan <[EMAIL PROTECTED]>
    Signed-off-by: Mark M. Hoffman <[EMAIL PROTECTED]>
---
 drivers/hwmon/lm70.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index 275d392..30b9b2b 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -81,7 +81,7 @@ static ssize_t lm70_sense_temp(struct device *dev,
         * So it's equivalent to multiplying by 0.25 * 1000 = 250.
         */
        val = ((int)raw/32) * 250;
-       status = sprintf(buf, "%+d\n", val); /* millidegrees Celsius */
+       status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */
 out:
        up(&p_lm70->sem);
        return status;
@@ -89,6 +89,14 @@ out:
 
 static DEVICE_ATTR(temp1_input, S_IRUGO, lm70_sense_temp, NULL);
 
+static ssize_t lm70_show_name(struct device *dev, struct device_attribute
+                             *devattr, char *buf)
+{
+       return sprintf(buf, "lm70\n");
+}
+
+static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL);
+
 /*----------------------------------------------------------------------*/
 
 static int __devinit lm70_probe(struct spi_device *spi)
@@ -115,7 +123,8 @@ static int __devinit lm70_probe(struct spi_device *spi)
        }
        dev_set_drvdata(&spi->dev, p_lm70);
 
-       if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input))) {
+       if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input))
+        || (status = device_create_file(&spi->dev, &dev_attr_name))) {
                dev_dbg(&spi->dev, "device_create_file failure.\n");
                goto out_dev_create_file_failed;
        }
@@ -123,6 +132,7 @@ static int __devinit lm70_probe(struct spi_device *spi)
        return 0;
 
 out_dev_create_file_failed:
+       device_remove_file(&spi->dev, &dev_attr_temp1_input);
        hwmon_device_unregister(p_lm70->cdev);
 out_dev_reg_failed:
        dev_set_drvdata(&spi->dev, NULL);
@@ -135,6 +145,7 @@ static int __devexit lm70_remove(struct spi_device *spi)
        struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);
 
        device_remove_file(&spi->dev, &dev_attr_temp1_input);
+       device_remove_file(&spi->dev, &dev_attr_name);
        hwmon_device_unregister(p_lm70->cdev);
        dev_set_drvdata(&spi->dev, NULL);
        kfree(p_lm70);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to