diff options
Diffstat (limited to 'drivers/gpio/pca953x.c')
-rw-r--r-- | drivers/gpio/pca953x.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index e0e0af536108..93f916720b13 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -23,21 +23,19 @@ | |||
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, }, |
36 | { "pca9537", 4, }, | 30 | { "pca9537", 4, }, |
37 | { "pca9538", 8, }, | 31 | { "pca9538", 8, }, |
38 | { "pca9539", 16, }, | 32 | { "pca9539", 16, }, |
33 | { "pca9555", 16, }, | ||
34 | { "pca9557", 8, }, | ||
39 | /* REVISIT several pca955x parts should work here too */ | 35 | /* REVISIT several pca955x parts should work here too */ |
36 | { } | ||
40 | }; | 37 | }; |
38 | MODULE_DEVICE_TABLE(i2c, pca953x_id); | ||
41 | 39 | ||
42 | struct pca953x_chip { | 40 | struct pca953x_chip { |
43 | unsigned gpio_start; | 41 | unsigned gpio_start; |
@@ -192,26 +190,17 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) | |||
192 | gc->owner = THIS_MODULE; | 190 | gc->owner = THIS_MODULE; |
193 | } | 191 | } |
194 | 192 | ||
195 | static int __devinit pca953x_probe(struct i2c_client *client) | 193 | static int __devinit pca953x_probe(struct i2c_client *client, |
194 | const struct i2c_device_id *id) | ||
196 | { | 195 | { |
197 | struct pca953x_platform_data *pdata; | 196 | struct pca953x_platform_data *pdata; |
198 | struct pca953x_chip *chip; | 197 | struct pca953x_chip *chip; |
199 | int ret, i; | 198 | int ret; |
200 | const struct pca953x_desc *id = NULL; | ||
201 | 199 | ||
202 | pdata = client->dev.platform_data; | 200 | pdata = client->dev.platform_data; |
203 | if (pdata == NULL) | 201 | if (pdata == NULL) |
204 | return -ENODEV; | 202 | return -ENODEV; |
205 | 203 | ||
206 | /* this loop vanishes when we get i2c_device_id */ | ||
207 | for (i = 0; i < ARRAY_SIZE(pca953x_descs); i++) | ||
208 | if (!strcmp(pca953x_descs[i].name, client->name)) { | ||
209 | id = pca953x_descs + i; | ||
210 | break; | ||
211 | } | ||
212 | if (!id) | ||
213 | return -ENODEV; | ||
214 | |||
215 | chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); | 204 | chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); |
216 | if (chip == NULL) | 205 | if (chip == NULL) |
217 | return -ENOMEM; | 206 | return -ENOMEM; |
@@ -291,6 +280,7 @@ static struct i2c_driver pca953x_driver = { | |||
291 | }, | 280 | }, |
292 | .probe = pca953x_probe, | 281 | .probe = pca953x_probe, |
293 | .remove = pca953x_remove, | 282 | .remove = pca953x_remove, |
283 | .id_table = pca953x_id, | ||
294 | }; | 284 | }; |
295 | 285 | ||
296 | static int __init pca953x_init(void) | 286 | static int __init pca953x_init(void) |