From: Rosen Penev Date: Tue, 8 Oct 2024 23:37:08 +0000 (-0700) Subject: mediatek: leds-smartrg: use devm_mutex_init X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=0dfe1e876a0704216215312ae4be6875d2378170;p=openwrt%2Fstaging%2Fwigyori.git mediatek: leds-smartrg: use devm_mutex_init No longer need normal _remove function. Replaced with _disable. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16651 Signed-off-by: Hauke Mehrtens --- diff --git a/target/linux/mediatek/files/drivers/leds/leds-smartrg-system.c b/target/linux/mediatek/files/drivers/leds/leds-smartrg-system.c index 5e1e3a3542..385f85d6da 100644 --- a/target/linux/mediatek/files/drivers/leds/leds-smartrg-system.c +++ b/target/linux/mediatek/files/drivers/leds/leds-smartrg-system.c @@ -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);