Re: [PATCH v3 3/3] gpio: add support for Cypress CYUSBS234 USB-GPIO adapter

From: Alexandre Courbot
Date: Tue Oct 07 2014 - 06:04:23 EST


On Mon, Oct 6, 2014 at 11:47 PM, Muthu Mani <muth@xxxxxxxxxxx> wrote:
> +
> +static int cy_gpio_direction_input(struct gpio_chip *chip,
> + unsigned offset)
> +{
> + return 0;
> +}
> +
> +static int cy_gpio_direction_output(struct gpio_chip *chip,
> + unsigned offset, int value)
> +{
> + return 0;
> +}

If that chip is capable of both output and input, shouldn't these
functions be implemented? I think this has already been pointed out in
a previous version but you did not reply.

> +
> +static int cyusbs23x_gpio_probe(struct platform_device *pdev)
> +{
> + struct cyusbs23x *cyusbs;
> + struct cyusbs_gpio *cy_gpio;
> + int ret = 0;
> +
> + dev_dbg(&pdev->dev, "%s\n", __func__);

> +
> + cyusbs = dev_get_drvdata(pdev->dev.parent);
> +
> + cy_gpio = devm_kzalloc(&pdev->dev, sizeof(*cy_gpio), GFP_KERNEL);
> + if (cy_gpio == NULL)
> + return -ENOMEM;
> +
> + cy_gpio->cyusbs = cyusbs;
> + /* registering gpio */
> + cy_gpio->gpio.label = dev_name(&pdev->dev);
> + cy_gpio->gpio.dev = &pdev->dev;
> + cy_gpio->gpio.owner = THIS_MODULE;
> + cy_gpio->gpio.base = -1;
> + cy_gpio->gpio.ngpio = 12; /* total GPIOs */

Isn't there a way to get the number of GPIOs from a reliable source?
If not, please at least use a macro here.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/