gpio generic driver

Barbier, Renaud renaud.barbier at abaco.com
Thu Jul 23 15:51:15 EDT 2020


Question regarding the function below:

static int bgpio_get(struct gpio_chip *gc, unsigned int gpio)
  {
          struct bgpio_chip *bgc = to_bgpio_chip(gc);

~         return bgc->read_reg(bgc->reg_dat) & bgc->pin2mask(bgc, gpio);
  }

This returns the value from the register i.e the value as in 0x01000000 for bit 3BE or 28LE. This is what I see using the drivers/gpio/gpio-mpc8xxx.c driver.

Is it not supposed to return just 0 or 1?

Linux has

return !!(gc->read_reg(gc->reg_dat) & bgpio_line2mask(gc, gpio));



More information about the barebox mailing list