All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: John Linville <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, Michael Buesch <mb@bu3sch.de>,
	Dmitry Baryshkov <dbaryshkov@gmail.com>
Subject: Re: [PATCH 2/4] rfkill: fix led-trigger unregister order in error unwind
Date: Sat, 19 Jul 2008 14:35:39 +0200	[thread overview]
Message-ID: <200807191435.39305.IvDoorn@gmail.com> (raw)
In-Reply-To: <1216150327-10904-3-git-send-email-hmh@hmh.eng.br>

On Tuesday 15 July 2008, Henrique de Moraes Holschuh wrote:
> rfkill needs to unregister the led trigger AFTER a call to
> rfkill_remove_switch(), otherwise it will not update the LED state,
> possibly leaving it ON when it should be OFF.
> 
> To make led-trigger unregistering safer, guard against unregistering a
> trigger twice, and also against issuing trigger events to a led trigger
> that was unregistered.  This makes the error unwind paths more resilient.
> 
> Refer to commit 8a8f1c0437a77cce29c1cb6089f01f22a6d9ca6e,
> "rfkill: Register LED triggers before registering switch".
> 
> Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
> Cc: Ivo van Doorn <IvDoorn@gmail.com>
> Cc: Michael Buesch <mb@bu3sch.de>
> Cc: Dmitry Baryshkov <dbaryshkov@gmail.com>

Acked-by: Ivo van Doorn <IvDoorn@gmail.com>

> ---
>  net/rfkill/rfkill.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
> index 022fe50..fc3a4fd 100644
> --- a/net/rfkill/rfkill.c
> +++ b/net/rfkill/rfkill.c
> @@ -590,8 +590,10 @@ static void rfkill_led_trigger_register(struct rfkill *rfkill)
>  static void rfkill_led_trigger_unregister(struct rfkill *rfkill)
>  {
>  #ifdef CONFIG_RFKILL_LEDS
> -	if (rfkill->led_trigger.name)
> +	if (rfkill->led_trigger.name) {
>  		led_trigger_unregister(&rfkill->led_trigger);
> +		rfkill->led_trigger.name = NULL;
> +	}
>  #endif
>  }
>  
> @@ -627,8 +629,8 @@ int rfkill_register(struct rfkill *rfkill)
>  
>  	error = device_add(dev);
>  	if (error) {
> -		rfkill_led_trigger_unregister(rfkill);
>  		rfkill_remove_switch(rfkill);
> +		rfkill_led_trigger_unregister(rfkill);
>  		return error;
>  	}
>  



  reply	other threads:[~2008-07-19 12:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-15 19:32 [GIT PATCH] rfkill fixes, set 2 Henrique de Moraes Holschuh
2008-07-15 19:32 ` [PATCH 1/4] rfkill: document rfkill_force_state as required Henrique de Moraes Holschuh
2008-07-19 12:34   ` Ivo van Doorn
2008-07-19 13:42     ` Henrique de Moraes Holschuh
2008-07-15 19:32 ` [PATCH 2/4] rfkill: fix led-trigger unregister order in error unwind Henrique de Moraes Holschuh
2008-07-19 12:35   ` Ivo van Doorn [this message]
2008-07-15 19:32 ` [PATCH 3/4] rfkill: document the rfkill struct locking Henrique de Moraes Holschuh
2008-07-19 12:39   ` Ivo van Doorn
2008-07-19 13:43     ` Henrique de Moraes Holschuh
2008-07-15 19:32 ` [PATCH 4/4] rfkill: mutex fixes Henrique de Moraes Holschuh
2008-07-17  4:56   ` Michael Buesch
2008-07-17 11:33     ` drago01
2008-07-17 12:10       ` Henrique de Moraes Holschuh
2008-07-19 12:47   ` Ivo van Doorn
2008-07-19 14:19     ` Henrique de Moraes Holschuh
2008-07-19 14:50       ` Ivo van Doorn
2008-07-19 14:51         ` Ivo van Doorn
2008-07-16 16:29 ` [GIT PATCH] rfkill fixes, set 2 Dan Williams
2008-07-17 11:54   ` Henrique de Moraes Holschuh
2008-07-17 21:56 ` [PATCH 5/4] rfkill: query EV_SW states when rfkill-input connects to a input device Henrique de Moraes Holschuh
2008-07-19  4:01   ` Dmitry Torokhov

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=200807191435.39305.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=dbaryshkov@gmail.com \
    --cc=hmh@hmh.eng.br \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mb@bu3sch.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.