mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eddie James <eajames@linux.vnet.ibm.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-hwmon@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jean Delvare <jdelvare@suse.com>, Joel Stanley <joel@jms.id.au>,
	Christopher Bostic <cbostic@linux.vnet.ibm.com>,
	Andrew Jeffery <andrew@aj.id.au>
Subject: Re: [PATCH v2 1/2] hwmon: (ucd9000) Add gpio chip interface
Date: Wed, 14 Mar 2018 14:01:34 -0500	[thread overview]
Message-ID: <2e301c07-8880-0821-0549-9c52f5fb35f5@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180314185542.GA23989@roeck-us.net>



On 03/14/2018 01:55 PM, Guenter Roeck wrote:
> On Tue, Mar 13, 2018 at 11:13:04PM +0200, Andy Shevchenko wrote:
>> On Tue, Mar 13, 2018 at 10:59 PM, Eddie James
>> <eajames@linux.vnet.ibm.com> wrote:
>>> From: Christopher Bostic <cbostic@linux.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?
>>
> You are right.
>
>>> +       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.
>>
> Same here. I checked and found that it also sets the owner, so maybe this can be
> dropped as well.

Ah true. Especially since there is a TODO: remove chip->owner in the core.

>
>>> +       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();
>>
> I am neutral to positiva on that.
> Might as well add the call to devm_gpiochip_add_data()
> into that function as well.

Sure. I can do a v4.

Thanks,
Eddie

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

  reply	other threads:[~2018-03-14 19:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 20:59 [PATCH v2 0/2] hwmon: (ucd9000) Add gpio and debugfs interfaces Eddie James
2018-03-13 20:59 ` [PATCH v2 1/2] hwmon: (ucd9000) Add gpio chip interface Eddie James
2018-03-13 21:13   ` Andy Shevchenko
2018-03-14 18:55     ` Guenter Roeck
2018-03-14 19:01       ` Eddie James [this message]
2018-03-16  5:26   ` kbuild test robot
2018-03-16  6:01   ` kbuild test robot
2018-03-13 20:59 ` [PATCH v2 2/2] hwmon: (ucd9000) Add debugfs attributes to provide mfr_status Eddie James
2018-03-14 19:19   ` Guenter Roeck
2018-03-14 19:46     ` Eddie James
2018-03-14 21:16       ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e301c07-8880-0821-0549-9c52f5fb35f5@linux.vnet.ibm.com \
    --to=eajames@linux.vnet.ibm.com \
    --cc=andrew@aj.id.au \
    --cc=andy.shevchenko@gmail.com \
    --cc=cbostic@linux.vnet.ibm.com \
    --cc=jdelvare@suse.com \
    --cc=joel@jms.id.au \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®