mirror of https://gitee.com/openkylin/linux.git
backlight: lv5207lp: use devm_backlight_device_register()
Use devm_backlight_device_register() to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
6255e8e984
commit
e924c2aadf
|
@ -124,9 +124,9 @@ static int lv5207lp_probe(struct i2c_client *client,
|
||||||
props.brightness = clamp_t(unsigned int, pdata->def_value, 0,
|
props.brightness = clamp_t(unsigned int, pdata->def_value, 0,
|
||||||
props.max_brightness);
|
props.max_brightness);
|
||||||
|
|
||||||
backlight = backlight_device_register(dev_name(&client->dev),
|
backlight = devm_backlight_device_register(&client->dev,
|
||||||
&lv->client->dev, lv,
|
dev_name(&client->dev), &lv->client->dev,
|
||||||
&lv5207lp_backlight_ops, &props);
|
lv, &lv5207lp_backlight_ops, &props);
|
||||||
if (IS_ERR(backlight)) {
|
if (IS_ERR(backlight)) {
|
||||||
dev_err(&client->dev, "failed to register backlight\n");
|
dev_err(&client->dev, "failed to register backlight\n");
|
||||||
return PTR_ERR(backlight);
|
return PTR_ERR(backlight);
|
||||||
|
@ -144,7 +144,6 @@ static int lv5207lp_remove(struct i2c_client *client)
|
||||||
|
|
||||||
backlight->props.brightness = 0;
|
backlight->props.brightness = 0;
|
||||||
backlight_update_status(backlight);
|
backlight_update_status(backlight);
|
||||||
backlight_device_unregister(backlight);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue