]> err.no Git - linux-2.6/blobdiff - drivers/hwmon/smsc47b397.c
[PATCH] readahead: reset cache_hit earlier
[linux-2.6] / drivers / hwmon / smsc47b397.c
index 0f965921b8ed1fff4f1ce181b7d33a1829730669..7fe71576dea4b7416e6b15ae387e56dc6238da1d 100644 (file)
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
-#include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
 #include <linux/init.h>
 #include <asm/io.h>
 
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
 /* Address is autodetected, there is no default value */
-static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
-static struct i2c_force_data forces[] = {{NULL}};
-
-enum chips { any_chip, smsc47b397 };
-static struct i2c_address_data addr_data = {
-       .normal_i2c             = normal_i2c,
-       .normal_isa             = normal_isa,
-       .probe                  = normal_i2c,           /* cheat */
-       .ignore                 = normal_i2c,           /* cheat */
-       .forces                 = forces,
-};
+static unsigned short address;
 
 /* Super-I/0 registers and commands */
 
@@ -219,15 +207,6 @@ sysfs_fan(4);
 #define device_create_file_fan(client, num) \
        device_create_file(&client->dev, &dev_attr_fan##num##_input)
 
-static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind);
-
-static int smsc47b397_attach_adapter(struct i2c_adapter *adapter)
-{
-       if (!(adapter->class & I2C_CLASS_HWMON))
-               return 0;
-       return i2c_detect(adapter, &addr_data, smsc47b397_detect);
-}
-
 static int smsc47b397_detach_client(struct i2c_client *client)
 {
        struct smsc47b397_data *data = i2c_get_clientdata(client);
@@ -235,11 +214,8 @@ static int smsc47b397_detach_client(struct i2c_client *client)
 
        hwmon_device_unregister(data->class_dev);
 
-       if ((err = i2c_detach_client(client))) {
-               dev_err(&client->dev, "Client deregistration failed, "
-                       "client not detached.\n");
+       if ((err = i2c_detach_client(client)))
                return err;
-       }
 
        release_region(client->addr, SMSC_EXTENT);
        kfree(data);
@@ -247,27 +223,24 @@ static int smsc47b397_detach_client(struct i2c_client *client)
        return 0;
 }
 
+static int smsc47b397_detect(struct i2c_adapter *adapter);
+
 static struct i2c_driver smsc47b397_driver = {
        .owner          = THIS_MODULE,
        .name           = "smsc47b397",
-       .id             = I2C_DRIVERID_SMSC47B397,
-       .flags          = I2C_DF_NOTIFY,
-       .attach_adapter = smsc47b397_attach_adapter,
+       .attach_adapter = smsc47b397_detect,
        .detach_client  = smsc47b397_detach_client,
 };
 
-static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int smsc47b397_detect(struct i2c_adapter *adapter)
 {
        struct i2c_client *new_client;
        struct smsc47b397_data *data;
        int err = 0;
 
-       if (!i2c_is_isa_adapter(adapter)) {
-               return 0;
-       }
-
-       if (!request_region(addr, SMSC_EXTENT, smsc47b397_driver.name)) {
-               dev_err(&adapter->dev, "Region 0x%x already in use!\n", addr);
+       if (!request_region(address, SMSC_EXTENT, smsc47b397_driver.name)) {
+               dev_err(&adapter->dev, "Region 0x%x already in use!\n",
+                       address);
                return -EBUSY;
        }
 
@@ -279,7 +252,7 @@ static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind)
 
        new_client = &data->client;
        i2c_set_clientdata(new_client, data);
-       new_client->addr = addr;
+       new_client->addr = address;
        init_MUTEX(&data->lock);
        new_client->adapter = adapter;
        new_client->driver = &smsc47b397_driver;
@@ -315,11 +288,11 @@ error_detach:
 error_free:
        kfree(data);
 error_release:
-       release_region(addr, SMSC_EXTENT);
+       release_region(address, SMSC_EXTENT);
        return err;
 }
 
-static int __init smsc47b397_find(unsigned int *addr)
+static int __init smsc47b397_find(unsigned short *addr)
 {
        u8 id, rev;
 
@@ -348,7 +321,7 @@ static int __init smsc47b397_init(void)
 {
        int ret;
 
-       if ((ret = smsc47b397_find(normal_isa)))
+       if ((ret = smsc47b397_find(&address)))
                return ret;
 
        return i2c_isa_add_driver(&smsc47b397_driver);