gpio updates for v6.9

Serialization rework:
- use SRCU to serialize access to the global GPIO device list, to GPIO device
  structs themselves and to GPIO descriptors
- make the GPIO subsystem resilient to the GPIO providers being unbound while
  the API calls are in progress
- don't dereference the SRCU-protected chip pointer if the information we need
  can be obtained from the GPIO device structure
- move some of the information contained in struct gpio_chip to struct
  gpio_device to further reduce the need to dereference the former
- pass the GPIO device struct instead of the GPIO chip to sysfs callback to,
  again, reduce the need for accessing the latter
- get GPIO descriptors from the GPIO device, not from the chip for the same
  reason
- allow for mostly lockless operation of the GPIO driver API: assure
  consistency with SRCU and atomic operations
- remove the global GPIO spinlock
- remove the character device RW semaphore

Core GPIOLIB:
- constify pointers in GPIO API where applicable
- unify the GPIO counting APIs for ACPI and OF
- provide a macro for iterating over all GPIOs, not only the ones that are
  requested
- remove leftover typedefs
- pass the consumer device to GPIO core in devm_fwnode_gpiod_get_index() for
  improved logging
- constify the GPIO bus type
- don't warn about removing GPIO chips with descriptors still held by users as
  we can now handle this situation gracefully
- remove unused logging helpers
- unexport functions that are only used internally in the GPIO subsystem
- set the device type (assign the relevant struct device_type) for GPIO devices

New drivers:
- add the ChromeOS EC GPIO driver

Driver improvements:
- allow building gpio-vf610 with COMPILE_TEST as well as disabling it in
  menuconfig (before it was always built for i.MX cofigs)
- count the number of EICs using the device properties instead of hard-coding
  it in gpio-eic-sprd
- improve the device naming, extend the debugfs output and add lockdep asserts
  to gpio-sim

DT bindings:
- document the 'label' property for gpio-pca9570
- convert aspeed,ast2400-gpio bindings to DT schema
- disallow unevaluated properties for gpio-mvebu
- document a new model in renesas,rcar-gpio

Documentation:
- improve the character device kerneldocs in user-space headers
- add proper documentation for the character device uAPI (both v1 and v2)
- move the sysfs and gpio-mockup docs into the "obsolete" section
- improve naming consistency for GPIO terms
- clarify the line values description for sysfs
- minor docs improvements
- improve the driver API contract for setting GPIO direction
- mark unsafe APIs as deprecated in kerneldocs and suggest replacements

Other:
- remove an obsolete test from selftests
gpio: sysfs: repair export returning -EPERM on 1st attempt

It would make sense to return -EPERM if the bit was already set (already
used), not if it was cleared. Before this fix pins can only be exported on
the 2nd attempt:

$ echo 522 > /sys/class/gpio/export
sh: write error: Operation not permitted
$ echo 522 > /sys/class/gpio/export

Fixes: 35b545332b80 ("gpio: remove gpio_lock")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 file changed