Skip to content

Commit

Permalink
Merge tag 'auxdisplay-for-linus-v5.9-rc1' of git://github.com/ojeda/l…
Browse files Browse the repository at this point in the history
…inux

Pull auxdisplay update from Miguel Ojeda:
 "Minor cleanup for auxdisplay: rReuse hex_to_bin() instead of custom
  code (Andy Shevchenko)"

* tag 'auxdisplay-for-linus-v5.9-rc1' of git://github.com/ojeda/linux:
  auxdisplay: charlcd: Reuse hex_to_bin() instead of custom code
  • Loading branch information
Linus Torvalds committed Aug 7, 2020
2 parents dfdf16e + 3f03b64 commit ed35832
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions drivers/auxdisplay/charlcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,24 +485,19 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
shift = 0;
value = 0;
while (*esc && cgoffset < 8) {
int half;

shift ^= 4;
if (*esc >= '0' && *esc <= '9') {
value |= (*esc - '0') << shift;
} else if (*esc >= 'A' && *esc <= 'F') {
value |= (*esc - 'A' + 10) << shift;
} else if (*esc >= 'a' && *esc <= 'f') {
value |= (*esc - 'a' + 10) << shift;
} else {
esc++;

half = hex_to_bin(*esc++);
if (half < 0)
continue;
}

value |= half << shift;
if (shift == 0) {
cgbytes[cgoffset++] = value;
value = 0;
}

esc++;
}

lcd->ops->write_cmd(lcd, LCD_CMD_SET_CGRAM_ADDR | (cgaddr * 8));
Expand Down

0 comments on commit ed35832

Please sign in to comment.