aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/pca953x.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-04-29 17:11:40 -0400
committerJean Delvare <khali@hyperion.delvare>2008-04-29 17:11:40 -0400
commit3760f736716f74bdc62a4ba5406934338da93eb2 (patch)
treee28e22c6655dd62566f1b7a99f9354a31bf9d06e /drivers/gpio/pca953x.c
parentd2653e92732bd3911feff6bee5e23dbf959381db (diff)
i2c: Convert most new-style drivers to use module aliasing
Based on earlier work by Jon Smirl and Jochen Friedrich. Update most new-style i2c drivers to use standard module aliasing instead of the old driver_name/type driver matching scheme. I've left the video drivers apart (except for SoC camera drivers) as they're a bit more diffcult to deal with, they'll have their own patch later. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Jon Smirl <jonsmirl@gmail.com> Cc: Jochen Friedrich <jochen@scram.de>
Diffstat (limited to 'drivers/gpio/pca953x.c')
-rw-r--r--drivers/gpio/pca953x.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 2670519236e5..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. */ 26static const struct i2c_device_id pca953x_id[] = {
27struct pca953x_desc {
28 char name[I2C_NAME_SIZE];
29 unsigned long driver_data;
30};
31
32static 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};
36MODULE_DEVICE_TABLE(i2c, pca953x_id);
41 37
42struct pca953x_chip { 38struct pca953x_chip {
43 unsigned gpio_start; 39 unsigned gpio_start;
@@ -193,26 +189,16 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
193} 189}
194 190
195static int __devinit pca953x_probe(struct i2c_client *client, 191static int __devinit pca953x_probe(struct i2c_client *client,
196 const struct i2c_device_id *did) 192 const struct i2c_device_id *id)
197{ 193{
198 struct pca953x_platform_data *pdata; 194 struct pca953x_platform_data *pdata;
199 struct pca953x_chip *chip; 195 struct pca953x_chip *chip;
200 int ret, i; 196 int ret, i;
201 const struct pca953x_desc *id = NULL;
202 197
203 pdata = client->dev.platform_data; 198 pdata = client->dev.platform_data;
204 if (pdata == NULL) 199 if (pdata == NULL)
205 return -ENODEV; 200 return -ENODEV;
206 201
207 /* this loop vanishes when we get i2c_device_id */
208 for (i = 0; i < ARRAY_SIZE(pca953x_descs); i++)
209 if (!strcmp(pca953x_descs[i].name, client->name)) {
210 id = pca953x_descs + i;
211 break;
212 }
213 if (!id)
214 return -ENODEV;
215
216 chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); 202 chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
217 if (chip == NULL) 203 if (chip == NULL)
218 return -ENOMEM; 204 return -ENOMEM;
@@ -292,6 +278,7 @@ static struct i2c_driver pca953x_driver = {
292 }, 278 },
293 .probe = pca953x_probe, 279 .probe = pca953x_probe,
294 .remove = pca953x_remove, 280 .remove = pca953x_remove,
281 .id_table = pca953x_id,
295}; 282};
296 283
297static int __init pca953x_init(void) 284static int __init pca953x_init(void)