Skip to content

Commit

Permalink
i2c: Kill is_newstyle_driver
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean Delvare committed Jun 19, 2009
1 parent f8a227e commit 1e40ac1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
32 changes: 1 addition & 31 deletions drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions include/linux/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 1e40ac1

Please sign in to comment.