lkml.org 
[lkml]   [2014]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC Patch] gpio: add GPIO hogging mechanism
On Thu, Oct 30, 2014 at 1:21 AM, Benoit Parrot <bparrot@ti.com> wrote:
>> > +
>> > if (status)
>> > goto fail;
>> >
>> > @@ -1742,6 +1757,72 @@ struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev,
>> > EXPORT_SYMBOL_GPL(__gpiod_get_index_optional);
>> >
>> > /**
>> > + * gpiod_get_hog_index - obtain a GPIO from a multi-index GPIO hog
>> > + * @dev: GPIO consumer
>> > + * @idx: index of the GPIO to obtain
>> > + *
>> > + * This should only be used by the gpiochip_add to request/set GPIO initial
>> > + * configuration.
>> > + *
>> > + * Return a valid GPIO descriptor, or an IS_ERR() condition in case of error.
>> > + */
>> > +struct gpio_desc *__must_check gpiod_get_hog_index(struct device *dev,
>> > + unsigned int idx)
>> > +{
>> > + struct gpio_desc *desc = NULL;
>> > + int err;
>> > + unsigned long flags;
>> > + const char *name;
>> > +
>> > + /* Using device tree? */
>> > + if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node)
>> > + desc = of_get_gpio_hog(dev->of_node, idx, &name, &flags);
>> > +
>> > + if (!desc)
>> > + return ERR_PTR(-ENOTSUPP);
>> > + else if (IS_ERR(desc))
>> > + return desc;
>> > +
>> > + dev_dbg(dev, "gpio-hog: GPIO:%d (%s) as %s%s\n",
>> > + desc_to_gpio(desc), name, (flags&GPIOF_DIR_IN)?"input":"output",
>> > + (flags&GPIOF_DIR_IN)?"":(flags&GPIOF_INIT_HIGH)?"/high":"/low");
>> > +
>>
>> ...
>
> I guess this means to remove the dev_dbg code?

No, it was just to delimitate the code which I suggested to factorize
into its own function below. :) This dev_dbg is fine IMHO.


\
 
 \ /
  Last update: 2014-10-30 01:41    [W:0.088 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site