linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
To: Michael Buesch <mb@bu3sch.de>
Cc: "Hin-Tak Leung" <htl10@users.sourceforge.net>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	"linux-wireless" <linux-wireless@vger.kernel.org>
Subject: Re: RTL8187 warnings on suspend
Date: Thu, 26 Nov 2009 16:04:03 -0200	[thread overview]
Message-ID: <200911261604.04008.herton@mandriva.com.br> (raw)
In-Reply-To: <200911252118.05822.herton@mandriva.com.br>

Em Qua 25 Nov 2009, às 21:18:05, Herton Ronaldo Krzesinski escreveu:
> Em Qua 25 Nov 2009, às 20:18:14, Michael Buesch escreveu:
> > On Wednesday 25 November 2009 22:44:25 Herton Ronaldo Krzesinski wrote:
> > > Hmm strange, reviewing it now I only see a missing #ifdef CONFIG_RTL8187_LEDS
> > > around rtl8187_leds_start inside rtl8187_start. Despite it, the patch worked
> > > here, may be something I'm not seeing...
> > 
> > http://bu3sch.de/misc/rtl8187.JPG
> 
> My approach wasn't good, I have another try, this one I couldn't test yet
> as I'm away from the laptop with rtl8187 until tomorrow, but I decided to post
> it now (sorry for another patch dump, this I hope should work):

There were some missing bits, this worked in my tests:

diff --git a/drivers/net/wireless/rtl818x/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187.h
index bf9175a..6d4bd5c 100644
--- a/drivers/net/wireless/rtl818x/rtl8187.h
+++ b/drivers/net/wireless/rtl818x/rtl8187.h
@@ -134,6 +134,7 @@ struct rtl8187_priv {
 		__le32 bits32;
 	} *io_dmabuf;
 	bool rfkill_off;
+	bool stopped;
 };
 
 void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 2017ccc..159e5bf 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -990,6 +990,7 @@ static int rtl8187_start(struct ieee80211_hw *dev)
 
 rtl8187_start_exit:
 	mutex_unlock(&priv->conf_mutex);
+	priv->stopped = false;
 	return ret;
 }
 
@@ -1022,6 +1023,14 @@ static void rtl8187_stop(struct ieee80211_hw *dev)
 
 	if (!priv->is_rtl8187b)
 		cancel_delayed_work_sync(&priv->work);
+
+#ifdef CONFIG_RTL8187_LEDS
+	/* XXX: turn the LED off */
+	cancel_delayed_work_sync(&priv->led_on);
+	ieee80211_queue_delayed_work(dev, &priv->led_off, 0);
+	flush_delayed_work(&priv->led_off);
+#endif
+	priv->stopped = true;
 }
 
 static int rtl8187_add_interface(struct ieee80211_hw *dev,
diff --git a/drivers/net/wireless/rtl818x/rtl8187_leds.c b/drivers/net/wireless/rtl818x/rtl8187_leds.c
index cf8a4a4..fd07235 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_leds.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_leds.c
@@ -107,6 +107,9 @@ static void rtl8187_led_brightness_set(struct led_classdev *led_dev,
 	struct ieee80211_hw *hw = led->dev;
 	struct rtl8187_priv *priv = hw->priv;
 
+	if (priv->stopped)
+		return;
+
 	if (brightness == LED_OFF) {
 		ieee80211_queue_delayed_work(hw, &priv->led_off, 0);
 		/* The LED is off for 1/20 sec so that it just blinks. */
@@ -192,10 +195,8 @@ void rtl8187_leds_init(struct ieee80211_hw *dev, u16 custid)
 		 "rtl8187-%s::rx", wiphy_name(dev->wiphy));
 	err = rtl8187_register_led(dev, &priv->led_rx, name,
 			 ieee80211_get_rx_led_name(dev), ledpin);
-	if (!err) {
-		ieee80211_queue_delayed_work(dev, &priv->led_on, 0);
+	if (!err)
 		return;
-	}
 	/* registration of RX LED failed - unregister TX */
 	rtl8187_unregister_led(&priv->led_tx);
 error:
@@ -208,8 +209,6 @@ void rtl8187_leds_exit(struct ieee80211_hw *dev)
 {
 	struct rtl8187_priv *priv = dev->priv;
 
-	/* turn the LED off before exiting */
-	ieee80211_queue_delayed_work(dev, &priv->led_off, 0);
 	rtl8187_unregister_led(&priv->led_rx);
 	rtl8187_unregister_led(&priv->led_tx);
 	cancel_delayed_work_sync(&priv->led_off);


But it is a bit of a hack, I think we should change LEDS_OFF case to not have
to turn the led off on stop/exit (mac80211 already calls led off on stop, but
on rtl8187 because the LEDS_OFF treatment in rtl8187_led_brightness_set
we have to turn it off on exit). I'll see if I can make a better patch.

-- 
[]'s
Herton

  reply	other threads:[~2009-11-26 18:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25 15:26 RTL8187 warnings on suspend Michael Buesch
2009-11-25 18:25 ` Herton Ronaldo Krzesinski
2009-11-25 19:29   ` Michael Buesch
2009-11-25 19:55     ` Herton Ronaldo Krzesinski
2009-11-25 20:57       ` Michael Buesch
2009-11-25 21:44         ` Herton Ronaldo Krzesinski
2009-11-25 22:18           ` Michael Buesch
2009-11-25 23:18             ` Herton Ronaldo Krzesinski
2009-11-26 18:04               ` Herton Ronaldo Krzesinski [this message]
2009-11-27  0:10                 ` Hin-Tak Leung
2009-11-27 11:45                   ` Herton Ronaldo Krzesinski
2009-11-27 12:33                     ` Hin-Tak Leung
2009-11-27 17:49                     ` Larry Finger
2009-12-01 13:49                       ` Herton Ronaldo Krzesinski
2009-12-01 20:11                         ` Larry Finger
2009-12-01 21:26                           ` Herton Ronaldo Krzesinski
2009-12-01 22:21                             ` Larry Finger
2009-12-08 22:01                         ` 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=200911261604.04008.herton@mandriva.com.br \
    --to=herton@mandriva.com.br \
    --cc=Larry.Finger@lwfinger.net \
    --cc=htl10@users.sourceforge.net \
    --cc=linux-wireless@vger.kernel.org \
    --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 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).