Loading drivers/i2c/i2c-core.c +6 −11 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ int i2c_add_adapter(struct i2c_adapter *adap) goto out_unlock; } res = idr_get_new(&i2c_adapter_idr, NULL, &id); res = idr_get_new(&i2c_adapter_idr, adap, &id); if (res < 0) { if (res == -EAGAIN) res = -ENOMEM; Loading Loading @@ -765,21 +765,16 @@ int i2c_adapter_id(struct i2c_adapter *adap) struct i2c_adapter* i2c_get_adapter(int id) { struct list_head *item; struct i2c_adapter *adapter; down(&core_lists); list_for_each(item,&adapters) { adapter = list_entry(item, struct i2c_adapter, list); if (id == adapter->nr && try_module_get(adapter->owner)) { adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); if (adapter && !try_module_get(adapter->owner)) adapter = NULL; up(&core_lists); return adapter; } } up(&core_lists); return NULL; } void i2c_put_adapter(struct i2c_adapter *adap) { Loading Loading
drivers/i2c/i2c-core.c +6 −11 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ int i2c_add_adapter(struct i2c_adapter *adap) goto out_unlock; } res = idr_get_new(&i2c_adapter_idr, NULL, &id); res = idr_get_new(&i2c_adapter_idr, adap, &id); if (res < 0) { if (res == -EAGAIN) res = -ENOMEM; Loading Loading @@ -765,21 +765,16 @@ int i2c_adapter_id(struct i2c_adapter *adap) struct i2c_adapter* i2c_get_adapter(int id) { struct list_head *item; struct i2c_adapter *adapter; down(&core_lists); list_for_each(item,&adapters) { adapter = list_entry(item, struct i2c_adapter, list); if (id == adapter->nr && try_module_get(adapter->owner)) { adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); if (adapter && !try_module_get(adapter->owner)) adapter = NULL; up(&core_lists); return adapter; } } up(&core_lists); return NULL; } void i2c_put_adapter(struct i2c_adapter *adap) { Loading