mediatek: leds-smartrg: use devm_mutex_init

No longer need normal _remove function. Replaced with _disable.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16651
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Rosen Penev 2024-10-08 16:37:08 -07:00 committed by Hauke Mehrtens
parent e52c57bb1b
commit 0dfe1e876a

View File

@ -163,6 +163,7 @@ srg_led_probe(struct i2c_client *client)
{
struct device_node *np = client->dev.of_node, *child;
struct srg_led_ctrl *sysled_ctrl;
int err;
sysled_ctrl = devm_kzalloc(&client->dev, sizeof(*sysled_ctrl), GFP_KERNEL);
if (!sysled_ctrl)
@ -170,7 +171,9 @@ srg_led_probe(struct i2c_client *client)
sysled_ctrl->client = client;
mutex_init(&sysled_ctrl->lock);
err = devm_mutex_init(&client->dev, &sysled_ctrl->lock);
if (err)
return err;
i2c_set_clientdata(client, sysled_ctrl);
@ -193,15 +196,6 @@ static void srg_led_disable(struct i2c_client *client)
srg_led_i2c_write(sysled_ctrl, i, 0);
}
static void
srg_led_remove(struct i2c_client *client)
{
struct srg_led_ctrl *sysled_ctrl = i2c_get_clientdata(client);
srg_led_disable(client);
mutex_destroy(&sysled_ctrl->lock);
}
static const struct i2c_device_id srg_led_id[] = {
{ "srg-sysled", 0 },
{ }
@ -220,7 +214,7 @@ static struct i2c_driver srg_sysled_driver = {
.of_match_table = of_srg_led_match,
},
.probe = srg_led_probe,
.remove = srg_led_remove,
.remove = srg_led_disable,
.id_table = srg_led_id,
};
module_i2c_driver(srg_sysled_driver);