提交 1e40ac12 编写于 作者: J Jean Delvare

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: NJean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
上级 f8a227e8
......@@ -41,8 +41,6 @@
static DEFINE_MUTEX(core_lock);
static DEFINE_IDR(i2c_adapter_idr);
#define is_newstyle_driver(d) ((d)->probe || (d)->remove || (d)->detect)
static int i2c_check_addr(struct i2c_adapter *adapter, int addr);
static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver);
......@@ -64,12 +62,6 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv)
struct i2c_client *client = to_i2c_client(dev);
struct i2c_driver *driver = to_i2c_driver(drv);
/* make legacy i2c drivers bypass driver model probing entirely;
* such drivers scan each i2c adapter/bus themselves.
*/
if (!is_newstyle_driver(driver))
return 0;
/* match on an id table if there is one */
if (driver->id_table)
return i2c_match_id(driver->id_table, client) != NULL;
......@@ -172,12 +164,6 @@ static int i2c_device_resume(struct device *dev)
return driver->resume(to_i2c_client(dev));
}
static void i2c_client_release(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
complete(&client->released);
}
static void i2c_client_dev_release(struct device *dev)
{
kfree(to_i2c_client(dev));
......@@ -282,12 +268,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
client->dev.parent = &client->adapter->dev;
client->dev.bus = &i2c_bus_type;
if (client->driver && !is_newstyle_driver(client->driver)) {
client->dev.release = i2c_client_release;
dev_set_uevent_suppress(&client->dev, 1);
} else
client->dev.release = i2c_client_dev_release;
client->dev.release = i2c_client_dev_release;
dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
client->addr);
......@@ -321,14 +302,6 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
void i2c_unregister_device(struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
struct i2c_driver *driver = client->driver;
if (driver && !is_newstyle_driver(driver)) {
dev_err(&client->dev, "can't unregister devices "
"with legacy drivers\n");
WARN_ON(1);
return;
}
mutex_lock(&adapter->clist_lock);
list_del(&client->list);
......@@ -736,9 +709,6 @@ static int __detach_adapter(struct device *dev, void *data)
i2c_unregister_device(client);
}
if (is_newstyle_driver(driver))
return 0;
if (driver->detach_adapter) {
if (driver->detach_adapter(adapter))
dev_err(&adapter->dev,
......
......@@ -180,7 +180,6 @@ struct i2c_driver {
* @irq: indicates the IRQ generated by this device (if any)
* @list: list of active/busy clients (DEPRECATED)
* @detected: member of an i2c_driver.clients list
* @released: used to synchronize client releases & detaches and references
*
* An i2c_client identifies a single device (i.e. chip) connected to an
* i2c bus. The behaviour exposed to Linux is defined by the driver
......@@ -198,7 +197,6 @@ struct i2c_client {
int irq; /* irq issued by device */
struct list_head list; /* DEPRECATED */
struct list_head detected;
struct completion released;
};
#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册