Merge tag 'gpio-v4.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 31 Jan 2018 20:25:27 +0000 (12:25 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 31 Jan 2018 20:25:27 +0000 (12:25 -0800)
Pull GPIO updates from Linus Walleij:
 "The is the bulk of GPIO changes for the v4.16 kernel cycle. It is
  pretty calm this time around I think. I even got time to get to things
  like starting to clean up header includes.

  Core changes:

   - Disallow open drain and open source flags to be set simultaneously.
     This doesn't make electrical sense, and would the hardware actually
     respond to this setting, the result would be short circuit.

   - ACPI GPIO has a new core infrastructure for handling quirks. The
     quirks are there to deal with broken ACPI tables centrally instead
     of pushing the work to individual drivers. In the world of BIOS
     writers, the ACPI tables are perfect. Until they find a mistake in
     it. When such a mistake is found, we can patch it with a quirk. It
     should never happen, the problem is that it happens. So we
     accomodate for it.

   - Several documentation updates.

   - Revert the patch setting up initial direction state from reading
     the device. This was causing bad things for drivers that can't read
     status on all its pins. It is only affecting debugfs information
     quality.

   - Label descriptors with the device name if no explicit label is
     passed in.

   - Pave the ground for transitioning SPI and regulators to use GPIO
     descriptors by implementing some quirks in the device tree GPIO
     parsing code.

  New drivers:

   - New driver for the Access PCIe IDIO 24 family.

  Other:

   - Major refactorings and improvements to the GPIO mockup driver used
     for test and verification.

   - Moved the AXP209 driver over to pin control since it gained a pin
     control back-end. These patches will appear (with the same hashes)
     in the pin control pull request as well.

   - Convert the onewire GPIO driver w1-gpio to use descriptors. This is
     merged here since the W1 maintainers send very few pull requests
     and he ACKed it.

   - Start to clean up driver headers using <linux/gpio.h> to just use
     <linux/gpio/driver.h> as appropriate"

* tag 'gpio-v4.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (103 commits)
  gpio: Timestamp events in hardirq handler
  gpio: Fix kernel stack leak to userspace
  gpio: Fix a documentation spelling mistake
  gpio: Documentation update
  gpiolib: remove redundant initialization of pointer desc
  gpio: of: Fix NPE from OF flags
  gpio: stmpe: Delete an unnecessary variable initialisation in stmpe_gpio_probe()
  gpio: stmpe: Move an assignment in stmpe_gpio_probe()
  gpio: stmpe: Improve a size determination in stmpe_gpio_probe()
  gpio: stmpe: Use seq_putc() in stmpe_dbg_show()
  gpio: No NULL owner
  gpio: stmpe: i2c transfer are forbiden in atomic context
  gpio: davinci: Include proper header
  gpio: da905x: Include proper header
  gpio: cs5535: Include proper header
  gpio: crystalcove: Include proper header
  gpio: bt8xx: Include proper header
  gpio: bcm-kona: Include proper header
  gpio: arizona: Include proper header
  gpio: amd8111: Include proper header
  ...

1  2 
MAINTAINERS
drivers/gpio/gpio-74x164.c
drivers/gpio/gpio-bcm-kona.c
drivers/gpio/gpio-brcmstb.c
drivers/gpio/gpio-davinci.c
drivers/gpio/gpiolib-acpi.c
drivers/gpio/gpiolib-of.c
drivers/gpio/gpiolib.c
drivers/gpio/gpiolib.h
include/linux/acpi.h
include/linux/gpio/driver.h

diff --combined MAINTAINERS
index 88cdd2925cefc76d1db7498a2f05657d2e4728d3,57811dfb341633c72528cbb4ccb4e2b270d25a4d..e26e4c7a5454ed57a610b06e7d6796021f53888d
@@@ -62,15 -62,7 +62,15 @@@ trivial patch so apply some common sens
  
  7.    When sending security related changes or reports to a maintainer
        please Cc: security@kernel.org, especially if the maintainer
 -      does not respond.
 +      does not respond. Please keep in mind that the security team is
 +      a small set of people who can be efficient only when working on
 +      verified bugs. Please only Cc: this list when you have identified
 +      that the bug would present a short-term risk to other users if it
 +      were publicly disclosed. For example, reports of address leaks do
 +      not represent an immediate threat and are better handled publicly,
 +      and ideally, should come with a patch proposal. Please do not send
 +      automated reports to this list either. Such bugs will be handled
 +      better and faster in the usual public places.
  
  8.    Happy hacking.
  
@@@ -278,6 -270,12 +278,12 @@@ L:       linux-gpio@vger.kernel.or
  S:    Maintained
  F:    drivers/gpio/gpio-pci-idio-16.c
  
+ ACCES PCIe-IDIO-24 GPIO DRIVER
+ M:    William Breathitt Gray <vilhelm.gray@gmail.com>
+ L:    linux-gpio@vger.kernel.org
+ S:    Maintained
+ F:    drivers/gpio/gpio-pcie-idio-24.c
  ACENIC DRIVER
  M:    Jes Sorensen <jes@trained-monkey.org>
  L:    linux-acenic@sunsite.dk
@@@ -329,7 -327,7 +335,7 @@@ F: drivers/acpi/apei
  
  ACPI COMPONENT ARCHITECTURE (ACPICA)
  M:    Robert Moore <robert.moore@intel.com>
 -M:    Lv Zheng <lv.zheng@intel.com>
 +M:    Erik Schmauss <erik.schmauss@intel.com>
  M:    "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
  L:    linux-acpi@vger.kernel.org
  L:    devel@acpica.org
@@@ -562,13 -560,13 +568,13 @@@ S:      Orpha
  F:    Documentation/filesystems/affs.txt
  F:    fs/affs/
  
 -AFS FILESYSTEM & AF_RXRPC SOCKET DOMAIN
 +AFS FILESYSTEM
  M:    David Howells <dhowells@redhat.com>
  L:    linux-afs@lists.infradead.org
  S:    Supported
  F:    fs/afs/
 -F:    include/net/af_rxrpc.h
 -F:    net/rxrpc/af_rxrpc.c
 +F:    include/trace/events/afs.h
 +F:    Documentation/filesystems/afs.txt
  W:    https://www.infradead.org/~dhowells/kafs/
  
  AGPGART DRIVER
@@@ -867,20 -865,13 +873,20 @@@ F:      kernel/configs/android
  ANDROID DRIVERS
  M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  M:    Arve Hjønnevåg <arve@android.com>
 -M:    Riley Andrews <riandrews@android.com>
 +M:    Todd Kjos <tkjos@android.com>
 +M:    Martijn Coenen <maco@android.com>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
  L:    devel@driverdev.osuosl.org
  S:    Supported
  F:    drivers/android/
  F:    drivers/staging/android/
  
 +ANDROID GOLDFISH PIC DRIVER
 +M:    Miodrag Dinic <miodrag.dinic@mips.com>
 +S:    Supported
 +F:    Documentation/devicetree/bindings/interrupt-controller/google,goldfish-pic.txt
 +F:    drivers/irqchip/irq-goldfish-pic.c
 +
  ANDROID GOLDFISH RTC DRIVER
  M:    Miodrag Dinic <miodrag.dinic@mips.com>
  S:    Supported
@@@ -1327,8 -1318,7 +1333,8 @@@ F:      tools/perf/arch/arm/util/pmu.
  F:    tools/perf/arch/arm/util/auxtrace.c
  F:    tools/perf/arch/arm/util/cs-etm.c
  F:    tools/perf/arch/arm/util/cs-etm.h
 -F:    tools/perf/util/cs-etm.h
 +F:    tools/perf/util/cs-etm.*
 +F:    tools/perf/util/cs-etm-decoder/*
  
  ARM/CORGI MACHINE SUPPORT
  M:    Richard Purdie <rpurdie@rpsys.net>
@@@ -1598,7 -1588,6 +1604,7 @@@ F:      arch/arm/boot/dts/kirkwood
  F:    arch/arm/configs/mvebu_*_defconfig
  F:    arch/arm/mach-mvebu/
  F:    arch/arm64/boot/dts/marvell/armada*
 +F:    drivers/cpufreq/armada-37xx-cpufreq.c
  F:    drivers/cpufreq/mvebu-cpufreq.c
  F:    drivers/irqchip/irq-armada-370-xp.c
  F:    drivers/irqchip/irq-mvebu-*
@@@ -2063,7 -2052,7 +2069,7 @@@ F:      arch/arm/boot/dts/uniphier
  F:    arch/arm/include/asm/hardware/cache-uniphier.h
  F:    arch/arm/mach-uniphier/
  F:    arch/arm/mm/cache-uniphier.c
 -F:    arch/arm64/boot/dts/socionext/
 +F:    arch/arm64/boot/dts/socionext/uniphier*
  F:    drivers/bus/uniphier-system-bus.c
  F:    drivers/clk/uniphier/
  F:    drivers/gpio/gpio-uniphier.c
@@@ -2399,6 -2388,13 +2405,6 @@@ F:     Documentation/devicetree/bindings/in
  F:    drivers/input/touchscreen/atmel_mxt_ts.c
  F:    include/linux/platform_data/atmel_mxt_ts.h
  
 -ATMEL NAND DRIVER
 -M:    Wenyou Yang <wenyou.yang@atmel.com>
 -M:    Josh Wu <rainyfeeling@outlook.com>
 -L:    linux-mtd@lists.infradead.org
 -S:    Supported
 -F:    drivers/mtd/nand/atmel/*
 -
  ATMEL SAMA5D2 ADC DRIVER
  M:    Ludovic Desroches <ludovic.desroches@microchip.com>
  L:    linux-iio@vger.kernel.org
@@@ -2630,22 -2626,24 +2636,22 @@@ F:   fs/bfs
  F:    include/uapi/linux/bfs_fs.h
  
  BLACKFIN ARCHITECTURE
 -M:    Steven Miao <realmz6@gmail.com>
  L:    adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
  T:    git git://git.code.sf.net/p/adi-linux/code
  W:    http://blackfin.uclinux.org
 -S:    Supported
 +S:    Orphan
  F:    arch/blackfin/
  
  BLACKFIN EMAC DRIVER
  L:    adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
  W:    http://blackfin.uclinux.org
 -S:    Supported
 +S:    Orphan
  F:    drivers/net/ethernet/adi/
  
  BLACKFIN MEDIA DRIVER
 -M:    Scott Jiang <scott.jiang.linux@gmail.com>
  L:    adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
  W:    http://blackfin.uclinux.org/
 -S:    Supported
 +S:    Orphan
  F:    drivers/media/platform/blackfin/
  F:    drivers/media/i2c/adv7183*
  F:    drivers/media/i2c/vs6624*
  BLACKFIN RTC DRIVER
  L:    adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
  W:    http://blackfin.uclinux.org
 -S:    Supported
 +S:    Orphan
  F:    drivers/rtc/rtc-bfin.c
  
  BLACKFIN SDH DRIVER
  L:    adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
  W:    http://blackfin.uclinux.org
 -S:    Supported
 +S:    Orphan
  F:    drivers/mmc/host/bfin_sdh.c
  
  BLACKFIN SERIAL DRIVER
  L:    adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
  W:    http://blackfin.uclinux.org
 -S:    Supported
 +S:    Orphan
  F:    drivers/tty/serial/bfin_uart.c
  
  BLACKFIN WATCHDOG DRIVER
  L:    adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
  W:    http://blackfin.uclinux.org
 -S:    Supported
 +S:    Orphan
  F:    drivers/watchdog/bfin_wdt.c
  
  BLINKM RGB LED DRIVER
@@@ -4343,12 -4341,10 +4349,12 @@@ T:   git git://git.infradead.org/users/hc
  W:    http://git.infradead.org/users/hch/dma-mapping.git
  S:    Supported
  F:    lib/dma-debug.c
 -F:    lib/dma-noop.c
 +F:    lib/dma-direct.c
  F:    lib/dma-virt.c
  F:    drivers/base/dma-mapping.c
  F:    drivers/base/dma-coherent.c
 +F:    include/asm-generic/dma-mapping.h
 +F:    include/linux/dma-direct.h
  F:    include/linux/dma-mapping.h
  
  DME1737 HARDWARE MONITOR DRIVER
@@@ -5150,12 -5146,6 +5156,12 @@@ L:    linux-edac@vger.kernel.or
  S:    Maintained
  F:    drivers/edac/skx_edac.c
  
 +EDAC-TI
 +M:    Tero Kristo <t-kristo@ti.com>
 +L:    linux-edac@vger.kernel.org
 +S:    Maintained
 +F:    drivers/edac/ti_edac.c
 +
  EDIROL UA-101/UA-1000 DRIVER
  M:    Clemens Ladisch <clemens@ladisch.de>
  L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
@@@ -5166,15 -5156,15 +5172,15 @@@ F:   sound/usb/misc/ua101.
  EFI TEST DRIVER
  L:    linux-efi@vger.kernel.org
  M:    Ivan Hu <ivan.hu@canonical.com>
 -M:    Matt Fleming <matt@codeblueprint.co.uk>
 +M:    Ard Biesheuvel <ard.biesheuvel@linaro.org>
  S:    Maintained
  F:    drivers/firmware/efi/test/
  
  EFI VARIABLE FILESYSTEM
  M:    Matthew Garrett <matthew.garrett@nebula.com>
  M:    Jeremy Kerr <jk@ozlabs.org>
 -M:    Matt Fleming <matt@codeblueprint.co.uk>
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git
 +M:    Ard Biesheuvel <ard.biesheuvel@linaro.org>
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git
  L:    linux-efi@vger.kernel.org
  S:    Maintained
  F:    fs/efivarfs/
@@@ -5335,6 -5325,7 +5341,6 @@@ S:      Supporte
  F:    security/integrity/evm/
  
  EXTENSIBLE FIRMWARE INTERFACE (EFI)
 -M:    Matt Fleming <matt@codeblueprint.co.uk>
  M:    Ard Biesheuvel <ard.biesheuvel@linaro.org>
  L:    linux-efi@vger.kernel.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git
@@@ -5445,7 -5436,7 +5451,7 @@@ F:      drivers/media/tuners/fc2580
  
  FCOE SUBSYSTEM (libfc, libfcoe, fcoe)
  M:    Johannes Thumshirn <jth@kernel.org>
 -L:    fcoe-devel@open-fcoe.org
 +L:    linux-scsi@vger.kernel.org
  W:    www.Open-FCoE.org
  S:    Supported
  F:    drivers/scsi/libfc/
@@@ -5979,6 -5970,7 +5985,7 @@@ F:      drivers/media/rc/gpio-ir-tx.
  
  GPIO MOCKUP DRIVER
  M:    Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
+ R:    Bartosz Golaszewski <brgl@bgdev.pl>
  L:    linux-gpio@vger.kernel.org
  S:    Maintained
  F:    drivers/gpio/gpio-mockup.c
@@@ -6189,6 -6181,7 +6196,6 @@@ M:      Jean Delvare <jdelvare@suse.com
  M:    Guenter Roeck <linux@roeck-us.net>
  L:    linux-hwmon@vger.kernel.org
  W:    http://hwmon.wiki.kernel.org/
 -T:    quilt http://jdelvare.nerim.net/devel/linux/jdelvare-hwmon/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
  S:    Maintained
  F:    Documentation/hwmon/
@@@ -6626,6 -6619,16 +6633,6 @@@ L:     linux-i2c@vger.kernel.or
  S:    Maintained
  F:    drivers/i2c/i2c-stub.c
  
 -i386 BOOT CODE
 -M:    "H. Peter Anvin" <hpa@zytor.com>
 -S:    Maintained
 -F:    arch/x86/boot/
 -
 -i386 SETUP CODE / CPU ERRATA WORKAROUNDS
 -M:    "H. Peter Anvin" <hpa@zytor.com>
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup.git
 -S:    Maintained
 -
  IA64 (Itanium) PLATFORM
  M:    Tony Luck <tony.luck@intel.com>
  M:    Fenghua Yu <fenghua.yu@intel.com>
@@@ -6892,7 -6895,7 +6899,7 @@@ M:      Jason Gunthorpe <jgg@mellanox.com
  L:    linux-rdma@vger.kernel.org
  W:    http://www.openfabrics.org/
  Q:    http://patchwork.kernel.org/project/linux-rdma/list/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git
  S:    Supported
  F:    Documentation/devicetree/bindings/infiniband/
  F:    Documentation/infiniband/
@@@ -7771,7 -7774,6 +7778,7 @@@ F:      security/keys
  
  KGDB / KDB /debug_core
  M:    Jason Wessel <jason.wessel@windriver.com>
 +M:    Daniel Thompson <daniel.thompson@linaro.org>
  W:    http://kgdb.wiki.kernel.org/
  L:    kgdb-bugreport@lists.sourceforge.net
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb.git
@@@ -8199,7 -8201,6 +8206,7 @@@ F:      arch/*/include/asm/rwsem.
  F:    include/linux/seqlock.h
  F:    lib/locking*.[ch]
  F:    kernel/locking/
 +X:    kernel/locking/locktorture.c
  
  LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks)
  M:    "Richard Russon (FlatCap)" <ldm@flatcap.org>
@@@ -8415,13 -8416,6 +8422,13 @@@ L:    linux-wireless@vger.kernel.or
  S:    Odd Fixes
  F:    drivers/net/wireless/marvell/mwl8k.c
  
 +MARVELL NAND CONTROLLER DRIVER
 +M:    Miquel Raynal <miquel.raynal@free-electrons.com>
 +L:    linux-mtd@lists.infradead.org
 +S:    Maintained
 +F:    drivers/mtd/nand/marvell_nand.c
 +F:    Documentation/devicetree/bindings/mtd/marvell-nand.txt
 +
  MARVELL SOC MMC/SD/SDIO CONTROLLER DRIVER
  M:    Nicolas Pitre <nico@fluxnic.net>
  S:    Odd Fixes
@@@ -8969,7 -8963,7 +8976,7 @@@ L:      linux-mtd@lists.infradead.or
  W:    http://www.linux-mtd.infradead.org/
  Q:    http://patchwork.ozlabs.org/project/linux-mtd/list/
  T:    git git://git.infradead.org/linux-mtd.git master
 -T:    git git://git.infradead.org/l2-mtd.git master
 +T:    git git://git.infradead.org/linux-mtd.git mtd/next
  S:    Maintained
  F:    Documentation/devicetree/bindings/mtd/
  F:    drivers/mtd/
@@@ -9058,14 -9052,6 +9065,14 @@@ F:    drivers/media/platform/atmel/atmel-i
  F:    drivers/media/platform/atmel/atmel-isc-regs.h
  F:    devicetree/bindings/media/atmel-isc.txt
  
 +MICROCHIP / ATMEL NAND DRIVER
 +M:    Wenyou Yang <wenyou.yang@microchip.com>
 +M:    Josh Wu <rainyfeeling@outlook.com>
 +L:    linux-mtd@lists.infradead.org
 +S:    Supported
 +F:    drivers/mtd/nand/atmel/*
 +F:    Documentation/devicetree/bindings/mtd/atmel-nand.txt
 +
  MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER
  M:    Woojung Huh <Woojung.Huh@microchip.com>
  M:    Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
@@@ -9108,7 -9094,6 +9115,7 @@@ F:      drivers/usb/image/microtek.
  
  MIPS
  M:    Ralf Baechle <ralf@linux-mips.org>
 +M:    James Hogan <jhogan@kernel.org>
  L:    linux-mips@linux-mips.org
  W:    http://www.linux-mips.org/
  T:    git git://git.linux-mips.org/pub/scm/ralf/linux.git
@@@ -9353,9 -9338,9 +9360,9 @@@ F:      drivers/gpu/drm/mxsfb
  F:    Documentation/devicetree/bindings/display/mxsfb-drm.txt
  
  MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
 -M:    Hyong-Youb Kim <hykim@myri.com>
 +M:    Chris Lee <christopher.lee@cspi.com>
  L:    netdev@vger.kernel.org
 -W:    https://www.myricom.com/support/downloads/myri10ge.html
 +W:    https://www.cspi.com/ethernet-products/support/downloads/
  S:    Supported
  F:    drivers/net/ethernet/myricom/myri10ge/
  
@@@ -9366,7 -9351,7 +9373,7 @@@ L:      linux-mtd@lists.infradead.or
  W:    http://www.linux-mtd.infradead.org/
  Q:    http://patchwork.ozlabs.org/project/linux-mtd/list/
  T:    git git://git.infradead.org/linux-mtd.git nand/fixes
 -T:    git git://git.infradead.org/l2-mtd.git nand/next
 +T:    git git://git.infradead.org/linux-mtd.git nand/next
  S:    Maintained
  F:    drivers/mtd/nand/
  F:    include/linux/mtd/*nand*.h
@@@ -9662,8 -9647,8 +9669,8 @@@ F:      include/uapi/linux/sunrpc
  NILFS2 FILESYSTEM
  M:    Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  L:    linux-nilfs@vger.kernel.org
 -W:    http://nilfs.sourceforge.net/
 -W:    http://nilfs.osdn.jp/
 +W:    https://nilfs.sourceforge.io/
 +W:    https://nilfs.osdn.jp/
  T:    git git://github.com/konis/nilfs2.git
  S:    Supported
  F:    Documentation/filesystems/nilfs2.txt
@@@ -9767,15 -9752,6 +9774,15 @@@ S:    Supporte
  F:    Documentation/filesystems/ntfs.txt
  F:    fs/ntfs/
  
 +NUBUS SUBSYSTEM
 +M:    Finn Thain <fthain@telegraphics.com.au>
 +L:    linux-m68k@lists.linux-m68k.org
 +S:    Maintained
 +F:    arch/*/include/asm/nubus.h
 +F:    drivers/nubus/
 +F:    include/linux/nubus.h
 +F:    include/uapi/linux/nubus.h
 +
  NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER
  M:    Antonino Daplas <adaplas@gmail.com>
  L:    linux-fbdev@vger.kernel.org
@@@ -9836,7 -9812,6 +9843,7 @@@ NXP TFA9879 DRIVE
  M:    Peter Rosin <peda@axentia.se>
  L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
  S:    Maintained
 +F:    Documentation/devicetree/bindings/sound/tfa9879.txt
  F:    sound/soc/codecs/tfa9879*
  
  NXP-NCI NFC DRIVER
@@@ -10168,7 -10143,7 +10175,7 @@@ F:   drivers/irqchip/irq-ompic.
  F:    drivers/irqchip/irq-or1k-*
  
  OPENVSWITCH
 -M:    Pravin Shelar <pshelar@nicira.com>
 +M:    Pravin B Shelar <pshelar@ovn.org>
  L:    netdev@vger.kernel.org
  L:    dev@openvswitch.org
  W:    http://openvswitch.org
@@@ -10923,7 -10898,6 +10930,7 @@@ F:   include/linux/pm.
  F:    include/linux/pm_*
  F:    include/linux/powercap.h
  F:    drivers/powercap/
 +F:    kernel/configs/nopm.config
  
  POWER STATE COORDINATION INTERFACE (PSCI)
  M:    Mark Rutland <mark.rutland@arm.com>
@@@ -11218,8 -11192,7 +11225,8 @@@ S:   Maintaine
  F:    drivers/firmware/qemu_fw_cfg.c
  
  QIB DRIVER
 -M:    Mike Marciniszyn <infinipath@intel.com>
 +M:    Dennis Dalessandro <dennis.dalessandro@intel.com>
 +M:    Mike Marciniszyn <mike.marciniszyn@intel.com>
  L:    linux-rdma@vger.kernel.org
  S:    Supported
  F:    drivers/infiniband/hw/qib/
@@@ -11246,6 -11219,7 +11253,6 @@@ F:   include/linux/qed
  F:    drivers/net/ethernet/qlogic/qede/
  
  QLOGIC QL4xxx RDMA DRIVER
 -M:    Ram Amrani <Ram.Amrani@cavium.com>
  M:    Michal Kalderon <Michal.Kalderon@cavium.com>
  M:    Ariel Elior <Ariel.Elior@cavium.com>
  L:    linux-rdma@vger.kernel.org
@@@ -11484,6 -11458,15 +11491,6 @@@ L:  linux-wireless@vger.kernel.or
  S:    Orphan
  F:    drivers/net/wireless/ray*
  
 -RCUTORTURE MODULE
 -M:    Josh Triplett <josh@joshtriplett.org>
 -M:    "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
 -L:    linux-kernel@vger.kernel.org
 -S:    Supported
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 -F:    Documentation/RCU/torture.txt
 -F:    kernel/rcu/rcutorture.c
 -
  RCUTORTURE TEST FRAMEWORK
  M:    "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
  M:    Josh Triplett <josh@joshtriplett.org>
@@@ -11507,7 -11490,6 +11514,7 @@@ F:   drivers/net/ethernet/rdc/r6040.
  
  RDMAVT - RDMA verbs software
  M:    Dennis Dalessandro <dennis.dalessandro@intel.com>
 +M:    Mike Marciniszyn <mike.marciniszyn@intel.com>
  L:    linux-rdma@vger.kernel.org
  S:    Supported
  F:    drivers/infiniband/sw/rdmavt
@@@ -11677,8 -11659,8 +11684,8 @@@ F:   drivers/mtd/nand/r852.
  RISC-V ARCHITECTURE
  M:    Palmer Dabbelt <palmer@sifive.com>
  M:    Albert Ou <albert@sifive.com>
 -L:    patches@groups.riscv.org
 -T:    git https://github.com/riscv/riscv-linux
 +L:    linux-riscv@lists.infradead.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux.git
  S:    Supported
  F:    arch/riscv/
  K:    riscv
@@@ -11802,18 -11784,6 +11809,18 @@@ T: git git://git.kernel.org/pub/scm/lin
  S:    Maintained
  F:    drivers/net/wireless/realtek/rtl8xxxu/
  
 +RXRPC SOCKETS (AF_RXRPC)
 +M:    David Howells <dhowells@redhat.com>
 +L:    linux-afs@lists.infradead.org
 +S:    Supported
 +F:    net/rxrpc/
 +F:    include/keys/rxrpc-type.h
 +F:    include/net/af_rxrpc.h
 +F:    include/trace/events/rxrpc.h
 +F:    include/uapi/linux/rxrpc.h
 +F:    Documentation/networking/rxrpc.txt
 +W:    https://www.infradead.org/~dhowells/kafs/
 +
  S3 SAVAGE FRAMEBUFFER DRIVER
  M:    Antonino Daplas <adaplas@gmail.com>
  L:    linux-fbdev@vger.kernel.org
@@@ -12259,7 -12229,7 +12266,7 @@@ M:   Security Officers <security@kernel.o
  S:    Supported
  
  SECURITY SUBSYSTEM
 -M:    James Morris <james.l.morris@oracle.com>
 +M:    James Morris <jmorris@namei.org>
  M:    "Serge E. Hallyn" <serge@hallyn.com>
  L:    linux-security-module@vger.kernel.org (suggested Cc:)
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
@@@ -12618,12 -12588,6 +12625,12 @@@ F: include/media/soc
  F:    drivers/media/i2c/soc_camera/
  F:    drivers/media/platform/soc_camera/
  
 +SOCIONEXT UNIPHIER SOUND DRIVER
 +M:    Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
 +L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
 +S:    Maintained
 +F:    sound/soc/uniphier/
 +
  SOEKRIS NET48XX LED SUPPORT
  M:    Chris Boot <bootc@bootc.net>
  S:    Maintained
@@@ -12648,15 -12612,6 +12655,15 @@@ L: linux-media@vger.kernel.or
  S:    Supported
  F:    drivers/media/pci/solo6x10/
  
 +SOFTWARE DELEGATED EXCEPTION INTERFACE (SDEI)
 +M:    James Morse <james.morse@arm.com>
 +L:    linux-arm-kernel@lists.infradead.org
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/arm/firmware/sdei.txt
 +F:    drivers/firmware/arm_sdei.c
 +F:    include/linux/sdei.h
 +F:    include/uapi/linux/sdei.h
 +
  SOFTWARE RAID (Multiple Disks) SUPPORT
  M:    Shaohua Li <shli@kernel.org>
  L:    linux-raid@vger.kernel.org
@@@ -12682,14 -12637,6 +12689,14 @@@ S: Maintaine
  F:    drivers/ssb/
  F:    include/linux/ssb/
  
 +SONY IMX274 SENSOR DRIVER
 +M:    Leon Luo <leonl@leopardimaging.com>
 +L:    linux-media@vger.kernel.org
 +T:    git git://linuxtv.org/media_tree.git
 +S:    Maintained
 +F:    drivers/media/i2c/imx274.c
 +F:    Documentation/devicetree/bindings/media/i2c/imx274.txt
 +
  SONY MEMORYSTICK CARD SUPPORT
  M:    Alex Dubov <oakad@yahoo.com>
  W:    http://tifmxx.berlios.de/
@@@ -12821,7 -12768,7 +12828,7 @@@ L:   linux-mtd@lists.infradead.or
  W:    http://www.linux-mtd.infradead.org/
  Q:    http://patchwork.ozlabs.org/project/linux-mtd/list/
  T:    git git://git.infradead.org/linux-mtd.git spi-nor/fixes
 -T:    git git://git.infradead.org/l2-mtd.git spi-nor/next
 +T:    git git://git.infradead.org/linux-mtd.git spi-nor/next
  S:    Maintained
  F:    drivers/mtd/spi-nor/
  F:    include/linux/mtd/spi-nor.h
@@@ -13074,7 -13021,7 +13081,7 @@@ F:   arch/x86/boot/video
  
  SWIOTLB SUBSYSTEM
  M:    Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
 -L:    linux-kernel@vger.kernel.org
 +L:    iommu@lists.linux-foundation.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb.git
  S:    Supported
  F:    lib/swiotlb.c
@@@ -13156,7 -13103,6 +13163,7 @@@ F:   drivers/dma/dw
  
  SYNOPSYS DESIGNWARE ENTERPRISE ETHERNET DRIVER
  M:    Jie Deng <jiedeng@synopsys.com>
 +M:    Jose Abreu <Jose.Abreu@synopsys.com>
  L:    netdev@vger.kernel.org
  S:    Supported
  F:    drivers/net/ethernet/synopsys/
@@@ -13532,7 -13478,6 +13539,7 @@@ M:   Mika Westerberg <mika.westerberg@lin
  M:    Yehezkel Bernat <yehezkel.bernat@intel.com>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git
  S:    Maintained
 +F:    Documentation/admin-guide/thunderbolt.rst
  F:    drivers/thunderbolt/
  F:    include/linux/thunderbolt.h
  
@@@ -13710,8 -13655,10 +13717,8 @@@ F:  drivers/net/wireless/ti
  F:    include/linux/wl12xx.h
  
  TILE ARCHITECTURE
 -M:    Chris Metcalf <cmetcalf@mellanox.com>
  W:    http://www.mellanox.com/repository/solutions/tile-scm/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile.git
 -S:    Supported
 +S:    Orphan
  F:    arch/tile/
  F:    drivers/char/tile-srom.c
  F:    drivers/edac/tile_edac.c
@@@ -13808,18 -13755,6 +13815,18 @@@ L: platform-driver-x86@vger.kernel.or
  S:    Maintained
  F:    drivers/platform/x86/topstar-laptop.c
  
 +TORTURE-TEST MODULES
 +M:    Davidlohr Bueso <dave@stgolabs.net>
 +M:    "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
 +M:    Josh Triplett <josh@joshtriplett.org>
 +L:    linux-kernel@vger.kernel.org
 +S:    Supported
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 +F:    Documentation/RCU/torture.txt
 +F:    kernel/torture.c
 +F:    kernel/rcu/rcutorture.c
 +F:    kernel/locking/locktorture.c
 +
  TOSHIBA ACPI EXTRAS DRIVER
  M:    Azael Avalos <coproscefalo@gmail.com>
  L:    platform-driver-x86@vger.kernel.org
@@@ -13903,13 -13838,6 +13910,13 @@@ T: git git://git.kernel.org/pub/scm/lin
  S:    Maintained
  K:    ^Subject:.*(?i)trivial
  
 +TEMPO SEMICONDUCTOR DRIVERS
 +M:    Steven Eckhoff <steven.eckhoff.opensource@gmail.com>
 +S:    Maintained
 +F:    sound/soc/codecs/tscs*.c
 +F:    sound/soc/codecs/tscs*.h
 +F:    Documentation/devicetree/bindings/sound/tscs*.txt
 +
  TTY LAYER
  M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  M:    Jiri Slaby <jslaby@suse.com>
@@@ -14708,7 -14636,6 +14715,7 @@@ W:   http://www.slimlogic.co.uk/?p=4
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
  S:    Supported
  F:    Documentation/devicetree/bindings/regulator/
 +F:    Documentation/power/regulator/
  F:    drivers/regulator/
  F:    include/dt-bindings/regulator/
  F:    include/linux/regulator/
@@@ -14919,7 -14846,7 +14926,7 @@@ F:   net/x25
  X86 ARCHITECTURE (32-BIT AND 64-BIT)
  M:    Thomas Gleixner <tglx@linutronix.de>
  M:    Ingo Molnar <mingo@redhat.com>
 -M:    "H. Peter Anvin" <hpa@zytor.com>
 +R:    "H. Peter Anvin" <hpa@zytor.com>
  M:    x86@kernel.org
  L:    linux-kernel@vger.kernel.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
@@@ -15029,7 -14956,6 +15036,7 @@@ F:   include/xen/interface/io/vscsiif.
  XEN SWIOTLB SUBSYSTEM
  M:    Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  L:    xen-devel@lists.xenproject.org (moderated for non-subscribers)
 +L:    iommu@lists.linux-foundation.org
  S:    Supported
  F:    arch/x86/xen/*swiotlb*
  F:    drivers/xen/*swiotlb*
index 15a1f4b348c41b2915755dba173d71704a862768,3c25f504a78406ccdc5d5fa6e4926ffc76884a52..fb7b620763a257658ddd60e5fd0c203248965f4d
@@@ -9,12 -9,11 +9,11 @@@
   *  published by the Free Software Foundation.
   */
  
- #include <linux/gpio/consumer.h>
  #include <linux/init.h>
  #include <linux/mutex.h>
  #include <linux/spi/spi.h>
- #include <linux/gpio.h>
- #include <linux/of_gpio.h>
+ #include <linux/gpio/driver.h>
+ #include <linux/gpio/consumer.h>
  #include <linux/slab.h>
  #include <linux/module.h>
  
@@@ -23,7 -22,6 +22,7 @@@
  struct gen_74x164_chip {
        struct gpio_chip        gpio_chip;
        struct mutex            lock;
 +      struct gpio_desc        *gpiod_oe;
        u32                     registers;
        /*
         * Since the registers are chained, every byte sent will make
@@@ -32,7 -30,8 +31,7 @@@
         * register at the end of the transfer. So, to have a logical
         * numbering, store the bytes in reverse order.
         */
 -      u8                      buffer[0];
 -      struct gpio_desc        *gpiod_oe;
 +      u8                      buffer[];
  };
  
  static int __gen_74x164_write_config(struct gen_74x164_chip *chip)
index 76861a00bb92c4b449f346433f282da8e6cb82c9,f4c793e9a92b8d87c0307d4fbe0be30895fa15a0..eb8369b21e9074d65599c1cafbc37e05a35e12d9
@@@ -17,7 -17,7 +17,7 @@@
  #include <linux/bitops.h>
  #include <linux/err.h>
  #include <linux/io.h>
- #include <linux/gpio.h>
+ #include <linux/gpio/driver.h>
  #include <linux/of_device.h>
  #include <linux/of_irq.h>
  #include <linux/init.h>
@@@ -127,7 -127,7 +127,7 @@@ static int bcm_kona_gpio_get_dir(struc
        u32 val;
  
        val = readl(reg_base + GPIO_CONTROL(gpio)) & GPIO_GPCTR0_IOTR_MASK;
-       return val ? GPIOF_DIR_IN : GPIOF_DIR_OUT;
+       return !!val;
  }
  
  static void bcm_kona_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
        raw_spin_lock_irqsave(&kona_gpio->lock, flags);
  
        /* this function only applies to output pin */
-       if (bcm_kona_gpio_get_dir(chip, gpio) == GPIOF_DIR_IN)
+       if (bcm_kona_gpio_get_dir(chip, gpio) == 1)
                goto out;
  
        reg_offset = value ? GPIO_OUT_SET(bank_id) : GPIO_OUT_CLEAR(bank_id);
@@@ -170,7 -170,7 +170,7 @@@ static int bcm_kona_gpio_get(struct gpi
        reg_base = kona_gpio->reg_base;
        raw_spin_lock_irqsave(&kona_gpio->lock, flags);
  
-       if (bcm_kona_gpio_get_dir(chip, gpio) == GPIOF_DIR_IN)
+       if (bcm_kona_gpio_get_dir(chip, gpio) == 1)
                reg_offset = GPIO_IN_STATUS(bank_id);
        else
                reg_offset = GPIO_OUT_STATUS(bank_id);
@@@ -522,7 -522,6 +522,7 @@@ static struct of_device_id const bcm_ko
   * category than their parents, so it won't report false recursion.
   */
  static struct lock_class_key gpio_lock_class;
 +static struct lock_class_key gpio_request_class;
  
  static int bcm_kona_gpio_irq_map(struct irq_domain *d, unsigned int irq,
                                 irq_hw_number_t hwirq)
        ret = irq_set_chip_data(irq, d->host_data);
        if (ret < 0)
                return ret;
 -      irq_set_lockdep_class(irq, &gpio_lock_class);
 +      irq_set_lockdep_class(irq, &gpio_lock_class, &gpio_request_class);
        irq_set_chip_and_handler(irq, &bcm_gpio_irq_chip, handle_simple_irq);
        irq_set_noprobe(irq);
  
index bb4f8cf18bd9f6c7e47328aaf2ec1cdd3dfc3d6b,3dcbeadca8d55a15a911750ccc77f4e468c0b04a..16c7f9f4941644b64c8fa71f4b0b2c7393e99b6a
@@@ -19,7 -19,6 +19,6 @@@
  #include <linux/irqdomain.h>
  #include <linux/irqchip/chained_irq.h>
  #include <linux/interrupt.h>
- #include <linux/bitops.h>
  
  enum gio_reg_index {
        GIO_REG_ODEN = 0,
@@@ -327,7 -326,6 +326,7 @@@ static struct brcmstb_gpio_bank *brcmst
   * category than their parents, so it won't report false recursion.
   */
  static struct lock_class_key brcmstb_gpio_irq_lock_class;
 +static struct lock_class_key brcmstb_gpio_irq_request_class;
  
  
  static int brcmstb_gpio_irq_map(struct irq_domain *d, unsigned int irq,
        ret = irq_set_chip_data(irq, &bank->gc);
        if (ret < 0)
                return ret;
 -      irq_set_lockdep_class(irq, &brcmstb_gpio_irq_lock_class);
 +      irq_set_lockdep_class(irq, &brcmstb_gpio_irq_lock_class,
 +                            &brcmstb_gpio_irq_request_class);
        irq_set_chip_and_handler(irq, &priv->irq_chip, handle_level_irq);
        irq_set_noprobe(irq);
        return 0;
index e4b3d7db68c95a2d87b9766e54f688fe2dd13f36,34fc0a167b7c3b9400a9b9674af025eabb3a7745..0b951ca78ec40c529b3df803249152d251d1e823
@@@ -9,7 -9,7 +9,7 @@@
   * the Free Software Foundation; either version 2 of the License, or
   * (at your option) any later version.
   */
- #include <linux/gpio.h>
+ #include <linux/gpio/driver.h>
  #include <linux/errno.h>
  #include <linux/kernel.h>
  #include <linux/clk.h>
@@@ -383,7 -383,7 +383,7 @@@ static int gpio_irq_type_unbanked(struc
        u32 mask;
  
        d = (struct davinci_gpio_controller *)irq_data_get_irq_handler_data(data);
 -      g = (struct davinci_gpio_regs __iomem *)d->regs;
 +      g = (struct davinci_gpio_regs __iomem *)d->regs[0];
        mask = __gpio_mask(data->irq - d->base_irq);
  
        if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
index d6f3d9ee1350e422e3f373427d55d6ce8b6be565,430a1475212d6b3bfe6b2bd46726b9a2e4df85ad..0ecffd172a80045722aa9a0fa2b6facdc0292e38
@@@ -414,7 -414,8 +414,8 @@@ EXPORT_SYMBOL_GPL(devm_acpi_dev_remove_
  
  static bool acpi_get_driver_gpio_data(struct acpi_device *adev,
                                      const char *name, int index,
-                                     struct acpi_reference_args *args)
+                                     struct acpi_reference_args *args,
+                                     unsigned int *quirks)
  {
        const struct acpi_gpio_mapping *gm;
  
                        args->args[1] = par->line_index;
                        args->args[2] = par->active_low;
                        args->nargs = 3;
+                       *quirks = gm->quirks;
                        return true;
                }
  
@@@ -461,8 -464,8 +464,8 @@@ acpi_gpio_to_gpiod_flags(const struct a
        }
  }
  
- int
- acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update)
static int
__acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update)
  {
        int ret = 0;
  
        return ret;
  }
  
+ int
+ acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info)
+ {
+       struct device *dev = &info->adev->dev;
+       enum gpiod_flags old = *flags;
+       int ret;
+       ret = __acpi_gpio_update_gpiod_flags(&old, info->flags);
+       if (info->quirks & ACPI_GPIO_QUIRK_NO_IO_RESTRICTION) {
+               if (ret)
+                       dev_warn(dev, FW_BUG "GPIO not in correct mode, fixing\n");
+       } else {
+               if (ret)
+                       dev_dbg(dev, "Override GPIO initialization flags\n");
+               *flags = old;
+       }
+       return ret;
+ }
  struct acpi_gpio_lookup {
        struct acpi_gpio_info info;
        int index;
        int pin_index;
        bool active_low;
-       struct acpi_device *adev;
        struct gpio_desc *desc;
        int n;
  };
@@@ -531,8 -553,8 +553,8 @@@ static int acpi_populate_gpio_lookup(st
                        lookup->info.triggering = agpio->triggering;
                } else {
                        lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio);
+                       lookup->info.polarity = lookup->active_low;
                }
        }
  
        return 1;
  static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup,
                                     struct acpi_gpio_info *info)
  {
+       struct acpi_device *adev = lookup->info.adev;
        struct list_head res_list;
        int ret;
  
        INIT_LIST_HEAD(&res_list);
  
-       ret = acpi_dev_get_resources(lookup->adev, &res_list,
+       ret = acpi_dev_get_resources(adev, &res_list,
                                     acpi_populate_gpio_lookup,
                                     lookup);
        if (ret < 0)
        if (!lookup->desc)
                return -ENOENT;
  
-       if (info) {
+       if (info)
                *info = lookup->info;
-               if (lookup->active_low)
-                       info->polarity = lookup->active_low;
-       }
        return 0;
  }
  
@@@ -570,6 -590,7 +590,7 @@@ static int acpi_gpio_property_lookup(st
                                     struct acpi_gpio_lookup *lookup)
  {
        struct acpi_reference_args args;
+       unsigned int quirks = 0;
        int ret;
  
        memset(&args, 0, sizeof(args));
                if (!adev)
                        return ret;
  
-               if (!acpi_get_driver_gpio_data(adev, propname, index, &args))
+               if (!acpi_get_driver_gpio_data(adev, propname, index, &args,
+                                              &quirks))
                        return ret;
        }
        /*
         * The property was found and resolved, so need to lookup the GPIO based
         * on returned args.
         */
-       lookup->adev = args.adev;
        if (args.nargs != 3)
                return -EPROTO;
  
        lookup->pin_index = args.args[1];
        lookup->active_low = !!args.args[2];
  
+       lookup->info.adev = args.adev;
+       lookup->info.quirks = quirks;
        return 0;
  }
  
@@@ -643,11 -666,11 +666,11 @@@ static struct gpio_desc *acpi_get_gpiod
                        return ERR_PTR(ret);
  
                dev_dbg(&adev->dev, "GPIO: _DSD returned %s %d %d %u\n",
-                       dev_name(&lookup.adev->dev), lookup.index,
+                       dev_name(&lookup.info.adev->dev), lookup.index,
                        lookup.pin_index, lookup.active_low);
        } else {
                dev_dbg(&adev->dev, "GPIO: looking up %d in _CRS\n", index);
-               lookup.adev = adev;
+               lookup.info.adev = adev;
        }
  
        ret = acpi_gpio_resource_lookup(&lookup, info);
@@@ -664,7 -687,6 +687,6 @@@ struct gpio_desc *acpi_find_gpio(struc
        struct acpi_gpio_info info;
        struct gpio_desc *desc;
        char propname[32];
-       int err;
        int i;
  
        /* Try first from _DSD */
        if (info.polarity == GPIO_ACTIVE_LOW)
                *lookupflags |= GPIO_ACTIVE_LOW;
  
-       err = acpi_gpio_update_gpiod_flags(dflags, info.flags);
-       if (err)
-               dev_dbg(dev, "Override GPIO initialization flags\n");
+       acpi_gpio_update_gpiod_flags(dflags, &info);
        return desc;
  }
  
@@@ -1074,7 -1093,7 +1093,7 @@@ void acpi_gpiochip_add(struct gpio_chi
        }
  
        if (!chip->names)
 -              devprop_gpiochip_set_names(chip);
 +              devprop_gpiochip_set_names(chip, dev_fwnode(chip->parent));
  
        acpi_gpiochip_request_regions(acpi_gpio);
        acpi_gpiochip_scan_gpios(acpi_gpio);
index 72a0695d2ac3a3d3217462ff4ea85147921f5dcd,27e8a339310c9035fc71f833aafb824cef051874..564bb7a31da43b4e924daf7501c36ec9a4eb8fc2
@@@ -56,6 -56,42 +56,42 @@@ static struct gpio_desc *of_xlate_and_g
        return gpiochip_get_desc(chip, ret);
  }
  
+ static void of_gpio_flags_quirks(struct device_node *np,
+                                enum of_gpio_flags *flags)
+ {
+       /*
+        * Some GPIO fixed regulator quirks.
+        * Note that active low is the default.
+        */
+       if (IS_ENABLED(CONFIG_REGULATOR) &&
+           (of_device_is_compatible(np, "reg-fixed-voltage") ||
+            of_device_is_compatible(np, "regulator-gpio"))) {
+               /*
+                * The regulator GPIO handles are specified such that the
+                * presence or absence of "enable-active-high" solely controls
+                * the polarity of the GPIO line. Any phandle flags must
+                * be actively ignored.
+                */
+               if (*flags & OF_GPIO_ACTIVE_LOW) {
+                       pr_warn("%s GPIO handle specifies active low - ignored\n",
+                               of_node_full_name(np));
+                       *flags &= ~OF_GPIO_ACTIVE_LOW;
+               }
+               if (!of_property_read_bool(np, "enable-active-high"))
+                       *flags |= OF_GPIO_ACTIVE_LOW;
+       }
+       /*
+        * Legacy open drain handling for fixed voltage regulators.
+        */
+       if (IS_ENABLED(CONFIG_REGULATOR) &&
+           of_device_is_compatible(np, "reg-fixed-voltage") &&
+           of_property_read_bool(np, "gpio-open-drain")) {
+               *flags |= (OF_GPIO_SINGLE_ENDED | OF_GPIO_OPEN_DRAIN);
+               pr_info("%s uses legacy open drain flag - update the DTS if you can\n",
+                       of_node_full_name(np));
+       }
+ }
  /**
   * of_get_named_gpiod_flags() - Get a GPIO descriptor and flags for GPIO API
   * @np:               device node to get GPIO from
@@@ -93,6 -129,9 +129,9 @@@ struct gpio_desc *of_get_named_gpiod_fl
        if (IS_ERR(desc))
                goto out;
  
+       if (flags)
+               of_gpio_flags_quirks(np, flags);
        pr_debug("%s: parsed '%s' property of node '%pOF[%d]' - status (%d)\n",
                 __func__, propname, np, index,
                 PTR_ERR_OR_ZERO(desc));
@@@ -117,6 -156,71 +156,71 @@@ int of_get_named_gpio_flags(struct devi
  }
  EXPORT_SYMBOL(of_get_named_gpio_flags);
  
+ /*
+  * The SPI GPIO bindings happened before we managed to establish that GPIO
+  * properties should be named "foo-gpios" so we have this special kludge for
+  * them.
+  */
+ static struct gpio_desc *of_find_spi_gpio(struct device *dev, const char *con_id,
+                                         enum of_gpio_flags *of_flags)
+ {
+       char prop_name[32]; /* 32 is max size of property name */
+       struct device_node *np = dev->of_node;
+       struct gpio_desc *desc;
+       /*
+        * Hopefully the compiler stubs the rest of the function if this
+        * is false.
+        */
+       if (!IS_ENABLED(CONFIG_SPI_MASTER))
+               return ERR_PTR(-ENOENT);
+       /* Allow this specifically for "spi-gpio" devices */
+       if (!of_device_is_compatible(np, "spi-gpio") || !con_id)
+               return ERR_PTR(-ENOENT);
+       /* Will be "gpio-sck", "gpio-mosi" or "gpio-miso" */
+       snprintf(prop_name, sizeof(prop_name), "%s-%s", "gpio", con_id);
+       desc = of_get_named_gpiod_flags(np, prop_name, 0, of_flags);
+       return desc;
+ }
+ /*
+  * Some regulator bindings happened before we managed to establish that GPIO
+  * properties should be named "foo-gpios" so we have this special kludge for
+  * them.
+  */
+ static struct gpio_desc *of_find_regulator_gpio(struct device *dev, const char *con_id,
+                                               enum of_gpio_flags *of_flags)
+ {
+       /* These are the connection IDs we accept as legacy GPIO phandles */
+       const char *whitelist[] = {
+               "wlf,ldoena", /* Arizona */
+               "wlf,ldo1ena", /* WM8994 */
+               "wlf,ldo2ena", /* WM8994 */
+       };
+       struct device_node *np = dev->of_node;
+       struct gpio_desc *desc;
+       int i;
+       if (!IS_ENABLED(CONFIG_REGULATOR))
+               return ERR_PTR(-ENOENT);
+       if (!con_id)
+               return ERR_PTR(-ENOENT);
+       for (i = 0; i < ARRAY_SIZE(whitelist); i++)
+               if (!strcmp(con_id, whitelist[i]))
+                       break;
+       if (i == ARRAY_SIZE(whitelist))
+               return ERR_PTR(-ENOENT);
+       desc = of_get_named_gpiod_flags(np, con_id, 0, of_flags);
+       return desc;
+ }
  struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
                               unsigned int idx,
                               enum gpio_lookup_flags *flags)
        struct gpio_desc *desc;
        unsigned int i;
  
+       /* Try GPIO property "foo-gpios" and "foo-gpio" */
        for (i = 0; i < ARRAY_SIZE(gpio_suffixes); i++) {
                if (con_id)
                        snprintf(prop_name, sizeof(prop_name), "%s-%s", con_id,
                        break;
        }
  
+       /* Special handling for SPI GPIOs if used */
+       if (IS_ERR(desc))
+               desc = of_find_spi_gpio(dev, con_id, &of_flags);
+       /* Special handling for regulator GPIOs if used */
+       if (IS_ERR(desc))
+               desc = of_find_regulator_gpio(dev, con_id, &of_flags);
        if (IS_ERR(desc))
                return desc;
  
                        *flags |= GPIO_OPEN_SOURCE;
        }
  
-       if (of_flags & OF_GPIO_SLEEP_MAY_LOSE_VALUE)
-               *flags |= GPIO_SLEEP_MAY_LOSE_VALUE;
+       if (of_flags & OF_GPIO_TRANSITORY)
+               *flags |= GPIO_TRANSITORY;
  
        return desc;
  }
@@@ -214,6 -327,8 +327,8 @@@ static struct gpio_desc *of_parse_own_g
  
        if (xlate_flags & OF_GPIO_ACTIVE_LOW)
                *lflags |= GPIO_ACTIVE_LOW;
+       if (xlate_flags & OF_GPIO_TRANSITORY)
+               *lflags |= GPIO_TRANSITORY;
  
        if (of_property_read_bool(np, "input"))
                *dflags |= GPIOD_IN;
@@@ -493,8 -608,7 +608,8 @@@ int of_gpiochip_add(struct gpio_chip *c
  
        /* If the chip defines names itself, these take precedence */
        if (!chip->names)
 -              devprop_gpiochip_set_names(chip);
 +              devprop_gpiochip_set_names(chip,
 +                                         of_fwnode_handle(chip->of_node));
  
        of_node_get(chip->of_node);
  
diff --combined drivers/gpio/gpiolib.c
index 5d6e8bb38ac717fe75e8eb10be6ac3ecbf7e8ee9,1eebd69f369e2ca300d39f21b058c926de62c890..36ca5064486e88acb70390480a83be85e3615bb0
@@@ -73,8 -73,7 +73,8 @@@ LIST_HEAD(gpio_devices)
  
  static void gpiochip_free_hogs(struct gpio_chip *chip);
  static int gpiochip_add_irqchip(struct gpio_chip *gpiochip,
 -                              struct lock_class_key *key);
 +                              struct lock_class_key *lock_key,
 +                              struct lock_class_key *request_key);
  static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip);
  static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gpiochip);
  static void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip);
@@@ -162,7 -161,7 +162,7 @@@ EXPORT_SYMBOL_GPL(desc_to_gpio)
   */
  struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
  {
-       if (!desc || !desc->gdev || !desc->gdev->chip)
+       if (!desc || !desc->gdev)
                return NULL;
        return desc->gdev->chip;
  }
@@@ -196,7 -195,7 +196,7 @@@ static int gpiochip_find_base(int ngpio
   * gpiod_get_direction - return the current direction of a GPIO
   * @desc:     GPIO to get the direction of
   *
-  * Return GPIOF_DIR_IN or GPIOF_DIR_OUT, or an error code in case of error.
+  * Returns 0 for output, 1 for input, or an error code in case of error.
   *
   * This function may sleep if gpiod_cansleep() is true.
   */
@@@ -460,6 -459,15 +460,15 @@@ static int linehandle_create(struct gpi
        if (lflags & ~GPIOHANDLE_REQUEST_VALID_FLAGS)
                return -EINVAL;
  
+       /*
+        * Do not allow OPEN_SOURCE & OPEN_DRAIN flags in a single request. If
+        * the hardware actually supports enabling both at the same time the
+        * electrical result would be disastrous.
+        */
+       if ((lflags & GPIOHANDLE_REQUEST_OPEN_DRAIN) &&
+           (lflags & GPIOHANDLE_REQUEST_OPEN_SOURCE))
+               return -EINVAL;
        /* OPEN_DRAIN and OPEN_SOURCE flags only make sense for output mode. */
        if (!(lflags & GPIOHANDLE_REQUEST_OUTPUT) &&
            ((lflags & GPIOHANDLE_REQUEST_OPEN_DRAIN) ||
                if (lflags & GPIOHANDLE_REQUEST_OPEN_SOURCE)
                        set_bit(FLAG_OPEN_SOURCE, &desc->flags);
  
+               ret = gpiod_set_transitory(desc, false);
+               if (ret < 0)
+                       goto out_free_descs;
                /*
                 * Lines have to be requested explicitly for input
                 * or output, else the line will be treated "as is".
@@@ -588,6 -600,9 +601,9 @@@ out_free_lh
   * @events: KFIFO for the GPIO events
   * @read_lock: mutex lock to protect reads from colliding with adding
   * new events to the FIFO
+  * @timestamp: cache for the timestamp storing it between hardirq
+  * and IRQ thread, used to bring the timestamp close to the actual
+  * event
   */
  struct lineevent_state {
        struct gpio_device *gdev;
        wait_queue_head_t wait;
        DECLARE_KFIFO(events, struct gpioevent_data, 16);
        struct mutex read_lock;
+       u64 timestamp;
  };
  
  #define GPIOEVENT_REQUEST_VALID_FLAGS \
        (GPIOEVENT_REQUEST_RISING_EDGE | \
        GPIOEVENT_REQUEST_FALLING_EDGE)
  
 -static unsigned int lineevent_poll(struct file *filep,
 +static __poll_t lineevent_poll(struct file *filep,
                                   struct poll_table_struct *wait)
  {
        struct lineevent_state *le = filep->private_data;
 -      unsigned int events = 0;
 +      __poll_t events = 0;
  
        poll_wait(filep, &le->wait, wait);
  
@@@ -732,7 -748,10 +749,10 @@@ static irqreturn_t lineevent_irq_thread
        struct gpioevent_data ge;
        int ret, level;
  
-       ge.timestamp = ktime_get_real_ns();
+       /* Do not leak kernel stack to userspace */
+       memset(&ge, 0, sizeof(ge));
+       ge.timestamp = le->timestamp;
        level = gpiod_get_value_cansleep(le->desc);
  
        if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE
        return IRQ_HANDLED;
  }
  
+ static irqreturn_t lineevent_irq_handler(int irq, void *p)
+ {
+       struct lineevent_state *le = p;
+       /*
+        * Just store the timestamp in hardirq context so we get it as
+        * close in time as possible to the actual event.
+        */
+       le->timestamp = ktime_get_real_ns();
+       return IRQ_WAKE_THREAD;
+ }
  static int lineevent_create(struct gpio_device *gdev, void __user *ip)
  {
        struct gpioevent_request eventreq;
  
        /* Request a thread to read the events */
        ret = request_threaded_irq(le->irq,
-                       NULL,
+                       lineevent_irq_handler,
                        lineevent_irq_thread,
                        irqflags,
                        le->label,
@@@ -1050,7 -1082,7 +1083,7 @@@ static void gpiodevice_release(struct d
  
        list_del(&gdev->list);
        ida_simple_remove(&gpio_ida, gdev->id);
-       kfree(gdev->label);
+       kfree_const(gdev->label);
        kfree(gdev->descs);
        kfree(gdev);
  }
@@@ -1101,8 -1133,7 +1134,8 @@@ static void gpiochip_setup_devs(void
  }
  
  int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
 -                             struct lock_class_key *key)
 +                             struct lock_class_key *lock_key,
 +                             struct lock_class_key *request_key)
  {
        unsigned long   flags;
        int             status = 0;
                goto err_free_descs;
        }
  
-       if (chip->label)
-               gdev->label = kstrdup(chip->label, GFP_KERNEL);
-       else
-               gdev->label = kstrdup("unknown", GFP_KERNEL);
+       gdev->label = kstrdup_const(chip->label ?: "unknown", GFP_KERNEL);
        if (!gdev->label) {
                status = -ENOMEM;
                goto err_free_descs;
                struct gpio_desc *desc = &gdev->descs[i];
  
                desc->gdev = gdev;
-               /*
-                * REVISIT: most hardware initializes GPIOs as inputs
-                * (often with pullups enabled) so power usage is
-                * minimized. Linux code should set the gpio direction
-                * first thing; but until it does, and in case
-                * chip->get_direction is not set, we may expose the
-                * wrong direction in sysfs.
-                */
  
-               if (chip->get_direction) {
-                       /*
-                        * If we have .get_direction, set up the initial
-                        * direction flag from the hardware.
-                        */
-                       int dir = chip->get_direction(chip, i);
-                       if (!dir)
-                               set_bit(FLAG_IS_OUT, &desc->flags);
-               } else if (!chip->direction_input) {
-                       /*
-                        * If the chip lacks the .direction_input callback
-                        * we logically assume all lines are outputs.
-                        */
-                       set_bit(FLAG_IS_OUT, &desc->flags);
-               }
+               /* REVISIT: most hardware initializes GPIOs as inputs (often
+                * with pullups enabled) so power usage is minimized. Linux
+                * code should set the gpio direction first thing; but until
+                * it does, and in case chip->get_direction is not set, we may
+                * expose the wrong direction in sysfs.
+                */
+               desc->flags = !chip->direction_input ? (1 << FLAG_IS_OUT) : 0;
        }
  
  #ifdef CONFIG_PINCTRL
        if (status)
                goto err_remove_from_list;
  
 -      status = gpiochip_add_irqchip(chip, key);
 +      status = gpiochip_add_irqchip(chip, lock_key, request_key);
        if (status)
                goto err_remove_chip;
  
@@@ -1283,7 -1294,7 +1296,7 @@@ err_remove_from_list
        list_del(&gdev->list);
        spin_unlock_irqrestore(&gpio_lock, flags);
  err_free_label:
-       kfree(gdev->label);
+       kfree_const(gdev->label);
  err_free_descs:
        kfree(gdev->descs);
  err_free_gdev:
@@@ -1383,7 -1394,7 +1396,7 @@@ static int devm_gpio_chip_match(struct 
  }
  
  /**
-  * devm_gpiochip_add_data() - Resource manager piochip_add_data()
+  * devm_gpiochip_add_data() - Resource manager gpiochip_add_data()
   * @dev: the device pointer on which irq_chip belongs to.
   * @chip: the chip to register, with chip->base initialized
   * @data: driver-private data associated with this chip
@@@ -1510,14 -1521,15 +1523,15 @@@ static void gpiochip_irqchip_free_valid
        gpiochip->irq.valid_mask = NULL;
  }
  
static bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
-                                      unsigned int offset)
+ bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
+                               unsigned int offset)
  {
        /* No mask means all valid */
        if (likely(!gpiochip->irq.valid_mask))
                return true;
        return test_bit(offset, gpiochip->irq.valid_mask);
  }
+ EXPORT_SYMBOL_GPL(gpiochip_irqchip_irq_valid);
  
  /**
   * gpiochip_set_cascaded_irqchip() - connects a cascaded irqchip to a gpiochip
@@@ -1634,7 -1646,7 +1648,7 @@@ int gpiochip_irq_map(struct irq_domain 
         * This lock class tells lockdep that GPIO irqs are in a different
         * category than their parents, so it won't report false recursion.
         */
 -      irq_set_lockdep_class(irq, chip->irq.lock_key);
 +      irq_set_lockdep_class(irq, chip->irq.lock_key, chip->irq.request_key);
        irq_set_chip_and_handler(irq, chip->irq.chip, chip->irq.handler);
        /* Chips that use nested thread handlers have them marked */
        if (chip->irq.threaded)
@@@ -1714,12 -1726,10 +1728,12 @@@ static int gpiochip_to_irq(struct gpio_
  /**
   * gpiochip_add_irqchip() - adds an IRQ chip to a GPIO chip
   * @gpiochip: the GPIO chip to add the IRQ chip to
 - * @lock_key: lockdep class
 + * @lock_key: lockdep class for IRQ lock
 + * @request_key: lockdep class for IRQ request
   */
  static int gpiochip_add_irqchip(struct gpio_chip *gpiochip,
 -                              struct lock_class_key *lock_key)
 +                              struct lock_class_key *lock_key,
 +                              struct lock_class_key *request_key)
  {
        struct irq_chip *irqchip = gpiochip->irq.chip;
        const struct irq_domain_ops *ops;
        gpiochip->to_irq = gpiochip_to_irq;
        gpiochip->irq.default_type = type;
        gpiochip->irq.lock_key = lock_key;
 +      gpiochip->irq.request_key = request_key;
  
        if (gpiochip->irq.domain_ops)
                ops = gpiochip->irq.domain_ops;
@@@ -1855,8 -1864,7 +1869,8 @@@ static void gpiochip_irqchip_remove(str
   * @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE
   * to have the core avoid setting up any default type in the hardware.
   * @threaded: whether this irqchip uses a nested thread handler
 - * @lock_key: lockdep class
 + * @lock_key: lockdep class for IRQ lock
 + * @request_key: lockdep class for IRQ request
   *
   * This function closely associates a certain irqchip with a certain
   * gpiochip, providing an irq domain to translate the local IRQs to
@@@ -1878,8 -1886,7 +1892,8 @@@ int gpiochip_irqchip_add_key(struct gpi
                             irq_flow_handler_t handler,
                             unsigned int type,
                             bool threaded,
 -                           struct lock_class_key *lock_key)
 +                           struct lock_class_key *lock_key,
 +                           struct lock_class_key *request_key)
  {
        struct device_node *of_node;
  
        gpiochip->irq.default_type = type;
        gpiochip->to_irq = gpiochip_to_irq;
        gpiochip->irq.lock_key = lock_key;
 +      gpiochip->irq.request_key = request_key;
        gpiochip->irq.domain = irq_domain_add_simple(of_node,
                                        gpiochip->ngpio, first_irq,
                                        &gpiochip_domain_ops, gpiochip);
@@@ -1948,8 -1954,7 +1962,8 @@@ EXPORT_SYMBOL_GPL(gpiochip_irqchip_add_
  #else /* CONFIG_GPIOLIB_IRQCHIP */
  
  static inline int gpiochip_add_irqchip(struct gpio_chip *gpiochip,
 -                                     struct lock_class_key *key)
 +                                     struct lock_class_key *lock_key,
 +                                     struct lock_class_key *request_key)
  {
        return 0;
  }
@@@ -2174,40 -2179,37 +2188,37 @@@ done
   * macro to avoid endless duplication. If the desc is NULL it is an
   * optional GPIO and calls should just bail out.
   */
+ static int validate_desc(const struct gpio_desc *desc, const char *func)
+ {
+       if (!desc)
+               return 0;
+       if (IS_ERR(desc)) {
+               pr_warn("%s: invalid GPIO (errorpointer)\n", func);
+               return PTR_ERR(desc);
+       }
+       if (!desc->gdev) {
+               pr_warn("%s: invalid GPIO (no device)\n", func);
+               return -EINVAL;
+       }
+       if (!desc->gdev->chip) {
+               dev_warn(&desc->gdev->dev,
+                        "%s: backing chip is gone\n", func);
+               return 0;
+       }
+       return 1;
+ }
  #define VALIDATE_DESC(desc) do { \
-       if (!desc) \
-               return 0; \
-       if (IS_ERR(desc)) {                                             \
-               pr_warn("%s: invalid GPIO (errorpointer)\n", __func__); \
-               return PTR_ERR(desc); \
-       } \
-       if (!desc->gdev) { \
-               pr_warn("%s: invalid GPIO (no device)\n", __func__); \
-               return -EINVAL; \
-       } \
-       if ( !desc->gdev->chip ) { \
-               dev_warn(&desc->gdev->dev, \
-                        "%s: backing chip is gone\n", __func__); \
-               return 0; \
-       } } while (0)
+       int __valid = validate_desc(desc, __func__); \
+       if (__valid <= 0) \
+               return __valid; \
+       } while (0)
  
  #define VALIDATE_DESC_VOID(desc) do { \
-       if (!desc) \
-               return; \
-       if (IS_ERR(desc)) {                                             \
-               pr_warn("%s: invalid GPIO (errorpointer)\n", __func__); \
-               return; \
-       } \
-       if (!desc->gdev) { \
-               pr_warn("%s: invalid GPIO (no device)\n", __func__); \
-               return; \
-       } \
-       if (!desc->gdev->chip) { \
-               dev_warn(&desc->gdev->dev, \
-                        "%s: backing chip is gone\n", __func__); \
+       int __valid = validate_desc(desc, __func__); \
+       if (__valid <= 0) \
                return; \
-       } } while (0)
+       } while (0)
  
  int gpiod_request(struct gpio_desc *desc, const char *label)
  {
@@@ -2456,7 -2458,7 +2467,7 @@@ EXPORT_SYMBOL_GPL(gpiod_direction_outpu
   */
  int gpiod_direction_output(struct gpio_desc *desc, int value)
  {
-       struct gpio_chip *gc = desc->gdev->chip;
+       struct gpio_chip *gc;
        int ret;
  
        VALIDATE_DESC(desc);
                return -EIO;
        }
  
+       gc = desc->gdev->chip;
        if (test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
                /* First see if we can enable open drain in hardware */
                ret = gpio_set_drive_single_ended(gc, gpio_chip_hwgpio(desc),
@@@ -2529,6 -2532,50 +2541,50 @@@ int gpiod_set_debounce(struct gpio_des
  }
  EXPORT_SYMBOL_GPL(gpiod_set_debounce);
  
+ /**
+  * gpiod_set_transitory - Lose or retain GPIO state on suspend or reset
+  * @desc: descriptor of the GPIO for which to configure persistence
+  * @transitory: True to lose state on suspend or reset, false for persistence
+  *
+  * Returns:
+  * 0 on success, otherwise a negative error code.
+  */
+ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory)
+ {
+       struct gpio_chip *chip;
+       unsigned long packed;
+       int gpio;
+       int rc;
+       VALIDATE_DESC(desc);
+       /*
+        * Handle FLAG_TRANSITORY first, enabling queries to gpiolib for
+        * persistence state.
+        */
+       if (transitory)
+               set_bit(FLAG_TRANSITORY, &desc->flags);
+       else
+               clear_bit(FLAG_TRANSITORY, &desc->flags);
+       /* If the driver supports it, set the persistence state now */
+       chip = desc->gdev->chip;
+       if (!chip->set_config)
+               return 0;
+       packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE,
+                                         !transitory);
+       gpio = gpio_chip_hwgpio(desc);
+       rc = chip->set_config(chip, gpio, packed);
+       if (rc == -ENOTSUPP) {
+               dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n",
+                               gpio);
+               return 0;
+       }
+       return rc;
+ }
+ EXPORT_SYMBOL_GPL(gpiod_set_transitory);
  /**
   * gpiod_is_active_low - test whether a GPIO is active-low or not
   * @desc: the gpio descriptor to test
@@@ -2892,27 -2939,6 +2948,27 @@@ void gpiod_set_raw_value(struct gpio_de
  }
  EXPORT_SYMBOL_GPL(gpiod_set_raw_value);
  
 +/**
 + * gpiod_set_value_nocheck() - set a GPIO line value without checking
 + * @desc: the descriptor to set the value on
 + * @value: value to set
 + *
 + * This sets the value of a GPIO line backing a descriptor, applying
 + * different semantic quirks like active low and open drain/source
 + * handling.
 + */
 +static void gpiod_set_value_nocheck(struct gpio_desc *desc, int value)
 +{
 +      if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
 +              value = !value;
 +      if (test_bit(FLAG_OPEN_DRAIN, &desc->flags))
 +              gpio_set_open_drain_value_commit(desc, value);
 +      else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags))
 +              gpio_set_open_source_value_commit(desc, value);
 +      else
 +              gpiod_set_raw_value_commit(desc, value);
 +}
 +
  /**
   * gpiod_set_value() - assign a gpio's value
   * @desc: gpio whose value will be assigned
  void gpiod_set_value(struct gpio_desc *desc, int value)
  {
        VALIDATE_DESC_VOID(desc);
 -      /* Should be using gpiod_set_value_cansleep() */
        WARN_ON(desc->gdev->chip->can_sleep);
 -      if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
 -              value = !value;
 -      if (test_bit(FLAG_OPEN_DRAIN, &desc->flags))
 -              gpio_set_open_drain_value_commit(desc, value);
 -      else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags))
 -              gpio_set_open_source_value_commit(desc, value);
 -      else
 -              gpiod_set_raw_value_commit(desc, value);
 +      gpiod_set_value_nocheck(desc, value);
  }
  EXPORT_SYMBOL_GPL(gpiod_set_value);
  
@@@ -3129,8 -3163,7 +3185,7 @@@ bool gpiochip_line_is_persistent(struc
        if (offset >= chip->ngpio)
                return false;
  
-       return !test_bit(FLAG_SLEEP_MAY_LOSE_VALUE,
-                        &chip->gpiodev->descs[offset].flags);
+       return !test_bit(FLAG_TRANSITORY, &chip->gpiodev->descs[offset].flags);
  }
  EXPORT_SYMBOL_GPL(gpiochip_line_is_persistent);
  
@@@ -3256,7 -3289,9 +3311,7 @@@ void gpiod_set_value_cansleep(struct gp
  {
        might_sleep_if(extra_checks);
        VALIDATE_DESC_VOID(desc);
 -      if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
 -              value = !value;
 -      gpiod_set_raw_value_commit(desc, value);
 +      gpiod_set_value_nocheck(desc, value);
  }
  EXPORT_SYMBOL_GPL(gpiod_set_value_cansleep);
  
@@@ -3565,8 -3600,10 +3620,10 @@@ int gpiod_configure_flags(struct gpio_d
  
        if (lflags & GPIO_OPEN_SOURCE)
                set_bit(FLAG_OPEN_SOURCE, &desc->flags);
-       if (lflags & GPIO_SLEEP_MAY_LOSE_VALUE)
-               set_bit(FLAG_SLEEP_MAY_LOSE_VALUE, &desc->flags);
+       status = gpiod_set_transitory(desc, (lflags & GPIO_TRANSITORY));
+       if (status < 0)
+               return status;
  
        /* No particular flag request, return here... */
        if (!(dflags & GPIOD_FLAGS_BIT_DIR_SET)) {
@@@ -3606,6 -3643,8 +3663,8 @@@ struct gpio_desc *__must_check gpiod_ge
        struct gpio_desc *desc = NULL;
        int status;
        enum gpio_lookup_flags lookupflags = 0;
+       /* Maybe we have a device name, maybe not */
+       const char *devname = dev ? dev_name(dev) : "?";
  
        dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id);
  
                return desc;
        }
  
-       status = gpiod_request(desc, con_id);
+       /*
+        * If a connection label was passed use that, else attempt to use
+        * the device name as label
+        */
+       status = gpiod_request(desc, con_id ? con_id : devname);
        if (status < 0)
                return ERR_PTR(status);
  
  }
  EXPORT_SYMBOL_GPL(gpiod_get_index);
  
+ /**
+  * gpiod_get_from_of_node() - obtain a GPIO from an OF node
+  * @node:     handle of the OF node
+  * @propname: name of the DT property representing the GPIO
+  * @index:    index of the GPIO to obtain for the consumer
+  * @dflags:   GPIO initialization flags
+  * @label:    label to attach to the requested GPIO
+  *
+  * Returns:
+  * On successful request the GPIO pin is configured in accordance with
+  * provided @dflags. If the node does not have the requested GPIO
+  * property, NULL is returned.
+  *
+  * In case of error an ERR_PTR() is returned.
+  */
+ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
+                                        const char *propname, int index,
+                                        enum gpiod_flags dflags,
+                                        const char *label)
+ {
+       struct gpio_desc *desc;
+       unsigned long lflags = 0;
+       enum of_gpio_flags flags;
+       bool active_low = false;
+       bool single_ended = false;
+       bool open_drain = false;
+       bool transitory = false;
+       int ret;
+       desc = of_get_named_gpiod_flags(node, propname,
+                                       index, &flags);
+       if (!desc || IS_ERR(desc)) {
+               /* If it is not there, just return NULL */
+               if (PTR_ERR(desc) == -ENOENT)
+                       return NULL;
+               return desc;
+       }
+       active_low = flags & OF_GPIO_ACTIVE_LOW;
+       single_ended = flags & OF_GPIO_SINGLE_ENDED;
+       open_drain = flags & OF_GPIO_OPEN_DRAIN;
+       transitory = flags & OF_GPIO_TRANSITORY;
+       ret = gpiod_request(desc, label);
+       if (ret)
+               return ERR_PTR(ret);
+       if (active_low)
+               lflags |= GPIO_ACTIVE_LOW;
+       if (single_ended) {
+               if (open_drain)
+                       lflags |= GPIO_OPEN_DRAIN;
+               else
+                       lflags |= GPIO_OPEN_SOURCE;
+       }
+       if (transitory)
+               lflags |= GPIO_TRANSITORY;
+       ret = gpiod_configure_flags(desc, propname, lflags, dflags);
+       if (ret < 0) {
+               gpiod_put(desc);
+               return ERR_PTR(ret);
+       }
+       return desc;
+ }
+ EXPORT_SYMBOL(gpiod_get_from_of_node);
  /**
   * fwnode_get_named_gpiod - obtain a GPIO from firmware node
   * @fwnode:   handle of the firmware node
   * @propname: name of the firmware property representing the GPIO
-  * @index:    index of the GPIO to obtain in the consumer
+  * @index:    index of the GPIO to obtain for the consumer
   * @dflags:   GPIO initialization flags
   * @label:    label to attach to the requested GPIO
   *
   * This function can be used for drivers that get their configuration
-  * from firmware.
+  * from opaque firmware.
   *
-  * Function properly finds the corresponding GPIO using whatever is the
+  * The function properly finds the corresponding GPIO using whatever is the
   * underlying firmware interface and then makes sure that the GPIO
   * descriptor is requested before it is returned to the caller.
   *
@@@ -3677,53 -3791,35 +3811,35 @@@ struct gpio_desc *fwnode_get_named_gpio
  {
        struct gpio_desc *desc = ERR_PTR(-ENODEV);
        unsigned long lflags = 0;
-       bool active_low = false;
-       bool single_ended = false;
-       bool open_drain = false;
        int ret;
  
        if (!fwnode)
                return ERR_PTR(-EINVAL);
  
        if (is_of_node(fwnode)) {
-               enum of_gpio_flags flags;
-               desc = of_get_named_gpiod_flags(to_of_node(fwnode), propname,
-                                               index, &flags);
-               if (!IS_ERR(desc)) {
-                       active_low = flags & OF_GPIO_ACTIVE_LOW;
-                       single_ended = flags & OF_GPIO_SINGLE_ENDED;
-                       open_drain = flags & OF_GPIO_OPEN_DRAIN;
-               }
+               desc = gpiod_get_from_of_node(to_of_node(fwnode),
+                                             propname, index,
+                                             dflags,
+                                             label);
+               return desc;
        } else if (is_acpi_node(fwnode)) {
                struct acpi_gpio_info info;
  
                desc = acpi_node_get_gpiod(fwnode, propname, index, &info);
-               if (!IS_ERR(desc)) {
-                       active_low = info.polarity == GPIO_ACTIVE_LOW;
-                       ret = acpi_gpio_update_gpiod_flags(&dflags, info.flags);
-                       if (ret)
-                               pr_debug("Override GPIO initialization flags\n");
-               }
-       }
+               if (IS_ERR(desc))
+                       return desc;
  
-       if (IS_ERR(desc))
-               return desc;
+               acpi_gpio_update_gpiod_flags(&dflags, &info);
  
+               if (info.polarity == GPIO_ACTIVE_LOW)
+                       lflags |= GPIO_ACTIVE_LOW;
+       }
+       /* Currently only ACPI takes this path */
        ret = gpiod_request(desc, label);
        if (ret)
                return ERR_PTR(ret);
  
-       if (active_low)
-               lflags |= GPIO_ACTIVE_LOW;
-       if (single_ended) {
-               if (open_drain)
-                       lflags |= GPIO_OPEN_DRAIN;
-               else
-                       lflags |= GPIO_OPEN_SOURCE;
-       }
        ret = gpiod_configure_flags(desc, propname, lflags, dflags);
        if (ret < 0) {
                gpiod_put(desc);
diff --combined drivers/gpio/gpiolib.h
index 6c44d165213910a259ee94c85731ab4d1ca68431,0ae9f991ede16ade7361cba353b2a0caf527af03..b17ec6795c81e921460b4b33fd5c2889ebbf797b
@@@ -58,7 -58,7 +58,7 @@@ struct gpio_device 
        struct gpio_desc        *descs;
        int                     base;
        u16                     ngpio;
-       char                    *label;
+       const char              *label;
        void                    *data;
        struct list_head        list;
  
  
  /**
   * struct acpi_gpio_info - ACPI GPIO specific information
+  * @adev: reference to ACPI device which consumes GPIO resource
   * @flags: GPIO initialization flags
   * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
   * @polarity: interrupt polarity as provided by ACPI
   * @triggering: triggering type as provided by ACPI
+  * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping
   */
  struct acpi_gpio_info {
+       struct acpi_device *adev;
        enum gpiod_flags flags;
        bool gpioint;
        int polarity;
        int triggering;
+       unsigned int quirks;
  };
  
  /* gpio suffixes used for ACPI and device tree lookup */
@@@ -124,7 -128,7 +128,7 @@@ void acpi_gpiochip_request_interrupts(s
  void acpi_gpiochip_free_interrupts(struct gpio_chip *chip);
  
  int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags,
-                                enum gpiod_flags update);
+                                struct acpi_gpio_info *info);
  
  struct gpio_desc *acpi_find_gpio(struct device *dev,
                                 const char *con_id,
@@@ -149,7 -153,7 +153,7 @@@ static inline voi
  acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
  
  static inline int
- acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update)
+ acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info)
  {
        return 0;
  }
@@@ -189,6 -193,12 +193,12 @@@ void gpiod_set_array_value_complex(boo
                                   struct gpio_desc **desc_array,
                                   int *value_array);
  
+ /* This is just passed between gpiolib and devres */
+ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
+                                        const char *propname, int index,
+                                        enum gpiod_flags dflags,
+                                        const char *label);
  extern struct spinlock gpio_lock;
  extern struct list_head gpio_devices;
  
@@@ -205,7 -215,7 +215,7 @@@ struct gpio_desc 
  #define FLAG_OPEN_SOURCE 8    /* Gpio is open source type */
  #define FLAG_USED_AS_IRQ 9    /* GPIO is connected to an IRQ */
  #define FLAG_IS_HOGGED        11      /* GPIO is hogged */
- #define FLAG_SLEEP_MAY_LOSE_VALUE 12  /* GPIO may lose value in sleep */
+ #define FLAG_TRANSITORY 12    /* GPIO may lose value in sleep or reset */
  
        /* Connection label */
        const char              *label;
@@@ -228,8 -238,7 +238,8 @@@ static inline int gpio_chip_hwgpio(cons
        return desc - &desc->gdev->descs[0];
  }
  
 -void devprop_gpiochip_set_names(struct gpio_chip *chip);
 +void devprop_gpiochip_set_names(struct gpio_chip *chip,
 +                              const struct fwnode_handle *fwnode);
  
  /* With descriptor prefix */
  
diff --combined include/linux/acpi.h
index a933f87ef98d54100e25e71985cfb8e16c62c06e,06b6eb775115044810a56d95062f29c6ab0ae052..f0ea50ba0550ded8c74d846267b544fcb42c20b5
@@@ -451,7 -451,6 +451,7 @@@ void __init acpi_no_s4_hw_signature(voi
  void __init acpi_old_suspend_ordering(void);
  void __init acpi_nvs_nosave(void);
  void __init acpi_nvs_nosave_s3(void);
 +void __init acpi_sleep_no_blacklist(void);
  #endif /* CONFIG_PM_SLEEP */
  
  struct acpi_osc_context {
@@@ -585,7 -584,6 +585,7 @@@ extern int acpi_nvs_for_each_region(in
  const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
                                               const struct device *dev);
  
 +void *acpi_get_match_data(const struct device *dev);
  extern bool acpi_driver_match_device(struct device *dev,
                                     const struct device_driver *drv);
  int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
@@@ -642,12 -640,6 +642,12 @@@ static inline bool acpi_dev_present(con
        return false;
  }
  
 +static inline const char *
 +acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
 +{
 +      return NULL;
 +}
 +
  static inline bool is_acpi_node(struct fwnode_handle *fwnode)
  {
        return false;
@@@ -763,11 -755,6 +763,11 @@@ static inline const struct acpi_device_
        return NULL;
  }
  
 +static inline void *acpi_get_match_data(const struct device *dev)
 +{
 +      return NULL;
 +}
 +
  static inline bool acpi_driver_match_device(struct device *dev,
                                            const struct device_driver *drv)
  {
@@@ -991,6 -978,11 +991,11 @@@ struct acpi_gpio_mapping 
        const char *name;
        const struct acpi_gpio_params *data;
        unsigned int size;
+ /* Ignore IoRestriction field */
+ #define ACPI_GPIO_QUIRK_NO_IO_RESTRICTION     BIT(0)
+       unsigned int quirks;
  };
  
  #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
index 7258cd676df42c3ea77700d1a6ed15e7957e4f37,b6a05dd0d10a99fb5c1bdc215e5c9129822db5bd..1ba9a331ec515d5a26d994eb512fa712db3f6b15
@@@ -66,10 -66,9 +66,10 @@@ struct gpio_irq_chip 
        /**
         * @lock_key:
         *
 -       * Per GPIO IRQ chip lockdep class.
 +       * Per GPIO IRQ chip lockdep classes.
         */
        struct lock_class_key *lock_key;
 +      struct lock_class_key *request_key;
  
        /**
         * @parent_handler:
@@@ -324,8 -323,7 +324,8 @@@ extern const char *gpiochip_is_requeste
  
  /* add/remove chips */
  extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
 -                                    struct lock_class_key *lock_key);
 +                                    struct lock_class_key *lock_key,
 +                                    struct lock_class_key *request_key);
  
  /**
   * gpiochip_add_data() - register a gpio_chip
   */
  #ifdef CONFIG_LOCKDEP
  #define gpiochip_add_data(chip, data) ({              \
 -              static struct lock_class_key key;       \
 -              gpiochip_add_data_with_key(chip, data, &key);   \
 +              static struct lock_class_key lock_key;  \
 +              static struct lock_class_key request_key;         \
 +              gpiochip_add_data_with_key(chip, data, &lock_key, \
 +                                         &request_key);         \
        })
  #else
 -#define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL)
 +#define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL, NULL)
  #endif
  
  static inline int gpiochip_add(struct gpio_chip *chip)
@@@ -433,9 -429,11 +433,12 @@@ int gpiochip_irqchip_add_key(struct gpi
                             irq_flow_handler_t handler,
                             unsigned int type,
                             bool threaded,
 -                           struct lock_class_key *lock_key);
 +                           struct lock_class_key *lock_key,
 +                           struct lock_class_key *request_key);
  
+ bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
+                               unsigned int offset);
  #ifdef CONFIG_LOCKDEP
  
  /*
@@@ -450,12 -448,10 +453,12 @@@ static inline int gpiochip_irqchip_add(
                                       irq_flow_handler_t handler,
                                       unsigned int type)
  {
 -      static struct lock_class_key key;
 +      static struct lock_class_key lock_key;
 +      static struct lock_class_key request_key;
  
        return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
 -                                      handler, type, false, &key);
 +                                      handler, type, false,
 +                                      &lock_key, &request_key);
  }
  
  static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,
                          unsigned int type)
  {
  
 -      static struct lock_class_key key;
 +      static struct lock_class_key lock_key;
 +      static struct lock_class_key request_key;
  
        return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
 -                                      handler, type, true, &key);
 +                                      handler, type, true,
 +                                      &lock_key, &request_key);
  }
  #else
  static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
                                       unsigned int type)
  {
        return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
 -                                      handler, type, false, NULL);
 +                                      handler, type, false, NULL, NULL);
  }
  
  static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,
                          unsigned int type)
  {
        return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
 -                                      handler, type, true, NULL);
 +                                      handler, type, true, NULL, NULL);
  }
  #endif /* CONFIG_LOCKDEP */