Skip to content

Commit c2be1a1

Browse files
committed
fbdev: andes: ftlcdc100: change OSD_putc if...else to switch
It is suggested in the Gitea code review: https://gitea.andestech.com/RD-SW/linux/pulls/17#issuecomment-73873 Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
1 parent 85803cf commit c2be1a1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/video/fbdev/ftlcdc100/pingpong-module.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -403,20 +403,27 @@ void OSD_Scal(struct faradayfb_info *fbi, int HScal, int VScal)
403403

404404
void OSD_putc(struct faradayfb_info *fbi, char c, int position, unsigned int value)
405405
{
406-
if (c >= '0' && c <= '9')
406+
switch (c) {
407+
case '0' ... '9':
407408
REG32(fbi->io_base + 0xc000 + position * 4) = ((c - '0') << 4) | value;
409+
break;
408410

409-
else if (c >= 'A' && c <= 'Z')
411+
case 'A' ... 'Z':
410412
REG32(fbi->io_base + 0xc000 + position * 4) = ((c - 'A' + 10) << 4) | value;
413+
break;
411414

412-
if (c == ' ')
415+
case ' ':
413416
REG32(fbi->io_base + 0xc000 + position * 4) = (('Z' - 'A' + 10 + 1) << 4) | value;
417+
break;
414418

415-
if (c == '=')
419+
case '=':
416420
REG32(fbi->io_base + 0xc000 + position * 4) = (('Z' - 'A' + 10 + 2) << 4) | value;
421+
break;
417422

418-
if (c == ',')
423+
case ',':
419424
REG32(fbi->io_base + 0xc000 + position * 4) = (('Z' - 'A' + 10 + 3) << 4) | value;
425+
break;
426+
}
420427
}
421428

422429
void OSD_puts(struct faradayfb_info *fbi, char *str, int position, unsigned int value)

0 commit comments

Comments
 (0)