backlight: tosa: use devm_backlight_device_register()
Use devm_backlight_device_register() to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.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
443956fdd5
commit
ffb1f6c83b
1 changed files with 3 additions and 4 deletions
|
@ -105,8 +105,9 @@ static int tosa_bl_probe(struct i2c_client *client,
|
||||||
memset(&props, 0, sizeof(struct backlight_properties));
|
memset(&props, 0, sizeof(struct backlight_properties));
|
||||||
props.type = BACKLIGHT_RAW;
|
props.type = BACKLIGHT_RAW;
|
||||||
props.max_brightness = 512 - 1;
|
props.max_brightness = 512 - 1;
|
||||||
data->bl = backlight_device_register("tosa-bl", &client->dev, data,
|
data->bl = devm_backlight_device_register(&client->dev, "tosa-bl",
|
||||||
&bl_ops, &props);
|
&client->dev, data, &bl_ops,
|
||||||
|
&props);
|
||||||
if (IS_ERR(data->bl)) {
|
if (IS_ERR(data->bl)) {
|
||||||
ret = PTR_ERR(data->bl);
|
ret = PTR_ERR(data->bl);
|
||||||
goto err_reg;
|
goto err_reg;
|
||||||
|
@ -128,9 +129,7 @@ static int tosa_bl_remove(struct i2c_client *client)
|
||||||
{
|
{
|
||||||
struct tosa_bl_data *data = i2c_get_clientdata(client);
|
struct tosa_bl_data *data = i2c_get_clientdata(client);
|
||||||
|
|
||||||
backlight_device_unregister(data->bl);
|
|
||||||
data->bl = NULL;
|
data->bl = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue