Re: [PATCH RFT] gpio: zevio: Get correct gpio output value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> > @@ -81,9 +81,15 @@ static inline void zevio_gpio_port_set(struct zevio_gpio *c, unsigned pin,
>> >  static int zevio_gpio_get(struct gpio_chip *chip, unsigned pin)
>> >  {
>> >     struct zevio_gpio *controller = to_zevio_gpio(chip);
>> > +   u32 val, dir;
>> >
>> > -   /* Only reading allowed, so no spinlock needed */
>> > -   u32 val = zevio_gpio_port_get(controller, pin, ZEVIO_GPIO_INPUT);
>> > +   spin_lock(&controller->lock);
>> > +   dir = zevio_gpio_port_get(controller, pin, ZEVIO_GPIO_DIRECTION);
>> > +   if (dir | BIT(ZEVIO_GPIO_BIT(pin)))
>> > +           val = zevio_gpio_port_get(controller, pin, ZEVIO_GPIO_INPUT);
>> > +   else
>> > +           val = zevio_gpio_port_get(controller, pin, ZEVIO_GPIO_OUTPUT);
>> > +   spin_unlock(&controller->lock);
>
> As a side effect of your making me look at the code:
>
> Is the if() not an "always true" condition?  Should this be
> s/|/\&/ instead?
You are right, I'm sending a v2 now.

Thanks for the review,
Axel
--
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




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux