aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2017-02-06 09:38:09 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-10 09:32:53 -0500
commit204a4f6d67a4d7e65571c21bd90039fdccc35b2c (patch)
tree400fe1ffabddeda3688fb46b67bbd5f86b40cbab
parent3f77b43965054c17fbc3111650c4e90f294a7bbe (diff)
misc: panel: Add lcd_home() helper
Add a helper function to move the cursor to the home position, so callers no longer need access to internal state. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/panel.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/drivers/misc/panel.c b/drivers/misc/panel.c
index ed19b3e399b0..9c7b00951c22 100644
--- a/drivers/misc/panel.c
+++ b/drivers/misc/panel.c
@@ -903,6 +903,13 @@ static void lcd_gotoxy(void)
903 (lcd.hwidth - 1) : lcd.bwidth - 1)); 903 (lcd.hwidth - 1) : lcd.bwidth - 1));
904} 904}
905 905
906static void lcd_home(void)
907{
908 lcd.addr.x = 0;
909 lcd.addr.y = 0;
910 lcd_gotoxy();
911}
912
906static void lcd_print(char c) 913static void lcd_print(char c)
907{ 914{
908 if (lcd.addr.x < lcd.bwidth) { 915 if (lcd.addr.x < lcd.bwidth) {
@@ -921,9 +928,7 @@ static void lcd_clear_fast_s(void)
921{ 928{
922 int pos; 929 int pos;
923 930
924 lcd.addr.x = 0; 931 lcd_home();
925 lcd.addr.y = 0;
926 lcd_gotoxy();
927 932
928 spin_lock_irq(&pprt_lock); 933 spin_lock_irq(&pprt_lock);
929 for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) { 934 for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) {
@@ -935,9 +940,7 @@ static void lcd_clear_fast_s(void)
935 } 940 }
936 spin_unlock_irq(&pprt_lock); 941 spin_unlock_irq(&pprt_lock);
937 942
938 lcd.addr.x = 0; 943 lcd_home();
939 lcd.addr.y = 0;
940 lcd_gotoxy();
941} 944}
942 945
943/* fills the display with spaces and resets X/Y */ 946/* fills the display with spaces and resets X/Y */
@@ -945,9 +948,7 @@ static void lcd_clear_fast_p8(void)
945{ 948{
946 int pos; 949 int pos;
947 950
948 lcd.addr.x = 0; 951 lcd_home();
949 lcd.addr.y = 0;
950 lcd_gotoxy();
951 952
952 spin_lock_irq(&pprt_lock); 953 spin_lock_irq(&pprt_lock);
953 for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) { 954 for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) {
@@ -973,9 +974,7 @@ static void lcd_clear_fast_p8(void)
973 } 974 }
974 spin_unlock_irq(&pprt_lock); 975 spin_unlock_irq(&pprt_lock);
975 976
976 lcd.addr.x = 0; 977 lcd_home();
977 lcd.addr.y = 0;
978 lcd_gotoxy();
979} 978}
980 979
981/* fills the display with spaces and resets X/Y */ 980/* fills the display with spaces and resets X/Y */
@@ -983,9 +982,7 @@ static void lcd_clear_fast_tilcd(void)
983{ 982{
984 int pos; 983 int pos;
985 984
986 lcd.addr.x = 0; 985 lcd_home();
987 lcd.addr.y = 0;
988 lcd_gotoxy();
989 986
990 spin_lock_irq(&pprt_lock); 987 spin_lock_irq(&pprt_lock);
991 for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) { 988 for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) {
@@ -996,9 +993,7 @@ static void lcd_clear_fast_tilcd(void)
996 993
997 spin_unlock_irq(&pprt_lock); 994 spin_unlock_irq(&pprt_lock);
998 995
999 lcd.addr.x = 0; 996 lcd_home();
1000 lcd.addr.y = 0;
1001 lcd_gotoxy();
1002} 997}
1003 998
1004/* clears the display and resets X/Y */ 999/* clears the display and resets X/Y */
@@ -1373,9 +1368,7 @@ static void lcd_write_char(char c)
1373 processed = 1; 1368 processed = 1;
1374 } else if (!strcmp(lcd.esc_seq.buf, "[H")) { 1369 } else if (!strcmp(lcd.esc_seq.buf, "[H")) {
1375 /* cursor to home */ 1370 /* cursor to home */
1376 lcd.addr.x = 0; 1371 lcd_home();
1377 lcd.addr.y = 0;
1378 lcd_gotoxy();
1379 processed = 1; 1372 processed = 1;
1380 } 1373 }
1381 /* codes starting with ^[[L */ 1374 /* codes starting with ^[[L */
@@ -1654,11 +1647,9 @@ static void lcd_init(void)
1654#else 1647#else
1655 panel_lcd_print("\x1b[Lc\x1b[Lb\x1b[L*Linux-" UTS_RELEASE); 1648 panel_lcd_print("\x1b[Lc\x1b[Lb\x1b[L*Linux-" UTS_RELEASE);
1656#endif 1649#endif
1657 lcd.addr.x = 0;
1658 lcd.addr.y = 0;
1659 /* clear the display on the next device opening */ 1650 /* clear the display on the next device opening */
1660 lcd.must_clear = true; 1651 lcd.must_clear = true;
1661 lcd_gotoxy(); 1652 lcd_home();
1662} 1653}
1663 1654
1664/* 1655/*