]> Git Repo - linux.git/commitdiff
Merge tag 'iio-for-4.1a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
authorGreg Kroah-Hartman <[email protected]>
Tue, 24 Mar 2015 21:53:52 +0000 (22:53 +0100)
committerGreg Kroah-Hartman <[email protected]>
Tue, 24 Mar 2015 21:53:52 +0000 (22:53 +0100)
Jonathan writes:

First set of new drivers, cleanups and functionality for IIO in the 4.1 cycle.

New drivers
* CM3323 color sensor.
* MS5611 pressure and temperature sensor.

New functionality
* mup6050 - create mux clients for devices described via ACPI. The reasoning
     and approach taken in this patch are complex.  Basically there is no
     otherway of finding out what is there than by some esoteric look ups in
     the ACPI data.
* cm3232 - PM support
* itg3200 - suspend/resume support
* mcp320x - add more ADCs to the kconfig to reflect what the driver supports
     (this patch and the bindings got left behind when the support was added
      a while back).

Docs / utils
* ti-adc128s052 - DT bindings.
* mcp3422 - DT bindings.
* mcp320x - DT bindings
* ABI docs for event threshold scale attributes, in_magn_offset, proximity
  scan_element and thresh falling/rising values for accelerometers.  All
  elements long in use that have slipped by being explicitly documented.
* Tidy up the tools previously in drivers/staging/iio/Documentation and move
  them out to /tools/iio. Yet another move that should have happened long ago.
  This time Roberta Dobrescu did the leg work.  Thanks!

Core Cleanups
* Export userspace IIO headers.  We should have done the appropriate header
  splitting a long time ago. Thanks to Daniel for sorting this out.

* Refactor the registring of attributes for buffers to move all non-custom
  ones to a vector allowing easier additions to the current set in the future.

Driver Cleanups
* gpiod related cleanups.  Make use of the additional parameter to specify
   initial direciton to avoid extra code.
* bmc150 - Various refactorings to reduce code repitition and prepare for
           hardware buffer support.  Some of these cleanups are good even
   without the new functionality.
* kmx61 - direct use of index to an array avoiding a structure element which
          was always the index to an element in an array of that structure.
* vf610 - avoid incorrect type for return from wait_for_completion_timeout.
* gp2ap020a00f - use put_unaligned_le32 for slight code simplification.
ade7754 - improve error handling including suppressing some build warnings.
ade7759 - improve error handling including suppressing some build warnings.
* hmc5843 - Long line and indentation fixes. Also some constifying of various
      constant data.
ade7854 - 80+ character line splitting.
* ad2s1210 - fix wrong printf format string.
* mxs-lradc - fix wrong printf format string.
ade7954-i2c - code alignment fixes and other trivial but worthwhile bits.
* periodic rtc trigger - make the frequency type an unsigned int as it
  is always treated as such.
* jsa1212 - constify struct regmap_config as it is constant.
* ad7793 - typo in the MODULE_DESCRIPTION
* mma9551 - check gpiod_to_irq errors.  Note that this doesn't actually cause
    any trouble but is worth tidying up as obviously incorrect.
* mlx90614 - refactor the register symbols to make it clear which reads are to
    RAM not PROM.

1  2 
MAINTAINERS
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
drivers/iio/light/Kconfig
drivers/staging/iio/adc/mxs-lradc.c
drivers/staging/iio/magnetometer/hmc5843_i2c.c
drivers/staging/iio/meter/ade7754.c
drivers/staging/iio/meter/ade7759.c
drivers/staging/iio/resolver/ad2s1210.c
include/uapi/linux/Kbuild
tools/iio/generic_buffer.c
tools/iio/iio_utils.c

diff --combined MAINTAINERS
index ccf1c898afb1f0bddf05e82de42b0d0fbc93f8f0,6fb6bdc2eb3ff455bfef694f0fdf780684a4a9f5..036284f6cf45dc477d78784278e347a97f982e49
@@@ -34,7 -34,7 +34,7 @@@ trivial patch so apply some common sens
        generalized kernel feature ready for next time.
  
        PLEASE check your patch with the automated style checker
 -      (scripts/checkpatch.pl) to catch trival style violations.
 +      (scripts/checkpatch.pl) to catch trivial style violations.
        See Documentation/CodingStyle for guidance here.
  
        PLEASE CC: the maintainers and mailing lists that are generated
@@@ -270,12 -270,12 +270,12 @@@ F:      drivers/acpi
  F:    drivers/pnp/pnpacpi/
  F:    include/linux/acpi.h
  F:    include/acpi/
 -F:    Documentation/acpi
 +F:    Documentation/acpi/
  F:    Documentation/ABI/testing/sysfs-bus-acpi
  F:    drivers/pci/*acpi*
  F:    drivers/pci/*/*acpi*
  F:    drivers/pci/*/*/*acpi*
 -F:    tools/power/acpi
 +F:    tools/power/acpi/
  
  ACPI COMPONENT ARCHITECTURE (ACPICA)
  M:    Robert Moore <[email protected]>
@@@ -563,12 -563,6 +563,12 @@@ S:       Odd Fixe
  L:    [email protected]
  F:    arch/alpha/
  
 +ALTERA MAILBOX DRIVER
 +M:    Ley Foon Tan <[email protected]>
 +L:    [email protected] (moderated for non-subscribers)
 +S:    Maintained
 +F:    drivers/mailbox/mailbox-altera.c
 +
  ALTERA TRIPLE SPEED ETHERNET DRIVER
  M:    Vince Bridgers <[email protected]>
  L:    [email protected]
@@@ -630,8 -624,6 +630,8 @@@ L:      [email protected]
  T:      git git://people.freedesktop.org/~gabbayo/linux.git
  S:      Supported
  F:      drivers/gpu/drm/amd/amdkfd/
 +F:    drivers/gpu/drm/amd/include/cik_structs.h
 +F:    drivers/gpu/drm/amd/include/kgd_kfd_interface.h
  F:      drivers/gpu/drm/radeon/radeon_kfd.c
  F:      drivers/gpu/drm/radeon/radeon_kfd.h
  F:      include/uapi/linux/kfd_ioctl.h
@@@ -667,13 -659,6 +667,13 @@@ L:       [email protected]
  S:    Maintained
  F:    drivers/media/i2c/ad9389b*
  
 +ANALOG DEVICES INC ADV7180 DRIVER
 +M:    Lars-Peter Clausen <[email protected]>
 +L:    [email protected]
 +W:    http://ez.analog.com/community/linux-device-drivers
 +S:    Supported
 +F:    drivers/media/i2c/adv7180.c
 +
  ANALOG DEVICES INC ADV7511 DRIVER
  M:    Hans Verkuil <[email protected]>
  L:    [email protected]
@@@ -725,7 -710,7 +725,7 @@@ F: staging/iio/trigger/iio-trig-bfin-ti
  
  ANDROID DRIVERS
  M:    Greg Kroah-Hartman <[email protected]>
 -M:    Arve Hjønnevåg <[email protected]>
 +M:    Arve Hjønnevåg <[email protected]>
  M:    Riley Andrews <[email protected]>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/gregkh/staging.git
  L:    [email protected]
@@@ -895,7 -880,6 +895,7 @@@ F: arch/arm/boot/dts/at91*.dt
  F:    arch/arm/boot/dts/at91*.dtsi
  F:    arch/arm/boot/dts/sama*.dts
  F:    arch/arm/boot/dts/sama*.dtsi
 +F:    arch/arm/include/debug/at91.S
  
  ARM/ATMEL AT91 Clock Support
  M:    Boris Brezillon <[email protected]>
@@@ -977,7 -961,7 +977,7 @@@ S: Maintaine
  F:    arch/arm/mach-prima2/
  F:    drivers/clk/sirf/
  F:    drivers/clocksource/timer-prima2.c
 -F:    drivers/clocksource/timer-marco.c
 +F:    drivers/clocksource/timer-atlas7.c
  N:    [^a-z]sirf
  
  ARM/EBSA110 MACHINE SUPPORT
@@@ -1030,16 -1014,6 +1030,16 @@@ F:    arch/arm/mach-mxs
  F:    arch/arm/boot/dts/imx*
  F:    arch/arm/configs/imx*_defconfig
  
 +ARM/FREESCALE VYBRID ARM ARCHITECTURE
 +M:    Shawn Guo <[email protected]>
 +M:    Sascha Hauer <[email protected]>
 +R:    Stefan Agner <[email protected]>
 +L:    [email protected] (moderated for non-subscribers)
 +S:    Maintained
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git
 +F:    arch/arm/mach-imx/*vf610*
 +F:    arch/arm/boot/dts/vf*
 +
  ARM/GLOMATION GESBC9312SX MACHINE SUPPORT
  M:    Lennert Buytenhek <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
@@@ -1186,7 -1160,6 +1186,7 @@@ M:      Sebastian Hesselbarth <sebastian.hes
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-mvebu/
 +F:    drivers/rtc/armada38x-rtc
  
  ARM/Marvell Berlin SoC support
  M:    Sebastian Hesselbarth <[email protected]>
@@@ -1198,7 -1171,6 +1198,7 @@@ ARM/Marvell Dove/MV78xx0/Orion SOC supp
  M:    Jason Cooper <[email protected]>
  M:    Andrew Lunn <[email protected]>
  M:    Sebastian Hesselbarth <[email protected]>
 +M:    Gregory Clement <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-dove/
@@@ -1321,13 -1293,10 +1321,13 @@@ S:   Maintaine
  
  ARM/QUALCOMM SUPPORT
  M:    Kumar Gala <[email protected]>
 +M:    Andy Gross <[email protected]>
  M:    David Brown <[email protected]>
  L:    [email protected]
 +L:    [email protected]
  S:    Maintained
  F:    arch/arm/mach-qcom/
 +F:    drivers/soc/qcom/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/galak/linux-qcom.git
  
  ARM/RADISYS ENP2611 MACHINE SUPPORT
@@@ -1429,6 -1398,7 +1429,6 @@@ F:      arch/arm/configs/ape6evm_defconfi
  F:    arch/arm/configs/armadillo800eva_defconfig
  F:    arch/arm/configs/bockw_defconfig
  F:    arch/arm/configs/kzm9g_defconfig
 -F:    arch/arm/configs/lager_defconfig
  F:    arch/arm/configs/mackerel_defconfig
  F:    arch/arm/configs/marzen_defconfig
  F:    arch/arm/configs/shmobile_defconfig
@@@ -1616,14 -1586,12 +1616,14 @@@ N:   xilin
  F:    drivers/clocksource/cadence_ttc_timer.c
  F:    drivers/i2c/busses/i2c-cadence.c
  F:    drivers/mmc/host/sdhci-of-arasan.c
 +F:    drivers/edac/synopsys_edac.c
  
  ARM SMMU DRIVER
  M:    Will Deacon <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  F:    drivers/iommu/arm-smmu.c
 +F:    drivers/iommu/io-pgtable-arm.c
  
  ARM64 PORT (AARCH64 ARCHITECTURE)
  M:    Catalin Marinas <[email protected]>
@@@ -1692,6 -1660,7 +1692,6 @@@ M:      Jiri Slaby <[email protected]
  M:    Nick Kossifidis <[email protected]>
  M:    "Luis R. Rodriguez" <[email protected]>
  L:    [email protected]
 -L:    [email protected]
  W:    http://wireless.kernel.org/en/users/Drivers/ath5k
  S:    Maintained
  F:    drivers/net/wireless/ath/ath5k/
@@@ -1741,7 -1710,7 +1741,7 @@@ S:      Maintaine
  F:    drivers/net/ethernet/atheros/
  
  ATM
 -M:    Chas Williams <[email protected]>
 +M:    Chas Williams <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  L:    [email protected]
  W:    http://linux-atm.sourceforge.net
@@@ -2076,7 -2045,7 +2076,7 @@@ F:      include/net/bluetooth
  BONDING DRIVER
  M:    Jay Vosburgh <[email protected]>
  M:    Veaceslav Falico <[email protected]>
 -M:    Andy Gospodarek <[email protected]>
 +M:    Andy Gospodarek <[email protected]>
  L:    [email protected]
  W:    http://sourceforge.net/projects/bonding/
  S:    Supported
@@@ -2118,6 -2087,7 +2118,6 @@@ F:      drivers/net/ethernet/broadcom/bnx2x
  
  BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITECTURE
  M:    Christian Daudt <[email protected]>
 -M:    Matt Porter <[email protected]>
  M:    Florian Fainelli <[email protected]>
  L:    [email protected]
  T:    git git://github.com/broadcom/mach-bcm
@@@ -2157,7 -2127,7 +2157,7 @@@ F:      arch/arm/boot/dts/bcm470
  BROADCOM BCM63XX ARM ARCHITECTURE
  M:    Florian Fainelli <[email protected]>
  L:    [email protected]
 -T:    git git://git.github.com/brcm/linux.git
 +T:    git git://github.com/broadcom/arm-bcm63xx.git
  S:    Maintained
  F:    arch/arm/mach-bcm/bcm63xx.c
  F:    arch/arm/include/debug/bcm63xx.S
@@@ -2174,7 -2144,6 +2174,7 @@@ M:      Brian Norris <computersforpeace@gmai
  M:    Gregory Fong <[email protected]>
  M:    Florian Fainelli <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
 +T:    git git://github.com/broadcom/stblinux.git
  S:    Maintained
  F:    arch/arm/mach-bcm/*brcmstb*
  F:    arch/arm/boot/dts/bcm7*.dts*
@@@ -2184,7 -2153,6 +2184,7 @@@ BROADCOM BMIPS MIPS ARCHITECTUR
  M:    Kevin Cernekee <[email protected]>
  M:    Florian Fainelli <[email protected]>
  L:    [email protected]
 +T:    git git://github.com/broadcom/stblinux.git
  S:    Maintained
  F:    arch/mips/bmips/*
  F:    arch/mips/include/asm/mach-bmips/*
@@@ -2227,7 -2195,7 +2227,7 @@@ M:      Ray Jui <[email protected]
  M:    Scott Branden <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  L:    [email protected]
 -T:    git git://git.github.com/brcm/linux.git
 +T:    git git://github.com/broadcom/cygnus-linux.git
  S:    Maintained
  N:    iproc
  N:    cygnus
@@@ -2379,9 -2347,8 +2379,9 @@@ F:      arch/x86/include/asm/tce.
  
  CAN NETWORK LAYER
  M:    Oliver Hartkopp <[email protected]>
 +M:    Marc Kleine-Budde <[email protected]>
  L:    [email protected]
 -W:    http://gitorious.org/linux-can
 +W:    https://github.com/linux-can
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git
  S:    Maintained
@@@ -2397,7 -2364,7 +2397,7 @@@ CAN NETWORK DRIVER
  M:    Wolfgang Grandegger <[email protected]>
  M:    Marc Kleine-Budde <[email protected]>
  L:    [email protected]
 -W:    http://gitorious.org/linux-can
 +W:    https://github.com/linux-can
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git
  S:    Maintained
@@@ -2444,8 -2411,7 +2444,8 @@@ F:      arch/powerpc/oprofile/*cell
  F:    arch/powerpc/platforms/cell/
  
  CEPH DISTRIBUTED FILE SYSTEM CLIENT
 -M:    Sage Weil <[email protected]>
 +M:    Yan, Zheng <[email protected]>
 +M:    Sage Weil <[email protected]>
  L:    [email protected]
  W:    http://ceph.com/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
@@@ -2982,12 -2948,6 +2982,12 @@@ S:    Supporte
  F:    drivers/input/touchscreen/cyttsp*
  F:    include/linux/input/cyttsp.h
  
 +DALLAS/MAXIM DS1685-FAMILY REAL TIME CLOCK
 +M:    Joshua Kinard <[email protected]>
 +S:    Maintained
 +F:    drivers/rtc/rtc-ds1685.c
 +F:    include/linux/rtc/ds1685.h
 +
  DAMA SLAVE for AX.25
  M:    Joerg Reuter <[email protected]>
  W:    http://yaina.de/jreuter/
@@@ -3064,7 -3024,6 +3064,7 @@@ F:      drivers/platform/x86/dell-laptop.
  
  DELL LAPTOP SMM DRIVER
  M:    Guenter Roeck <[email protected]>
 +S:    Maintained
  F:    drivers/char/i8k.c
  F:    include/uapi/linux/i8k.h
  
@@@ -3080,7 -3039,7 +3080,7 @@@ S:      Maintaine
  F:    drivers/platform/x86/dell-wmi.c
  
  DESIGNWARE USB2 DRD IP DRIVER
 -M:    Paul Zimmerman <paulz@synopsys.com>
 +M:    John Youn <johnyoun@synopsys.com>
  L:    [email protected]
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
  S:    Maintained
  S:    Maintained
  F:    drivers/i2c/busses/i2c-diolan-u2c.c
  
 +DIRECT ACCESS (DAX)
 +M:    Matthew Wilcox <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    fs/dax.c
 +
  DIRECTORY NOTIFICATION (DNOTIFY)
  M:    Eric Paris <[email protected]>
  S:    Maintained
@@@ -3266,7 -3219,6 +3266,7 @@@ F:      Documentation
  X:    Documentation/ABI/
  X:    Documentation/devicetree/
  X:    Documentation/[a-z][a-z]_[A-Z][A-Z]/
 +T:    git git://git.lwn.net/linux-2.6.git docs-next
  
  DOUBLETALK DRIVER
  M:    "James R. Van Zandt" <[email protected]>
@@@ -3526,14 -3478,6 +3526,14 @@@ M:    "Maciej W. Rozycki" <macro@linux-mip
  S:    Maintained
  F:    drivers/tty/serial/dz.*
  
 +E3X0 POWER BUTTON DRIVER
 +M:    Moritz Fischer <[email protected]>
 +L:    [email protected]
 +W:    http://www.ettus.com
 +S:    Supported
 +F:    drivers/input/misc/e3x0-button.c
 +F:    Documentation/devicetree/bindings/input/e3x0-button.txt
 +
  E4000 MEDIA DRIVER
  M:    Antti Palosaari <[email protected]>
  L:    [email protected]
@@@ -3575,8 -3519,6 +3575,8 @@@ M:      Borislav Petkov <[email protected]
  M:    Mauro Carvalho Chehab <[email protected]>
  L:    [email protected]
  W:    bluesmoke.sourceforge.net
 +T:    git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git#for-next
 +T:    git://git.kernel.org/pub/linux/kernel/git/mchehab/linux-edac.git#linux_next
  S:    Supported
  F:    Documentation/edac.txt
  F:    drivers/edac/
@@@ -3948,7 -3890,7 +3948,7 @@@ S:      Maintaine
  F:    drivers/staging/fbtft/
  
  FCOE SUBSYSTEM (libfc, libfcoe, fcoe)
 -M:    Robert Love <robert.w.love@intel.com>
 +M:    Vasu Dev <vasu.dev@intel.com>
  L:    [email protected]
  W:    www.Open-FCoE.org
  S:    Supported
@@@ -4104,12 -4046,6 +4104,12 @@@ S:    Maintaine
  F:    include/linux/platform_data/video-imxfb.h
  F:    drivers/video/fbdev/imxfb.c
  
 +FREESCALE QUAD SPI DRIVER
 +M:    Han Xu <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/mtd/spi-nor/fsl-quadspi.c
 +
  FREESCALE SOC FS_ENET DRIVER
  M:    Pantelis Antoniou <[email protected]>
  M:    Vitaly Bordug <[email protected]>
@@@ -4156,12 -4092,6 +4156,12 @@@ F:    sound/soc/fsl/fsl
  F:    sound/soc/fsl/imx*
  F:    sound/soc/fsl/mpc8610_hpcd.c
  
 +FREESCALE QORIQ MANAGEMENT COMPLEX DRIVER
 +M:    J. German Rivera <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/staging/fsl-mc/
 +
  FREEVXFS FILESYSTEM
  M:    Christoph Hellwig <[email protected]>
  W:    ftp://ftp.openlinux.org/pub/people/hch/vxfs
@@@ -4256,11 -4186,6 +4256,11 @@@ W:    http://www.icp-vortex.com
  S:    Supported
  F:    drivers/scsi/gdt*
  
 +GDB KERNEL DEBUGGING HELPER SCRIPTS
 +M:    Jan Kiszka <[email protected]>
 +S:    Supported
 +F:    scripts/gdb/
 +
  GEMTEK FM RADIO RECEIVER DRIVER
  M:    Hans Verkuil <[email protected]>
  L:    [email protected]
@@@ -4495,7 -4420,6 +4495,7 @@@ F:      include/linux/hwmon*.
  HARDWARE RANDOM NUMBER GENERATOR CORE
  M:    Matt Mackall <[email protected]>
  M:    Herbert Xu <[email protected]>
 +L:    [email protected]
  S:    Odd fixes
  F:    Documentation/hw_random.txt
  F:    drivers/char/hw_random/
@@@ -4947,6 -4871,7 +4947,7 @@@ S:      Maintaine
  F:    drivers/iio/
  F:    drivers/staging/iio/
  F:    include/linux/iio/
+ F:    tools/iio/
  
  IKANOS/ADI EAGLE ADSL USB DRIVER
  M:    Matthieu Castet <[email protected]>
@@@ -4981,7 -4906,7 +4982,7 @@@ F:      drivers/ipack
  
  INTEGRITY MEASUREMENT ARCHITECTURE (IMA)
  M:    Mimi Zohar <[email protected]>
 -M:    Dmitry Kasatkin <d.kasatkin@samsung.com>
 +M:    Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
  L:    [email protected]
  L:    [email protected]
  L:    [email protected]
@@@ -5041,16 -4966,6 +5042,16 @@@ F:    Documentation/input/multi-touch-prot
  F:    drivers/input/input-mt.c
  K:    \b(ABS|SYN)_MT_
  
 +INTEL ASoC BDW/HSW DRIVERS
 +M:    Jie Yang <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    sound/soc/intel/sst-haswell*
 +F:    sound/soc/intel/sst-dsp*
 +F:    sound/soc/intel/sst-firmware.c
 +F:    sound/soc/intel/broadwell.c
 +F:    sound/soc/intel/haswell.c
 +
  INTEL C600 SERIES SAS CONTROLLER DRIVER
  M:    Intel SCU Linux support <[email protected]>
  M:    Artur Paszkiewicz <[email protected]>
@@@ -5938,21 -5853,6 +5939,21 @@@ F:    Documentation/misc-devices/lis3lv02
  F:    drivers/misc/lis3lv02d/
  F:    drivers/platform/x86/hp_accel.c
  
 +LIVE PATCHING
 +M:    Josh Poimboeuf <[email protected]>
 +M:    Seth Jennings <[email protected]>
 +M:    Jiri Kosina <[email protected]>
 +M:    Vojtech Pavlik <[email protected]>
 +S:    Maintained
 +F:    kernel/livepatch/
 +F:    include/linux/livepatch.h
 +F:    arch/x86/include/asm/livepatch.h
 +F:    arch/x86/kernel/livepatch.c
 +F:    Documentation/ABI/testing/sysfs-kernel-livepatch
 +F:    samples/livepatch/
 +L:    [email protected]
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching.git
 +
  LLC (802.2)
  M:    Arnaldo Carvalho de Melo <[email protected]>
  S:    Maintained
@@@ -6251,33 -6151,6 +6252,33 @@@ F:    Documentation/devicetree/bindings/i2
  F:    drivers/hwmon/max6697.c
  F:    include/linux/platform_data/max6697.h
  
 +MAXIM MUIC CHARGER DRIVERS FOR EXYNOS BASED BOARDS
 +M:    Krzysztof Kozlowski <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    drivers/power/max14577_charger.c
 +F:    drivers/power/max77693_charger.c
 +
 +MAXIM PMIC AND MUIC DRIVERS FOR EXYNOS BASED BOARDS
 +M:    Chanwoo Choi <[email protected]>
 +M:    Krzysztof Kozlowski <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    drivers/*/max14577.c
 +F:    drivers/*/max77686.c
 +F:    drivers/*/max77693.c
 +F:    drivers/extcon/extcon-max14577.c
 +F:    drivers/extcon/extcon-max77693.c
 +F:    drivers/rtc/rtc-max77686.c
 +F:    drivers/clk/clk-max77686.c
 +F:    Documentation/devicetree/bindings/mfd/max14577.txt
 +F:    Documentation/devicetree/bindings/mfd/max77686.txt
 +F:    Documentation/devicetree/bindings/mfd/max77693.txt
 +F:    Documentation/devicetree/bindings/clock/maxim,max77686.txt
 +F:    include/linux/mfd/max14577*.h
 +F:    include/linux/mfd/max77686*.h
 +F:    include/linux/mfd/max77693*.h
 +
  MAXIRADIO FM RADIO RECEIVER DRIVER
  M:    Hans Verkuil <[email protected]>
  L:    [email protected]
@@@ -6308,6 -6181,14 +6309,6 @@@ F:     include/uapi/linux/meye.
  F:    include/uapi/linux/ivtv*
  F:    include/uapi/linux/uvcvideo.h
  
 -MEDIAVISION PRO MOVIE STUDIO DRIVER
 -M:    Hans Verkuil <[email protected]>
 -L:    [email protected]
 -T:    git git://linuxtv.org/media_tree.git
 -W:    http://linuxtv.org
 -S:    Odd Fixes
 -F:    drivers/media/parport/pms*
 -
  MEGARAID SCSI/SAS DRIVERS
  M:    Kashyap Desai <[email protected]>
  M:    Sumit Saxena <[email protected]>
@@@ -6725,10 -6606,9 +6726,10 @@@ F:    include/uapi/linux/netrom.
  F:    net/netrom/
  
  NETWORK BLOCK DEVICE (NBD)
 -M:    Paul Clements <[email protected]>
 +M:    Markus Pargmann <[email protected]>
  S:    Maintained
  L:    [email protected]
 +T:    git git://git.pengutronix.de/git/mpa/linux-nbd.git
  F:    Documentation/blockdev/nbd.txt
  F:    drivers/block/nbd.c
  F:    include/linux/nbd.h
@@@ -6757,7 -6637,6 +6758,7 @@@ F:      include/linux/netdevice.
  F:    include/uapi/linux/in.h
  F:    include/uapi/linux/net.h
  F:    include/uapi/linux/netdevice.h
 +F:    include/uapi/linux/net_namespace.h
  F:    tools/net/
  F:    tools/testing/selftests/net/
  F:    lib/random32.c
@@@ -6862,7 -6741,6 +6863,7 @@@ F:      Documentation/devicetree/bindings/ne
  
  NFS, SUNRPC, AND LOCKD CLIENTS
  M:    Trond Myklebust <[email protected]>
 +M:    Anna Schumaker <[email protected]>
  L:    [email protected]
  W:    http://client.linux-nfs.org
  T:    git git://git.linux-nfs.org/projects/trondmy/linux-nfs.git
@@@ -6905,7 -6783,7 +6906,7 @@@ F:      drivers/scsi/nsp32
  NIOS2 ARCHITECTURE
  M:    Ley Foon Tan <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
 -T:    git git://git.rocketboards.org/linux-socfpga.git
 +T:    git git://git.rocketboards.org/linux-socfpga-next.git
  S:    Maintained
  F:    arch/nios2/
  
  S:    Maintained
  F:    arch/arm/mach-omap2/omap_hwmod.*
  
 +OMAP HWMOD DATA
 +M:    Paul Walmsley <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    arch/arm/mach-omap2/omap_hwmod*data*
 +
  OMAP HWMOD DATA FOR OMAP4-BASED DEVICES
  M:    Benoît Cousson <[email protected]>
  L:    [email protected]
@@@ -7203,12 -7075,11 +7204,12 @@@ F:   arch/openrisc
  
  OPENVSWITCH
  M:    Pravin Shelar <[email protected]>
 +L:    [email protected]
  L:    [email protected]
  W:    http://openvswitch.org
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pshelar/openvswitch.git
  S:    Maintained
  F:    net/openvswitch/
 +F:    include/uapi/linux/openvswitch.h
  
  OPL4 DRIVER
  M:    Clemens Ladisch <[email protected]>
@@@ -7230,7 -7101,8 +7231,7 @@@ ORACLE CLUSTER FILESYSTEM 2 (OCFS2
  M:    Mark Fasheh <[email protected]>
  M:    Joel Becker <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
 -W:    http://oss.oracle.com/projects/ocfs2/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2.git
 +W:    http://ocfs2.wiki.kernel.org
  S:    Supported
  F:    Documentation/filesystems/ocfs2.txt
  F:    Documentation/filesystems/dlmfs.txt
@@@ -7319,7 -7191,7 +7320,7 @@@ M:      Alok Kataria <[email protected]
  M:    Rusty Russell <[email protected]>
  L:    [email protected]
  S:    Supported
 -F:    Documentation/ia64/paravirt_ops.txt
 +F:    Documentation/virtual/paravirt_ops.txt
  F:    arch/*/kernel/paravirt*
  F:    arch/*/include/asm/paravirt.h
  
@@@ -7405,14 -7277,6 +7406,14 @@@ F:    include/linux/pci
  F:    arch/x86/pci/
  F:    arch/x86/kernel/quirks.c
  
 +PCI DRIVER FOR ARM VERSATILE PLATFORM
 +M:    Rob Herring <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/pci/versatile.txt
 +F:    drivers/pci/host/pci-versatile.c
 +
  PCI DRIVER FOR APPLIEDMICRO XGENE
  M:    Tanmay Inamdar <[email protected]>
  L:    [email protected]
@@@ -8014,9 -7878,17 +8015,9 @@@ T:     git git://github.com/KrasnikovEugene
  S:    Supported
  F:    drivers/net/wireless/ath/wcn36xx/
  
 -QUICKCAM PARALLEL PORT WEBCAMS
 -M:    Hans Verkuil <[email protected]>
 -L:    [email protected]
 -T:    git git://linuxtv.org/media_tree.git
 -W:    http://linuxtv.org
 -S:    Odd Fixes
 -F:    drivers/media/parport/*-qcam*
 -
  RADOS BLOCK DEVICE (RBD)
 -M:    Yehuda Sadeh <yehuda@inktank.com>
 -M:    Sage Weil <sage@inktank.com>
 +M:    Ilya Dryomov <idryomov@gmail.com>
 +M:    Sage Weil <sage@redhat.com>
  M:    Alex Elder <[email protected]>
  M:    [email protected]
  W:    http://ceph.com/
@@@ -8202,13 -8074,6 +8203,13 @@@ S:    Maintaine
  F:    Documentation/rfkill.txt
  F:    net/rfkill/
  
 +RHASHTABLE
 +M:    Thomas Graf <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    lib/rhashtable.c
 +F:    include/linux/rhashtable.h
 +
  RICOH SMARTMEDIA/XD DRIVER
  M:    Maxim Levitsky <[email protected]>
  S:    Maintained
@@@ -8497,14 -8362,6 +8498,14 @@@ S:    Supporte
  L:    [email protected]
  F:    drivers/net/ethernet/samsung/sxgbe/
  
 +SAMSUNG THERMAL DRIVER
 +M:    Lukasz Majewski <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Supported
 +T:    https://github.com/lmajewski/linux-samsung-thermal.git
 +F:    drivers/thermal/samsung/
 +
  SAMSUNG USB2 PHY DRIVER
  M:    Kamil Debski <[email protected]>
  L:    [email protected]
@@@ -8528,7 -8385,6 +8529,7 @@@ SYNOPSYS DESIGNWARE DMAC DRIVE
  M:    Viresh Kumar <[email protected]>
  M:    Andy Shevchenko <[email protected]>
  S:    Maintained
 +F:    include/linux/dma/dw.h
  F:    include/linux/platform_data/dma-dw.h
  F:    drivers/dma/dw/
  
@@@ -8560,6 -8416,12 +8561,6 @@@ F:     kernel/time/clocksource.
  F:    kernel/time/time*.c
  F:    kernel/time/ntp.c
  
 -TLG2300 VIDEO4LINUX-2 DRIVER
 -M:    Huang Shijie <[email protected]>
 -M:    Hans Verkuil <[email protected]>
 -S:    Odd Fixes
 -F:    drivers/media/usb/tlg2300/
 -
  SC1200 WDT DRIVER
  M:    Zwane Mwaikambo <[email protected]>
  S:    Maintained
@@@ -8591,7 -8453,7 +8592,7 @@@ S:      Maintaine
  F:    drivers/scsi/sr*
  
  SCSI RDMA PROTOCOL (SRP) INITIATOR
 -M:    Bart Van Assche <b[email protected]>
 +M:    Bart Van Assche <b[email protected]>
  L:    [email protected]
  S:    Supported
  W:    http://www.openfabrics.org
@@@ -8925,15 -8787,6 +8926,15 @@@ S:    Maintaine
  F:    drivers/media/platform/davinci/
  F:    include/media/davinci/
  
 +TI AM437X VPFE DRIVER
 +M:    Lad, Prabhakar <[email protected]>
 +L:    [email protected]
 +W:    http://linuxtv.org/
 +Q:    http://patchwork.linuxtv.org/project/linux-media/list/
 +T:    git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
 +S:    Maintained
 +F:    drivers/media/platform/am437x/
 +
  SIS 190 ETHERNET DRIVER
  M:    Francois Romieu <[email protected]>
  L:    [email protected]
@@@ -9015,8 -8868,6 +9016,8 @@@ F:      drivers/media/i2c/smiapp
  F:    include/media/smiapp.h
  F:    drivers/media/i2c/smiapp-pll.c
  F:    drivers/media/i2c/smiapp-pll.h
 +F:    include/uapi/linux/smiapp.h
 +F:    Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
  
  SMM665 HARDWARE MONITOR DRIVER
  M:    Guenter Roeck <[email protected]>
@@@ -9083,7 -8934,6 +9084,7 @@@ SOFTLOGIC 6x10 MPEG CODE
  M:    Bluecherry Maintainers <[email protected]>
  M:    Andrey Utkin <[email protected]>
  M:    Andrey Utkin <[email protected]>
 +M:    Ismael Luceno <[email protected]>
  L:    [email protected]
  S:    Supported
  F:    drivers/media/pci/solo6x10/
  S:    Maintained
  F:    drivers/staging/sm7xxfb/
  
 +STAGING - SILICON MOTION SM750 FRAME BUFFER DRIVER
 +M:    Sudip Mukherjee <[email protected]>
 +M:    Teddy Wang <[email protected]>
 +M:    Sudip Mukherjee <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/staging/sm750fb/
 +
  STAGING - SLICOSS
  M:    Lior Dotan <[email protected]>
  M:    Christopher Harrer <[email protected]>
@@@ -9412,13 -9254,6 +9413,13 @@@ F:    arch/m68k/sun3*
  F:    arch/m68k/include/asm/sun3*
  F:    drivers/net/ethernet/i825xx/sun3*
  
 +SUN4I LOW RES ADC ATTACHED TABLET KEYS DRIVER
 +M:    Hans de Goede <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
 +F:    drivers/input/keyboard/sun4i-lradc-keys.c
 +
  SUNDANCE NETWORK DRIVER
  M:    Denis Kirjanov <[email protected]>
  L:    [email protected]
@@@ -9427,6 -9262,7 +9428,6 @@@ F:      drivers/net/ethernet/dlink/sundance.
  
  SUPERH
  L:    [email protected]
 -W:    http://www.linux-sh.org
  Q:    http://patchwork.kernel.org/project/linux-sh/list/
  S:    Orphan
  F:    Documentation/sh/
  S:    Maintained
  F:    drivers/thermal/ti-soc-thermal/
  
 +TI CDCE706 CLOCK DRIVER
 +M:    Max Filippov <[email protected]>
 +S:    Maintained
 +F:    drivers/clk/clk-cdce706.c
 +
  TI CLOCK DRIVER
  M:    Tero Kristo <[email protected]>
  L:    [email protected]
@@@ -9810,13 -9641,6 +9811,13 @@@ F:    drivers/power/lp8788-charger.
  F:    drivers/regulator/lp8788-*.c
  F:    include/linux/mfd/lp8788*.h
  
 +TI NETCP ETHERNET DRIVER
 +M:    Wingman Kwok <[email protected]>
 +M:    Murali Karicheri <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/net/ethernet/ti/netcp*
 +
  TI TWL4030 SERIES SOC CODEC DRIVER
  M:    Peter Ujfalusi <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
@@@ -9844,7 -9668,7 +9845,7 @@@ F:      net/tipc
  
  TILE ARCHITECTURE
  M:    Chris Metcalf <[email protected]>
 -W:    http://www.tilera.com/scm/
 +W:    http://www.ezchip.com/scm/
  S:    Supported
  F:    arch/tile/
  F:    drivers/char/tile-srom.c
@@@ -9937,21 -9761,13 +9938,21 @@@ F:   drivers/media/pci/tw68
  
  TPM DEVICE DRIVER
  M:    Peter Huewe <[email protected]>
 -M:    Ashley Lai <[email protected]>
  M:    Marcel Selhorst <[email protected]>
  W:    http://tpmdd.sourceforge.net
  L:    [email protected] (moderated for non-subscribers)
 +Q:    git git://github.com/PeterHuewe/linux-tpmdd.git
 +T:    https://github.com/PeterHuewe/linux-tpmdd
  S:    Maintained
  F:    drivers/char/tpm/
  
 +TPM IBM_VTPM DEVICE DRIVER
 +M:    Ashley Lai <[email protected]>
 +W:    http://tpmdd.sourceforge.net
 +L:    [email protected] (moderated for non-subscribers)
 +S:    Maintained
 +F:    drivers/char/tpm/tpm_ibmvtpm*
 +
  TRACING
  M:    Steven Rostedt <[email protected]>
  M:    Ingo Molnar <[email protected]>
@@@ -10106,15 -9922,20 +10107,15 @@@ F: drivers/scsi/ufs
  
  UNSORTED BLOCK IMAGES (UBI)
  M:    Artem Bityutskiy <[email protected]>
 +M:    Richard Weinberger <[email protected]>
  W:    http://www.linux-mtd.infradead.org/
  L:    [email protected]
  T:    git git://git.infradead.org/ubifs-2.6.git
 -S:    Maintained
 +S:    Supported
  F:    drivers/mtd/ubi/
  F:    include/linux/mtd/ubi.h
  F:    include/uapi/mtd/ubi-user.h
  
 -UNSORTED BLOCK IMAGES (UBI) Fastmap
 -M:    Richard Weinberger <[email protected]>
 -L:    [email protected]
 -S:    Maintained
 -F:    drivers/mtd/ubi/fastmap.c
 -
  USB ACM DRIVER
  M:    Oliver Neukum <[email protected]>
  L:    [email protected]
@@@ -10221,13 -10042,6 +10222,13 @@@ S: Maintaine
  F:    Documentation/usb/ohci.txt
  F:    drivers/usb/host/ohci*
  
 +USB OTG FSM (Finite State Machine)
 +M:    Peter Chen <[email protected]>
 +T:    git git://github.com/hzpeterchen/linux-usb.git
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/usb/common/usb-otg-fsm.c
 +
  USB OVER IP DRIVER
  M:    Valentina Manea <[email protected]>
  M:    Shuah Khan <[email protected]>
@@@ -10811,7 -10625,6 +10812,7 @@@ F:   drivers/pci/*xen
  
  XEN BLOCK SUBSYSTEM
  M:    Konrad Rzeszutek Wilk <[email protected]>
 +M:    Roger Pau Monné <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Supported
  F:    drivers/block/xen-blkback/*
@@@ -10867,7 -10680,6 +10868,7 @@@ M:   Max Filippov <[email protected]
  L:    [email protected]
  S:    Maintained
  F:    drivers/spi/spi-xtensa-xtfpga.c
 +F:    sound/soc/xtensa/xtfpga-i2s.c
  
  YAM DRIVER FOR AX.25
  M:    Jean-Paul Roubelat <[email protected]>
index d8d5bed65e072cae577968edb78e2e592c2a5bfa,c42e08ee92dadce01520829dbdf1f8cf6c63c272..5613f3ab9f96a903c709a54559c83fe679fa6f15
@@@ -780,11 -780,7 +780,11 @@@ static int inv_mpu_probe(struct i2c_cli
  
        i2c_set_clientdata(client, indio_dev);
        indio_dev->dev.parent = &client->dev;
 -      indio_dev->name = id->name;
 +      /* id will be NULL when enumerated via ACPI */
 +      if (id)
 +              indio_dev->name = (char *)id->name;
 +      else
 +              indio_dev->name = (char *)dev_name(&client->dev);
        indio_dev->channels = inv_mpu_channels;
        indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels);
  
                goto out_unreg_device;
        }
  
+       result = inv_mpu_acpi_create_mux_client(st);
+       if (result)
+               goto out_del_mux;
        return 0;
  
+ out_del_mux:
+       i2c_del_mux_adapter(st->mux_adapter);
  out_unreg_device:
        iio_device_unregister(indio_dev);
  out_remove_trigger:
@@@ -841,6 -843,7 +847,7 @@@ static int inv_mpu_remove(struct i2c_cl
        struct iio_dev *indio_dev = i2c_get_clientdata(client);
        struct inv_mpu6050_state *st = iio_priv(indio_dev);
  
+       inv_mpu_acpi_delete_mux_client(st);
        i2c_del_mux_adapter(st->mux_adapter);
        iio_device_unregister(indio_dev);
        inv_mpu6050_remove_trigger(st);
index a224afd6380c84eff7c76996c7c38eb621493140,cd937d9293ffe1cbe849500a38da986d45b9f720..01a1a16ab7be8fcc4ae7df6a2782caa377b271a7
@@@ -59,6 -59,16 +59,16 @@@ config CM323
         To compile this driver as a module, choose M here:
         the module will be called cm3232.
  
+ config CM3323
+       depends on I2C
+       tristate "Capella CM3323 color light sensor"
+       help
+        Say Y here if you want to build a driver for Capela CM3323
+        color sensor.
+        To compile this driver as a module, choose M here: the module will
+        be called cm3323.
  config CM36651
        depends on I2C
        tristate "CM36651 driver"
@@@ -73,7 -83,6 +83,7 @@@
  config GP2AP020A00F
        tristate "Sharp GP2AP020A00F Proximity/ALS sensor"
        depends on I2C
 +      select REGMAP_I2C
        select IIO_BUFFER
        select IIO_TRIGGERED_BUFFER
        select IRQ_WORK
@@@ -127,7 -136,6 +137,7 @@@ config HID_SENSOR_PRO
  config JSA1212
        tristate "JSA1212 ALS and proximity sensor driver"
        depends on I2C
 +      select REGMAP_I2C
        help
         Say Y here if you want to build a IIO driver for JSA1212
         proximity & ALS sensor device.
index 816174388f13347447c495700e3dad85e7c269db,d5f8ea96f4bc10c61e4b2ed202fbe3b9ca71b477..17f4ee7f8b76b82ca551d5455730ab306924b070
@@@ -214,17 -214,11 +214,17 @@@ struct mxs_lradc 
        unsigned long           is_divided;
  
        /*
 -       * Touchscreen LRADC channels receives a private slot in the CTRL4
 -       * register, the slot #7. Therefore only 7 slots instead of 8 in the
 -       * CTRL4 register can be mapped to LRADC channels when using the
 -       * touchscreen.
 -       *
 +       * When the touchscreen is enabled, we give it two private virtual
 +       * channels: #6 and #7. This means that only 6 virtual channels (instead
 +       * of 8) will be available for buffered capture.
 +       */
 +#define TOUCHSCREEN_VCHANNEL1         7
 +#define TOUCHSCREEN_VCHANNEL2         6
 +#define BUFFER_VCHANS_LIMITED         0x3f
 +#define BUFFER_VCHANS_ALL             0xff
 +      u8                      buffer_vchans;
 +
 +      /*
         * Furthermore, certain LRADC channels are shared between touchscreen
         * and/or touch-buttons and generic LRADC block. Therefore when using
         * either of these, these channels are not available for the regular
  #define       LRADC_CTRL4                             0x140
  #define       LRADC_CTRL4_LRADCSELECT_MASK(n)         (0xf << ((n) * 4))
  #define       LRADC_CTRL4_LRADCSELECT_OFFSET(n)       ((n) * 4)
 +#define       LRADC_CTRL4_LRADCSELECT(n, x) \
 +                              (((x) << LRADC_CTRL4_LRADCSELECT_OFFSET(n)) & \
 +                              LRADC_CTRL4_LRADCSELECT_MASK(n))
  
  #define LRADC_RESOLUTION                      12
  #define LRADC_SINGLE_SAMPLE_MASK              ((1 << LRADC_RESOLUTION) - 1)
@@@ -425,14 -416,6 +425,14 @@@ static bool mxs_lradc_check_touch_event
                                        LRADC_STATUS_TOUCH_DETECT_RAW);
  }
  
 +static void mxs_lradc_map_channel(struct mxs_lradc *lradc, unsigned vch,
 +                                unsigned ch)
 +{
 +      mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(vch),
 +                              LRADC_CTRL4);
 +      mxs_lradc_reg_set(lradc, LRADC_CTRL4_LRADCSELECT(vch, ch), LRADC_CTRL4);
 +}
 +
  static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch)
  {
        /*
                LRADC_DELAY_DELAY(lradc->over_sample_delay - 1),
                        LRADC_DELAY(3));
  
 -      mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) |
 -                      LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) |
 -                      LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1);
 +      mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch), LRADC_CTRL1);
  
 -      /* wake us again, when the complete conversion is done */
 -      mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch), LRADC_CTRL1);
        /*
         * after changing the touchscreen plates setting
         * the signals need some initial time to settle. Start the
@@@ -522,8 -509,12 +522,8 @@@ static void mxs_lradc_setup_ts_pressure
                LRADC_DELAY_DELAY(lradc->over_sample_delay - 1),
                                        LRADC_DELAY(3));
  
 -      mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) |
 -                      LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) |
 -                      LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1);
 +      mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch2), LRADC_CTRL1);
  
 -      /* wake us again, when the conversions are done */
 -      mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch2), LRADC_CTRL1);
        /*
         * after changing the touchscreen plates setting
         * the signals need some initial time to settle. Start the
@@@ -589,6 -580,36 +589,6 @@@ static unsigned mxs_lradc_read_ts_press
  #define TS_CH_XM 4
  #define TS_CH_YM 5
  
 -static int mxs_lradc_read_ts_channel(struct mxs_lradc *lradc)
 -{
 -      u32 reg;
 -      int val;
 -
 -      reg = readl(lradc->base + LRADC_CTRL1);
 -
 -      /* only channels 3 to 5 are of interest here */
 -      if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YP)) {
 -              mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YP) |
 -                      LRADC_CTRL1_LRADC_IRQ(TS_CH_YP), LRADC_CTRL1);
 -              val = mxs_lradc_read_raw_channel(lradc, TS_CH_YP);
 -      } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_XM)) {
 -              mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_XM) |
 -                      LRADC_CTRL1_LRADC_IRQ(TS_CH_XM), LRADC_CTRL1);
 -              val = mxs_lradc_read_raw_channel(lradc, TS_CH_XM);
 -      } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YM)) {
 -              mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YM) |
 -                      LRADC_CTRL1_LRADC_IRQ(TS_CH_YM), LRADC_CTRL1);
 -              val = mxs_lradc_read_raw_channel(lradc, TS_CH_YM);
 -      } else {
 -              return -EIO;
 -      }
 -
 -      mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2));
 -      mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3));
 -
 -      return val;
 -}
 -
  /*
   * YP(open)--+-------------+
   *           |             |--+
@@@ -632,8 -653,7 +632,8 @@@ static void mxs_lradc_prepare_x_pos(str
        mxs_lradc_reg_set(lradc, mxs_lradc_drive_x_plate(lradc), LRADC_CTRL0);
  
        lradc->cur_plate = LRADC_SAMPLE_X;
 -      mxs_lradc_setup_ts_channel(lradc, TS_CH_YP);
 +      mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YP);
 +      mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1);
  }
  
  /*
@@@ -654,8 -674,7 +654,8 @@@ static void mxs_lradc_prepare_y_pos(str
        mxs_lradc_reg_set(lradc, mxs_lradc_drive_y_plate(lradc), LRADC_CTRL0);
  
        lradc->cur_plate = LRADC_SAMPLE_Y;
 -      mxs_lradc_setup_ts_channel(lradc, TS_CH_XM);
 +      mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_XM);
 +      mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1);
  }
  
  /*
@@@ -676,10 -695,7 +676,10 @@@ static void mxs_lradc_prepare_pressure(
        mxs_lradc_reg_set(lradc, mxs_lradc_drive_pressure(lradc), LRADC_CTRL0);
  
        lradc->cur_plate = LRADC_SAMPLE_PRESSURE;
 -      mxs_lradc_setup_ts_pressure(lradc, TS_CH_XP, TS_CH_YM);
 +      mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YM);
 +      mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL2, TS_CH_XP);
 +      mxs_lradc_setup_ts_pressure(lradc, TOUCHSCREEN_VCHANNEL2,
 +                                              TOUCHSCREEN_VCHANNEL1);
  }
  
  static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc)
        mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
  }
  
 +static void mxs_lradc_start_touch_event(struct mxs_lradc *lradc)
 +{
 +      mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
 +                              LRADC_CTRL1);
 +      mxs_lradc_reg_set(lradc,
 +              LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1);
 +      /*
 +       * start with the Y-pos, because it uses nearly the same plate
 +       * settings like the touch detection
 +       */
 +      mxs_lradc_prepare_y_pos(lradc);
 +}
 +
  static void mxs_lradc_report_ts_event(struct mxs_lradc *lradc)
  {
        input_report_abs(lradc->ts_input, ABS_X, lradc->ts_x_pos);
@@@ -722,12 -725,10 +722,12 @@@ static void mxs_lradc_complete_touch_ev
         * start a dummy conversion to burn time to settle the signals
         * note: we are not interested in the conversion's value
         */
 -      mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(5));
 -      mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1);
 -      mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(5), LRADC_CTRL1);
 -      mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(1 << 5) |
 +      mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(TOUCHSCREEN_VCHANNEL1));
 +      mxs_lradc_reg_clear(lradc,
 +              LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) |
 +              LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1);
 +      mxs_lradc_reg_wrt(lradc,
 +              LRADC_DELAY_TRIGGER(1 << TOUCHSCREEN_VCHANNEL1) |
                LRADC_DELAY_KICK | LRADC_DELAY_DELAY(10), /* waste 5 ms */
                        LRADC_DELAY(2));
  }
@@@ -759,45 -760,59 +759,45 @@@ static void mxs_lradc_finish_touch_even
  
        /* if it is released, wait for the next touch via IRQ */
        lradc->cur_plate = LRADC_TOUCH;
 -      mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
 +      mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2));
 +      mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3));
 +      mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ |
 +              LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) |
 +              LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1);
        mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
  }
  
  /* touchscreen's state machine */
  static void mxs_lradc_handle_touch(struct mxs_lradc *lradc)
  {
 -      int val;
 -
        switch (lradc->cur_plate) {
        case LRADC_TOUCH:
 -              /*
 -               * start with the Y-pos, because it uses nearly the same plate
 -               * settings like the touch detection
 -               */
 -              if (mxs_lradc_check_touch_event(lradc)) {
 -                      mxs_lradc_reg_clear(lradc,
 -                                      LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
 -                                      LRADC_CTRL1);
 -                      mxs_lradc_prepare_y_pos(lradc);
 -              }
 +              if (mxs_lradc_check_touch_event(lradc))
 +                      mxs_lradc_start_touch_event(lradc);
                mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ,
                                        LRADC_CTRL1);
                return;
  
        case LRADC_SAMPLE_Y:
 -              val = mxs_lradc_read_ts_channel(lradc);
 -              if (val < 0) {
 -                      mxs_lradc_enable_touch_detection(lradc); /* re-start */
 -                      return;
 -              }
 -              lradc->ts_y_pos = val;
 +              lradc->ts_y_pos = mxs_lradc_read_raw_channel(lradc,
 +                                                      TOUCHSCREEN_VCHANNEL1);
                mxs_lradc_prepare_x_pos(lradc);
                return;
  
        case LRADC_SAMPLE_X:
 -              val = mxs_lradc_read_ts_channel(lradc);
 -              if (val < 0) {
 -                      mxs_lradc_enable_touch_detection(lradc); /* re-start */
 -                      return;
 -              }
 -              lradc->ts_x_pos = val;
 +              lradc->ts_x_pos = mxs_lradc_read_raw_channel(lradc,
 +                                                      TOUCHSCREEN_VCHANNEL1);
                mxs_lradc_prepare_pressure(lradc);
                return;
  
        case LRADC_SAMPLE_PRESSURE:
 -              lradc->ts_pressure =
 -                      mxs_lradc_read_ts_pressure(lradc, TS_CH_XP, TS_CH_YM);
 +              lradc->ts_pressure = mxs_lradc_read_ts_pressure(lradc,
 +                                                      TOUCHSCREEN_VCHANNEL2,
 +                                                      TOUCHSCREEN_VCHANNEL1);
                mxs_lradc_complete_touch_event(lradc);
                return;
  
        case LRADC_SAMPLE_VALID:
 -              val = mxs_lradc_read_ts_channel(lradc); /* ignore the value */
                mxs_lradc_finish_touch_event(lradc, 1);
                break;
        }
@@@ -829,9 -844,9 +829,9 @@@ static int mxs_lradc_read_single(struc
         * used if doing raw sampling.
         */
        if (lradc->soc == IMX28_LRADC)
 -              mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
 +              mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0),
                        LRADC_CTRL1);
 -      mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
 +      mxs_lradc_reg_clear(lradc, 0x1, LRADC_CTRL0);
  
        /* Enable / disable the divider per requirement */
        if (test_bit(chan, &lradc->is_divided))
@@@ -993,7 -1008,7 +993,7 @@@ static ssize_t mxs_lradc_show_scale_ava
        int i, len = 0;
  
        for (i = 0; i < ARRAY_SIZE(lradc->scale_avail[ch]); i++)
-               len += sprintf(buf + len, "%d.%09u ",
+               len += sprintf(buf + len, "%u.%09u ",
                               lradc->scale_avail[ch][i].integer,
                               lradc->scale_avail[ch][i].nano);
  
@@@ -1075,8 -1090,9 +1075,8 @@@ static void mxs_lradc_disable_ts(struc
  {
        /* stop all interrupts from firing */
        mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN |
 -              LRADC_CTRL1_LRADC_IRQ_EN(2) | LRADC_CTRL1_LRADC_IRQ_EN(3) |
 -              LRADC_CTRL1_LRADC_IRQ_EN(4) | LRADC_CTRL1_LRADC_IRQ_EN(5),
 -              LRADC_CTRL1);
 +              LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) |
 +              LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1);
  
        /* Power-down touchscreen touch-detect circuitry. */
        mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
@@@ -1142,31 -1158,26 +1142,31 @@@ static irqreturn_t mxs_lradc_handle_irq
        struct iio_dev *iio = data;
        struct mxs_lradc *lradc = iio_priv(iio);
        unsigned long reg = readl(lradc->base + LRADC_CTRL1);
 +      uint32_t clr_irq = mxs_lradc_irq_mask(lradc);
        const uint32_t ts_irq_mask =
                LRADC_CTRL1_TOUCH_DETECT_IRQ |
 -              LRADC_CTRL1_LRADC_IRQ(2) |
 -              LRADC_CTRL1_LRADC_IRQ(3) |
 -              LRADC_CTRL1_LRADC_IRQ(4) |
 -              LRADC_CTRL1_LRADC_IRQ(5);
 +              LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) |
 +              LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2);
  
        if (!(reg & mxs_lradc_irq_mask(lradc)))
                return IRQ_NONE;
  
 -      if (lradc->use_touchscreen && (reg & ts_irq_mask))
 +      if (lradc->use_touchscreen && (reg & ts_irq_mask)) {
                mxs_lradc_handle_touch(lradc);
  
 -      if (iio_buffer_enabled(iio))
 -              iio_trigger_poll(iio->trig);
 -      else if (reg & LRADC_CTRL1_LRADC_IRQ(0))
 +              /* Make sure we don't clear the next conversion's interrupt. */
 +              clr_irq &= ~(LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) |
 +                              LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2));
 +      }
 +
 +      if (iio_buffer_enabled(iio)) {
 +              if (reg & lradc->buffer_vchans)
 +                      iio_trigger_poll(iio->trig);
 +      } else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) {
                complete(&lradc->completion);
 +      }
  
 -      mxs_lradc_reg_clear(lradc, reg & mxs_lradc_irq_mask(lradc),
 -                      LRADC_CTRL1);
 +      mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1);
  
        return IRQ_HANDLED;
  }
@@@ -1278,10 -1289,9 +1278,10 @@@ static int mxs_lradc_buffer_preenable(s
        }
  
        if (lradc->soc == IMX28_LRADC)
 -              mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
 -                                                      LRADC_CTRL1);
 -      mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
 +              mxs_lradc_reg_clear(lradc,
 +                      lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET,
 +                      LRADC_CTRL1);
 +      mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0);
  
        for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
                ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs);
@@@ -1314,11 -1324,10 +1314,11 @@@ static int mxs_lradc_buffer_postdisable
        mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK |
                                        LRADC_DELAY_KICK, LRADC_DELAY(0));
  
 -      mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
 +      mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0);
        if (lradc->soc == IMX28_LRADC)
 -              mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
 -                                      LRADC_CTRL1);
 +              mxs_lradc_reg_clear(lradc,
 +                      lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET,
 +                      LRADC_CTRL1);
  
        kfree(lradc->buffer);
        mutex_unlock(&lradc->lock);
@@@ -1344,7 -1353,7 +1344,7 @@@ static bool mxs_lradc_validate_scan_mas
        if (lradc->use_touchbutton)
                rsvd_chans++;
        if (lradc->use_touchscreen)
 -              rsvd_chans++;
 +              rsvd_chans += 2;
  
        /* Test for attempts to map channels with special mode of operation. */
        if (bitmap_intersects(mask, &rsvd_mask, LRADC_MAX_TOTAL_CHANS))
@@@ -1404,13 -1413,6 +1404,13 @@@ static const struct iio_chan_spec mxs_l
                .channel = 8,
                .scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,},
        },
 +      /* Hidden channel to keep indexes */
 +      {
 +              .type = IIO_TEMP,
 +              .indexed = 1,
 +              .scan_index = -1,
 +              .channel = 9,
 +      },
        MXS_ADC_CHAN(10, IIO_VOLTAGE),  /* VDDIO */
        MXS_ADC_CHAN(11, IIO_VOLTAGE),  /* VTH */
        MXS_ADC_CHAN(12, IIO_VOLTAGE),  /* VDDA */
@@@ -1581,11 -1583,6 +1581,11 @@@ static int mxs_lradc_probe(struct platf
  
        touch_ret = mxs_lradc_probe_touchscreen(lradc, node);
  
 +      if (touch_ret == 0)
 +              lradc->buffer_vchans = BUFFER_VCHANS_LIMITED;
 +      else
 +              lradc->buffer_vchans = BUFFER_VCHANS_ALL;
 +
        /* Grab all IRQ sources */
        for (i = 0; i < of_cfg->irq_count; i++) {
                lradc->irq[i] = platform_get_irq(pdev, i);
index 6b4c74236916fd5729efb2e6f4b1a4e99ca6ce1a,2beff253bd0d935233b582ae5bcf22b611625cbd..ff08667fa2f60071ab6a5dd800830db2ae03b224
  #include "hmc5843.h"
  
  static const struct regmap_range hmc5843_readable_ranges[] = {
-               regmap_reg_range(0, HMC5843_ID_END),
+       regmap_reg_range(0, HMC5843_ID_END),
  };
  
- static struct regmap_access_table hmc5843_readable_table = {
-               .yes_ranges = hmc5843_readable_ranges,
-               .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges),
+ static const struct regmap_access_table hmc5843_readable_table = {
+       .yes_ranges = hmc5843_readable_ranges,
+       .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges),
  };
  
  static const struct regmap_range hmc5843_writable_ranges[] = {
-               regmap_reg_range(0, HMC5843_MODE_REG),
+       regmap_reg_range(0, HMC5843_MODE_REG),
  };
  
- static struct regmap_access_table hmc5843_writable_table = {
-               .yes_ranges = hmc5843_writable_ranges,
-               .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges),
+ static const struct regmap_access_table hmc5843_writable_table = {
+       .yes_ranges = hmc5843_writable_ranges,
+       .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges),
  };
  
  static const struct regmap_range hmc5843_volatile_ranges[] = {
-               regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_REG),
+       regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_REG),
  };
  
- static struct regmap_access_table hmc5843_volatile_table = {
-               .yes_ranges = hmc5843_volatile_ranges,
-               .n_yes_ranges = ARRAY_SIZE(hmc5843_volatile_ranges),
+ static const struct regmap_access_table hmc5843_volatile_table = {
+       .yes_ranges = hmc5843_volatile_ranges,
+       .n_yes_ranges = ARRAY_SIZE(hmc5843_volatile_ranges),
  };
  
- static struct regmap_config hmc5843_i2c_regmap_config = {
-               .reg_bits = 8,
-               .val_bits = 8,
+ static const struct regmap_config hmc5843_i2c_regmap_config = {
+       .reg_bits = 8,
+       .val_bits = 8,
  
-               .rd_table = &hmc5843_readable_table,
-               .wr_table = &hmc5843_writable_table,
-               .volatile_table = &hmc5843_volatile_table,
+       .rd_table = &hmc5843_readable_table,
+       .wr_table = &hmc5843_writable_table,
+       .volatile_table = &hmc5843_volatile_table,
  
-               .cache_type = REGCACHE_RBTREE,
+       .cache_type = REGCACHE_RBTREE,
  };
  
 -static int hmc5843_i2c_probe(struct i2c_client *client,
 -                       const struct i2c_device_id *id)
 +static int hmc5843_i2c_probe(struct i2c_client *cli,
 +                           const struct i2c_device_id *id)
  {
 -      return hmc5843_common_probe(&client->dev,
 -              devm_regmap_init_i2c(client, &hmc5843_i2c_regmap_config),
 -              id->driver_data);
 +      return hmc5843_common_probe(&cli->dev,
 +                      devm_regmap_init_i2c(cli, &hmc5843_i2c_regmap_config),
 +                      id->driver_data);
  }
  
  static int hmc5843_i2c_remove(struct i2c_client *client)
index 8dc5089772a39549e28e3df387c69b080646cb20,746b18894ebf6009cfe379cb3e7b69eaf26b57c9..6335b5815acda3dc7ce47be53a38587a085594ee
@@@ -216,9 -216,13 +216,13 @@@ error_ret
  
  static int ade7754_reset(struct device *dev)
  {
+       int ret;
        u8 val;
  
-       ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
+       ret = ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
+       if (ret < 0)
+               return ret;
        val |= 1 << 6; /* Software Chip Reset */
        return ade7754_spi_write_reg_8(dev, ADE7754_OPMODE, val);
  }
@@@ -362,9 -366,16 +366,16 @@@ error_ret
  /* Power down the device */
  static int ade7754_stop_device(struct device *dev)
  {
+       int ret;
        u8 val;
  
-       ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
+       ret = ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
+       if (ret < 0) {
+               dev_err(dev, "unable to power down the device, error: %d",
+                       ret);
+               return ret;
+       }
        val |= 7 << 3;  /* ADE7754 powered down */
        return ade7754_spi_write_reg_8(dev, ADE7754_OPMODE, val);
  }
@@@ -432,7 -443,7 +443,7 @@@ static ssize_t ade7754_write_frequency(
  
        mutex_lock(&indio_dev->mlock);
  
 -      t = (26000 / val);
 +      t = 26000 / val;
        if (t > 0)
                t--;
  
@@@ -540,7 -551,11 +551,7 @@@ static int ade7754_probe(struct spi_dev
        ret = ade7754_initial_setup(indio_dev);
        if (ret)
                return ret;
 -      ret = iio_device_register(indio_dev);
 -      if (ret)
 -              return ret;
 -
 -      return 0;
 +      return iio_device_register(indio_dev);
  }
  
  /* fixme, confirm ordering in this function */
index 7eef8b9573fc85faaae975457966857d76dfdafc,9afdb1e1a2222e89b89d54ee0ec2042e8cb65b47..dbceda1e67eaba530687b131bdfddb014d86181d
@@@ -215,15 -215,21 +215,19 @@@ error_ret
  
  static int ade7759_reset(struct device *dev)
  {
+       int ret;
        u16 val;
  
-       ade7759_spi_read_reg_16(dev,
+       ret = ade7759_spi_read_reg_16(dev,
                        ADE7759_MODE,
                        &val);
+       if (ret < 0)
+               return ret;
        val |= 1 << 6; /* Software Chip Reset */
 -      ret = ade7759_spi_write_reg_16(dev,
 +      return ade7759_spi_write_reg_16(dev,
                        ADE7759_MODE,
                        val);
 -
 -      return ret;
  }
  
  static IIO_DEV_ATTR_AENERGY(ade7759_read_40bit, ADE7759_AENERGY);
@@@ -298,11 -304,18 +302,18 @@@ error_ret
  /* Power down the device */
  static int ade7759_stop_device(struct device *dev)
  {
+       int ret;
        u16 val;
  
-       ade7759_spi_read_reg_16(dev,
+       ret = ade7759_spi_read_reg_16(dev,
                        ADE7759_MODE,
                        &val);
+       if (ret < 0) {
+               dev_err(dev, "unable to power down the device, error: %d\n",
+                       ret);
+               return ret;
+       }
        val |= 1 << 4;  /* AD converters can be turned off */
  
        return ade7759_spi_write_reg_16(dev, ADE7759_MODE, val);
@@@ -371,7 -384,7 +382,7 @@@ static ssize_t ade7759_write_frequency(
  
        mutex_lock(&indio_dev->mlock);
  
 -      t = (27900 / val);
 +      t = 27900 / val;
        if (t > 0)
                t--;
  
@@@ -462,7 -475,11 +473,7 @@@ static int ade7759_probe(struct spi_dev
        if (ret)
                return ret;
  
 -      ret = iio_device_register(indio_dev);
 -      if (ret)
 -              return ret;
 -
 -      return 0;
 +      return iio_device_register(indio_dev);
  }
  
  /* fixme, confirm ordering in this function */
index 5b1daeacac7a22ef0576f861acf94a591734d5ef,a8ecf87ef4a961f1c938dffc0839b25e5b5ed92b..7bc3e4a73834d5e305b47d93f83e8d2e96e95f4f
@@@ -151,7 -151,7 +151,7 @@@ int ad2s1210_update_frequency_control_w
  
        fcw = (unsigned char)(st->fexcit * (1 << 15) / st->fclkin);
        if (fcw < AD2S1210_MIN_FCW || fcw > AD2S1210_MAX_FCW) {
 -              pr_err("ad2s1210: FCW out of range\n");
 +              dev_err(&st->sdev->dev, "ad2s1210: FCW out of range\n");
                return -ERANGE;
        }
  
@@@ -198,7 -198,7 +198,7 @@@ static ssize_t ad2s1210_show_fclkin(str
  {
        struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
  
-       return sprintf(buf, "%d\n", st->fclkin);
+       return sprintf(buf, "%u\n", st->fclkin);
  }
  
  static ssize_t ad2s1210_store_fclkin(struct device *dev,
        if (ret)
                return ret;
        if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) {
 -              pr_err("ad2s1210: fclkin out of range\n");
 +              dev_err(dev, "ad2s1210: fclkin out of range\n");
                return -EINVAL;
        }
  
@@@ -237,7 -237,7 +237,7 @@@ static ssize_t ad2s1210_show_fexcit(str
  {
        struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
  
-       return sprintf(buf, "%d\n", st->fexcit);
+       return sprintf(buf, "%u\n", st->fexcit);
  }
  
  static ssize_t ad2s1210_store_fexcit(struct device *dev,
        if (ret < 0)
                return ret;
        if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) {
 -              pr_err("ad2s1210: excitation frequency out of range\n");
 +              dev_err(dev,
 +                      "ad2s1210: excitation frequency out of range\n");
                return -EINVAL;
        }
        mutex_lock(&st->lock);
@@@ -308,8 -307,7 +308,8 @@@ static ssize_t ad2s1210_store_control(s
                goto error_ret;
        if (ret & AD2S1210_MSB_IS_HIGH) {
                ret = -EIO;
 -              pr_err("ad2s1210: write control register fail\n");
 +              dev_err(dev,
 +                      "ad2s1210: write control register fail\n");
                goto error_ret;
        }
        st->resolution
        if (st->pdata->gpioin) {
                data = ad2s1210_read_resolution_pin(st);
                if (data != st->resolution)
 -                      pr_warn("ad2s1210: resolution settings not match\n");
 +                      dev_warn(dev, "ad2s1210: resolution settings not match\n");
        } else
                ad2s1210_set_resolution_pin(st);
  
@@@ -348,7 -346,7 +348,7 @@@ static ssize_t ad2s1210_store_resolutio
  
        ret = kstrtou8(buf, 10, &udata);
        if (ret || udata < 10 || udata > 16) {
 -              pr_err("ad2s1210: resolution out of range\n");
 +              dev_err(dev, "ad2s1210: resolution out of range\n");
                return -EINVAL;
        }
        mutex_lock(&st->lock);
        data = ret;
        if (data & AD2S1210_MSB_IS_HIGH) {
                ret = -EIO;
 -              pr_err("ad2s1210: setting resolution fail\n");
 +              dev_err(dev, "ad2s1210: setting resolution fail\n");
                goto error_ret;
        }
        st->resolution
        if (st->pdata->gpioin) {
                data = ad2s1210_read_resolution_pin(st);
                if (data != st->resolution)
 -                      pr_warn("ad2s1210: resolution settings not match\n");
 +                      dev_warn(dev, "ad2s1210: resolution settings not match\n");
        } else
                ad2s1210_set_resolution_pin(st);
        ret = len;
index 68ceb97c458c90b96bf484df23a89a485d2b9ff3,5bfc5bdc3c5d5d2ef8f3cdb174ff03d4bec7351b..38df23435ebbd399489326e649f828c8654878c0
@@@ -6,6 -6,7 +6,7 @@@ header-y += caif
  header-y += dvb/
  header-y += hdlc/
  header-y += hsi/
+ header-y += iio/
  header-y += isdn/
  header-y += mmc/
  header-y += nfsd/
@@@ -35,7 -36,6 +36,7 @@@ header-y += adfs_fs.
  header-y += affs_hardblocks.h
  header-y += agpgart.h
  header-y += aio_abi.h
 +header-y += am437x-vpfe.h
  header-y += apm_bios.h
  header-y += arcfb.h
  header-y += atalk.h
@@@ -284,7 -284,6 +285,7 @@@ header-y += net.
  header-y += netlink_diag.h
  header-y += netlink.h
  header-y += netrom.h
 +header-y += net_namespace.h
  header-y += net_tstamp.h
  header-y += nfc.h
  header-y += nfs2.h
@@@ -370,6 -369,7 +371,6 @@@ header-y += snmp.
  header-y += sock_diag.h
  header-y += socket.h
  header-y += sockios.h
 -header-y += som.h
  header-y += sonet.h
  header-y += sonypi.h
  header-y += soundcard.h
index 0000000000000000000000000000000000000000,8f8f058eb8074864e79e5327100241322df7f4e5..f805493be3ebb1097965241baa7be50f045ae67d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,359 +1,359 @@@
 -      input = input >> info->shift;
+ /* Industrialio buffer test code.
+  *
+  * Copyright (c) 2008 Jonathan Cameron
+  *
+  * This program is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU General Public License version 2 as published by
+  * the Free Software Foundation.
+  *
+  * This program is primarily intended as an example application.
+  * Reads the current buffer setup from sysfs and starts a short capture
+  * from the specified device, pretty printing the result after appropriate
+  * conversion.
+  *
+  * Command line parameters
+  * generic_buffer -n <device_name> -t <trigger_name>
+  * If trigger name is not specified the program assumes you want a dataready
+  * trigger associated with the device and goes looking for it.
+  *
+  */
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <dirent.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <errno.h>
+ #include <sys/stat.h>
+ #include <sys/dir.h>
+ #include <linux/types.h>
+ #include <string.h>
+ #include <poll.h>
+ #include <endian.h>
+ #include <getopt.h>
+ #include <inttypes.h>
+ #include "iio_utils.h"
+ /**
+  * size_from_channelarray() - calculate the storage size of a scan
+  * @channels:         the channel info array
+  * @num_channels:     number of channels
+  *
+  * Has the side effect of filling the channels[i].location values used
+  * in processing the buffer output.
+  **/
+ int size_from_channelarray(struct iio_channel_info *channels, int num_channels)
+ {
+       int bytes = 0;
+       int i = 0;
+       while (i < num_channels) {
+               if (bytes % channels[i].bytes == 0)
+                       channels[i].location = bytes;
+               else
+                       channels[i].location = bytes - bytes%channels[i].bytes
+                               + channels[i].bytes;
+               bytes = channels[i].location + channels[i].bytes;
+               i++;
+       }
+       return bytes;
+ }
+ void print2byte(int input, struct iio_channel_info *info)
+ {
+       /* First swap if incorrect endian */
+       if (info->be)
+               input = be16toh((uint16_t)input);
+       else
+               input = le16toh((uint16_t)input);
+       /*
+        * Shift before conversion to avoid sign extension
+        * of left aligned data
+        */
++      input >>= info->shift;
+       if (info->is_signed) {
+               int16_t val = input;
+               val &= (1 << info->bits_used) - 1;
+               val = (int16_t)(val << (16 - info->bits_used)) >>
+                       (16 - info->bits_used);
+               printf("%05f ", ((float)val + info->offset)*info->scale);
+       } else {
+               uint16_t val = input;
+               val &= (1 << info->bits_used) - 1;
+               printf("%05f ", ((float)val + info->offset)*info->scale);
+       }
+ }
+ /**
+  * process_scan() - print out the values in SI units
+  * @data:             pointer to the start of the scan
+  * @channels:         information about the channels. Note
+  *  size_from_channelarray must have been called first to fill the
+  *  location offsets.
+  * @num_channels:     number of channels
+  **/
+ void process_scan(char *data,
+                 struct iio_channel_info *channels,
+                 int num_channels)
+ {
+       int k;
+       for (k = 0; k < num_channels; k++)
+               switch (channels[k].bytes) {
+                       /* only a few cases implemented so far */
+               case 2:
+                       print2byte(*(uint16_t *)(data + channels[k].location),
+                                  &channels[k]);
+                       break;
+               case 4:
+                       if (!channels[k].is_signed) {
+                               uint32_t val = *(uint32_t *)
+                                       (data + channels[k].location);
+                               printf("%05f ", ((float)val +
+                                                channels[k].offset)*
+                                      channels[k].scale);
+                       }
+                       break;
+               case 8:
+                       if (channels[k].is_signed) {
+                               int64_t val = *(int64_t *)
+                                       (data +
+                                        channels[k].location);
+                               if ((val >> channels[k].bits_used) & 1)
+                                       val = (val & channels[k].mask) |
+                                               ~channels[k].mask;
+                               /* special case for timestamp */
+                               if (channels[k].scale == 1.0f &&
+                                   channels[k].offset == 0.0f)
+                                       printf("%" PRId64 " ", val);
+                               else
+                                       printf("%05f ", ((float)val +
+                                                        channels[k].offset)*
+                                              channels[k].scale);
+                       }
+                       break;
+               default:
+                       break;
+               }
+       printf("\n");
+ }
+ int main(int argc, char **argv)
+ {
+       unsigned long num_loops = 2;
+       unsigned long timedelay = 1000000;
+       unsigned long buf_len = 128;
+       int ret, c, i, j, toread;
+       int fp;
+       int num_channels;
+       char *trigger_name = NULL, *device_name = NULL;
+       char *dev_dir_name, *buf_dir_name;
+       int datardytrigger = 1;
+       char *data;
+       ssize_t read_size;
+       int dev_num, trig_num;
+       char *buffer_access;
+       int scan_size;
+       int noevents = 0;
+       int notrigger = 0;
+       char *dummy;
+       struct iio_channel_info *channels;
+       while ((c = getopt(argc, argv, "l:w:c:et:n:g")) != -1) {
+               switch (c) {
+               case 'n':
+                       device_name = optarg;
+                       break;
+               case 't':
+                       trigger_name = optarg;
+                       datardytrigger = 0;
+                       break;
+               case 'e':
+                       noevents = 1;
+                       break;
+               case 'c':
+                       num_loops = strtoul(optarg, &dummy, 10);
+                       break;
+               case 'w':
+                       timedelay = strtoul(optarg, &dummy, 10);
+                       break;
+               case 'l':
+                       buf_len = strtoul(optarg, &dummy, 10);
+                       break;
+               case 'g':
+                       notrigger = 1;
+                       break;
+               case '?':
+                       return -1;
+               }
+       }
+       if (device_name == NULL)
+               return -1;
+       /* Find the device requested */
+       dev_num = find_type_by_name(device_name, "iio:device");
+       if (dev_num < 0) {
+               printf("Failed to find the %s\n", device_name);
+               ret = -ENODEV;
+               goto error_ret;
+       }
+       printf("iio device number being used is %d\n", dev_num);
+       asprintf(&dev_dir_name, "%siio:device%d", iio_dir, dev_num);
+       if (!notrigger) {
+               if (trigger_name == NULL) {
+                       /*
+                        * Build the trigger name. If it is device associated
+                        * its name is <device_name>_dev[n] where n matches
+                        * the device number found above.
+                        */
+                       ret = asprintf(&trigger_name,
+                                      "%s-dev%d", device_name, dev_num);
+                       if (ret < 0) {
+                               ret = -ENOMEM;
+                               goto error_ret;
+                       }
+               }
+               /* Verify the trigger exists */
+               trig_num = find_type_by_name(trigger_name, "trigger");
+               if (trig_num < 0) {
+                       printf("Failed to find the trigger %s\n", trigger_name);
+                       ret = -ENODEV;
+                       goto error_free_triggername;
+               }
+               printf("iio trigger number being used is %d\n", trig_num);
+       } else
+               printf("trigger-less mode selected\n");
+       /*
+        * Parse the files in scan_elements to identify what channels are
+        * present
+        */
+       ret = build_channel_array(dev_dir_name, &channels, &num_channels);
+       if (ret) {
+               printf("Problem reading scan element information\n");
+               printf("diag %s\n", dev_dir_name);
+               goto error_free_triggername;
+       }
+       /*
+        * Construct the directory name for the associated buffer.
+        * As we know that the lis3l02dq has only one buffer this may
+        * be built rather than found.
+        */
+       ret = asprintf(&buf_dir_name,
+                      "%siio:device%d/buffer", iio_dir, dev_num);
+       if (ret < 0) {
+               ret = -ENOMEM;
+               goto error_free_triggername;
+       }
+       if (!notrigger) {
+               printf("%s %s\n", dev_dir_name, trigger_name);
+               /* Set the device trigger to be the data ready trigger found
+                * above */
+               ret = write_sysfs_string_and_verify("trigger/current_trigger",
+                                                   dev_dir_name,
+                                                   trigger_name);
+               if (ret < 0) {
+                       printf("Failed to write current_trigger file\n");
+                       goto error_free_buf_dir_name;
+               }
+       }
+       /* Setup ring buffer parameters */
+       ret = write_sysfs_int("length", buf_dir_name, buf_len);
+       if (ret < 0)
+               goto error_free_buf_dir_name;
+       /* Enable the buffer */
+       ret = write_sysfs_int("enable", buf_dir_name, 1);
+       if (ret < 0)
+               goto error_free_buf_dir_name;
+       scan_size = size_from_channelarray(channels, num_channels);
+       data = malloc(scan_size*buf_len);
+       if (!data) {
+               ret = -ENOMEM;
+               goto error_free_buf_dir_name;
+       }
+       ret = asprintf(&buffer_access, "/dev/iio:device%d", dev_num);
+       if (ret < 0) {
+               ret = -ENOMEM;
+               goto error_free_data;
+       }
+       /* Attempt to open non blocking the access dev */
+       fp = open(buffer_access, O_RDONLY | O_NONBLOCK);
+       if (fp == -1) { /* If it isn't there make the node */
+               printf("Failed to open %s\n", buffer_access);
+               ret = -errno;
+               goto error_free_buffer_access;
+       }
+       /* Wait for events 10 times */
+       for (j = 0; j < num_loops; j++) {
+               if (!noevents) {
+                       struct pollfd pfd = {
+                               .fd = fp,
+                               .events = POLLIN,
+                       };
+                       poll(&pfd, 1, -1);
+                       toread = buf_len;
+               } else {
+                       usleep(timedelay);
+                       toread = 64;
+               }
+               read_size = read(fp,
+                                data,
+                                toread*scan_size);
+               if (read_size < 0) {
+                       if (errno == -EAGAIN) {
+                               printf("nothing available\n");
+                               continue;
+                       } else
+                               break;
+               }
+               for (i = 0; i < read_size/scan_size; i++)
+                       process_scan(data + scan_size*i,
+                                    channels,
+                                    num_channels);
+       }
+       /* Stop the buffer */
+       ret = write_sysfs_int("enable", buf_dir_name, 0);
+       if (ret < 0)
+               goto error_close_buffer_access;
+       if (!notrigger)
+               /* Disconnect the trigger - just write a dummy name. */
+               write_sysfs_string("trigger/current_trigger",
+                                  dev_dir_name, "NULL");
+ error_close_buffer_access:
+       close(fp);
+ error_free_data:
+       free(data);
+ error_free_buffer_access:
+       free(buffer_access);
+ error_free_buf_dir_name:
+       free(buf_dir_name);
+ error_free_triggername:
+       if (datardytrigger)
+               free(trigger_name);
+ error_ret:
+       return ret;
+ }
diff --combined tools/iio/iio_utils.c
index 0000000000000000000000000000000000000000,aea9282101871e9d53b52c02340e842fde9292bc..2680a2e0f11380d1257e65bcd96117667daf7478
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,651 +1,655 @@@
+ /* IIO - useful set of util functionality
+  *
+  * Copyright (c) 2008 Jonathan Cameron
+  *
+  * This program is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU General Public License version 2 as published by
+  * the Free Software Foundation.
+  */
++#ifndef _IIO_UTILS_H
++#define _IIO_UTILS_H
+ #include <string.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <stdint.h>
+ #include <dirent.h>
+ #include <errno.h>
+ #include <ctype.h>
+ #include "iio_utils.h"
+ const char *iio_dir = "/sys/bus/iio/devices/";
+ /**
+  * iioutils_break_up_name() - extract generic name from full channel name
+  * @full_name: the full channel name
+  * @generic_name: the output generic channel name
+  **/
+ int iioutils_break_up_name(const char *full_name,
+                                 char **generic_name)
+ {
+       char *current;
+       char *w, *r;
+       char *working;
+       current = strdup(full_name);
+       working = strtok(current, "_\0");
+       w = working;
+       r = working;
+       while (*r != '\0') {
+               if (!isdigit(*r)) {
+                       *w = *r;
+                       w++;
+               }
+               r++;
+       }
+       *w = '\0';
+       *generic_name = strdup(working);
+       free(current);
+       return 0;
+ }
+ /**
+  * iioutils_get_type() - find and process _type attribute data
+  * @is_signed: output whether channel is signed
+  * @bytes: output how many bytes the channel storage occupies
+  * @mask: output a bit mask for the raw data
+  * @be: big endian
+  * @device_dir: the iio device directory
+  * @name: the channel name
+  * @generic_name: the channel type name
+  **/
+ int iioutils_get_type(unsigned *is_signed,
+                            unsigned *bytes,
+                            unsigned *bits_used,
+                            unsigned *shift,
+                            uint64_t *mask,
+                            unsigned *be,
+                            const char *device_dir,
+                            const char *name,
+                            const char *generic_name)
+ {
+       FILE *sysfsfp;
+       int ret;
+       DIR *dp;
+       char *scan_el_dir, *builtname, *builtname_generic, *filename = 0;
+       char signchar, endianchar;
+       unsigned padint;
+       const struct dirent *ent;
+       ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir);
+       if (ret < 0) {
+               ret = -ENOMEM;
+               goto error_ret;
+       }
+       ret = asprintf(&builtname, FORMAT_TYPE_FILE, name);
+       if (ret < 0) {
+               ret = -ENOMEM;
+               goto error_free_scan_el_dir;
+       }
+       ret = asprintf(&builtname_generic, FORMAT_TYPE_FILE, generic_name);
+       if (ret < 0) {
+               ret = -ENOMEM;
+               goto error_free_builtname;
+       }
+       dp = opendir(scan_el_dir);
+       if (dp == NULL) {
+               ret = -errno;
+               goto error_free_builtname_generic;
+       }
+       while (ent = readdir(dp), ent != NULL)
+               /*
+                * Do we allow devices to override a generic name with
+                * a specific one?
+                */
+               if ((strcmp(builtname, ent->d_name) == 0) ||
+                   (strcmp(builtname_generic, ent->d_name) == 0)) {
+                       ret = asprintf(&filename,
+                                      "%s/%s", scan_el_dir, ent->d_name);
+                       if (ret < 0) {
+                               ret = -ENOMEM;
+                               goto error_closedir;
+                       }
+                       sysfsfp = fopen(filename, "r");
+                       if (sysfsfp == NULL) {
+                               printf("failed to open %s\n", filename);
+                               ret = -errno;
+                               goto error_free_filename;
+                       }
+                       ret = fscanf(sysfsfp,
+                                    "%ce:%c%u/%u>>%u",
+                                    &endianchar,
+                                    &signchar,
+                                    bits_used,
+                                    &padint, shift);
+                       if (ret < 0) {
+                               printf("failed to pass scan type description\n");
+                               ret = -errno;
+                               goto error_close_sysfsfp;
+                       }
+                       *be = (endianchar == 'b');
+                       *bytes = padint / 8;
+                       if (*bits_used == 64)
+                               *mask = ~0;
+                       else
+                               *mask = (1 << *bits_used) - 1;
+                       if (signchar == 's')
+                               *is_signed = 1;
+                       else
+                               *is_signed = 0;
+                       fclose(sysfsfp);
+                       free(filename);
+                       filename = 0;
+                       sysfsfp = 0;
+               }
+ error_close_sysfsfp:
+       if (sysfsfp)
+               fclose(sysfsfp);
+ error_free_filename:
+       if (filename)
+               free(filename);
+ error_closedir:
+       closedir(dp);
+ error_free_builtname_generic:
+       free(builtname_generic);
+ error_free_builtname:
+       free(builtname);
+ error_free_scan_el_dir:
+       free(scan_el_dir);
+ error_ret:
+       return ret;
+ }
+ int iioutils_get_param_float(float *output,
+                                   const char *param_name,
+                                   const char *device_dir,
+                                   const char *name,
+                                   const char *generic_name)
+ {
+       FILE *sysfsfp;
+       int ret;
+       DIR *dp;
+       char *builtname, *builtname_generic;
+       char *filename = NULL;
+       const struct dirent *ent;
+       ret = asprintf(&builtname, "%s_%s", name, param_name);
+       if (ret < 0) {
+               ret = -ENOMEM;
+               goto error_ret;
+       }
+       ret = asprintf(&builtname_generic,
+                      "%s_%s", generic_name, param_name);
+       if (ret < 0) {
+               ret = -ENOMEM;
+               goto error_free_builtname;
+       }
+       dp = opendir(device_dir);
+       if (dp == NULL) {
+               ret = -errno;
+               goto error_free_builtname_generic;
+       }
+       while (ent = readdir(dp), ent != NULL)
+               if ((strcmp(builtname, ent->d_name) == 0) ||
+                   (strcmp(builtname_generic, ent->d_name) == 0)) {
+                       ret = asprintf(&filename,
+                                      "%s/%s", device_dir, ent->d_name);
+                       if (ret < 0) {
+                               ret = -ENOMEM;
+                               goto error_closedir;
+                       }
+                       sysfsfp = fopen(filename, "r");
+                       if (!sysfsfp) {
+                               ret = -errno;
+                               goto error_free_filename;
+                       }
+                       fscanf(sysfsfp, "%f", output);
+                       break;
+               }
+ error_free_filename:
+       if (filename)
+               free(filename);
+ error_closedir:
+       closedir(dp);
+ error_free_builtname_generic:
+       free(builtname_generic);
+ error_free_builtname:
+       free(builtname);
+ error_ret:
+       return ret;
+ }
+ /**
+  * bsort_channel_array_by_index() - reorder so that the array is in index order
+  *
+  **/
+ void bsort_channel_array_by_index(struct iio_channel_info **ci_array,
+                                        int cnt)
+ {
+       struct iio_channel_info temp;
+       int x, y;
+       for (x = 0; x < cnt; x++)
+               for (y = 0; y < (cnt - 1); y++)
+                       if ((*ci_array)[y].index > (*ci_array)[y+1].index) {
+                               temp = (*ci_array)[y + 1];
+                               (*ci_array)[y + 1] = (*ci_array)[y];
+                               (*ci_array)[y] = temp;
+                       }
+ }
+ /**
+  * build_channel_array() - function to figure out what channels are present
+  * @device_dir: the IIO device directory in sysfs
+  * @
+  **/
+ int build_channel_array(const char *device_dir,
+                             struct iio_channel_info **ci_array,
+                             int *counter)
+ {
+       DIR *dp;
+       FILE *sysfsfp;
+       int count, i;
+       struct iio_channel_info *current;
+       int ret;
+       const struct dirent *ent;
+       char *scan_el_dir;
+       char *filename;
+       *counter = 0;
+       ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir);
+       if (ret < 0) {
+               ret = -ENOMEM;
+               goto error_ret;
+       }
+       dp = opendir(scan_el_dir);
+       if (dp == NULL) {
+               ret = -errno;
+               goto error_free_name;
+       }
+       while (ent = readdir(dp), ent != NULL)
+               if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
+                          "_en") == 0) {
+                       ret = asprintf(&filename,
+                                      "%s/%s", scan_el_dir, ent->d_name);
+                       if (ret < 0) {
+                               ret = -ENOMEM;
+                               goto error_close_dir;
+                       }
+                       sysfsfp = fopen(filename, "r");
+                       if (sysfsfp == NULL) {
+                               ret = -errno;
+                               free(filename);
+                               goto error_close_dir;
+                       }
+                       fscanf(sysfsfp, "%i", &ret);
+                       if (ret == 1)
+                               (*counter)++;
+                       fclose(sysfsfp);
+                       free(filename);
+               }
+       *ci_array = malloc(sizeof(**ci_array) * (*counter));
+       if (*ci_array == NULL) {
+               ret = -ENOMEM;
+               goto error_close_dir;
+       }
+       seekdir(dp, 0);
+       count = 0;
+       while (ent = readdir(dp), ent != NULL) {
+               if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
+                          "_en") == 0) {
+                       int current_enabled = 0;
+                       current = &(*ci_array)[count++];
+                       ret = asprintf(&filename,
+                                      "%s/%s", scan_el_dir, ent->d_name);
+                       if (ret < 0) {
+                               ret = -ENOMEM;
+                               /* decrement count to avoid freeing name */
+                               count--;
+                               goto error_cleanup_array;
+                       }
+                       sysfsfp = fopen(filename, "r");
+                       if (sysfsfp == NULL) {
+                               free(filename);
+                               ret = -errno;
+                               goto error_cleanup_array;
+                       }
+                       fscanf(sysfsfp, "%i", &current_enabled);
+                       fclose(sysfsfp);
+                       if (!current_enabled) {
+                               free(filename);
+                               count--;
+                               continue;
+                       }
+                       current->scale = 1.0;
+                       current->offset = 0;
+                       current->name = strndup(ent->d_name,
+                                               strlen(ent->d_name) -
+                                               strlen("_en"));
+                       if (current->name == NULL) {
+                               free(filename);
+                               ret = -ENOMEM;
+                               goto error_cleanup_array;
+                       }
+                       /* Get the generic and specific name elements */
+                       ret = iioutils_break_up_name(current->name,
+                                                    &current->generic_name);
+                       if (ret) {
+                               free(filename);
+                               goto error_cleanup_array;
+                       }
+                       ret = asprintf(&filename,
+                                      "%s/%s_index",
+                                      scan_el_dir,
+                                      current->name);
+                       if (ret < 0) {
+                               free(filename);
+                               ret = -ENOMEM;
+                               goto error_cleanup_array;
+                       }
+                       sysfsfp = fopen(filename, "r");
+                       fscanf(sysfsfp, "%u", &current->index);
+                       fclose(sysfsfp);
+                       free(filename);
+                       /* Find the scale */
+                       ret = iioutils_get_param_float(&current->scale,
+                                                      "scale",
+                                                      device_dir,
+                                                      current->name,
+                                                      current->generic_name);
+                       if (ret < 0)
+                               goto error_cleanup_array;
+                       ret = iioutils_get_param_float(&current->offset,
+                                                      "offset",
+                                                      device_dir,
+                                                      current->name,
+                                                      current->generic_name);
+                       if (ret < 0)
+                               goto error_cleanup_array;
+                       ret = iioutils_get_type(&current->is_signed,
+                                               &current->bytes,
+                                               &current->bits_used,
+                                               &current->shift,
+                                               &current->mask,
+                                               &current->be,
+                                               device_dir,
+                                               current->name,
+                                               current->generic_name);
+               }
+       }
+       closedir(dp);
+       /* reorder so that the array is in index order */
+       bsort_channel_array_by_index(ci_array, *counter);
+       return 0;
+ error_cleanup_array:
+       for (i = count - 1;  i >= 0; i--)
+               free((*ci_array)[i].name);
+       free(*ci_array);
+ error_close_dir:
+       closedir(dp);
+ error_free_name:
+       free(scan_el_dir);
+ error_ret:
+       return ret;
+ }
+ /**
+  * find_type_by_name() - function to match top level types by name
+  * @name: top level type instance name
+  * @type: the type of top level instance being sort
+  *
+  * Typical types this is used for are device and trigger.
+  **/
+ int find_type_by_name(const char *name, const char *type)
+ {
+       const struct dirent *ent;
+       int number, numstrlen;
+       FILE *nameFile;
+       DIR *dp;
+       char thisname[IIO_MAX_NAME_LENGTH];
+       char *filename;
+       dp = opendir(iio_dir);
+       if (dp == NULL) {
+               printf("No industrialio devices available\n");
+               return -ENODEV;
+       }
+       while (ent = readdir(dp), ent != NULL) {
+               if (strcmp(ent->d_name, ".") != 0 &&
+                       strcmp(ent->d_name, "..") != 0 &&
+                       strlen(ent->d_name) > strlen(type) &&
+                       strncmp(ent->d_name, type, strlen(type)) == 0) {
+                       numstrlen = sscanf(ent->d_name + strlen(type),
+                                          "%d",
+                                          &number);
+                       /* verify the next character is not a colon */
+                       if (strncmp(ent->d_name + strlen(type) + numstrlen,
+                                       ":",
+                                       1) != 0) {
+                               filename = malloc(strlen(iio_dir)
+                                               + strlen(type)
+                                               + numstrlen
+                                               + 6);
+                               if (filename == NULL) {
+                                       closedir(dp);
+                                       return -ENOMEM;
+                               }
+                               sprintf(filename, "%s%s%d/name",
+                                       iio_dir,
+                                       type,
+                                       number);
+                               nameFile = fopen(filename, "r");
+                               if (!nameFile) {
+                                       free(filename);
+                                       continue;
+                               }
+                               free(filename);
+                               fscanf(nameFile, "%s", thisname);
+                               fclose(nameFile);
+                               if (strcmp(name, thisname) == 0) {
+                                       closedir(dp);
+                                       return number;
+                               }
+                       }
+               }
+       }
+       closedir(dp);
+       return -ENODEV;
+ }
+ int _write_sysfs_int(char *filename, char *basedir, int val, int verify)
+ {
+       int ret = 0;
+       FILE *sysfsfp;
+       int test;
+       char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
+       if (temp == NULL)
+               return -ENOMEM;
+       sprintf(temp, "%s/%s", basedir, filename);
+       sysfsfp = fopen(temp, "w");
+       if (sysfsfp == NULL) {
+               printf("failed to open %s\n", temp);
+               ret = -errno;
+               goto error_free;
+       }
+       fprintf(sysfsfp, "%d", val);
+       fclose(sysfsfp);
+       if (verify) {
+               sysfsfp = fopen(temp, "r");
+               if (sysfsfp == NULL) {
+                       printf("failed to open %s\n", temp);
+                       ret = -errno;
+                       goto error_free;
+               }
+               fscanf(sysfsfp, "%d", &test);
+               fclose(sysfsfp);
+               if (test != val) {
+                       printf("Possible failure in int write %d to %s%s\n",
+                               val,
+                               basedir,
+                               filename);
+                       ret = -1;
+               }
+       }
+ error_free:
+       free(temp);
+       return ret;
+ }
+ int write_sysfs_int(char *filename, char *basedir, int val)
+ {
+       return _write_sysfs_int(filename, basedir, val, 0);
+ }
+ int write_sysfs_int_and_verify(char *filename, char *basedir, int val)
+ {
+       return _write_sysfs_int(filename, basedir, val, 1);
+ }
+ int _write_sysfs_string(char *filename, char *basedir, char *val, int verify)
+ {
+       int ret = 0;
+       FILE  *sysfsfp;
+       char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
+       if (temp == NULL) {
+               printf("Memory allocation failed\n");
+               return -ENOMEM;
+       }
+       sprintf(temp, "%s/%s", basedir, filename);
+       sysfsfp = fopen(temp, "w");
+       if (sysfsfp == NULL) {
+               printf("Could not open %s\n", temp);
+               ret = -errno;
+               goto error_free;
+       }
+       fprintf(sysfsfp, "%s", val);
+       fclose(sysfsfp);
+       if (verify) {
+               sysfsfp = fopen(temp, "r");
+               if (sysfsfp == NULL) {
+                       printf("could not open file to verify\n");
+                       ret = -errno;
+                       goto error_free;
+               }
+               fscanf(sysfsfp, "%s", temp);
+               fclose(sysfsfp);
+               if (strcmp(temp, val) != 0) {
+                       printf("Possible failure in string write of %s "
+                               "Should be %s "
+                               "written to %s\%s\n",
+                               temp,
+                               val,
+                               basedir,
+                               filename);
+                       ret = -1;
+               }
+       }
+ error_free:
+       free(temp);
+       return ret;
+ }
+ /**
+  * write_sysfs_string_and_verify() - string write, readback and verify
+  * @filename: name of file to write to
+  * @basedir: the sysfs directory in which the file is to be found
+  * @val: the string to write
+  **/
+ int write_sysfs_string_and_verify(char *filename, char *basedir, char *val)
+ {
+       return _write_sysfs_string(filename, basedir, val, 1);
+ }
+ int write_sysfs_string(char *filename, char *basedir, char *val)
+ {
+       return _write_sysfs_string(filename, basedir, val, 0);
+ }
+ int read_sysfs_posint(char *filename, char *basedir)
+ {
+       int ret;
+       FILE  *sysfsfp;
+       char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
+       if (temp == NULL) {
+               printf("Memory allocation failed");
+               return -ENOMEM;
+       }
+       sprintf(temp, "%s/%s", basedir, filename);
+       sysfsfp = fopen(temp, "r");
+       if (sysfsfp == NULL) {
+               ret = -errno;
+               goto error_free;
+       }
+       fscanf(sysfsfp, "%d\n", &ret);
+       fclose(sysfsfp);
+ error_free:
+       free(temp);
+       return ret;
+ }
+ int read_sysfs_float(char *filename, char *basedir, float *val)
+ {
+       int ret = 0;
+       FILE  *sysfsfp;
+       char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
+       if (temp == NULL) {
+               printf("Memory allocation failed");
+               return -ENOMEM;
+       }
+       sprintf(temp, "%s/%s", basedir, filename);
+       sysfsfp = fopen(temp, "r");
+       if (sysfsfp == NULL) {
+               ret = -errno;
+               goto error_free;
+       }
+       fscanf(sysfsfp, "%f\n", val);
+       fclose(sysfsfp);
+ error_free:
+       free(temp);
+       return ret;
+ }
+ int read_sysfs_string(const char *filename, const char *basedir, char *str)
+ {
+       int ret = 0;
+       FILE  *sysfsfp;
+       char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
+       if (temp == NULL) {
+               printf("Memory allocation failed");
+               return -ENOMEM;
+       }
+       sprintf(temp, "%s/%s", basedir, filename);
+       sysfsfp = fopen(temp, "r");
+       if (sysfsfp == NULL) {
+               ret = -errno;
+               goto error_free;
+       }
+       fscanf(sysfsfp, "%s\n", str);
+       fclose(sysfsfp);
+ error_free:
+       free(temp);
+       return ret;
+ }
++
++#endif /* _IIO_UTILS_H */
This page took 0.256457 seconds and 4 git commands to generate.