diff options
Diffstat (limited to 'drivers/i2c/chips/pcf8574.c')
-rw-r--r-- | drivers/i2c/chips/pcf8574.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c index e5b31329b56e..1b3db2b3ada9 100644 --- a/drivers/i2c/chips/pcf8574.c +++ b/drivers/i2c/chips/pcf8574.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | pcf8574.c - Part of lm_sensors, Linux kernel modules for hardware | ||
3 | monitoring | ||
4 | Copyright (c) 2000 Frodo Looijaard <frodol@dds.nl>, | 2 | Copyright (c) 2000 Frodo Looijaard <frodol@dds.nl>, |
5 | Philip Edelbrock <phil@netroedge.com>, | 3 | Philip Edelbrock <phil@netroedge.com>, |
6 | Dan Eaton <dan.eaton@rocketlogix.com> | 4 | Dan Eaton <dan.eaton@rocketlogix.com> |
@@ -129,7 +127,7 @@ static int pcf8574_attach_adapter(struct i2c_adapter *adapter) | |||
129 | /* This function is called by i2c_probe */ | 127 | /* This function is called by i2c_probe */ |
130 | static int pcf8574_detect(struct i2c_adapter *adapter, int address, int kind) | 128 | static int pcf8574_detect(struct i2c_adapter *adapter, int address, int kind) |
131 | { | 129 | { |
132 | struct i2c_client *new_client; | 130 | struct i2c_client *client; |
133 | struct pcf8574_data *data; | 131 | struct pcf8574_data *data; |
134 | int err = 0; | 132 | int err = 0; |
135 | const char *client_name = ""; | 133 | const char *client_name = ""; |
@@ -144,12 +142,11 @@ static int pcf8574_detect(struct i2c_adapter *adapter, int address, int kind) | |||
144 | goto exit; | 142 | goto exit; |
145 | } | 143 | } |
146 | 144 | ||
147 | new_client = &data->client; | 145 | client = &data->client; |
148 | i2c_set_clientdata(new_client, data); | 146 | i2c_set_clientdata(client, data); |
149 | new_client->addr = address; | 147 | client->addr = address; |
150 | new_client->adapter = adapter; | 148 | client->adapter = adapter; |
151 | new_client->driver = &pcf8574_driver; | 149 | client->driver = &pcf8574_driver; |
152 | new_client->flags = 0; | ||
153 | 150 | ||
154 | /* Now, we would do the remaining detection. But the PCF8574 is plainly | 151 | /* Now, we would do the remaining detection. But the PCF8574 is plainly |
155 | impossible to detect! Stupid chip. */ | 152 | impossible to detect! Stupid chip. */ |
@@ -168,23 +165,23 @@ static int pcf8574_detect(struct i2c_adapter *adapter, int address, int kind) | |||
168 | client_name = "pcf8574"; | 165 | client_name = "pcf8574"; |
169 | 166 | ||
170 | /* Fill in the remaining client fields and put it into the global list */ | 167 | /* Fill in the remaining client fields and put it into the global list */ |
171 | strlcpy(new_client->name, client_name, I2C_NAME_SIZE); | 168 | strlcpy(client->name, client_name, I2C_NAME_SIZE); |
172 | 169 | ||
173 | /* Tell the I2C layer a new client has arrived */ | 170 | /* Tell the I2C layer a new client has arrived */ |
174 | if ((err = i2c_attach_client(new_client))) | 171 | if ((err = i2c_attach_client(client))) |
175 | goto exit_free; | 172 | goto exit_free; |
176 | 173 | ||
177 | /* Initialize the PCF8574 chip */ | 174 | /* Initialize the PCF8574 chip */ |
178 | pcf8574_init_client(new_client); | 175 | pcf8574_init_client(client); |
179 | 176 | ||
180 | /* Register sysfs hooks */ | 177 | /* Register sysfs hooks */ |
181 | err = sysfs_create_group(&new_client->dev.kobj, &pcf8574_attr_group); | 178 | err = sysfs_create_group(&client->dev.kobj, &pcf8574_attr_group); |
182 | if (err) | 179 | if (err) |
183 | goto exit_detach; | 180 | goto exit_detach; |
184 | return 0; | 181 | return 0; |
185 | 182 | ||
186 | exit_detach: | 183 | exit_detach: |
187 | i2c_detach_client(new_client); | 184 | i2c_detach_client(client); |
188 | exit_free: | 185 | exit_free: |
189 | kfree(data); | 186 | kfree(data); |
190 | exit: | 187 | exit: |