[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAVeFu+ZMdMH4YQxUrzRaCRndxff_REOZHi3jVHyOTKGUMqTEQ@mail.gmail.com>
Date: Thu, 30 Oct 2014 09:29:03 +0900
From: Alexandre Courbot <gnurou@...il.com>
To: Benoit Parrot <bparrot@...com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
Pantelis Antoniou <panto@...oniou-consulting.com>,
Jiri Prchal <jiri.prchal@...ignal.cz>
Subject: Re: [RFC Patch] gpio: add GPIO hogging mechanism
On Thu, Oct 30, 2014 at 1:21 AM, Benoit Parrot <bparrot@...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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists