* [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
@ 2022-12-28 9:32 Andy Shevchenko
2022-12-28 10:09 ` Andy Shevchenko
2023-01-09 17:06 ` Lee Jones
0 siblings, 2 replies; 8+ messages in thread
From: Andy Shevchenko @ 2022-12-28 9:32 UTC (permalink / raw)
To: Pavel Machek, Vincent Knecht, linux-leds, linux-kernel, llvm
Cc: Lee Jones, Nathan Chancellor, Nick Desaulniers, Tom Rix,
Andy Shevchenko, kernel test robot
Clang complains that devm_add_action() takes a parameter with a wrong type:
warning: cast from 'void (*)(struct mutex *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict]
err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
It appears that the commit e1af5c815586 ("leds: is31fl319x: Fix devm vs.
non-devm ordering") missed two things:
- while mention devm_add_action_or_reset() the actual change got
devm_add_action() call by unknown reason
- strictly speaking the parameter is not compatible by type
Fix both issues by switching to devm_add_action_or_reset() and adding a
wrapper for mutex_destroy() call.
Reported-by: kernel test robot <lkp@intel.com>
Fixes: e1af5c815586 ("leds: is31fl319x: Fix devm vs. non-devm ordering")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Vincent Knecht <vincent.knecht@mailoo.org>
---
v2: added tag (Vincent), Cc'ed to Lee
drivers/leds/leds-is31fl319x.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
index b2f4c4ec7c56..7c908414ac7e 100644
--- a/drivers/leds/leds-is31fl319x.c
+++ b/drivers/leds/leds-is31fl319x.c
@@ -495,6 +495,11 @@ static inline int is31fl3196_db_to_gain(u32 dezibel)
return dezibel / IS31FL3196_AUDIO_GAIN_DB_STEP;
}
+static void is31f1319x_mutex_destroy(void *lock)
+{
+ mutex_destroy(lock);
+}
+
static int is31fl319x_probe(struct i2c_client *client)
{
struct is31fl319x_chip *is31;
@@ -511,7 +516,7 @@ static int is31fl319x_probe(struct i2c_client *client)
return -ENOMEM;
mutex_init(&is31->lock);
- err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
+ err = devm_add_action_or_reset(dev, is31f1319x_mutex_destroy, &is31->lock);
if (err)
return err;
--
2.35.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
2022-12-28 9:32 [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest() Andy Shevchenko
@ 2022-12-28 10:09 ` Andy Shevchenko
2023-01-09 17:06 ` Lee Jones
1 sibling, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2022-12-28 10:09 UTC (permalink / raw)
To: Pavel Machek, Vincent Knecht, linux-leds, linux-kernel, llvm
Cc: Lee Jones, Nathan Chancellor, Nick Desaulniers, Tom Rix,
kernel test robot
On Wed, Dec 28, 2022 at 11:32:38AM +0200, Andy Shevchenko wrote:
> Clang complains that devm_add_action() takes a parameter with a wrong type:
>
> warning: cast from 'void (*)(struct mutex *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict]
> err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 warning generated.
>
> It appears that the commit e1af5c815586 ("leds: is31fl319x: Fix devm vs.
> non-devm ordering") missed two things:
> - while mention devm_add_action_or_reset() the actual change got
> devm_add_action() call by unknown reason
> - strictly speaking the parameter is not compatible by type
>
> Fix both issues by switching to devm_add_action_or_reset() and adding a
> wrapper for mutex_destroy() call.
This should be read as v2 actually (but code wise the v1 and v2 has no difference).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
2022-12-28 9:32 [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest() Andy Shevchenko
2022-12-28 10:09 ` Andy Shevchenko
@ 2023-01-09 17:06 ` Lee Jones
2023-01-09 17:35 ` Andy Shevchenko
1 sibling, 1 reply; 8+ messages in thread
From: Lee Jones @ 2023-01-09 17:06 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Pavel Machek, Vincent Knecht, linux-leds, linux-kernel, llvm,
Nathan Chancellor, Nick Desaulniers, Tom Rix, kernel test robot
On Wed, 28 Dec 2022, Andy Shevchenko wrote:
> Clang complains that devm_add_action() takes a parameter with a wrong type:
>
> warning: cast from 'void (*)(struct mutex *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict]
> err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 warning generated.
>
> It appears that the commit e1af5c815586 ("leds: is31fl319x: Fix devm vs.
> non-devm ordering") missed two things:
> - while mention devm_add_action_or_reset() the actual change got
> devm_add_action() call by unknown reason
> - strictly speaking the parameter is not compatible by type
I fixed-up the wording above a little.
> Fix both issues by switching to devm_add_action_or_reset() and adding a
> wrapper for mutex_destroy() call.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: e1af5c815586 ("leds: is31fl319x: Fix devm vs. non-devm ordering")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Tested-by: Vincent Knecht <vincent.knecht@mailoo.org>
> ---
>
> v2: added tag (Vincent), Cc'ed to Lee
>
> drivers/leds/leds-is31fl319x.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
Applied, thanks
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
2023-01-09 17:06 ` Lee Jones
@ 2023-01-09 17:35 ` Andy Shevchenko
2023-01-10 10:10 ` Lee Jones
0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2023-01-09 17:35 UTC (permalink / raw)
To: Lee Jones
Cc: Pavel Machek, Vincent Knecht, linux-leds, linux-kernel, llvm,
Nathan Chancellor, Nick Desaulniers, Tom Rix, kernel test robot
On Mon, Jan 09, 2023 at 05:06:03PM +0000, Lee Jones wrote:
> On Wed, 28 Dec 2022, Andy Shevchenko wrote:
...
> Applied, thanks
Thank you and HNY!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
2023-01-09 17:35 ` Andy Shevchenko
@ 2023-01-10 10:10 ` Lee Jones
0 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2023-01-10 10:10 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Pavel Machek, Vincent Knecht, linux-leds, linux-kernel, llvm,
Nathan Chancellor, Nick Desaulniers, Tom Rix, kernel test robot
On Mon, 09 Jan 2023, Andy Shevchenko wrote:
> On Mon, Jan 09, 2023 at 05:06:03PM +0000, Lee Jones wrote:
> > On Wed, 28 Dec 2022, Andy Shevchenko wrote:
>
> ...
>
> > Applied, thanks
>
> Thank you and HNY!
HNYTYT!
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
2022-11-05 12:37 ` Vincent Knecht
@ 2022-11-07 11:10 ` Andy Shevchenko
0 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2022-11-07 11:10 UTC (permalink / raw)
To: Vincent Knecht
Cc: Pavel Machek, linux-leds, linux-kernel, llvm, Nathan Chancellor,
Nick Desaulniers, Tom Rix, kernel test robot
On Sat, Nov 05, 2022 at 01:37:55PM +0100, Vincent Knecht wrote:
> Le samedi 05 novembre 2022 à 01:59 +0200, Andy Shevchenko a écrit :
...
> LED still works fine after applying this patch,
> also after rmmod'ing and modprobe'ing again.
> Please let me know if something else should be tested.
> Thank you !
Thank you very much for testing, I believe it's comprehensive what you have
done already.
> Tested-by: Vincent Knecht <vincent.knecht@mailoo.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
2022-11-04 23:59 Andy Shevchenko
@ 2022-11-05 12:37 ` Vincent Knecht
2022-11-07 11:10 ` Andy Shevchenko
0 siblings, 1 reply; 8+ messages in thread
From: Vincent Knecht @ 2022-11-05 12:37 UTC (permalink / raw)
To: Andy Shevchenko, Pavel Machek, linux-leds, linux-kernel, llvm
Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, kernel test robot
Le samedi 05 novembre 2022 à 01:59 +0200, Andy Shevchenko a écrit :
> Clang complains that devm_add_action() takes a parameter with a wrong type:
>
> warning: cast from 'void (*)(struct mutex *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-
> function-type-strict]
> err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 warning generated.
>
> It appears that the commit e1af5c815586 ("leds: is31fl319x: Fix devm vs.
> non-devm ordering") missed two things:
> - while mention devm_add_action_or_reset() the actual change got
> devm_add_action() call by unknown reason
> - strictly speaking the parameter is not compatible by type
>
> Fix both issues by switching to devm_add_action_or_reset() and adding a
> wrapper for mutex_destroy() call.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: e1af5c815586 ("leds: is31fl319x: Fix devm vs. non-devm ordering")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/leds/leds-is31fl319x.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
> index 52b59b62f437..6f94ad83e066 100644
> --- a/drivers/leds/leds-is31fl319x.c
> +++ b/drivers/leds/leds-is31fl319x.c
> @@ -494,6 +494,11 @@ static inline int is31fl3196_db_to_gain(u32 dezibel)
> return dezibel / IS31FL3196_AUDIO_GAIN_DB_STEP;
> }
>
> +static void is31f1319x_mutex_destroy(void *lock)
> +{
> + mutex_destroy(lock);
> +}
> +
> static int is31fl319x_probe(struct i2c_client *client)
> {
> struct is31fl319x_chip *is31;
> @@ -510,7 +515,7 @@ static int is31fl319x_probe(struct i2c_client *client)
> return -ENOMEM;
>
> mutex_init(&is31->lock);
> - err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
> + err = devm_add_action_or_reset(dev, is31f1319x_mutex_destroy, &is31->lock);
> if (err)
> return err;
>
LED still works fine after applying this patch,
also after rmmod'ing and modprobe'ing again.
Please let me know if something else should be tested.
Thank you !
Tested-by: Vincent Knecht <vincent.knecht@mailoo.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
@ 2022-11-04 23:59 Andy Shevchenko
2022-11-05 12:37 ` Vincent Knecht
0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2022-11-04 23:59 UTC (permalink / raw)
To: Vincent Knecht, Pavel Machek, linux-leds, linux-kernel, llvm
Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, Andy Shevchenko,
kernel test robot
Clang complains that devm_add_action() takes a parameter with a wrong type:
warning: cast from 'void (*)(struct mutex *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict]
err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
It appears that the commit e1af5c815586 ("leds: is31fl319x: Fix devm vs.
non-devm ordering") missed two things:
- while mention devm_add_action_or_reset() the actual change got
devm_add_action() call by unknown reason
- strictly speaking the parameter is not compatible by type
Fix both issues by switching to devm_add_action_or_reset() and adding a
wrapper for mutex_destroy() call.
Reported-by: kernel test robot <lkp@intel.com>
Fixes: e1af5c815586 ("leds: is31fl319x: Fix devm vs. non-devm ordering")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/leds/leds-is31fl319x.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
index 52b59b62f437..6f94ad83e066 100644
--- a/drivers/leds/leds-is31fl319x.c
+++ b/drivers/leds/leds-is31fl319x.c
@@ -494,6 +494,11 @@ static inline int is31fl3196_db_to_gain(u32 dezibel)
return dezibel / IS31FL3196_AUDIO_GAIN_DB_STEP;
}
+static void is31f1319x_mutex_destroy(void *lock)
+{
+ mutex_destroy(lock);
+}
+
static int is31fl319x_probe(struct i2c_client *client)
{
struct is31fl319x_chip *is31;
@@ -510,7 +515,7 @@ static int is31fl319x_probe(struct i2c_client *client)
return -ENOMEM;
mutex_init(&is31->lock);
- err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
+ err = devm_add_action_or_reset(dev, is31f1319x_mutex_destroy, &is31->lock);
if (err)
return err;
--
2.35.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-01-10 10:10 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-28 9:32 [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest() Andy Shevchenko
2022-12-28 10:09 ` Andy Shevchenko
2023-01-09 17:06 ` Lee Jones
2023-01-09 17:35 ` Andy Shevchenko
2023-01-10 10:10 ` Lee Jones
-- strict thread matches above, loose matches on Subject: below --
2022-11-04 23:59 Andy Shevchenko
2022-11-05 12:37 ` Vincent Knecht
2022-11-07 11:10 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).