diff mbox

[14/25] rfkill: don't use [delayed_]work_pending()

Message ID 1356141435-17340-15-git-send-email-tj@kernel.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Tejun Heo Dec. 22, 2012, 1:57 a.m. UTC
There's no need to test whether a (delayed) work item in pending
before queueing, flushing or cancelling it.  Most uses are unnecessary
and quite a few of them are buggy.

Remove unnecessary pending tests from rfkill.  Only compile
tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: "John W. Linville" <linville@tuxdriver.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.

 net/rfkill/input.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Johannes Berg Dec. 22, 2012, 8:22 p.m. UTC | #1
On Fri, 2012-12-21 at 17:57 -0800, Tejun Heo wrote:
> There's no need to test whether a (delayed) work item in pending
> before queueing, flushing or cancelling it.  Most uses are unnecessary
> and quite a few of them are buggy.
> 
> Remove unnecessary pending tests from rfkill.  Only compile
> tested.

Looks fine to me, feel free to route through your tree -- nobody changes
rfkill much (famous last words...) :-)

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tejun Heo Dec. 28, 2012, 9:42 p.m. UTC | #2
On Sat, Dec 22, 2012 at 09:22:13PM +0100, Johannes Berg wrote:
> On Fri, 2012-12-21 at 17:57 -0800, Tejun Heo wrote:
> > There's no need to test whether a (delayed) work item in pending
> > before queueing, flushing or cancelling it.  Most uses are unnecessary
> > and quite a few of them are buggy.
> > 
> > Remove unnecessary pending tests from rfkill.  Only compile
> > tested.
> 
> Looks fine to me, feel free to route through your tree -- nobody changes
> rfkill much (famous last words...) :-)

Applied to wq/for-3.9-cleanups w/ your Acked-by added.  Thanks.
diff mbox

Patch

diff --git a/net/rfkill/input.c b/net/rfkill/input.c
index c9d931e..b85107b 100644
--- a/net/rfkill/input.c
+++ b/net/rfkill/input.c
@@ -148,11 +148,9 @@  static unsigned long rfkill_ratelimit(const unsigned long last)
 
 static void rfkill_schedule_ratelimited(void)
 {
-	if (delayed_work_pending(&rfkill_op_work))
-		return;
-	schedule_delayed_work(&rfkill_op_work,
-			      rfkill_ratelimit(rfkill_last_scheduled));
-	rfkill_last_scheduled = jiffies;
+	if (schedule_delayed_work(&rfkill_op_work,
+				  rfkill_ratelimit(rfkill_last_scheduled)))
+		rfkill_last_scheduled = jiffies;
 }
 
 static void rfkill_schedule_global_op(enum rfkill_sched_op op)