mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-01 12:04:08 +00:00
i2c-dev: attach/detach_adapter cleanups
i2c-dev: attach/detach_adapter cleanups * Only print that an adapter was attached when it succeeds. * i2c_dev == NULL on detach simply means that the attach failed before, this isn't an error per se. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
7a8d29cec7
commit
b32d20dc8b
1 changed files with 5 additions and 5 deletions
|
@ -412,9 +412,6 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
|
||||||
if (IS_ERR(i2c_dev))
|
if (IS_ERR(i2c_dev))
|
||||||
return PTR_ERR(i2c_dev);
|
return PTR_ERR(i2c_dev);
|
||||||
|
|
||||||
pr_debug("i2c-dev: adapter [%s] registered as minor %d\n",
|
|
||||||
adap->name, adap->nr);
|
|
||||||
|
|
||||||
/* register this i2c device with the driver core */
|
/* register this i2c device with the driver core */
|
||||||
i2c_dev->class_dev = class_device_create(i2c_dev_class, NULL,
|
i2c_dev->class_dev = class_device_create(i2c_dev_class, NULL,
|
||||||
MKDEV(I2C_MAJOR, adap->nr),
|
MKDEV(I2C_MAJOR, adap->nr),
|
||||||
|
@ -427,6 +424,9 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
|
||||||
res = class_device_create_file(i2c_dev->class_dev, &class_device_attr_name);
|
res = class_device_create_file(i2c_dev->class_dev, &class_device_attr_name);
|
||||||
if (res)
|
if (res)
|
||||||
goto error_destroy;
|
goto error_destroy;
|
||||||
|
|
||||||
|
pr_debug("i2c-dev: adapter [%s] registered as minor %d\n",
|
||||||
|
adap->name, adap->nr);
|
||||||
return 0;
|
return 0;
|
||||||
error_destroy:
|
error_destroy:
|
||||||
class_device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
|
class_device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
|
||||||
|
@ -441,8 +441,8 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap)
|
||||||
struct i2c_dev *i2c_dev;
|
struct i2c_dev *i2c_dev;
|
||||||
|
|
||||||
i2c_dev = i2c_dev_get_by_minor(adap->nr);
|
i2c_dev = i2c_dev_get_by_minor(adap->nr);
|
||||||
if (!i2c_dev)
|
if (!i2c_dev) /* attach_adapter must have failed */
|
||||||
return -ENODEV;
|
return 0;
|
||||||
|
|
||||||
class_device_remove_file(i2c_dev->class_dev, &class_device_attr_name);
|
class_device_remove_file(i2c_dev->class_dev, &class_device_attr_name);
|
||||||
return_i2c_dev(i2c_dev);
|
return_i2c_dev(i2c_dev);
|
||||||
|
|
Loading…
Add table
Reference in a new issue