From: Larry Finger <Larry.Finger@lwfinger.net>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: Herton Ronaldo Krzesinski <herton@mandriva.com.br>,
Hin-Tak Leung <htl10@users.sourceforge.net>,
sidhayn@gmail.com, linux-wireless@vger.kernel.org,
mcgrof@gmail.com, johannes@sipsolutions.net
Subject: Re: [PATCH] rtl8187: Fix kernel oops when device is removed when LEDS enabled (Bugzilla #14539)
Date: Thu, 05 Nov 2009 00:00:25 -0600 [thread overview]
Message-ID: <4AF269F9.4020107@lwfinger.net> (raw)
In-Reply-To: <20091104184700.GK12965@tuxdriver.com>
On 11/04/2009 12:47 PM, John W. Linville wrote:
>
> They are musings -- but feel free to be inspired! :-)
>
I was somewhat inspired and tried the following alternative patch:
++++++++++++++++++++++++++++++++++++++++++++++++\
Index: wireless-testing/drivers/net/wireless/rtl818x/rtl8187_leds.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187_leds.c
+++ wireless-testing/drivers/net/wireless/rtl818x/rtl8187_leds.c
@@ -107,6 +107,9 @@ static void rtl8187_led_brightness_set(s
struct ieee80211_hw *hw = led->dev;
struct rtl8187_priv *priv = hw->priv;
+ /* detect shutting down */
+ if (priv->leds_off)
+ 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. */
@@ -179,6 +182,7 @@ void rtl8187_leds_init(struct ieee80211_
ledpin = LED_PIN_GPIO0;
}
+ priv->leds_off = false;
INIT_DELAYED_WORK(&priv->led_on, led_turn_on);
INIT_DELAYED_WORK(&priv->led_off, led_turn_off);
@@ -210,6 +214,7 @@ void rtl8187_leds_exit(struct ieee80211_
/* turn the LED off before exiting */
ieee80211_queue_delayed_work(dev, &priv->led_off, 0);
+ priv->leds_off = true;
cancel_delayed_work_sync(&priv->led_off);
cancel_delayed_work_sync(&priv->led_on);
rtl8187_unregister_led(&priv->led_rx);
Index: wireless-testing/drivers/net/wireless/rtl818x/rtl8187.h
===================================================================
--- wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187.h
+++ wireless-testing/drivers/net/wireless/rtl818x/rtl8187.h
@@ -134,6 +134,7 @@ struct rtl8187_priv {
__le32 bits32;
} *io_dmabuf;
bool rfkill_off;
+ bool leds_off;
};
void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
++++++++++++++++++++++++++++++++++++++++++++++
Yes, I know it is white-space damaged. I do not want it being applied!
By adding a new variable that is set whenever the LED system is being
shutdown, the kernel no longer panics; however, the LED is not turned
off on shutdown, further confirmation that USB transfers take a long
time to happen. I could add an msleep() between queuing the led_off
work and setting the leds_off flag, but this just seems like extra
complexity. I think we should go with the counter-intuitive order on
the shutdown.
Larry
prev parent reply other threads:[~2009-11-05 6:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-04 6:00 [PATCH] rtl8187: Fix kernel oops when device is removed when LEDS enabled (Bugzilla #14539) Larry Finger
2009-11-04 15:11 ` John W. Linville
2009-11-04 15:30 ` Christian Lamparter
2009-11-04 16:49 ` John W. Linville
2009-11-05 0:14 ` Herton Ronaldo Krzesinski
2009-11-05 2:34 ` Larry Finger
2009-11-05 4:55 ` Richard Farina
2009-11-05 5:16 ` Larry Finger
2009-11-04 15:54 ` Larry Finger
2009-11-04 16:54 ` John W. Linville
2009-11-04 18:13 ` Larry Finger
2009-11-04 18:47 ` John W. Linville
2009-11-05 4:57 ` Richard Farina
2009-11-05 6:00 ` Larry Finger [this message]
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=4AF269F9.4020107@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=herton@mandriva.com.br \
--cc=htl10@users.sourceforge.net \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mcgrof@gmail.com \
--cc=sidhayn@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 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).