Re: [PATCH 2/5] gpio: pca953x: code shrink

From: Geert Uytterhoeven
Date: Mon Sep 05 2016 - 10:40:38 EST


On Mon, Sep 5, 2016 at 4:31 PM, Bartosz Golaszewski
<bgolaszewski@xxxxxxxxxxxx> wrote:
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -94,6 +94,24 @@ MODULE_DEVICE_TABLE(acpi, pca953x_acpi_ids);
>
> #define NBANK(chip) DIV_ROUND_UP(chip->gpio_chip.ngpio, BANK_SZ)
>
> +struct pca953x_offset {
> + int direction;
> + int output;
> + int input;
> +};
> +
> +static struct pca953x_offset pca953x_offsets = {

const

> + .direction = PCA953X_DIRECTION,
> + .output = PCA953X_OUTPUT,
> + .input = PCA953X_INPUT,
> +};
> +
> +static struct pca953x_offset pca957x_offsets = {

const

> + .direction = PCA957X_CFG,
> + .output = PCA957X_OUT,
> + .input = PCA957X_IN,
> +};
> +
> struct pca953x_chip {
> unsigned gpio_start;
> u8 reg_output[MAX_BANK];
> @@ -113,6 +131,8 @@ struct pca953x_chip {
> const char *const *names;
> int chip_type;
> unsigned long driver_data;
> +
> + struct pca953x_offset *offset;

const

> };

Gr{oetje,eeting}s,

Geert

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

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