From: Lee Jones <lee@kernel.org>
To: George Stark <gnstark@salutedevices.com>
Cc: andy.shevchenko@gmail.com, pavel@ucw.cz, vadimp@nvidia.com,
christophe.leroy@csgroup.eu, hdegoede@redhat.com,
mazziesaccount@gmail.com, peterz@infradead.org, mingo@redhat.com,
will@kernel.org, longman@redhat.com, boqun.feng@gmail.com,
nikitos.tr@gmail.com, marek.behun@nic.cz, kabel@kernel.org,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 0/8] devm_led_classdev_register() usage problem
Date: Thu, 11 Apr 2024 14:45:14 +0100 [thread overview]
Message-ID: <20240411134514.GK1980182@google.com> (raw)
In-Reply-To: <e3dd3ed1-02dc-447c-9fdd-9d8193a25e5f@salutedevices.com>
On Fri, 29 Mar 2024, George Stark wrote:
> Hello Lee
>
> On 3/22/24 13:43, Lee Jones wrote:
> > On Fri, 22 Mar 2024, George Stark wrote:
> >
> > > Hello Lee
> > >
> > > On 3/21/24 21:11, Lee Jones wrote:
> > > > On Thu, 14 Mar 2024, George Stark wrote:
> > > >
> > > > > This patch series fixes the problem of devm_led_classdev_register misusing.
> > > > >
> > > > > The basic problem is described in [1]. Shortly when devm_led_classdev_register()
> > > > > is used then led_classdev_unregister() called after driver's remove() callback.
> > > > > led_classdev_unregister() calls driver's brightness_set callback and that callback
> > > > > may use resources which were destroyed already in driver's remove().
> > > > >
> > > > > After discussion with maintainers [2] [3] we decided:
> > > > > 1) don't touch led subsystem core code and don't remove led_set_brightness() from it
> > > > > but fix drivers
> > > > > 2) don't use devm_led_classdev_unregister
> > > > >
> > > > > So the solution is to use devm wrappers for all resources
> > > > > driver's brightness_set() depends on. And introduce dedicated devm wrapper
> > > > > for mutex as it's often used resource.
> > >
> > > ...
> > >
> > > > > locking/mutex: introduce devm_mutex_init()
> > > > > leds: aw2013: use devm API to cleanup module's resources
> > > > > leds: aw200xx: use devm API to cleanup module's resources
> > > > > leds: lp3952: use devm API to cleanup module's resources
> > > > > leds: lm3532: use devm API to cleanup module's resources
> > > > > leds: nic78bx: use devm API to cleanup module's resources
> > > > > leds: mlxreg: use devm_mutex_init() for mutex initialization
> > > > > leds: an30259a: use devm_mutex_init() for mutex initialization
> > > > >
> > > > > drivers/leds/leds-an30259a.c | 14 ++++----------
> > > > > drivers/leds/leds-aw200xx.c | 32 +++++++++++++++++++++-----------
> > > > > drivers/leds/leds-aw2013.c | 25 +++++++++++++------------
> > > > > drivers/leds/leds-lm3532.c | 29 +++++++++++++++++------------
> > > > > drivers/leds/leds-lp3952.c | 21 +++++++++++----------
> > > > > drivers/leds/leds-mlxreg.c | 14 +++++---------
> > > > > drivers/leds/leds-nic78bx.c | 23 +++++++++++++----------
> > > > > include/linux/mutex.h | 27 +++++++++++++++++++++++++++
> > > > > kernel/locking/mutex-debug.c | 11 +++++++++++
> > > > > 9 files changed, 122 insertions(+), 74 deletions(-)
> > > >
> > > > Doesn't apply to v6.8.
> > > >
> > > > What base was used for this?
> > >
> > > I've just pulled git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > > and v7 was applied cleanly. linux-next is ok too.
> > >
> > > v6.8 is lack of recent patch 6969d0a2ba1adc9ba6a49b9805f24080896c255c
> > > v7's patch #2 depends on it
> >
> > No problem. I'll wait for v6.9-rc1.
> >
>
> Just checked the v7 patch series on released 6.9-rc1 and it's applied
> cleanly. If anything i can help please let me know.
It applies, but doesn't seem to build:
make --silent --keep-going --jobs=8 O=../build ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CROSS_COMPILE_COMPAT=arm-linux-gnueabihf- 'CC=sccache aarch64-linux-gnu-gcc' 'HOSTCC=sccache gcc' allmodconfig
make --silent --keep-going --jobs=8 O=../build ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CROSS_COMPILE_COMPAT=arm-linux-gnueabihf- 'CC=sccache aarch64-linux-gnu-gcc' 'HOSTCC=sccache gcc'
ERROR: modpost: "__devm_mutex_init" [drivers/leds/leds-an30259a.ko] undefined!
ERROR: modpost: "__devm_mutex_init" [drivers/leds/leds-aw200xx.ko] undefined!
ERROR: modpost: "__devm_mutex_init" [drivers/leds/leds-aw2013.ko] undefined!
ERROR: modpost: "__devm_mutex_init" [drivers/leds/leds-lm3532.ko] undefined!
ERROR: modpost: "__devm_mutex_init" [drivers/leds/leds-mlxreg.ko] undefined!
make[3]: *** [/builds/linux/scripts/Makefile.modpost:145: Module.symvers] Error 1
Did you forget to export it?
--
Lee Jones [李琼斯]
next prev parent reply other threads:[~2024-04-11 13:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 20:18 [PATCH v7 0/8] devm_led_classdev_register() usage problem George Stark
2024-03-14 20:18 ` [PATCH v7 1/8] locking/mutex: introduce devm_mutex_init() George Stark
2024-03-14 23:33 ` Andy Shevchenko
2024-03-14 20:18 ` [PATCH v7 2/8] leds: aw2013: use devm API to cleanup module's resources George Stark
2024-03-14 20:18 ` [PATCH v7 3/8] leds: aw200xx: " George Stark
2024-03-14 20:18 ` [PATCH v7 4/8] leds: lp3952: " George Stark
2024-03-14 23:36 ` Andy Shevchenko
2024-03-14 20:18 ` [PATCH v7 5/8] leds: lm3532: " George Stark
2024-03-14 20:18 ` [PATCH v7 6/8] leds: nic78bx: " George Stark
2024-03-14 20:18 ` [PATCH v7 7/8] leds: mlxreg: use devm_mutex_init() for mutex initialization George Stark
2024-03-14 20:18 ` [PATCH v7 8/8] leds: an30259a: " George Stark
2024-03-21 18:11 ` [PATCH v7 0/8] devm_led_classdev_register() usage problem Lee Jones
2024-03-22 10:19 ` George Stark
2024-03-22 10:43 ` Lee Jones
2024-03-29 13:43 ` George Stark
2024-04-11 13:45 ` Lee Jones [this message]
2024-04-11 14:20 ` George Stark
2024-04-11 10:59 ` Lee Jones
2024-04-11 11:00 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240411134514.GK1980182@google.com \
--to=lee@kernel.org \
--cc=andy.shevchenko@gmail.com \
--cc=boqun.feng@gmail.com \
--cc=christophe.leroy@csgroup.eu \
--cc=gnstark@salutedevices.com \
--cc=hdegoede@redhat.com \
--cc=kabel@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=longman@redhat.com \
--cc=marek.behun@nic.cz \
--cc=mazziesaccount@gmail.com \
--cc=mingo@redhat.com \
--cc=nikitos.tr@gmail.com \
--cc=pavel@ucw.cz \
--cc=peterz@infradead.org \
--cc=vadimp@nvidia.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).