Re: [PATCH 3/4] Staging: panel: usleep_range is preferred over udelay

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

 



Hello.

On 10/26/2015 11:44 PM, Swetha wrote:

This patch fixes the issue:

CHECK: usleep_range is preferred over udelay; see
Documentation/timers/timers-howto.txt

Signed-off-by: Swetha <theonly.ultimate@xxxxxxxxx>

   Full (and true) name needed here.

---
  drivers/staging/panel/panel.c | 34 +++++++++++++++++++---------------
  1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 11a50f6..66ad4d0 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -825,7 +825,8 @@ static void lcd_write_cmd_s(int cmd)
  	lcd_send_serial(0x1F);	/* R/W=W, RS=0 */
  	lcd_send_serial(cmd & 0x0F);
  	lcd_send_serial((cmd >> 4) & 0x0F);
-	udelay(40);		/* the shortest command takes at least 40 us */
+	/* the shortest command takes at least 40 us */
+	usleep_range(40, 100);
  	spin_unlock_irq(&pprt_lock);

   You can't sleep in the atomic context, you're holding a spinlock.

  }

@@ -836,7 +837,8 @@ static void lcd_write_data_s(int data)
  	lcd_send_serial(0x5F);	/* R/W=W, RS=1 */
  	lcd_send_serial(data & 0x0F);
  	lcd_send_serial((data >> 4) & 0x0F);
-	udelay(40);		/* the shortest data takes at least 40 us */
+	/* the shortest data takes at least 40 us */
+	usleep_range(40, 100);
  	spin_unlock_irq(&pprt_lock);

   Likewise.

  }

@@ -846,19 +848,20 @@ static void lcd_write_cmd_p8(int cmd)
  	spin_lock_irq(&pprt_lock);
  	/* present the data to the data port */
  	w_dtr(pprt, cmd);
-	udelay(20);	/* maintain the data during 20 us before the strobe */
+	/* maintain the data during 20 us before the strobe */
+	usleep_range(20, 100);

  	bits.e = BIT_SET;
  	bits.rs = BIT_CLR;
  	bits.rw = BIT_CLR;
  	set_ctrl_bits();

-	udelay(40);	/* maintain the strobe during 40 us */
+	usleep_range(40, 100);	/* maintain the strobe during 40 us */

  	bits.e = BIT_CLR;
  	set_ctrl_bits();

-	udelay(120);	/* the shortest command takes at least 120 us */
+	usleep_range(120, 500);	/* the shortest command takes at least 120 us */

   Likewise.

  	spin_unlock_irq(&pprt_lock);
  }

@@ -868,19 +871,20 @@ static void lcd_write_data_p8(int data)
  	spin_lock_irq(&pprt_lock);
  	/* present the data to the data port */
  	w_dtr(pprt, data);
-	udelay(20);	/* maintain the data during 20 us before the strobe */
+	/* maintain the data during 20 us before the strobe */
+	usleep_range(20, 100);

  	bits.e = BIT_SET;
  	bits.rs = BIT_SET;
  	bits.rw = BIT_CLR;
  	set_ctrl_bits();

-	udelay(40);	/* maintain the strobe during 40 us */
+	usleep_range(40, 100);	/* maintain the strobe during 40 us */

  	bits.e = BIT_CLR;
  	set_ctrl_bits();

-	udelay(45);	/* the shortest data takes at least 45 us */
+	usleep_range(45, 100);	/* the shortest data takes at least 45 us */
  	spin_unlock_irq(&pprt_lock);

   Likewise.

  }

@@ -890,7 +894,7 @@ static void lcd_write_cmd_tilcd(int cmd)
  	spin_lock_irq(&pprt_lock);
  	/* present the data to the control port */
  	w_ctr(pprt, cmd);
-	udelay(60);
+	usleep_range(60, 120);
  	spin_unlock_irq(&pprt_lock);
  }

@@ -900,7 +904,7 @@ static void lcd_write_data_tilcd(int data)
  	spin_lock_irq(&pprt_lock);
  	/* present the data to the data port */
  	w_dtr(pprt, data);
-	udelay(60);
+	usleep_range(60, 120);
  	spin_unlock_irq(&pprt_lock);
  }

@@ -943,7 +947,7 @@ static void lcd_clear_fast_s(void)
  		lcd_send_serial(0x5F);	/* R/W=W, RS=1 */
  		lcd_send_serial(' ' & 0x0F);
  		lcd_send_serial((' ' >> 4) & 0x0F);
-		udelay(40);	/* the shortest data takes at least 40 us */
+		usleep_range(40, 100);	/* the shortest data takes at least 40 us */
  	}
  	spin_unlock_irq(&pprt_lock);


   Likewise.

@@ -967,7 +971,7 @@ static void lcd_clear_fast_p8(void)
  		w_dtr(pprt, ' ');

  		/* maintain the data during 20 us before the strobe */
-		udelay(20);
+		usleep_range(20, 100);

  		bits.e = BIT_SET;
  		bits.rs = BIT_SET;
@@ -975,13 +979,13 @@ static void lcd_clear_fast_p8(void)
  		set_ctrl_bits();

  		/* maintain the strobe during 40 us */
-		udelay(40);
+		usleep_range(40, 100);

  		bits.e = BIT_CLR;
  		set_ctrl_bits();

  		/* the shortest data takes at least 45 us */
-		udelay(45);
+		usleep_range(45, 100);
  	}
  	spin_unlock_irq(&pprt_lock);


   Likeise.

@@ -1003,7 +1007,7 @@ static void lcd_clear_fast_tilcd(void)
  	for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) {
  		/* present the data to the data port */
  		w_dtr(pprt, ' ');
-		udelay(60);
+		usleep_range(60, 120);
  	}

  	spin_unlock_irq(&pprt_lock);

   Likewise.

MBR, Sergei

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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux