diff options
-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 | ||||
-rw-r--r-- | include/linux/i2c.h | 5 |
4 files changed, 19 insertions, 18 deletions
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c index 03672c9ca409..9f93fb85d06e 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 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) | |||
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 9da51eb37c06..9715217a0343 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, |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index a9cea62fd486..75aa18e865da 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -105,11 +105,12 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, | |||
105 | * A driver is capable of handling one or more physical devices present on | 105 | * A driver is capable of handling one or more physical devices present on |
106 | * I2C adapters. This information is used to inform the driver of adapter | 106 | * I2C adapters. This information is used to inform the driver of adapter |
107 | * events. | 107 | * events. |
108 | * | ||
109 | * The driver.owner field should be set to the module owner of this driver. | ||
110 | * The driver.name field should be set to the name of this driver. | ||
108 | */ | 111 | */ |
109 | 112 | ||
110 | struct i2c_driver { | 113 | struct i2c_driver { |
111 | struct module *owner; | ||
112 | char name[32]; | ||
113 | int id; | 114 | int id; |
114 | unsigned int class; | 115 | unsigned int class; |
115 | 116 | ||