aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm90.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-09-08 01:45:47 -0400
committerLen Brown <len.brown@intel.com>2005-09-08 01:45:47 -0400
commit64e47488c913ac704d465a6af86a26786d1412a5 (patch)
treed3b0148592963dcde26e4bb35ddfec8b1eaf8e23 /drivers/hwmon/lm90.c
parent4a35a46bf1cda4737c428380d1db5d15e2590d18 (diff)
parentcaf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff)
Merge linux-2.6 with linux-acpi-2.6
Diffstat (limited to 'drivers/hwmon/lm90.c')
-rw-r--r--drivers/hwmon/lm90.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index a67dcadf7cb0..14de05fcd431 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -75,8 +75,9 @@
75#include <linux/slab.h> 75#include <linux/slab.h>
76#include <linux/jiffies.h> 76#include <linux/jiffies.h>
77#include <linux/i2c.h> 77#include <linux/i2c.h>
78#include <linux/i2c-sensor.h>
79#include <linux/hwmon-sysfs.h> 78#include <linux/hwmon-sysfs.h>
79#include <linux/hwmon.h>
80#include <linux/err.h>
80 81
81/* 82/*
82 * Addresses to scan 83 * Addresses to scan
@@ -89,13 +90,12 @@
89 */ 90 */
90 91
91static unsigned short normal_i2c[] = { 0x4c, 0x4d, I2C_CLIENT_END }; 92static unsigned short normal_i2c[] = { 0x4c, 0x4d, I2C_CLIENT_END };
92static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
93 93
94/* 94/*
95 * Insmod parameters 95 * Insmod parameters
96 */ 96 */
97 97
98SENSORS_INSMOD_6(lm90, adm1032, lm99, lm86, max6657, adt7461); 98I2C_CLIENT_INSMOD_6(lm90, adm1032, lm99, lm86, max6657, adt7461);
99 99
100/* 100/*
101 * The LM90 registers 101 * The LM90 registers
@@ -200,6 +200,7 @@ static struct i2c_driver lm90_driver = {
200 200
201struct lm90_data { 201struct lm90_data {
202 struct i2c_client client; 202 struct i2c_client client;
203 struct class_device *class_dev;
203 struct semaphore update_lock; 204 struct semaphore update_lock;
204 char valid; /* zero until following fields are valid */ 205 char valid; /* zero until following fields are valid */
205 unsigned long last_updated; /* in jiffies */ 206 unsigned long last_updated; /* in jiffies */
@@ -352,7 +353,7 @@ static int lm90_attach_adapter(struct i2c_adapter *adapter)
352{ 353{
353 if (!(adapter->class & I2C_CLASS_HWMON)) 354 if (!(adapter->class & I2C_CLASS_HWMON))
354 return 0; 355 return 0;
355 return i2c_detect(adapter, &addr_data, lm90_detect); 356 return i2c_probe(adapter, &addr_data, lm90_detect);
356} 357}
357 358
358/* 359/*
@@ -500,6 +501,12 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind)
500 lm90_init_client(new_client); 501 lm90_init_client(new_client);
501 502
502 /* Register sysfs hooks */ 503 /* Register sysfs hooks */
504 data->class_dev = hwmon_device_register(&new_client->dev);
505 if (IS_ERR(data->class_dev)) {
506 err = PTR_ERR(data->class_dev);
507 goto exit_detach;
508 }
509
503 device_create_file(&new_client->dev, 510 device_create_file(&new_client->dev,
504 &sensor_dev_attr_temp1_input.dev_attr); 511 &sensor_dev_attr_temp1_input.dev_attr);
505 device_create_file(&new_client->dev, 512 device_create_file(&new_client->dev,
@@ -524,6 +531,8 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind)
524 531
525 return 0; 532 return 0;
526 533
534exit_detach:
535 i2c_detach_client(new_client);
527exit_free: 536exit_free:
528 kfree(data); 537 kfree(data);
529exit: 538exit:
@@ -547,15 +556,15 @@ static void lm90_init_client(struct i2c_client *client)
547 556
548static int lm90_detach_client(struct i2c_client *client) 557static int lm90_detach_client(struct i2c_client *client)
549{ 558{
559 struct lm90_data *data = i2c_get_clientdata(client);
550 int err; 560 int err;
551 561
552 if ((err = i2c_detach_client(client))) { 562 hwmon_device_unregister(data->class_dev);
553 dev_err(&client->dev, "Client deregistration failed, " 563
554 "client not detached.\n"); 564 if ((err = i2c_detach_client(client)))
555 return err; 565 return err;
556 }
557 566
558 kfree(i2c_get_clientdata(client)); 567 kfree(data);
559 return 0; 568 return 0;
560} 569}
561 570