Re: [PATCH v2 12/15] auxdisplay: ht16k33: Switch to use line display character mapping

From: Geert Uytterhoeven
Date: Thu Feb 15 2024 - 05:59:03 EST


Hi Andy,

On Mon, Feb 12, 2024 at 6:04 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> Since line display library supports necessary bits to map the characters
> (if required), switch this driver to use that.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

Minor nits below.

> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -445,18 +413,20 @@ static void ht16k33_seg7_update(struct work_struct *work)
> struct ht16k33_priv *priv = container_of(work, struct ht16k33_priv,
> work.work);
> struct ht16k33_seg *seg = &priv->seg;
> + struct linedisp *linedisp = &seg->linedisp;
> + struct linedisp_map *map = linedisp->map;

struct linedisp_map *map = seg.linedisp->map;

as linedisp is not used below.

> char *s = seg->curr;
> uint8_t buf[9];
>
> - buf[0] = map_to_seg7(&seg->map.seg7, *s++);
> + buf[0] = map_to_seg7(&map->map.seg7, *s++);
> buf[1] = 0;
> - buf[2] = map_to_seg7(&seg->map.seg7, *s++);
> + buf[2] = map_to_seg7(&map->map.seg7, *s++);
> buf[3] = 0;
> buf[4] = 0;
> buf[5] = 0;
> - buf[6] = map_to_seg7(&seg->map.seg7, *s++);
> + buf[6] = map_to_seg7(&map->map.seg7, *s++);
> buf[7] = 0;
> - buf[8] = map_to_seg7(&seg->map.seg7, *s++);
> + buf[8] = map_to_seg7(&map->map.seg7, *s++);
>
> i2c_smbus_write_i2c_block_data(priv->client, 0, ARRAY_SIZE(buf), buf);
> }
> @@ -466,17 +436,39 @@ static void ht16k33_seg14_update(struct work_struct *work)
> struct ht16k33_priv *priv = container_of(work, struct ht16k33_priv,
> work.work);
> struct ht16k33_seg *seg = &priv->seg;
> + struct linedisp *linedisp = &seg->linedisp;
> + struct linedisp_map *map = linedisp->map;

Likewise.

> char *s = seg->curr;
> uint8_t buf[8];
>
> - put_unaligned_le16(map_to_seg14(&seg->map.seg14, *s++), buf);
> - put_unaligned_le16(map_to_seg14(&seg->map.seg14, *s++), buf + 2);
> - put_unaligned_le16(map_to_seg14(&seg->map.seg14, *s++), buf + 4);
> - put_unaligned_le16(map_to_seg14(&seg->map.seg14, *s++), buf + 6);
> + put_unaligned_le16(map_to_seg14(&map->map.seg14, *s++), buf + 0);
> + put_unaligned_le16(map_to_seg14(&map->map.seg14, *s++), buf + 2);
> + put_unaligned_le16(map_to_seg14(&map->map.seg14, *s++), buf + 4);
> + put_unaligned_le16(map_to_seg14(&map->map.seg14, *s++), buf + 6);
>
> i2c_smbus_write_i2c_block_data(priv->client, 0, ARRAY_SIZE(buf), buf);
> }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68korg

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds