On Thu, Apr 24, 2014 at 8:57 AM, <yegorslists@xxxxxxxxxxxxxx> wrote: > From: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx> > > This patch implements gpio_chip's get_direction() routine, that > lets other drivers get particular GPIOs direction using > struct gpio_desc. > > Signed-off-by: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx> > Acked-by: Javier Martinez Canillas <javier@xxxxxxxxxxxx> > --- > Changes: > v3: get rid of _get_gpio_direction() (Linus Walleij) > v2: rework return value calculation Looks good to me, Kevin, Santosh? Part of me wants to list Javier as maintainer for this driver. > +static int gpio_get_direction(struct gpio_chip *chip, unsigned offset) > +{ > + struct gpio_bank *bank; > + unsigned long flags; > + void __iomem *reg; > + int dir; That is a bool, actually. But no big deal. > + > + bank = container_of(chip, struct gpio_bank, chip); > + reg = bank->base + bank->regs->direction; > + spin_lock_irqsave(&bank->lock, flags); > + dir = !!(readl_relaxed(reg) & BIT(offset)); > + spin_unlock_irqrestore(&bank->lock, flags); > + return dir; > +} Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html