diff options
author | Laurent Riffard <laurent.riffard@free.fr> | 2005-11-26 14:34:05 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-06 01:16:22 -0500 |
commit | 35d8b2e6b8e86b0d5126f36613b5202d4eb978b6 (patch) | |
tree | 2327c791f10216db39ae5c22235a13a5bc886d1e /drivers/i2c | |
parent | 482c788ded0aa9710722eaf9cf60886d3b923218 (diff) |
[PATCH] i2c: Drop i2c_driver.{owner,name}, 1 of 11
We should use the i2c_driver.driver's .name and .owner fields
instead of the i2c_driver's ones.
This patch updates the core of the i2c drivers: it removes .name and
.owner fields from the struct i2c_device and modify various
functions to use struct device fields instead.
Signed-off-by: Laurent Riffard <laurent.riffard@free.fr>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-isa.c | 4 | ||||
-rw-r--r-- | drivers/i2c/i2c-core.c | 22 | ||||
-rw-r--r-- | drivers/i2c/i2c-dev.c | 6 |
3 files changed, 16 insertions, 16 deletions
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c index 03672c9ca40..9f93fb85d06 100644 --- a/drivers/i2c/busses/i2c-isa.c +++ b/drivers/i2c/busses/i2c-isa.c | |||
@@ -92,8 +92,6 @@ int i2c_isa_add_driver(struct i2c_driver *driver) | |||
92 | int res; | 92 | int res; |
93 | 93 | ||
94 | /* Add the driver to the list of i2c drivers in the driver core */ | 94 | /* Add the driver to the list of i2c drivers in the driver core */ |
95 | driver->driver.name = driver->name; | ||
96 | driver->driver.owner = driver->owner; | ||
97 | driver->driver.bus = &i2c_bus_type; | 95 | driver->driver.bus = &i2c_bus_type; |
98 | driver->driver.probe = i2c_isa_device_probe; | 96 | driver->driver.probe = i2c_isa_device_probe; |
99 | driver->driver.remove = i2c_isa_device_remove; | 97 | driver->driver.remove = i2c_isa_device_remove; |
@@ -124,7 +122,7 @@ int i2c_isa_del_driver(struct i2c_driver *driver) | |||
124 | if ((res = driver->detach_client(client))) { | 122 | if ((res = driver->detach_client(client))) { |
125 | dev_err(&isa_adapter.dev, "Failed, driver " | 123 | dev_err(&isa_adapter.dev, "Failed, driver " |
126 | "%s not unregistered!\n", | 124 | "%s not unregistered!\n", |
127 | driver->name); | 125 | driver->driver.name); |
128 | return res; | 126 | return res; |
129 | } | 127 | } |
130 | } | 128 | } |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index a1c5dff8543..4ce5f0f32fb 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -235,7 +235,8 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
235 | if (driver->detach_adapter) | 235 | if (driver->detach_adapter) |
236 | if ((res = driver->detach_adapter(adap))) { | 236 | if ((res = driver->detach_adapter(adap))) { |
237 | dev_err(&adap->dev, "detach_adapter failed " | 237 | dev_err(&adap->dev, "detach_adapter failed " |
238 | "for driver [%s]\n", driver->name); | 238 | "for driver [%s]\n", |
239 | driver->driver.name); | ||
239 | goto out_unlock; | 240 | goto out_unlock; |
240 | } | 241 | } |
241 | } | 242 | } |
@@ -295,8 +296,6 @@ int i2c_add_driver(struct i2c_driver *driver) | |||
295 | down(&core_lists); | 296 | down(&core_lists); |
296 | 297 | ||
297 | /* add the driver to the list of i2c drivers in the driver core */ | 298 | /* add the driver to the list of i2c drivers in the driver core */ |
298 | driver->driver.owner = driver->owner; | ||
299 | driver->driver.name = driver->name; | ||
300 | driver->driver.bus = &i2c_bus_type; | 299 | driver->driver.bus = &i2c_bus_type; |
301 | driver->driver.probe = i2c_device_probe; | 300 | driver->driver.probe = i2c_device_probe; |
302 | driver->driver.remove = i2c_device_remove; | 301 | driver->driver.remove = i2c_device_remove; |
@@ -306,7 +305,7 @@ int i2c_add_driver(struct i2c_driver *driver) | |||
306 | goto out_unlock; | 305 | goto out_unlock; |
307 | 306 | ||
308 | list_add_tail(&driver->list,&drivers); | 307 | list_add_tail(&driver->list,&drivers); |
309 | pr_debug("i2c-core: driver [%s] registered\n", driver->name); | 308 | pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name); |
310 | 309 | ||
311 | /* now look for instances of driver on our adapters */ | 310 | /* now look for instances of driver on our adapters */ |
312 | if (driver->attach_adapter) { | 311 | if (driver->attach_adapter) { |
@@ -344,7 +343,8 @@ int i2c_del_driver(struct i2c_driver *driver) | |||
344 | if (driver->detach_adapter) { | 343 | if (driver->detach_adapter) { |
345 | if ((res = driver->detach_adapter(adap))) { | 344 | if ((res = driver->detach_adapter(adap))) { |
346 | dev_err(&adap->dev, "detach_adapter failed " | 345 | dev_err(&adap->dev, "detach_adapter failed " |
347 | "for driver [%s]\n", driver->name); | 346 | "for driver [%s]\n", |
347 | driver->driver.name); | ||
348 | goto out_unlock; | 348 | goto out_unlock; |
349 | } | 349 | } |
350 | } else { | 350 | } else { |
@@ -368,7 +368,7 @@ int i2c_del_driver(struct i2c_driver *driver) | |||
368 | 368 | ||
369 | driver_unregister(&driver->driver); | 369 | driver_unregister(&driver->driver); |
370 | list_del(&driver->list); | 370 | list_del(&driver->list); |
371 | pr_debug("i2c-core: driver [%s] unregistered\n", driver->name); | 371 | pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name); |
372 | 372 | ||
373 | out_unlock: | 373 | out_unlock: |
374 | up(&core_lists); | 374 | up(&core_lists); |
@@ -473,10 +473,10 @@ int i2c_detach_client(struct i2c_client *client) | |||
473 | static int i2c_inc_use_client(struct i2c_client *client) | 473 | static int i2c_inc_use_client(struct i2c_client *client) |
474 | { | 474 | { |
475 | 475 | ||
476 | if (!try_module_get(client->driver->owner)) | 476 | if (!try_module_get(client->driver->driver.owner)) |
477 | return -ENODEV; | 477 | return -ENODEV; |
478 | if (!try_module_get(client->adapter->owner)) { | 478 | if (!try_module_get(client->adapter->owner)) { |
479 | module_put(client->driver->owner); | 479 | module_put(client->driver->driver.owner); |
480 | return -ENODEV; | 480 | return -ENODEV; |
481 | } | 481 | } |
482 | 482 | ||
@@ -485,7 +485,7 @@ static int i2c_inc_use_client(struct i2c_client *client) | |||
485 | 485 | ||
486 | static void i2c_dec_use_client(struct i2c_client *client) | 486 | static void i2c_dec_use_client(struct i2c_client *client) |
487 | { | 487 | { |
488 | module_put(client->driver->owner); | 488 | module_put(client->driver->driver.owner); |
489 | module_put(client->adapter->owner); | 489 | module_put(client->adapter->owner); |
490 | } | 490 | } |
491 | 491 | ||
@@ -524,14 +524,14 @@ void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) | |||
524 | down(&adap->clist_lock); | 524 | down(&adap->clist_lock); |
525 | list_for_each(item,&adap->clients) { | 525 | list_for_each(item,&adap->clients) { |
526 | client = list_entry(item, struct i2c_client, list); | 526 | client = list_entry(item, struct i2c_client, list); |
527 | if (!try_module_get(client->driver->owner)) | 527 | if (!try_module_get(client->driver->driver.owner)) |
528 | continue; | 528 | continue; |
529 | if (NULL != client->driver->command) { | 529 | if (NULL != client->driver->command) { |
530 | up(&adap->clist_lock); | 530 | up(&adap->clist_lock); |
531 | client->driver->command(client,cmd,arg); | 531 | client->driver->command(client,cmd,arg); |
532 | down(&adap->clist_lock); | 532 | down(&adap->clist_lock); |
533 | } | 533 | } |
534 | module_put(client->driver->owner); | 534 | module_put(client->driver->driver.owner); |
535 | } | 535 | } |
536 | up(&adap->clist_lock); | 536 | up(&adap->clist_lock); |
537 | } | 537 | } |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 9da51eb37c0..9715217a034 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -481,8 +481,10 @@ static int i2cdev_command(struct i2c_client *client, unsigned int cmd, | |||
481 | } | 481 | } |
482 | 482 | ||
483 | static struct i2c_driver i2cdev_driver = { | 483 | static struct i2c_driver i2cdev_driver = { |
484 | .owner = THIS_MODULE, | 484 | .driver = { |
485 | .name = "dev_driver", | 485 | .owner = THIS_MODULE, |
486 | .name = "dev_driver", | ||
487 | }, | ||
486 | .id = I2C_DRIVERID_I2CDEV, | 488 | .id = I2C_DRIVERID_I2CDEV, |
487 | .attach_adapter = i2cdev_attach_adapter, | 489 | .attach_adapter = i2cdev_attach_adapter, |
488 | .detach_adapter = i2cdev_detach_adapter, | 490 | .detach_adapter = i2cdev_detach_adapter, |