Commit 91fa4ee8 authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

backlight: adp8860: use devm_backlight_device_register()

Use devm_backlight_device_register() to make cleanup paths simpler.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5f652c71
...@@ -711,8 +711,9 @@ static int adp8860_probe(struct i2c_client *client, ...@@ -711,8 +711,9 @@ static int adp8860_probe(struct i2c_client *client,
mutex_init(&data->lock); mutex_init(&data->lock);
bl = backlight_device_register(dev_driver_string(&client->dev), bl = devm_backlight_device_register(&client->dev,
&client->dev, data, &adp8860_bl_ops, &props); dev_driver_string(&client->dev),
&client->dev, data, &adp8860_bl_ops, &props);
if (IS_ERR(bl)) { if (IS_ERR(bl)) {
dev_err(&client->dev, "failed to register backlight\n"); dev_err(&client->dev, "failed to register backlight\n");
return PTR_ERR(bl); return PTR_ERR(bl);
...@@ -728,7 +729,7 @@ static int adp8860_probe(struct i2c_client *client, ...@@ -728,7 +729,7 @@ static int adp8860_probe(struct i2c_client *client,
if (ret) { if (ret) {
dev_err(&client->dev, "failed to register sysfs\n"); dev_err(&client->dev, "failed to register sysfs\n");
goto out1; return ret;
} }
ret = adp8860_bl_setup(bl); ret = adp8860_bl_setup(bl);
...@@ -751,8 +752,6 @@ static int adp8860_probe(struct i2c_client *client, ...@@ -751,8 +752,6 @@ static int adp8860_probe(struct i2c_client *client,
if (data->en_ambl_sens) if (data->en_ambl_sens)
sysfs_remove_group(&data->bl->dev.kobj, sysfs_remove_group(&data->bl->dev.kobj,
&adp8860_bl_attr_group); &adp8860_bl_attr_group);
out1:
backlight_device_unregister(bl);
return ret; return ret;
} }
...@@ -770,8 +769,6 @@ static int adp8860_remove(struct i2c_client *client) ...@@ -770,8 +769,6 @@ static int adp8860_remove(struct i2c_client *client)
sysfs_remove_group(&data->bl->dev.kobj, sysfs_remove_group(&data->bl->dev.kobj,
&adp8860_bl_attr_group); &adp8860_bl_attr_group);
backlight_device_unregister(data->bl);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment