backlight: lm3639: Use devm_backlight_device_register()
Change to use devm_backlight_device_register() for simple cleanup. Signed-off-by: Daniel Jeong <gshark.jeong@gmail.com> Acked-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
9a6adb339e
commit
f1740e4cff
@ -349,8 +349,9 @@ static int lm3639_probe(struct i2c_client *client,
|
|||||||
props.brightness = pdata->init_brt_led;
|
props.brightness = pdata->init_brt_led;
|
||||||
props.max_brightness = pdata->max_brt_led;
|
props.max_brightness = pdata->max_brt_led;
|
||||||
pchip->bled =
|
pchip->bled =
|
||||||
backlight_device_register("lm3639_bled", pchip->dev, pchip,
|
devm_backlight_device_register(pchip->dev, "lm3639_bled",
|
||||||
&lm3639_bled_ops, &props);
|
pchip->dev, pchip, &lm3639_bled_ops,
|
||||||
|
&props);
|
||||||
if (IS_ERR(pchip->bled)) {
|
if (IS_ERR(pchip->bled)) {
|
||||||
dev_err(&client->dev, "fail : backlight register\n");
|
dev_err(&client->dev, "fail : backlight register\n");
|
||||||
ret = PTR_ERR(pchip->bled);
|
ret = PTR_ERR(pchip->bled);
|
||||||
@ -360,7 +361,7 @@ static int lm3639_probe(struct i2c_client *client,
|
|||||||
ret = device_create_file(&(pchip->bled->dev), &dev_attr_bled_mode);
|
ret = device_create_file(&(pchip->bled->dev), &dev_attr_bled_mode);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&client->dev, "failed : add sysfs entries\n");
|
dev_err(&client->dev, "failed : add sysfs entries\n");
|
||||||
goto err_bled_mode;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flash */
|
/* flash */
|
||||||
@ -391,8 +392,6 @@ err_torch:
|
|||||||
led_classdev_unregister(&pchip->cdev_flash);
|
led_classdev_unregister(&pchip->cdev_flash);
|
||||||
err_flash:
|
err_flash:
|
||||||
device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode);
|
device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode);
|
||||||
err_bled_mode:
|
|
||||||
backlight_device_unregister(pchip->bled);
|
|
||||||
err_out:
|
err_out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -407,10 +406,8 @@ static int lm3639_remove(struct i2c_client *client)
|
|||||||
led_classdev_unregister(&pchip->cdev_torch);
|
led_classdev_unregister(&pchip->cdev_torch);
|
||||||
if (&pchip->cdev_flash)
|
if (&pchip->cdev_flash)
|
||||||
led_classdev_unregister(&pchip->cdev_flash);
|
led_classdev_unregister(&pchip->cdev_flash);
|
||||||
if (pchip->bled) {
|
if (pchip->bled)
|
||||||
device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode);
|
device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode);
|
||||||
backlight_device_unregister(pchip->bled);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,6 +429,6 @@ static struct i2c_driver lm3639_i2c_driver = {
|
|||||||
module_i2c_driver(lm3639_i2c_driver);
|
module_i2c_driver(lm3639_i2c_driver);
|
||||||
|
|
||||||
MODULE_DESCRIPTION("Texas Instruments Backlight+Flash LED driver for LM3639");
|
MODULE_DESCRIPTION("Texas Instruments Backlight+Flash LED driver for LM3639");
|
||||||
MODULE_AUTHOR("Daniel Jeong <daniel.jeong@ti.com>");
|
MODULE_AUTHOR("Daniel Jeong <gshark.jeong@gmail.com>");
|
||||||
MODULE_AUTHOR("G.Shark Jeong <gshark.jeong@gmail.com>");
|
MODULE_AUTHOR("Ldd Mlp <ldd-mlp@list.ti.com>");
|
||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL v2");
|
||||||
|
Loading…
Reference in New Issue
Block a user