Re: [PATCH v3 2/2] gpio: add Technologic I2C-FPGA gpio support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 11, 2016 at 10:32 PM, Lucile Quirion
<lucile.quirion@xxxxxxxxxxxxxxxxxxxx> wrote:

> This driver is generic and aims to support all Technologic Systems's
> boards embedding FPGA GPIOs with an I2C interface.
>
> This driver supports TS-4900, TS-7970, TS-7990 and TS-4100 series.
>
> Signed-off-by: Lucile Quirion <lucile.quirion@xxxxxxxxxxxxxxxxxxxx>

Much smaller and nicer now :)

> +config GPIO_TS4900
> +       tristate "Technologic Systems FPGA I2C GPIO"

select REGMAP_I2C

Here.

> +#include <linux/gpio.h>

Drop that. You should not use this header in drivers.

> +static int ts4900_gpio_get_direction(struct gpio_chip *chip,
> +                                    unsigned int offset)
> +{
> +       struct ts4900_gpio_priv *priv = gpiochip_get_data(chip);
> +       unsigned int reg;
> +
> +       regmap_read(priv->regmap, offset, &reg);
> +
> +       return (reg & TS4900_GPIO_OE) ? GPIOF_DIR_OUT : GPIOF_DIR_IN;

Do not use GPIOF_DIR_OUT/GPIOF_DIR_IN. These are for the
machine descriptions, not drivers. Just return 0/1.

You can even:

return !(reg & TS4900_GPIO_OE);

I think that returns 0 on output and 1 on input.

After these fixes I will be happy I think.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux