From: Tejun Heo <tj@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>,
Stanislav Yakovlev <stas.yakovlev@gmail.com>,
linux-wireless@vger.kernel.org
Subject: [PATCH 04/25] ipw2x00: simplify scan_event handling
Date: Fri, 21 Dec 2012 17:56:54 -0800 [thread overview]
Message-ID: <1356141435-17340-5-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1356141435-17340-1-git-send-email-tj@kernel.org>
* Drop unnesssary delayd_work_pending() tests.
* Unify scan_event_{now|later} by using mod_delayed_work() w/ 0 delay
for scan_event_now.
* Make ipw2200 scan_event handling match ipw2100 - use
mod_delayed_work() w/ 0 delay for immediate scanning.
Only compile tested.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Stanislav Yakovlev <stas.yakovlev@gmail.com>
Cc: linux-wireless@vger.kernel.org
---
Please let me know how this patch should be routed. I can take it
through the workqueue tree if necessary.
Thanks.
drivers/net/wireless/ipw2x00/ipw2100.c | 31 ++++++++-----------------------
drivers/net/wireless/ipw2x00/ipw2100.h | 3 +--
drivers/net/wireless/ipw2x00/ipw2200.c | 13 +++----------
3 files changed, 12 insertions(+), 35 deletions(-)
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index d92b21a..b3ab7b7 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -2181,9 +2181,10 @@ static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status)
mod_delayed_work(system_wq, &priv->rf_kill, round_jiffies_relative(HZ));
}
-static void send_scan_event(void *data)
+static void ipw2100_scan_event(struct work_struct *work)
{
- struct ipw2100_priv *priv = data;
+ struct ipw2100_priv *priv = container_of(work, struct ipw2100_priv,
+ scan_event.work);
union iwreq_data wrqu;
wrqu.data.length = 0;
@@ -2191,18 +2192,6 @@ static void send_scan_event(void *data)
wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL);
}
-static void ipw2100_scan_event_later(struct work_struct *work)
-{
- send_scan_event(container_of(work, struct ipw2100_priv,
- scan_event_later.work));
-}
-
-static void ipw2100_scan_event_now(struct work_struct *work)
-{
- send_scan_event(container_of(work, struct ipw2100_priv,
- scan_event_now));
-}
-
static void isr_scan_complete(struct ipw2100_priv *priv, u32 status)
{
IPW_DEBUG_SCAN("scan complete\n");
@@ -2212,13 +2201,11 @@ static void isr_scan_complete(struct ipw2100_priv *priv, u32 status)
/* Only userspace-requested scan completion events go out immediately */
if (!priv->user_requested_scan) {
- if (!delayed_work_pending(&priv->scan_event_later))
- schedule_delayed_work(&priv->scan_event_later,
- round_jiffies_relative(msecs_to_jiffies(4000)));
+ schedule_delayed_work(&priv->scan_event,
+ round_jiffies_relative(msecs_to_jiffies(4000)));
} else {
priv->user_requested_scan = 0;
- cancel_delayed_work(&priv->scan_event_later);
- schedule_work(&priv->scan_event_now);
+ mod_delayed_work(system_wq, &priv->scan_event, 0);
}
}
@@ -4459,8 +4446,7 @@ static void ipw2100_kill_works(struct ipw2100_priv *priv)
cancel_delayed_work_sync(&priv->wx_event_work);
cancel_delayed_work_sync(&priv->hang_check);
cancel_delayed_work_sync(&priv->rf_kill);
- cancel_work_sync(&priv->scan_event_now);
- cancel_delayed_work_sync(&priv->scan_event_later);
+ cancel_delayed_work_sync(&priv->scan_event);
}
static int ipw2100_tx_allocate(struct ipw2100_priv *priv)
@@ -6195,8 +6181,7 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work);
INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check);
INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill);
- INIT_WORK(&priv->scan_event_now, ipw2100_scan_event_now);
- INIT_DELAYED_WORK(&priv->scan_event_later, ipw2100_scan_event_later);
+ INIT_DELAYED_WORK(&priv->scan_event, ipw2100_scan_event);
tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
ipw2100_irq_tasklet, (unsigned long)priv);
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.h b/drivers/net/wireless/ipw2x00/ipw2100.h
index 5fe17cb..c6d7879 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.h
+++ b/drivers/net/wireless/ipw2x00/ipw2100.h
@@ -577,8 +577,7 @@ struct ipw2100_priv {
struct delayed_work wx_event_work;
struct delayed_work hang_check;
struct delayed_work rf_kill;
- struct work_struct scan_event_now;
- struct delayed_work scan_event_later;
+ struct delayed_work scan_event;
int user_requested_scan;
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 844f201..2c2d6db 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -4480,18 +4480,11 @@ static void handle_scan_event(struct ipw_priv *priv)
{
/* Only userspace-requested scan completion events go out immediately */
if (!priv->user_requested_scan) {
- if (!delayed_work_pending(&priv->scan_event))
- schedule_delayed_work(&priv->scan_event,
- round_jiffies_relative(msecs_to_jiffies(4000)));
+ schedule_delayed_work(&priv->scan_event,
+ round_jiffies_relative(msecs_to_jiffies(4000)));
} else {
- union iwreq_data wrqu;
-
priv->user_requested_scan = 0;
- cancel_delayed_work(&priv->scan_event);
-
- wrqu.data.length = 0;
- wrqu.data.flags = 0;
- wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL);
+ mod_delayed_work(system_wq, &priv->scan_event, 0);
}
}
--
1.8.0.2
next prev parent reply other threads:[~2012-12-22 1:58 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-22 1:56 [PATCHSET] workqueue: don't use [delayed_]work_pending() Tejun Heo
2012-12-22 1:56 ` [PATCH 01/25] charger_manager: " Tejun Heo
2013-01-05 22:11 ` Anton Vorontsov
2012-12-22 1:56 ` [PATCH 02/25] ab8500_charger: " Tejun Heo
[not found] ` <CACRpkdYE3F22rnW+ZRhOWT4VGRhG2CSnb7Rj3gdCosTK8wLQmA@mail.gmail.com>
[not found] ` <50EAA53F.1000304@stericsson.com>
2013-01-07 10:48 ` Arun MURTHY
2013-01-08 14:30 ` Linus Walleij
2012-12-22 1:56 ` [PATCH 03/25] sja1000: " Tejun Heo
2012-12-22 8:01 ` David Miller
2012-12-28 21:40 ` Tejun Heo
2012-12-22 1:56 ` Tejun Heo [this message]
2013-01-27 21:02 ` [PATCH 04/25] ipw2x00: simplify scan_event handling Stanislav Yakovlev
2013-02-09 19:31 ` Tejun Heo
2012-12-22 1:56 ` [PATCH 05/25] devfreq: don't use [delayed_]work_pending() Tejun Heo
2012-12-22 1:56 ` [PATCH 06/25] libertas: " Tejun Heo
2012-12-22 1:56 ` [PATCH 07/25] mwifiex: " Tejun Heo
2012-12-22 22:29 ` Bing Zhao
2012-12-28 21:41 ` Tejun Heo
2012-12-22 1:56 ` [PATCH 08/25] thinkpad_acpi: " Tejun Heo
2012-12-22 23:55 ` Henrique de Moraes Holschuh
2012-12-28 21:41 ` Tejun Heo
2012-12-22 1:56 ` [PATCH 09/25] wl1251: " Tejun Heo
2012-12-22 14:14 ` Luciano Coelho
2012-12-28 21:42 ` Tejun Heo
2012-12-22 1:57 ` [PATCH 10/25] kprobes: fix wait_for_kprobe_optimizer() Tejun Heo
2012-12-25 3:51 ` Masami Hiramatsu
2013-01-28 19:49 ` Tejun Heo
2013-01-29 11:53 ` Masami Hiramatsu
2013-02-09 19:33 ` Tejun Heo
2012-12-22 1:57 ` [PATCH 11/25] pm: don't use [delayed_]work_pending() Tejun Heo
2012-12-22 11:53 ` Rafael J. Wysocki
2012-12-25 16:44 ` Tejun Heo
2012-12-22 1:57 ` [PATCH 12/25] bluetooth/l2cap: " Tejun Heo
2013-01-03 22:27 ` Gustavo Padovan
2012-12-22 1:57 ` [PATCH 13/25] sound/wm8350: " Tejun Heo
2012-12-24 16:11 ` Mark Brown
2012-12-22 1:57 ` [PATCH 14/25] rfkill: " Tejun Heo
2012-12-22 20:22 ` Johannes Berg
2012-12-28 21:42 ` Tejun Heo
2012-12-22 1:57 ` [PATCH 15/25] x86/mce: " Tejun Heo
2012-12-25 11:07 ` Borislav Petkov
2012-12-28 21:44 ` [PATCH v2 " Tejun Heo
2012-12-22 1:57 ` [PATCH 16/25] PM / Domains: " Tejun Heo
2012-12-22 11:57 ` Rafael J. Wysocki
2012-12-25 17:03 ` Tejun Heo
2012-12-25 20:33 ` Rafael J. Wysocki
2012-12-26 1:23 ` Tejun Heo
2012-12-22 1:57 ` [PATCH 17/25] wm97xx: " Tejun Heo
2012-12-23 9:54 ` Dmitry Torokhov
2012-12-24 16:18 ` Mark Brown
2013-03-09 23:53 ` Dmitry Torokhov
2013-03-12 18:49 ` Mark Brown
2012-12-24 18:25 ` Tejun Heo
2012-12-22 1:57 ` [PATCH 18/25] TMIO MMC: " Tejun Heo
2012-12-24 22:31 ` Guennadi Liakhovetski
2012-12-22 1:57 ` [PATCH 19/25] net/caif: " Tejun Heo
2012-12-22 1:57 ` [PATCH 20/25] wimax/i2400m: fix i2400m->wake_tx_skb handling Tejun Heo
2012-12-22 15:28 ` Perez-Gonzalez, Inaky
2013-01-04 21:19 ` Dan Williams
2013-02-09 19:35 ` Tejun Heo
2012-12-22 1:57 ` [PATCH 21/25] tty/max3100: don't use [delayed_]work_pending() Tejun Heo
2012-12-22 4:21 ` Greg Kroah-Hartman
2012-12-28 21:44 ` Tejun Heo
2012-12-22 1:57 ` [PATCH 22/25] usb/at91_udc: " Tejun Heo
2013-01-07 16:25 ` Nicolas Ferre
2012-12-22 1:57 ` [PATCH 23/25] video/exynos: " Tejun Heo
2012-12-22 3:05 ` Kukjin Kim
2012-12-26 4:04 ` Jingoo Han
2012-12-28 21:44 ` 'Tejun Heo'
2012-12-22 1:57 ` [PATCH 24/25] debugobjects: " Tejun Heo
2012-12-22 1:57 ` [PATCH 25/25] ipc: " Tejun Heo
2012-12-22 2:15 ` Andrew Morton
2012-12-22 2:22 ` Tejun Heo
2012-12-22 11:09 ` Borislav Petkov
2012-12-24 18:33 ` Tejun Heo
2012-12-24 18:45 ` Tejun Heo
2012-12-24 19:41 ` Borislav Petkov
2012-12-25 3:29 ` Tejun Heo
2012-12-25 10:46 ` Borislav Petkov
2012-12-25 16:35 ` Tejun Heo
2012-12-24 18:55 ` Borislav Petkov
2012-12-24 19:07 ` Tejun Heo
2012-12-24 19:32 ` Borislav Petkov
2012-12-25 3:18 ` Tejun Heo
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=1356141435-17340-5-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=stas.yakovlev@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