X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fi2c%2Fchips%2Fpcf8591.c;h=ce420a67560bf2cc457148953828dc7dfb6fdb27;hb=1ef43204f4bd24dcd3156185b19b31b6b4151ae9;hp=db812ade85645bb2288190eec7a2f0359a532d92;hpb=29516d75a0b09e0a0328dd55c98a342515c9615a;p=powerpc.git diff --git a/drivers/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c index db812ade85..ce420a6756 100644 --- a/drivers/i2c/chips/pcf8591.c +++ b/drivers/i2c/chips/pcf8591.c @@ -24,15 +24,13 @@ #include #include #include -#include /* Addresses to scan */ static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; -static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END }; /* Insmod parameters */ -SENSORS_INSMOD_1(pcf8591); +I2C_CLIENT_INSMOD_1(pcf8591); static int input_mode; module_param(input_mode, int, 0); @@ -164,11 +162,11 @@ static DEVICE_ATTR(out0_enable, S_IWUSR | S_IRUGO, */ static int pcf8591_attach_adapter(struct i2c_adapter *adapter) { - return i2c_detect(adapter, &addr_data, pcf8591_detect); + return i2c_probe(adapter, &addr_data, pcf8591_detect); } -/* This function is called by i2c_detect */ -int pcf8591_detect(struct i2c_adapter *adapter, int address, int kind) +/* This function is called by i2c_probe */ +static int pcf8591_detect(struct i2c_adapter *adapter, int address, int kind) { struct i2c_client *new_client; struct pcf8591_data *data; @@ -180,11 +178,10 @@ int pcf8591_detect(struct i2c_adapter *adapter, int address, int kind) /* OK. For now, we presume we have a valid client. We now create the client structure, even though we cannot fill it completely yet. */ - if (!(data = kmalloc(sizeof(struct pcf8591_data), GFP_KERNEL))) { + if (!(data = kzalloc(sizeof(struct pcf8591_data), GFP_KERNEL))) { err = -ENOMEM; goto exit; } - memset(data, 0, sizeof(struct pcf8591_data)); new_client = &data->client; i2c_set_clientdata(new_client, data); @@ -241,11 +238,8 @@ static int pcf8591_detach_client(struct i2c_client *client) { int err; - 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; - } kfree(i2c_get_clientdata(client)); return 0;