Skip to content

Commit ebd4351

Browse files
Swetha5gregkh
authored andcommitted
Staging: panel: usleep_range is preferred over udelay
This patch fixes the issue: CHECK: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt Signed-off-by: Sirnam Swetha <theonly.ultimate@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 46f566e commit ebd4351

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

drivers/staging/panel/panel.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,8 @@ static void lcd_write_cmd_s(int cmd)
825825
lcd_send_serial(0x1F); /* R/W=W, RS=0 */
826826
lcd_send_serial(cmd & 0x0F);
827827
lcd_send_serial((cmd >> 4) & 0x0F);
828-
udelay(40); /* the shortest command takes at least 40 us */
828+
/* the shortest command takes at least 40 us */
829+
usleep_range(40, 100);
829830
spin_unlock_irq(&pprt_lock);
830831
}
831832

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

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

851854
bits.e = BIT_SET;
852855
bits.rs = BIT_CLR;
853856
bits.rw = BIT_CLR;
854857
set_ctrl_bits();
855858

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

858861
bits.e = BIT_CLR;
859862
set_ctrl_bits();
860863

861-
udelay(120); /* the shortest command takes at least 120 us */
864+
usleep_range(120, 500); /* the shortest command takes at least 120 us */
862865
spin_unlock_irq(&pprt_lock);
863866
}
864867

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

873877
bits.e = BIT_SET;
874878
bits.rs = BIT_SET;
875879
bits.rw = BIT_CLR;
876880
set_ctrl_bits();
877881

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

880884
bits.e = BIT_CLR;
881885
set_ctrl_bits();
882886

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

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

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

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

@@ -967,21 +971,21 @@ static void lcd_clear_fast_p8(void)
967971
w_dtr(pprt, ' ');
968972

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

972976
bits.e = BIT_SET;
973977
bits.rs = BIT_SET;
974978
bits.rw = BIT_CLR;
975979
set_ctrl_bits();
976980

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

980984
bits.e = BIT_CLR;
981985
set_ctrl_bits();
982986

983987
/* the shortest data takes at least 45 us */
984-
udelay(45);
988+
usleep_range(45, 100);
985989
}
986990
spin_unlock_irq(&pprt_lock);
987991

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

10091013
spin_unlock_irq(&pprt_lock);

0 commit comments

Comments
 (0)