Hi Janusz,
On Sun, Sep 2, 2018 at 2:01 PM Janusz Krzysztofik <[email protected]> wrote:
> Most users of get/set array functions iterate consecutive bits of data,
> usually a single integer, while processing array of results obtained
> from, or building an array of values to be passed to those functions.
> Save time wasted on those iterations by changing the functions' API to
> accept bitmaps.
>
> All current users are updated as well.
>
> More benefits from the change are expected as soon as planned support
> for accepting/passing those bitmaps directly from/to respective GPIO
> chip callbacks if applicable is implemented.
>
> Cc: Jonathan Corbet <[email protected]>
> Cc: Miguel Ojeda Sandonis <[email protected]>
> Cc: Geert Uytterhoeven <[email protected]>
> Cc: Sebastien Bourdelin <[email protected]>
> Cc: Lukas Wunner <[email protected]>
> Cc: Peter Korsgaard <[email protected]>
> Cc: Peter Rosin <[email protected]>
> Cc: Andrew Lunn <[email protected]>
> Cc: Florian Fainelli <[email protected]>
> Cc: "David S. Miller" <[email protected]>
> Cc: Rojhalat Ibrahim <[email protected]>
> Cc: Dominik Brodowski <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Kishon Vijay Abraham I <[email protected]>
> Cc: Tony Lindgren <[email protected]>
> Cc: Lars-Peter Clausen <[email protected]>
> Cc: Michael Hennerich <[email protected]>
> Cc: Jonathan Cameron <[email protected]>
> Cc: Hartmut Knaack <[email protected]>
> Cc: Peter Meerwald-Stadler <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Jiri Slaby <[email protected]>
> Cc: Yegor Yefremov <[email protected]>
> Cc: Uwe Kleine-König <[email protected]>
> Signed-off-by: Janusz Krzysztofik <[email protected]>
> Acked-by: Ulf Hansson <[email protected]>
> --- a/drivers/auxdisplay/hd44780.c
> +++ b/drivers/auxdisplay/hd44780.c
> @@ -62,17 +62,12 @@ static void hd44780_strobe_gpio(struct hd44780 *hd)
> /* write to an LCD panel register in 8 bit GPIO mode */
> static void hd44780_write_gpio8(struct hd44780 *hd, u8 val, unsigned int rs)
> {
> - int values[10]; /* for DATA[0-7], RS, RW */
> - unsigned int i, n;
> -
> - for (i = 0; i < 8; i++)
> - values[PIN_DATA0 + i] = !!(val & BIT(i));
> - values[PIN_CTRL_RS] = rs;
> - n = 9;
> - if (hd->pins[PIN_CTRL_RW]) {
> - values[PIN_CTRL_RW] = 0;
> - n++;
> - }
> + DECLARE_BITMAP(values, 10); /* for DATA[0-7], RS, RW */
> + unsigned int n;
> +
> + *values = val;
Given DECLARE_BITMAP() creates an array, the above line looks a bit funny now.
IMHO, either you use
unsigned long values;
values = val;
__assign_bit(8, &values, rs);
or
DECLARE_BITMAP(values, 10);
values[0] = val;
__assign_bit(8, values, rs);
Nevertheless, for hd44780.c:
Reviewed-by: Geert Uytterhoeven <[email protected]>
Tested-by: Geert Uytterhoeven <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel