All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hin-Tak Leung <htl10@users.sourceforge.net>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Herton Ronaldo Krzesinski <herton@canonical.com>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [RFC PATCH] rtl8187: Fix led support for rfkill
Date: Sat, 26 Mar 2011 21:33:23 +0000	[thread overview]
Message-ID: <4D8E5BA3.1090909@users.sourceforge.net> (raw)
In-Reply-To: <1301174394-12642-1-git-send-email-wuzhangjin@gmail.com>

Wu Zhangjin wrote:
> led can not be turned off normally when rfkill is blocked, the cause is
> the led_turn_off() function exit as not expected:

Hmm. While this sounds more sensible, is it needed? And what does the windows 
driver do?

I think there are two kind of LEDs - one that comes on and off with the rfkill 
switch; Larry or Herton makes the 2nd one, if there is one, blink while there is 
traffic (and stay steady on otherwise).

> 
> drivers/net/wireless/rtl818x/rtl8187/leds.c:
> 
> static void led_turn_off(struct work_struct *work)
> {
> 	[...]
> 	/* Don't change the LED, when the device is down. */
> 	if (!priv->vif || priv->vif->type == NL80211_IFTYPE_UNSPECIFIED)
> 		return ;
> 	[...]
> 
> When rfkill is blocked, the function calling order looks like this:
> 
> net/mac80211/iface.c:
> 
> ieee80211_do_stop
> 	-> drv_remove_interface = rtl8187_remove_interface
> 	-> ieee80211_stop_device
> 		-> led_set_brightness
> 			-> led_turn_off
> 	-> drv_stop = rtl8187_stop
> 
> rtl8187_remove_interface() set priv->vif to NULL, so, led_turn_off()
> will return and will not be able to turn off the led. delay the setting
> of priv->vif to rtl8187_stop() can solve it.
> 
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> ---
>  drivers/net/wireless/rtl818x/rtl8187/dev.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
> index 2bb5297..1fea0cd 100644
> --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
> +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
> @@ -1007,6 +1007,9 @@ static void rtl8187_stop(struct ieee80211_hw *dev)
>  	u32 reg;
>  
>  	mutex_lock(&priv->conf_mutex);
> +
> +	priv->vif = NULL;
> +
>  	rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
>  
>  	reg = rtl818x_ioread8(priv, &priv->map->CMD);
> @@ -1067,10 +1070,7 @@ exit:
>  static void rtl8187_remove_interface(struct ieee80211_hw *dev,
>  				     struct ieee80211_vif *vif)
>  {
> -	struct rtl8187_priv *priv = dev->priv;
> -	mutex_lock(&priv->conf_mutex);
> -	priv->vif = NULL;
> -	mutex_unlock(&priv->conf_mutex);
> +	/* Nothing to do */
>  }
>  
>  static int rtl8187_config(struct ieee80211_hw *dev, u32 changed)

WARNING: multiple messages have this Message-ID (diff)
From: Hin-Tak Leung <htl10-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
To: Wu Zhangjin <wuzhangjin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Herton Ronaldo Krzesinski
	<herton-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
	Larry Finger
	<Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC PATCH] rtl8187: Fix led support for rfkill
Date: Sat, 26 Mar 2011 21:33:23 +0000	[thread overview]
Message-ID: <4D8E5BA3.1090909@users.sourceforge.net> (raw)
In-Reply-To: <1301174394-12642-1-git-send-email-wuzhangjin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Wu Zhangjin wrote:
> led can not be turned off normally when rfkill is blocked, the cause is
> the led_turn_off() function exit as not expected:

Hmm. While this sounds more sensible, is it needed? And what does the windows 
driver do?

I think there are two kind of LEDs - one that comes on and off with the rfkill 
switch; Larry or Herton makes the 2nd one, if there is one, blink while there is 
traffic (and stay steady on otherwise).

> 
> drivers/net/wireless/rtl818x/rtl8187/leds.c:
> 
> static void led_turn_off(struct work_struct *work)
> {
> 	[...]
> 	/* Don't change the LED, when the device is down. */
> 	if (!priv->vif || priv->vif->type == NL80211_IFTYPE_UNSPECIFIED)
> 		return ;
> 	[...]
> 
> When rfkill is blocked, the function calling order looks like this:
> 
> net/mac80211/iface.c:
> 
> ieee80211_do_stop
> 	-> drv_remove_interface = rtl8187_remove_interface
> 	-> ieee80211_stop_device
> 		-> led_set_brightness
> 			-> led_turn_off
> 	-> drv_stop = rtl8187_stop
> 
> rtl8187_remove_interface() set priv->vif to NULL, so, led_turn_off()
> will return and will not be able to turn off the led. delay the setting
> of priv->vif to rtl8187_stop() can solve it.
> 
> Signed-off-by: Wu Zhangjin <wuzhangjin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/net/wireless/rtl818x/rtl8187/dev.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
> index 2bb5297..1fea0cd 100644
> --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
> +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
> @@ -1007,6 +1007,9 @@ static void rtl8187_stop(struct ieee80211_hw *dev)
>  	u32 reg;
>  
>  	mutex_lock(&priv->conf_mutex);
> +
> +	priv->vif = NULL;
> +
>  	rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
>  
>  	reg = rtl818x_ioread8(priv, &priv->map->CMD);
> @@ -1067,10 +1070,7 @@ exit:
>  static void rtl8187_remove_interface(struct ieee80211_hw *dev,
>  				     struct ieee80211_vif *vif)
>  {
> -	struct rtl8187_priv *priv = dev->priv;
> -	mutex_lock(&priv->conf_mutex);
> -	priv->vif = NULL;
> -	mutex_unlock(&priv->conf_mutex);
> +	/* Nothing to do */
>  }
>  
>  static int rtl8187_config(struct ieee80211_hw *dev, u32 changed)
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-03-26 21:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-26 21:19 [RFC PATCH] rtl8187: Fix led support for rfkill Wu Zhangjin
2011-03-26 21:19 ` Wu Zhangjin
2011-03-26 21:33 ` Hin-Tak Leung [this message]
2011-03-26 21:33   ` Hin-Tak Leung
2011-03-26 22:25   ` wu zhangjin
2011-03-27  0:55     ` Hin-Tak Leung
2011-03-27  0:55       ` Hin-Tak Leung
2011-03-27 22:47       ` Larry Finger
2011-03-27 22:47         ` Larry Finger
2011-03-28 15:40         ` Herton Ronaldo Krzesinski
2011-03-31 16:22           ` wu zhangjin
2011-03-31 16:22             ` wu zhangjin
2011-03-31 17:19             ` Herton Ronaldo Krzesinski
2011-04-01  3:12               ` wu zhangjin
2011-03-31 16:04         ` wu zhangjin
2011-03-31 16:04           ` wu zhangjin
2011-03-31 16:03       ` wu zhangjin
2011-03-31 16:03         ` wu zhangjin

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=4D8E5BA3.1090909@users.sourceforge.net \
    --to=htl10@users.sourceforge.net \
    --cc=Larry.Finger@lwfinger.net \
    --cc=herton@canonical.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=wuzhangjin@gmail.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 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.