diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-06-19 10:58:19 -0400 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-06-19 10:58:19 -0400 |
commit | 1e40ac12dab22d98d0178e87364cf4e36862809c (patch) | |
tree | 4a17e391d0b4d33bd9d13c077c789145f436dd76 | |
parent | f8a227e8ac19c2d3e189833b8518b1805d9b443c (diff) |
i2c: Kill is_newstyle_driver
Legacy i2c drivers are gone, all drivers are new-style now, so there
is no point to check.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
-rw-r--r-- | drivers/i2c/i2c-core.c | 32 | ||||
-rw-r--r-- | include/linux/i2c.h | 2 |
2 files changed, 1 insertions, 33 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 06c428b5822e..95fb997b41e0 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -41,8 +41,6 @@ | |||
41 | static DEFINE_MUTEX(core_lock); | 41 | static DEFINE_MUTEX(core_lock); |
42 | static DEFINE_IDR(i2c_adapter_idr); | 42 | static DEFINE_IDR(i2c_adapter_idr); |
43 | 43 | ||
44 | #define is_newstyle_driver(d) ((d)->probe || (d)->remove || (d)->detect) | ||
45 | |||
46 | static int i2c_check_addr(struct i2c_adapter *adapter, int addr); | 44 | static int i2c_check_addr(struct i2c_adapter *adapter, int addr); |
47 | static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver); | 45 | static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver); |
48 | 46 | ||
@@ -64,12 +62,6 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv) | |||
64 | struct i2c_client *client = to_i2c_client(dev); | 62 | struct i2c_client *client = to_i2c_client(dev); |
65 | struct i2c_driver *driver = to_i2c_driver(drv); | 63 | struct i2c_driver *driver = to_i2c_driver(drv); |
66 | 64 | ||
67 | /* make legacy i2c drivers bypass driver model probing entirely; | ||
68 | * such drivers scan each i2c adapter/bus themselves. | ||
69 | */ | ||
70 | if (!is_newstyle_driver(driver)) | ||
71 | return 0; | ||
72 | |||
73 | /* match on an id table if there is one */ | 65 | /* match on an id table if there is one */ |
74 | if (driver->id_table) | 66 | if (driver->id_table) |
75 | return i2c_match_id(driver->id_table, client) != NULL; | 67 | return i2c_match_id(driver->id_table, client) != NULL; |
@@ -172,12 +164,6 @@ static int i2c_device_resume(struct device *dev) | |||
172 | return driver->resume(to_i2c_client(dev)); | 164 | return driver->resume(to_i2c_client(dev)); |
173 | } | 165 | } |
174 | 166 | ||
175 | static void i2c_client_release(struct device *dev) | ||
176 | { | ||
177 | struct i2c_client *client = to_i2c_client(dev); | ||
178 | complete(&client->released); | ||
179 | } | ||
180 | |||
181 | static void i2c_client_dev_release(struct device *dev) | 167 | static void i2c_client_dev_release(struct device *dev) |
182 | { | 168 | { |
183 | kfree(to_i2c_client(dev)); | 169 | kfree(to_i2c_client(dev)); |
@@ -282,12 +268,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) | |||
282 | 268 | ||
283 | client->dev.parent = &client->adapter->dev; | 269 | client->dev.parent = &client->adapter->dev; |
284 | client->dev.bus = &i2c_bus_type; | 270 | client->dev.bus = &i2c_bus_type; |
285 | 271 | client->dev.release = i2c_client_dev_release; | |
286 | if (client->driver && !is_newstyle_driver(client->driver)) { | ||
287 | client->dev.release = i2c_client_release; | ||
288 | dev_set_uevent_suppress(&client->dev, 1); | ||
289 | } else | ||
290 | client->dev.release = i2c_client_dev_release; | ||
291 | 272 | ||
292 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), | 273 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), |
293 | client->addr); | 274 | client->addr); |
@@ -321,14 +302,6 @@ EXPORT_SYMBOL_GPL(i2c_new_device); | |||
321 | void i2c_unregister_device(struct i2c_client *client) | 302 | void i2c_unregister_device(struct i2c_client *client) |
322 | { | 303 | { |
323 | struct i2c_adapter *adapter = client->adapter; | 304 | struct i2c_adapter *adapter = client->adapter; |
324 | struct i2c_driver *driver = client->driver; | ||
325 | |||
326 | if (driver && !is_newstyle_driver(driver)) { | ||
327 | dev_err(&client->dev, "can't unregister devices " | ||
328 | "with legacy drivers\n"); | ||
329 | WARN_ON(1); | ||
330 | return; | ||
331 | } | ||
332 | 305 | ||
333 | mutex_lock(&adapter->clist_lock); | 306 | mutex_lock(&adapter->clist_lock); |
334 | list_del(&client->list); | 307 | list_del(&client->list); |
@@ -736,9 +709,6 @@ static int __detach_adapter(struct device *dev, void *data) | |||
736 | i2c_unregister_device(client); | 709 | i2c_unregister_device(client); |
737 | } | 710 | } |
738 | 711 | ||
739 | if (is_newstyle_driver(driver)) | ||
740 | return 0; | ||
741 | |||
742 | if (driver->detach_adapter) { | 712 | if (driver->detach_adapter) { |
743 | if (driver->detach_adapter(adapter)) | 713 | if (driver->detach_adapter(adapter)) |
744 | dev_err(&adapter->dev, | 714 | dev_err(&adapter->dev, |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index db25a870843a..28b27282496f 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -180,7 +180,6 @@ struct i2c_driver { | |||
180 | * @irq: indicates the IRQ generated by this device (if any) | 180 | * @irq: indicates the IRQ generated by this device (if any) |
181 | * @list: list of active/busy clients (DEPRECATED) | 181 | * @list: list of active/busy clients (DEPRECATED) |
182 | * @detected: member of an i2c_driver.clients list | 182 | * @detected: member of an i2c_driver.clients list |
183 | * @released: used to synchronize client releases & detaches and references | ||
184 | * | 183 | * |
185 | * An i2c_client identifies a single device (i.e. chip) connected to an | 184 | * An i2c_client identifies a single device (i.e. chip) connected to an |
186 | * i2c bus. The behaviour exposed to Linux is defined by the driver | 185 | * i2c bus. The behaviour exposed to Linux is defined by the driver |
@@ -198,7 +197,6 @@ struct i2c_client { | |||
198 | int irq; /* irq issued by device */ | 197 | int irq; /* irq issued by device */ |
199 | struct list_head list; /* DEPRECATED */ | 198 | struct list_head list; /* DEPRECATED */ |
200 | struct list_head detected; | 199 | struct list_head detected; |
201 | struct completion released; | ||
202 | }; | 200 | }; |
203 | #define to_i2c_client(d) container_of(d, struct i2c_client, dev) | 201 | #define to_i2c_client(d) container_of(d, struct i2c_client, dev) |
204 | 202 | ||