From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: George Stark <gnstark@salutedevices.com>,
"pavel@ucw.cz" <pavel@ucw.cz>, "lee@kernel.org" <lee@kernel.org>,
"vadimp@nvidia.com" <vadimp@nvidia.com>,
"mpe@ellerman.id.au" <mpe@ellerman.id.au>,
"npiggin@gmail.com" <npiggin@gmail.com>
Cc: "linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"kernel@sberdevices.ru" <kernel@sberdevices.ru>
Subject: Re: [PATCH 2/8] leds: nic78bx: explicitly unregister LEDs at module's shutdown
Date: Mon, 6 Nov 2023 08:13:19 +0000 [thread overview]
Message-ID: <810346b6-c8a4-8c40-8fe3-242332428313@csgroup.eu> (raw)
In-Reply-To: <20231025130737.2015468-3-gnstark@salutedevices.com>
Le 25/10/2023 à 15:07, George Stark a écrit :
> LEDs are registered using devm_led_classdev_register() and automatically
> unregistered after module's remove(). led_classdev_unregister() calls
> led_set_brightness() to turn off the LEDs and module's appropriate callback
> uses resources those were destroyed already in module's remove().
> So explicitly unregister LEDs at module shutdown.
>
> Signed-off-by: George Stark <gnstark@salutedevices.com>
> ---
> drivers/leds/leds-nic78bx.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/leds/leds-nic78bx.c b/drivers/leds/leds-nic78bx.c
> index f196f52eec1e..12b70fcad37f 100644
> --- a/drivers/leds/leds-nic78bx.c
> +++ b/drivers/leds/leds-nic78bx.c
> @@ -170,6 +170,10 @@ static int nic78bx_probe(struct platform_device *pdev)
> static int nic78bx_remove(struct platform_device *pdev)
> {
> struct nic78bx_led_data *led_data = platform_get_drvdata(pdev);
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(nic78bx_leds); i++)
> + devm_led_classdev_unregister(&pdev->dev, &nic78bx_leds[i].cdev);
The whole purpose of devm_ functions is that you don't need to call
unregister when removing the driver as the dev core will do it for you.
I understand your problem but I think this is not the solution.
>
> /* Lock LED register */
> outb(NIC78BX_LOCK_VALUE,
next prev parent reply other threads:[~2023-11-06 8:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 13:07 [PATCH 0/8] devm_led_classdev_register() usage problem George Stark
2023-10-25 13:07 ` [PATCH 1/8] leds: powernv: explicitly unregister LEDs at module's shutdown George Stark
2023-10-25 13:07 ` [PATCH 2/8] leds: nic78bx: " George Stark
2023-11-06 8:13 ` Christophe Leroy [this message]
2023-11-09 23:28 ` George Stark
2023-10-25 13:07 ` [PATCH 3/8] leds: an30259a: " George Stark
2023-10-25 13:07 ` [PATCH 4/8] leds: mlxreg: " George Stark
2023-10-25 13:07 ` [PATCH 5/8] leds: aw200xx: " George Stark
2023-10-25 13:07 ` [PATCH 6/8] leds: aw2013: " George Stark
2023-10-25 13:07 ` [PATCH 7/8] leds: lp3952: " George Stark
2023-11-04 7:18 ` [PATCH 0/8] devm_led_classdev_register() usage problem George Stark
2023-11-24 15:30 ` Andy Shevchenko
2023-11-06 8:11 ` Christophe Leroy
2023-11-24 15:28 ` Andy Shevchenko
2023-11-25 0:47 ` George Stark
2023-11-25 11:04 ` Jonathan Cameron
2023-11-27 12:41 ` Andy Shevchenko
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=810346b6-c8a4-8c40-8fe3-242332428313@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=gnstark@salutedevices.com \
--cc=kernel@sberdevices.ru \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=pavel@ucw.cz \
--cc=vadimp@nvidia.com \
/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
all inboxes | Powered by JetHome®