Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77329
b: refs/heads/master
c: bdc511f
h: refs/heads/master
i:
  77327: dcfa3b9
v: v3
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Jan 27, 2008
1 parent 57ab375 commit d1f58c6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0f79b72e45da68bf542a63a08f9c924b91b507e7
refs/heads/master: bdc511f438f6ca40307e06edda00331e6ac0f813
46 changes: 2 additions & 44 deletions trunk/drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,6 @@ int i2c_attach_client(struct i2c_client *client)
}
list_add_tail(&client->list,&adapter->clients);

client->usage_count = 0;

client->dev.parent = &client->adapter->dev;
client->dev.bus = &i2c_bus_type;

Expand Down Expand Up @@ -744,12 +742,6 @@ int i2c_detach_client(struct i2c_client *client)
struct i2c_adapter *adapter = client->adapter;
int res = 0;

if (client->usage_count > 0) {
dev_warn(&client->dev, "Client [%s] still busy, "
"can't detach\n", client->name);
return -EBUSY;
}

if (adapter->client_unregister) {
res = adapter->client_unregister(client);
if (res) {
Expand All @@ -772,50 +764,16 @@ int i2c_detach_client(struct i2c_client *client)
}
EXPORT_SYMBOL(i2c_detach_client);

static int i2c_inc_use_client(struct i2c_client *client)
{

if (!try_module_get(client->driver->driver.owner))
return -ENODEV;
if (!try_module_get(client->adapter->owner)) {
module_put(client->driver->driver.owner);
return -ENODEV;
}

return 0;
}

static void i2c_dec_use_client(struct i2c_client *client)
{
module_put(client->driver->driver.owner);
module_put(client->adapter->owner);
}

int i2c_use_client(struct i2c_client *client)
{
int ret;

ret = i2c_inc_use_client(client);
if (ret)
return ret;

client->usage_count++;

get_device(&client->dev);
return 0;
}
EXPORT_SYMBOL(i2c_use_client);

int i2c_release_client(struct i2c_client *client)
{
if (!client->usage_count) {
pr_debug("i2c-core: %s used one too many times\n",
__FUNCTION__);
return -EPERM;
}

client->usage_count--;
i2c_dec_use_client(client);

put_device(&client->dev);
return 0;
}
EXPORT_SYMBOL(i2c_release_client);
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/video/ks0127.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,6 @@ static struct i2c_client ks0127_client_tmpl =
.addr = 0,
.adapter = NULL,
.driver = &i2c_driver_ks0127,
.usage_count = 0
};

static int ks0127_found_proc(struct i2c_adapter *adapter, int addr, int kind)
Expand Down
3 changes: 0 additions & 3 deletions trunk/include/linux/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ struct i2c_driver {
* generic enough to hide second-sourcing and compatible revisions.
* @adapter: manages the bus segment hosting this I2C device
* @driver: device's driver, hence pointer to access routines
* @usage_count: counts current number of users of this client
* @dev: Driver model device node for the slave.
* @irq: indicates the IRQ generated by this device (if any)
* @driver_name: Identifies new-style driver used with this device; also
Expand All @@ -175,8 +174,6 @@ struct i2c_client {
char name[I2C_NAME_SIZE];
struct i2c_adapter *adapter; /* the adapter we sit on */
struct i2c_driver *driver; /* and our access routines */
int usage_count; /* How many accesses currently */
/* to the client */
struct device dev; /* the device structure */
int irq; /* irq issued by device (or -1) */
char driver_name[KOBJ_NAME_LEN];
Expand Down

0 comments on commit d1f58c6

Please sign in to comment.