diff options
Diffstat (limited to 'drivers/gpio/pca953x.c')
-rw-r--r-- | drivers/gpio/pca953x.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 6e72fd31184d..5a99e81d2784 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -23,13 +23,7 @@ | |||
23 | #define PCA953X_INVERT 2 | 23 | #define PCA953X_INVERT 2 |
24 | #define PCA953X_DIRECTION 3 | 24 | #define PCA953X_DIRECTION 3 |
25 | 25 | ||
26 | /* This is temporary - in 2.6.26 i2c_driver_data should replace it. */ | 26 | static const struct i2c_device_id pca953x_id[] = { |
27 | struct pca953x_desc { | ||
28 | char name[I2C_NAME_SIZE]; | ||
29 | unsigned long driver_data; | ||
30 | }; | ||
31 | |||
32 | static const struct pca953x_desc pca953x_descs[] = { | ||
33 | { "pca9534", 8, }, | 27 | { "pca9534", 8, }, |
34 | { "pca9535", 16, }, | 28 | { "pca9535", 16, }, |
35 | { "pca9536", 4, }, | 29 | { "pca9536", 4, }, |
@@ -37,7 +31,9 @@ static const struct pca953x_desc pca953x_descs[] = { | |||
37 | { "pca9538", 8, }, | 31 | { "pca9538", 8, }, |
38 | { "pca9539", 16, }, | 32 | { "pca9539", 16, }, |
39 | /* REVISIT several pca955x parts should work here too */ | 33 | /* REVISIT several pca955x parts should work here too */ |
34 | { } | ||
40 | }; | 35 | }; |
36 | MODULE_DEVICE_TABLE(i2c, pca953x_id); | ||
41 | 37 | ||
42 | struct pca953x_chip { | 38 | struct pca953x_chip { |
43 | unsigned gpio_start; | 39 | unsigned gpio_start; |
@@ -189,28 +185,20 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) | |||
189 | gc->base = chip->gpio_start; | 185 | gc->base = chip->gpio_start; |
190 | gc->ngpio = gpios; | 186 | gc->ngpio = gpios; |
191 | gc->label = chip->client->name; | 187 | gc->label = chip->client->name; |
188 | gc->owner = THIS_MODULE; | ||
192 | } | 189 | } |
193 | 190 | ||
194 | static int __devinit pca953x_probe(struct i2c_client *client) | 191 | static int __devinit pca953x_probe(struct i2c_client *client, |
192 | const struct i2c_device_id *id) | ||
195 | { | 193 | { |
196 | struct pca953x_platform_data *pdata; | 194 | struct pca953x_platform_data *pdata; |
197 | struct pca953x_chip *chip; | 195 | struct pca953x_chip *chip; |
198 | int ret, i; | 196 | int ret, i; |
199 | const struct pca953x_desc *id = NULL; | ||
200 | 197 | ||
201 | pdata = client->dev.platform_data; | 198 | pdata = client->dev.platform_data; |
202 | if (pdata == NULL) | 199 | if (pdata == NULL) |
203 | return -ENODEV; | 200 | return -ENODEV; |
204 | 201 | ||
205 | /* this loop vanishes when we get i2c_device_id */ | ||
206 | for (i = 0; i < ARRAY_SIZE(pca953x_descs); i++) | ||
207 | if (!strcmp(pca953x_descs[i].name, client->name)) { | ||
208 | id = pca953x_descs + i; | ||
209 | break; | ||
210 | } | ||
211 | if (!id) | ||
212 | return -ENODEV; | ||
213 | |||
214 | chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); | 202 | chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); |
215 | if (chip == NULL) | 203 | if (chip == NULL) |
216 | return -ENOMEM; | 204 | return -ENOMEM; |
@@ -290,6 +278,7 @@ static struct i2c_driver pca953x_driver = { | |||
290 | }, | 278 | }, |
291 | .probe = pca953x_probe, | 279 | .probe = pca953x_probe, |
292 | .remove = pca953x_remove, | 280 | .remove = pca953x_remove, |
281 | .id_table = pca953x_id, | ||
293 | }; | 282 | }; |
294 | 283 | ||
295 | static int __init pca953x_init(void) | 284 | static int __init pca953x_init(void) |