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]
Message-ID: <CAHp75VdOzzmN=6K4H3rVGGaqMJ+q+nXnoY=qksNT6uvHnG6CAQ@mail.gmail.com>
Date:   Tue, 13 Mar 2018 23:13:04 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Eddie James <eajames@...ux.vnet.ibm.com>
Cc:     linux-hwmon@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Jean Delvare <jdelvare@...e.com>,
        Guenter Roeck <linux@...ck-us.net>,
        Joel Stanley <joel@....id.au>,
        Christopher Bostic <cbostic@...ux.vnet.ibm.com>,
        Andrew Jeffery <andrew@...id.au>
Subject: Re: [PATCH v2 1/2] hwmon: (ucd9000) Add gpio chip interface

On Tue, Mar 13, 2018 at 10:59 PM, Eddie James
<eajames@...ux.vnet.ibm.com> wrote:
> From: Christopher Bostic <cbostic@...ux.vnet.ibm.com>
>
> Add a struct gpio_chip and define some methods so that this device's
> I/O can be accessed via /sys/class/gpio.

> +       /*
> +        * Note:
> +        *
> +        * Pinmux support has not been added to the new gpio_chip.
> +        * This support should be added when possible given the mux
> +        * behavior of these IO devices.
> +        */

> +       data->gpio.label = (const char *)&client->name;

Hmm... Why do you need this casting?

> +       data->gpio.get_direction = ucd9000_gpio_get_direction;
> +       data->gpio.direction_input = ucd9000_gpio_direction_input;
> +       data->gpio.direction_output = ucd9000_gpio_direction_output;
> +       data->gpio.get = ucd9000_gpio_get;
> +       data->gpio.set = ucd9000_gpio_set;

> +       data->gpio.can_sleep = 1;

Isn't it type of boolean?

> +       data->gpio.base = -1;

> +       data->gpio.parent = &client->dev;
> +       data->gpio.owner = THIS_MODULE;

> +       data->gpio.of_node = client->dev.of_node;

I think GPIO core does this for you.

> +       if (data->gpio.ngpio) {

Hmm...

I would rather reorganize the above part to a separate helper, like

static int ..._probe_gpio()
{
...
  switch () {
   default:
     return 0; /* GPIO part is optional */
  }
  return 0;
}

ret = _probe_gpio();
if (ret)
 dev_warn();

> +               ret = devm_gpiochip_add_data(&client->dev, &data->gpio,
> +                                            client);
> +               if (ret)
> +                       dev_warn(&client->dev, "Could not add gpiochip: %d\n",
> +                                ret);
> +       }
> +
>         return pmbus_do_probe(client, mid, info);
>  }
>
> --
> 1.8.3.1
>



-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ