linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: bcm43xx-dev@lists.berlios.de
Cc: Larry Finger <Larry.Finger@lwfinger.net>, linux-wireless@vger.kernel.org
Subject: Re: [RFC/T] b43: Fix Radio On/Off LED action
Date: Tue, 27 Nov 2007 17:13:02 +0100	[thread overview]
Message-ID: <200711271713.02698.mb@bu3sch.de> (raw)
In-Reply-To: <474c3fed.AWsUCELaFNf32i8C%Larry.Finger@lwfinger.net>

On Tuesday 27 November 2007 17:03:57 Larry Finger wrote:
> Since addition of the rfkill callback, the LED associated with the off
> switch on the radio has not worked because essential data in the rfkill
> structure was missing. This hack adds the necessary data and places direct
> calls to turn the leds on/off.
> 
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> ---
> 
> Index: wireless-2.6/drivers/net/wireless/b43/rfkill.c
> ===================================================================
> --- wireless-2.6.orig/drivers/net/wireless/b43/rfkill.c
> +++ wireless-2.6/drivers/net/wireless/b43/rfkill.c
> @@ -23,6 +23,7 @@
>  */
>  
>  #include "rfkill.h"
> +#include "leds.h"
>  #include "b43.h"
>  
>  
> @@ -57,6 +58,10 @@ static void b43_rfkill_poll(struct input
>  		report_change = 1;
>  		b43info(wl, "Radio hardware status changed to %s\n",
>  			enabled ? "ENABLED" : "DISABLED");
> +		if (enabled)
> +			b43_led_turn_on(dev, 1, 1);
> +		else
> +			b43_led_turn_off(dev, 1, 1);
>  	}
>  	mutex_unlock(&wl->mutex);
>  

This is not how led triggers work.
You are shortcutting the whole thing here. So you could as well
remove the whole rfkill and LEDs code.

Please properly register the LED in the leds code and
add a default LED trigger for the rfkill trigger.
This has several advantages to the user, among the possiblility to
reassign a LED to a different trigger.

> @@ -70,11 +75,13 @@ static int b43_rfkill_soft_toggle(void *
>  	struct b43_wldev *dev = data;
>  	struct b43_wl *wl = dev->wl;
>  	int err = 0;
> +	int lock = mutex_is_locked(&wl->mutex);
>  
>  	if (!wl->rfkill.registered)
>  		return 0;
>  
> -	mutex_lock(&wl->mutex);
> +	if (!lock)
> +		mutex_lock(&wl->mutex);

Nah, it shouldn't be locked by "current" in the first place, here.
(I guess that's what you are trying to check here).
That's what the !registered check above is for.
This !lock check is racy.

>  	B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED);
>  	switch (state) {
>  	case RFKILL_STATE_ON:
> @@ -93,7 +100,8 @@ static int b43_rfkill_soft_toggle(void *
>  		break;
>  	}
>  out_unlock:
> -	mutex_unlock(&wl->mutex);
> +	if (!lock)
> +		mutex_unlock(&wl->mutex);
>  
>  	return err;


-- 
Greetings Michael.

  reply	other threads:[~2007-11-27 16:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27 16:03 [RFC/T] b43: Fix Radio On/Off LED action Larry Finger
2007-11-27 16:13 ` Michael Buesch [this message]
2007-11-27 16:28   ` Larry Finger
2007-11-27 17:05     ` Michael Buesch
2007-11-27 18:29       ` Ehud Gavron
2007-11-27 20:02   ` [RFC/T V2] " Larry Finger
2007-11-27 20:20     ` Michael Buesch
2007-11-27 21:22       ` Larry Finger
2007-11-28 14:11         ` Michael Buesch
2007-11-28 15:05           ` Larry Finger
2007-11-28 16:13             ` Michael Buesch
2007-11-28 16:41               ` Larry Finger
2007-11-28 16:46                 ` Michael Buesch
2007-11-28 17:08                   ` Larry Finger

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=200711271713.02698.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=Larry.Finger@lwfinger.net \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=linux-wireless@vger.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).