From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> Linus, Here's the pull-request with updates for the next release from the GPIO subsystem. We have a new GPIO multiplexer driver, bunch of driver updates and refactoring in the core GPIO library. Details are in the signed tag. There are two merges, one is the regular one from Andy with ACPI changes, the second pulls in the code from i2c that introduces the i2c_client_get_device_id() helper used in commits converting i2c driver to using .probe_new(). I've also included the uAPI fixes for the user-space induced NULL-pointer dereferences with the changes you requested (don't use semaphore trylocks). Please pull, Bartosz Golaszewski The following changes since commit 9abf2313adc1ca1b6180c508c25f22f9395cc780: Linux 6.1-rc1 (2022-10-16 15:36:24 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git tags/gpio-updates-for-v6.2 for you to fetch changes up to 11e47bbd700f31bd1ee9f8863381bc9e741c0e97: gpio: sim: set a limit on the number of GPIOs (2022-12-14 09:53:20 +0100) ---------------------------------------------------------------- gpio: updates for v6.2 GPIO core: - teach gpiolib to work with software nodes for HW description - remove ARCH_NR_GPIOS treewide as we no longer impose any limit on the number of GPIOS since the allocation became entirely dynamic - add support for HW quirks for Cirrus CS42L56 codec, Marvell NFC controller, Freescale PCIe and Ethernet controller, Himax LCDs and Mediatek mt2701 - refactor OF quirk code - some general refactoring of the OF and ACPI code, adding new helpers, minor tweaks and fixes, making fwnode usage consistent etc. GPIO uAPI: - fix an issue where the user-space can trigger a NULL-pointer dereference in the kernel by opening a device file, forcing a driver unbind and then calling one of the syscalls on the associated file descriptor New drivers: - add gpio-latch: a new GPIO multiplexer based on latches connected to other GPIOs Driver updates: - convert i2c GPIO expanders to using .probe_new() - drop the gpio-sta2x11 driver - factor out common code for the ACCES IDIO-16 family of controllers and use this new library wherever applicable in drivers - add DT support to gpio-hisi - allow building gpio-davinci as a module and increase its maxItems property - add support for a new model to gpio-pca9570 - other minor changes to various drivers ---------------------------------------------------------------- Aidan MacDonald (1): gpio: sl28cpld: Replace irqchip mask_invert with unmask_base Andy Shevchenko (11): gpio: merrifield: Use str_enable_disable() helper gpiolib: cdev: Fix typo in kernel doc for struct line gpio: exar: Allow IO port access gpiolib: of: Make use of device_match_of_node() gpio: Add Generic regmap GPIO conversion to the TODO list gpiolib: of: Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode gpiolib: of: Integrate of_gpiochip_init_valid_mask() into gpiochip_init_valid_mask() gpiolib: of: Prepare of_mm_gpiochip_add_data() for fwnode gpiolib: of: Drop redundant check in of_mm_gpiochip_remove() gpiolib: Unify access to the device properties gpiolib: Provide to_gpio_device() helper Angel Iglesias (1): i2c: core: Introduce i2c_client_get_device_id helper function Bartosz Golaszewski (5): Merge tag 'intel-gpio-v6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel into gpio/for-next Merge branch 'i2c/client_device_id_helper-immutable' of https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into gpio/for-next gpiolib: cdev: fix NULL-pointer dereferences gpiolib: protect the GPIO device against being dropped while in use by user-space gpio: sim: set a limit on the number of GPIOs Brian Masney (1): gpiolib: ensure that fwnode is properly set Christophe JAILLET (1): gpio: Do not include <linux/kernel.h> when not really needed. Christophe Leroy (8): gpio: aggregator: Stop using ARCH_NR_GPIOS gpio: davinci: Stop using ARCH_NR_GPIOS gpiolib: Warn on drivers still using static gpiobase allocation gpiolib: Get rid of ARCH_NR_GPIOS Documentation: gpio: Remove text about ARCH_NR_GPIOS x86: Remove CONFIG_ARCH_NR_GPIO arm: Remove CONFIG_ARCH_NR_GPIO arm64: Remove CONFIG_ARCH_NR_GPIO Davide Ciminaghi (1): gpio: Remove sta2x11 GPIO driver Dmitry Torokhov (21): gpiolib: of: add a quirk for legacy names in Mediatek mt2701-cs42448 gpiolib: of: consolidate simple renames into a single quirk gpiolib: of: tighten selection of gpio renaming quirks gpiolib: of: add quirk for locating reset lines with legacy bindings gpiolib: of: add a quirk for reset line for Marvell NFC controller gpiolib: of: add a quirk for reset line for Cirrus CS42L56 codec gpiolib: of: add a quirk for legacy names in MOXA ART RTC gpiolib: of: factor out code overriding gpio line polarity gpiolib: of: add quirk for phy reset polarity for Freescale Ethernet gpiolib: of: add a quirk for reset line polarity for Himax LCDs gpiolib: of: factor out quirk setting polarity via separate property gpiolib: of: add polarity quirk for Freescale PCIe controller leds: gpio: switch to using devm_fwnode_gpiod_get() leds: lgm-sso: switch to using devm_fwnode_gpiod_get() gpiolib: remove devm_fwnode_get_[index_]gpiod_from_child() gpiolib: of: change of_find_gpio() to accept device node gpiolib: acpi: change acpi_find_gpio() to accept firmware node gpiolib: acpi: teach acpi_find_gpio() to handle data-only nodes gpiolib: acpi: avoid leaking ACPI details into upper gpiolib layers gpiolib: consolidate GPIO lookups gpiolib: add support for software nodes Guillaume La Roque (1): gpio: davinci: add support of module build Jeremy Kerr (1): gpio: ftgpio010: use device name for gpiochip name & label Nishanth Menon (1): dt-bindings: gpio: gpio-davinci: Increase maxItems in gpio-line-names Sascha Hauer (2): dt-bindings: gpio: Add gpio-latch binding document gpio: Add gpio latch driver Shubhrajyoti Datta (3): dt-bindings: gpio: pca9570: Add compatible for slg7xl45106 gpio: pca9570: add a platform data structure gpio: pca9570: add slg7xl45106 support Stephen Kitt (1): drivers/gpio: use simple i2c probe Thierry Reding (1): gpiolib: of: Use correct fwnode for DT-probed chips Uwe Kleine-König (3): gpio: max732x: Convert to i2c's .probe_new() gpio: pca953x: Convert to i2c's .probe_new() gpio: pcf857x: Convert to i2c's .probe_new() Weilong Chen (2): dt-bindings: gpio: add entry for hisilicon,ascend910-gpio gpio: hisi: Add initial device tree support William Breathitt Gray (3): gpio: idio-16: Introduce the ACCES IDIO-16 GPIO library module gpio: 104-idio-16: Utilize the idio-16 GPIO library gpio: pci-idio-16: Utilize the idio-16 GPIO library Xiang Yang (1): gpiolib: acpi: Use METHOD_NAME__AEI macro for acpi_walk_resources .../devicetree/bindings/gpio/gpio-davinci.yaml | 2 +- .../devicetree/bindings/gpio/gpio-latch.yaml | 94 +++++ .../devicetree/bindings/gpio/gpio-pca9570.yaml | 1 + .../bindings/gpio/hisilicon,ascend910-gpio.yaml | 56 +++ Documentation/driver-api/gpio/legacy.rst | 5 - MAINTAINERS | 8 + arch/arm/Kconfig | 21 - arch/arm/include/asm/gpio.h | 1 - arch/arm64/Kconfig | 12 - arch/x86/Kconfig | 5 - drivers/gpio/Kconfig | 29 +- drivers/gpio/Makefile | 4 +- drivers/gpio/TODO | 7 + drivers/gpio/gpio-104-idio-16.c | 88 +--- drivers/gpio/gpio-aggregator.c | 7 +- drivers/gpio/gpio-davinci.c | 14 +- drivers/gpio/gpio-exar.c | 1 + drivers/gpio/gpio-ftgpio010.c | 2 +- drivers/gpio/gpio-gw-pld.c | 5 +- drivers/gpio/gpio-hisi.c | 7 + drivers/gpio/gpio-idio-16.c | 146 +++++++ drivers/gpio/gpio-idio-16.h | 71 ++++ drivers/gpio/gpio-latch.c | 219 ++++++++++ drivers/gpio/gpio-max7300.c | 5 +- drivers/gpio/gpio-max732x.c | 6 +- drivers/gpio/gpio-merrifield.c | 3 +- drivers/gpio/gpio-pca953x.c | 6 +- drivers/gpio/gpio-pca9570.c | 49 ++- drivers/gpio/gpio-pcf857x.c | 6 +- drivers/gpio/gpio-pci-idio-16.c | 119 +----- drivers/gpio/gpio-sim.c | 4 + drivers/gpio/gpio-sl28cpld.c | 3 +- drivers/gpio/gpio-sta2x11.c | 411 ------------------- drivers/gpio/gpio-tpic2810.c | 5 +- drivers/gpio/gpio-ts4900.c | 5 +- drivers/gpio/gpiolib-acpi.c | 134 +++--- drivers/gpio/gpiolib-acpi.h | 54 +-- drivers/gpio/gpiolib-cdev.c | 206 ++++++++-- drivers/gpio/gpiolib-of.c | 452 ++++++++++++--------- drivers/gpio/gpiolib-of.h | 9 +- drivers/gpio/gpiolib-swnode.c | 123 ++++++ drivers/gpio/gpiolib-swnode.h | 14 + drivers/gpio/gpiolib.c | 295 +++++++------- drivers/gpio/gpiolib.h | 14 +- drivers/i2c/i2c-core-base.c | 14 + drivers/leds/blink/leds-lgm-sso.c | 5 +- drivers/leds/leds-gpio.c | 5 +- include/asm-generic/gpio.h | 55 +-- include/linux/gpio/consumer.h | 21 - include/linux/gpio/property.h | 11 + include/linux/i2c.h | 1 + include/linux/of_gpio.h | 2 +- 52 files changed, 1629 insertions(+), 1213 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-latch.yaml create mode 100644 Documentation/devicetree/bindings/gpio/hisilicon,ascend910-gpio.yaml create mode 100644 drivers/gpio/gpio-idio-16.c create mode 100644 drivers/gpio/gpio-idio-16.h create mode 100644 drivers/gpio/gpio-latch.c delete mode 100644 drivers/gpio/gpio-sta2x11.c create mode 100644 drivers/gpio/gpiolib-swnode.c create mode 100644 drivers/gpio/gpiolib-swnode.h create mode 100644 include/linux/gpio/property.h