lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 8 Oct 2014 07:09:06 +0000
From:	Muthu Mani <muth@...ress.com>
To:	Alexandre Courbot <gnurou@...il.com>
CC:	Samuel Ortiz <sameo@...ux.intel.com>,
	Lee Jones <lee.jones@...aro.org>,
	Wolfram Sang <wsa@...-dreams.de>,
	Linus Walleij <linus.walleij@...aro.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Rajaram Regupathy <rera@...ress.com>,
	"Johan Hovold" <johan@...nel.org>
Subject: RE: [PATCH v3 3/3] gpio: add support for Cypress CYUSBS234 USB-GPIO
 adapter

> -----Original Message-----
> From: Alexandre Courbot [mailto:gnurou@...il.com]
> Sent: Tuesday, October 07, 2014 3:34 PM
> To: Muthu Mani
> Cc: Samuel Ortiz; Lee Jones; Wolfram Sang; Linus Walleij; Greg Kroah-
> Hartman; linux-i2c@...r.kernel.org; linux-gpio@...r.kernel.org; linux-
> usb@...r.kernel.org; Linux Kernel Mailing List; Rajaram Regupathy; Johan
> Hovold
> Subject: Re: [PATCH v3 3/3] gpio: add support for Cypress CYUSBS234 USB-
> GPIO adapter
> 
> On Mon, Oct 6, 2014 at 11:47 PM, Muthu Mani <muth@...ress.com> 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.

Thanks for your inputs.

Only the GPIOs which are configured to be output GPIO can be set.
The set operation would fail trying to set the input or unconfigured GPIOs.
In this version of driver, this support is not added, it can be introduced in future versions.
I will add a TODO note in the code.

> 
> > +
> > +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.

CYUSBS234 has 12 GPIOs in total as per the datasheet. I will add a macro and use it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ