aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorLaurent Riffard <laurent.riffard@free.fr>2005-11-26 14:34:05 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-06 01:16:22 -0500
commit35d8b2e6b8e86b0d5126f36613b5202d4eb978b6 (patch)
tree2327c791f10216db39ae5c22235a13a5bc886d1e /drivers/i2c/i2c-core.c
parent482c788ded0aa9710722eaf9cf60886d3b923218 (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/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index a1c5dff85431..4ce5f0f32fba 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)
473static int i2c_inc_use_client(struct i2c_client *client) 473static 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
486static void i2c_dec_use_client(struct i2c_client *client) 486static 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}