* [PATCH 6.1] leds: an30259a: Use devm_mutex_init() for mutex initialization
@ 2024-12-13 3:52 bin.lan.cn
2024-12-13 11:15 ` Greg KH
2024-12-13 15:13 ` Sasha Levin
0 siblings, 2 replies; 3+ messages in thread
From: bin.lan.cn @ 2024-12-13 3:52 UTC (permalink / raw)
To: stable, gnstark; +Cc: andy.shevchenko
From: George Stark <gnstark@salutedevices.com>
[ Upstream commit c382e2e3eccb6b7ca8c7aff5092c1668428e7de6 ]
In this driver LEDs are registered using devm_led_classdev_register()
so they are automatically unregistered after module's remove() is done.
led_classdev_unregister() calls module's led_set_brightness() to turn off
the LEDs and that callback uses mutex which was destroyed already
in module's remove() so use devm API instead.
Signed-off-by: George Stark <gnstark@salutedevices.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240411161032.609544-9-gnstark@salutedevices.com
Signed-off-by: Lee Jones <lee@kernel.org>
[ Resolve merge conflict in drivers/leds/leds-an30259a.c ]
Signed-off-by: Bin Lan <bin.lan.cn@windriver.com>
---
drivers/leds/leds-an30259a.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/leds/leds-an30259a.c b/drivers/leds/leds-an30259a.c
index e072ee5409f7..374011e3121e 100644
--- a/drivers/leds/leds-an30259a.c
+++ b/drivers/leds/leds-an30259a.c
@@ -296,7 +296,10 @@ static int an30259a_probe(struct i2c_client *client)
if (err < 0)
return err;
- mutex_init(&chip->mutex);
+ err = devm_mutex_init(&client->dev, &chip->mutex);
+ if (err)
+ return err;
+
chip->client = client;
i2c_set_clientdata(client, chip);
@@ -330,17 +333,9 @@ static int an30259a_probe(struct i2c_client *client)
return 0;
exit:
- mutex_destroy(&chip->mutex);
return err;
}
-static void an30259a_remove(struct i2c_client *client)
-{
- struct an30259a *chip = i2c_get_clientdata(client);
-
- mutex_destroy(&chip->mutex);
-}
-
static const struct of_device_id an30259a_match_table[] = {
{ .compatible = "panasonic,an30259a", },
{ /* sentinel */ },
@@ -360,7 +355,6 @@ static struct i2c_driver an30259a_driver = {
.of_match_table = of_match_ptr(an30259a_match_table),
},
.probe_new = an30259a_probe,
- .remove = an30259a_remove,
.id_table = an30259a_id,
};
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 6.1] leds: an30259a: Use devm_mutex_init() for mutex initialization
2024-12-13 3:52 [PATCH 6.1] leds: an30259a: Use devm_mutex_init() for mutex initialization bin.lan.cn
@ 2024-12-13 11:15 ` Greg KH
2024-12-13 15:13 ` Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2024-12-13 11:15 UTC (permalink / raw)
To: bin.lan.cn; +Cc: stable, gnstark, andy.shevchenko
On Fri, Dec 13, 2024 at 11:52:06AM +0800, bin.lan.cn@eng.windriver.com wrote:
> From: George Stark <gnstark@salutedevices.com>
>
> [ Upstream commit c382e2e3eccb6b7ca8c7aff5092c1668428e7de6 ]
>
> In this driver LEDs are registered using devm_led_classdev_register()
> so they are automatically unregistered after module's remove() is done.
> led_classdev_unregister() calls module's led_set_brightness() to turn off
> the LEDs and that callback uses mutex which was destroyed already
> in module's remove() so use devm API instead.
>
> Signed-off-by: George Stark <gnstark@salutedevices.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Link: https://lore.kernel.org/r/20240411161032.609544-9-gnstark@salutedevices.com
> Signed-off-by: Lee Jones <lee@kernel.org>
> [ Resolve merge conflict in drivers/leds/leds-an30259a.c ]
> Signed-off-by: Bin Lan <bin.lan.cn@windriver.com>
> ---
> drivers/leds/leds-an30259a.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
Now deleted, please see:
https://lore.kernel.org/r/2024121322-conjuror-gap-b542@gregkh
for what you all need to do, TOGETHER, to get this fixed and so that I
can accept patches from your company in the future.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 6.1] leds: an30259a: Use devm_mutex_init() for mutex initialization
2024-12-13 3:52 [PATCH 6.1] leds: an30259a: Use devm_mutex_init() for mutex initialization bin.lan.cn
2024-12-13 11:15 ` Greg KH
@ 2024-12-13 15:13 ` Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2024-12-13 15:13 UTC (permalink / raw)
To: stable; +Cc: bin.lan.cn, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: c382e2e3eccb6b7ca8c7aff5092c1668428e7de6
WARNING: Author mismatch between patch and upstream commit:
Backport author: bin.lan.cn@eng.windriver.com
Commit author: George Stark <gnstark@salutedevices.com>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: 3ead19aa341d)
6.1.y | Not found
Note: The patch differs from the upstream commit:
---
1: c382e2e3eccb6 ! 1: c7a5b2d87541f leds: an30259a: Use devm_mutex_init() for mutex initialization
@@ Metadata
## Commit message ##
leds: an30259a: Use devm_mutex_init() for mutex initialization
+ [ Upstream commit c382e2e3eccb6b7ca8c7aff5092c1668428e7de6 ]
+
In this driver LEDs are registered using devm_led_classdev_register()
so they are automatically unregistered after module's remove() is done.
led_classdev_unregister() calls module's led_set_brightness() to turn off
@@ Commit message
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240411161032.609544-9-gnstark@salutedevices.com
Signed-off-by: Lee Jones <lee@kernel.org>
+ [ Resolve merge conflict in drivers/leds/leds-an30259a.c ]
+ Signed-off-by: Bin Lan <bin.lan.cn@windriver.com>
## drivers/leds/leds-an30259a.c ##
@@ drivers/leds/leds-an30259a.c: static int an30259a_probe(struct i2c_client *client)
@@ drivers/leds/leds-an30259a.c: static int an30259a_probe(struct i2c_client *clien
{ .compatible = "panasonic,an30259a", },
{ /* sentinel */ },
@@ drivers/leds/leds-an30259a.c: static struct i2c_driver an30259a_driver = {
- .of_match_table = an30259a_match_table,
+ .of_match_table = of_match_ptr(an30259a_match_table),
},
- .probe = an30259a_probe,
+ .probe_new = an30259a_probe,
- .remove = an30259a_remove,
.id_table = an30259a_id,
};
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y | Success | Success |
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-13 15:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-13 3:52 [PATCH 6.1] leds: an30259a: Use devm_mutex_init() for mutex initialization bin.lan.cn
2024-12-13 11:15 ` Greg KH
2024-12-13 15:13 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox