[PATCH 16/16] staging: ks7010: extract JIFFIES_TO_WAIT definition for common code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This commit extracts JIFFIES_TO_WAIT definition to be precalculated
by preprocessor insted of just do the same operation different times
in ks7010_rw_function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx>
---
 drivers/staging/ks7010/ks7010_sdio.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index d689599..9e98062 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -418,6 +418,8 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, uint16_t size)
 	tasklet_schedule(&priv->rx_bh_task);
 }
 
+#define JIFFIES_TO_WAIT ((30 * HZ) / 1000)
+
 static void ks7010_rw_function(struct work_struct *work)
 {
 	struct ks_wlan_private *priv;
@@ -427,19 +429,18 @@ static void ks7010_rw_function(struct work_struct *work)
 	priv = container_of(work, struct ks_wlan_private, rw_dwork.work);
 
 	/* wait after DOZE */
-	if (time_after(priv->last_doze + ((30 * HZ) / 1000), jiffies)) {
+	if (time_after(priv->last_doze + JIFFIES_TO_WAIT, jiffies)) {
 		netdev_dbg(priv->net_dev, "wait after DOZE\n");
 		queue_delayed_work(priv->wq, &priv->rw_dwork, 1);
 		return;
 	}
 
 	/* wait after WAKEUP */
-	while (time_after(priv->last_wakeup + ((30 * HZ) / 1000), jiffies)) {
+	while (time_after(priv->last_wakeup + JIFFIES_TO_WAIT, jiffies)) {
 		netdev_dbg(priv->net_dev, "wait after WAKEUP\n");
 		dev_info(&priv->ks_sdio_card->func->dev,
 			 "wake: %lu %lu\n",
-			 priv->last_wakeup + (30 * HZ) / 1000,
-				jiffies);
+			 priv->last_wakeup + JIFFIES_TO_WAIT, jiffies);
 		msleep(30);
 	}
 
-- 
2.7.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux