Re: [rtc-linux] [PATCH V3 2/3] pincntrl: add support for AMS AS3722pin control driver

From: Laxman Dewangan
Date: Tue Sep 24 2013 - 12:54:47 EST


On Tuesday 24 September 2013 06:22 PM, Linus Walleij wrote:
On Tue, Sep 24, 2013 at 1:58 PM, Laxman Dewangan <ldewangan@xxxxxxxxxx> wrote:
+static int as_pci_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+ struct as3722_pctrl_info *as_pci = to_as_pci(chip);
+
+ return as3722_irq_get_virq(as_pci->as3722, offset);
+}
+
+static int as_pci_request(struct gpio_chip *chip, unsigned offset)
+{
+ struct as3722_pctrl_info *as_pci = to_as_pci(chip);
+
+ if (as_pci->gpio_control[offset].io_function)
+ return -EBUSY;
+ return 0;
+}
Why is this not calling pinctrl_request_gpio(as_pci->chip.base + offset)
instead of just checking if we happen to be GPIO and failing if
we are not?

I would implement .free calling pinctrl_free_gpio(gpio) as well.

See e.g. pinctrl-abx500.c



Wow, cool, I saw and it is simple, the gpios callback is wrapper over the pincontrol mux APIs.

I also see opportunity to re-factor the request/free/direction_input/direction_output to move to core so that need not to implement locally, the gpio_chip's callback can use directly.

Will post once this driver is accepted.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/