GPIO bulk updates for the v4.5 kernel cycle:

Infrastructural changes:

- In struct gpio_chip, rename the .dev node to .parent to better reflect
  the fact that this is not the GPIO struct device abstraction. We will
  add that soon so this would be totallt confusing.

- It was noted that the driver .get_value() callbacks was
  sometimes reporting negative -ERR values to the gpiolib core, expecting
  them to be propagated to consumer gpiod_get_value() and gpio_get_value()
  calls. This was not happening, so as there was a mess of drivers
  returning negative errors and some returning "anything else than zero"
  to indicate that a line was active. As some would have bit 31 set to
  indicate "line active" it clashed with negative error codes. This is
  fixed by the largeish series clamping values in all drivers with
  !!value to [0,1] and then augmenting the code to propagate error codes
  to consumers. (Includes some ACKed patches in other subsystems.)

- Add a void *data pointer to struct gpio_chip. The container_of() design
  pattern is indeed very nice, but we want to reform the struct gpio_chip
  to be a non-volative, stateless business, and keep states internal to
  the gpiolib to be able to hold on to the state when adding a proper
  userspace ABI (character device) further down the road. To achieve this,
  drivers need a handle at the internal state that is not dependent on
  their struct gpio_chip() so we add gpiochip_add_data() and
  gpiochip_get_data() following the pattern of many other subsystems.
  All the "use gpiochip data pointer" patches transforms drivers to this

- The Generic GPIO chip header has been merged into the general
  <linux/gpio/driver.h> header, and the custom header for that removed.
  Instead of having a separate mm_gpio_chip struct for these generic
  drivers, merge that into struct gpio_chip, simplifying the code and
  removing the need for separate and confusing includes.

Misc improvements:

- Stabilize the way GPIOs are looked up from the ACPI legacy

- Incremental driver features for PXA, PCA953X, Lantiq (patches from the
  OpenWRT community), RCAR, Zynq, PL061, 104-idi-48

New drivers:

- Add a GPIO chip to the ALSA SoC AC97 driver.

- Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir, but
  the branch is merged here too to account for infrastructural changes).

- The sx150x driver now supports the sx1502.
Version: GnuPG v1

gpio: generic: make bgpio_pdata always visible

Board files that define their own bgpio_pdata are broken when
CONFIG_GPIO_GENERIC is disabled and the bgpio_pdata structure
definition is hidden by the #ifdef:

arch/arm/mach-clps711x/board-autcpu12.c:148:15: error: variable 'autcpu12_mmgpio_pdata' has initializer but incomplete type
 static struct bgpio_pdata autcpu12_mmgpio_pdata __initdata = {
arch/arm/mach-clps711x/board-autcpu12.c:149:2: error: unknown field 'base' specified in initializer

Since the board files should generally not care what drivers are
enabled, this makes the structure definition visible again.

Signed-off-by: Arnd Bergmann <>
Fixes: 0f4630f3720e ("gpio: generic: factor into gpio_chip struct")
Signed-off-by: Linus Walleij <>
1 file changed