[PATCH 19/25] net/caif: don't use [delayed_]work_pending()

From: Tejun Heo
Date: Fri Dec 21 2012 - 21:00:31 EST


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 caif. Only compile tested.

Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
---
Please let me know how this patch should be routed. I can take it
through the workqueue tree if necessary.

Thanks.

drivers/net/caif/caif_shmcore.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/net/caif/caif_shmcore.c b/drivers/net/caif/caif_shmcore.c
index bc497d7..16bd654 100644
--- a/drivers/net/caif/caif_shmcore.c
+++ b/drivers/net/caif/caif_shmcore.c
@@ -183,9 +183,7 @@ int caif_shmdrv_rx_cb(u32 mbx_msg, void *priv)
spin_unlock_irqrestore(&pshm_drv->lock, flags);

/* Schedule RX work queue. */
- if (!work_pending(&pshm_drv->shm_rx_work))
- queue_work(pshm_drv->pshm_rx_workqueue,
- &pshm_drv->shm_rx_work);
+ queue_work(pshm_drv->pshm_rx_workqueue, &pshm_drv->shm_rx_work);
}

/* Check for emptied buffers. */
@@ -246,9 +244,8 @@ int caif_shmdrv_rx_cb(u32 mbx_msg, void *priv)


/* Schedule the work queue. if required */
- if (!work_pending(&pshm_drv->shm_tx_work))
- queue_work(pshm_drv->pshm_tx_workqueue,
- &pshm_drv->shm_tx_work);
+ queue_work(pshm_drv->pshm_tx_workqueue,
+ &pshm_drv->shm_tx_work);
} else
spin_unlock_irqrestore(&pshm_drv->lock, flags);
}
@@ -374,8 +371,7 @@ static void shm_rx_work_func(struct work_struct *rx_work)
}

/* Schedule the work queue. if required */
- if (!work_pending(&pshm_drv->shm_tx_work))
- queue_work(pshm_drv->pshm_tx_workqueue, &pshm_drv->shm_tx_work);
+ queue_work(pshm_drv->pshm_tx_workqueue, &pshm_drv->shm_tx_work);

}

@@ -528,8 +524,7 @@ static int shm_netdev_tx(struct sk_buff *skb, struct net_device *shm_netdev)
skb_queue_tail(&pshm_drv->sk_qhead, skb);

/* Schedule Tx work queue. for deferred processing of skbs*/
- if (!work_pending(&pshm_drv->shm_tx_work))
- queue_work(pshm_drv->pshm_tx_workqueue, &pshm_drv->shm_tx_work);
+ queue_work(pshm_drv->pshm_tx_workqueue, &pshm_drv->shm_tx_work);

return 0;
}
--
1.8.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/