GitHub/moto-9609/android_kernel_motorola_exynos9610.git
8 years agoiio: pressure: mpl115: don't set unused i2c clientdata
Akinobu Mita [Fri, 15 Jan 2016 16:00:02 +0000 (01:00 +0900)]
iio: pressure: mpl115: don't set unused i2c clientdata

mpl115 sets i2c clientdata, but it is not used anywhere.  So remove it.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoStaging: iio: Documentation: Remove unused sysfs attributes
Shraddha Barke [Thu, 21 Jan 2016 06:52:59 +0000 (12:22 +0530)]
Staging: iio: Documentation: Remove unused sysfs attributes

This patch removes the unused sysfs attributes range, range_available,
adc_resolution and adc_resolution_available.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: opt3001: enable operation w/o IRQ
Alexander Koch [Sat, 16 Jan 2016 16:14:38 +0000 (17:14 +0100)]
iio: light: opt3001: enable operation w/o IRQ

Enable operation of the TI OPT3001 light sensor without having an
interrupt line available to connect the INT pin to.

In this operation mode, we issue a conversion request and simply wait
for the conversion time available as timeout value, determined from
integration time configuration and the worst-case time given in the data
sheet (sect. 6.5, table on p. 5):

  short integration time (100ms): 110ms + 3ms = 113ms
   long integration time (800ms): 880ms + 3ms = 883ms

This change is transparent as behaviour defaults to using the interrupt
method if an interrupt no. is configured via device tree. Interrupt-less
operation mode is performed when no valid interrupt no. is given.

Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Tested-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: opt3001: trivial type refactoring
Alexander Koch [Sat, 16 Jan 2016 16:14:37 +0000 (17:14 +0100)]
iio: light: opt3001: trivial type refactoring

Change variable type of struct opt3001 members 'ok_to_ignore_lock' and
'result_ready' uint16-bitfield of length one to bool.

They are used as bool, let the compiler do the optimization.

Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Tested-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: opt3001: extract int. time constants
Alexander Koch [Sat, 16 Jan 2016 16:14:36 +0000 (17:14 +0100)]
iio: light: opt3001: extract int. time constants

Extract integration times as #define constants. This prepares using them
for delay/timeout length determination.

Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Tested-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoStaging: iio: adc: fix indent on break statement
Colin Ian King [Sat, 23 Jan 2016 19:33:10 +0000 (19:33 +0000)]
Staging: iio: adc: fix indent on break statement

Fix indent warning when building with gcc 6:
drivers/staging/iio/adc/ad7192.c:239:4: warning: statement is indented
  as if it were guarded by... [-Wmisleading-indentation]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: add ad5761 DAC driver
Ricardo Ribalda Delgado [Sat, 16 Jan 2016 13:24:07 +0000 (14:24 +0100)]
iio: add ad5761 DAC driver

ad5761 is a 1-channel DAC with configurable output range.
The driver uses the regulator interface for its voltage ref.

It shares its register layout with ad5761r, ad5721 and ad5721r.

Differences:
ad5761* are 16 bit, ad5721* are 12 bits.
ad57*1r have an internal reference.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: axp288: remove redundant duplicate const on axp288_adc_channels
Colin Ian King [Fri, 22 Jan 2016 17:49:22 +0000 (17:49 +0000)]
iio: adc: axp288: remove redundant duplicate const on axp288_adc_channels

duplicate const can be removed, it is redundant. Found by static
analysis using smatch.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: mma8452: add support for MMA8451Q
Martin Kepplinger [Sat, 16 Jan 2016 14:35:22 +0000 (15:35 +0100)]
iio: mma8452: add support for MMA8451Q

This adds support for this series' 14 bit accelerometer chip, MMA8451Q.
It's datasheet is available at the vendor's website:

https://cache.freescale.com/files/sensors/doc/data_sheet/MMA8451Q.pdf

Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: mma8452: whitespace cleanup
Martin Kepplinger [Sat, 16 Jan 2016 14:35:21 +0000 (15:35 +0100)]
iio: mma8452: whitespace cleanup

Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: mma8452: add freefall detection for Freescale's accelerometers
Martin Kepplinger [Sat, 16 Jan 2016 14:35:20 +0000 (15:35 +0100)]
iio: mma8452: add freefall detection for Freescale's accelerometers

This adds freefall event detection to the supported devices. It adds
the in_accel_x&y&z_mag_falling_en iio event attribute, which activates
freefall mode.

In freefall mode, the current acceleration magnitude (AND combination
of all axis values) is compared to the specified threshold.
If it falls under the threshold (in_accel_mag_falling_value),
the appropriate IIO event code is generated.

This is what the sysfs "events" directory for these devices looks
like after this change:

-rw-r--r--    4096 Oct 23 08:45 in_accel_mag_falling_period
-rw-r--r--    4096 Oct 23 08:45 in_accel_mag_falling_value
-rw-r--r--    4096 Oct 23 08:45 in_accel_mag_rising_period
-rw-r--r--    4096 Oct 23 08:45 in_accel_mag_rising_value
-r--r--r--    4096 Oct 23 08:45 in_accel_scale
-rw-r--r--    4096 Oct 23 08:45 in_accel_x&y&z_mag_falling_en
-rw-r--r--    4096 Oct 23 08:45 in_accel_x_mag_rising_en
-rw-r--r--    4096 Oct 23 08:45 in_accel_y_mag_rising_en
-rw-r--r--    4096 Oct 23 08:45 in_accel_z_mag_rising_en

Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:adc:at91-sama5d2: code cleanup
Ludovic Desroches [Mon, 18 Jan 2016 08:41:56 +0000 (09:41 +0100)]
iio:adc:at91-sama5d2: code cleanup

Use var type for sizeof argument instead of the struct name.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:adc:at91-sama5d2: fix vref_uv type
Ludovic Desroches [Mon, 18 Jan 2016 08:41:55 +0000 (09:41 +0100)]
iio:adc:at91-sama5d2: fix vref_uv type

vref_uv has to be an int.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: mcp320x: support more differential voltage measurement
Akinobu Mita [Thu, 7 Jan 2016 15:40:30 +0000 (00:40 +0900)]
iio: adc: mcp320x: support more differential voltage measurement

mcp320x driver supports the pseudo-differential mode by
in_voltage'IN+'-voltage'IN-'_raw where (IN+, IN-) = (0, 1), (2, 3), ...

mcp320x chips except MCP3X01 can also select swapped IN+ and IN-
pairs in the pseudo-differential mode.
i.e. in_voltage'IN+'-voltage'IN-'_raw where (IN+, IN-) = (1, 0),
(3, 2), ...

If the voltage level of IN+ is equal to or less than IN-, the
resultant code will be 000h.  So it is useful to provide these, too.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Oskar Andero <oskar.andero@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoMAINTAINERS: add entry for Atmel SAMA5D2 ADC driver
Ludovic Desroches [Fri, 15 Jan 2016 08:54:18 +0000 (09:54 +0100)]
MAINTAINERS: add entry for Atmel SAMA5D2 ADC driver

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:adc:at91_adc8xx: introduce new atmel adc driver
Ludovic Desroches [Thu, 14 Jan 2016 15:38:13 +0000 (16:38 +0100)]
iio:adc:at91_adc8xx: introduce new atmel adc driver

This driver supports the new version of the Atmel ADC device introduced
with the SAMA5D2 SoC family.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: ak8975: constify ak_def structures
Julia Lawall [Tue, 5 Jan 2016 14:56:42 +0000 (15:56 +0100)]
iio: ak8975: constify ak_def structures

The ak_def structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: st_sensors: support active-low interrupts
Linus Walleij [Thu, 19 Nov 2015 09:15:17 +0000 (10:15 +0100)]
iio: st_sensors: support active-low interrupts

Most ST MEMS Sensors that support interrupts can also handle sending
an active low interrupt, i.e. going from high to low on data ready
(or other interrupt) and thus triggering on a falling edge to the
interrupt controller.

Set up logic to inspect the interrupt line we get for a sensor: if
it is triggering on rising edge, leave everything alone, but if it
triggers on falling edges, set up active low, and if unsupported
configurations appear: warn with errors and reconfigure the interrupt
to a rising edge, which all interrupt generating sensors support.

Create a local header for st_sensors_core.h to share functions
between the sensor core and the trigger setup code.

Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoStaging: iio: cdc: ad7150: Fix alignment should match open parenthesis
Shraddha Barke [Tue, 29 Dec 2015 11:27:31 +0000 (16:57 +0530)]
Staging: iio: cdc: ad7150: Fix alignment should match open parenthesis

Fix the checkpatch warning of alignment should match open
parenthesis.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoStaging: iio: cdc: ad7150: Prefer using the BIT macro
Shraddha Barke [Tue, 29 Dec 2015 11:27:30 +0000 (16:57 +0530)]
Staging: iio: cdc: ad7150: Prefer using the BIT macro

Replace bit shifting on 1 with the BIT(x) macro

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: health: max30100: add config for LED current
Matt Ranostay [Wed, 30 Dec 2015 05:44:48 +0000 (21:44 -0800)]
iio: health: max30100: add config for LED current

Allow the current for both RED and IR LEDs to be set via an device tree
property setting.

This is an optional setting that is useful for applications that have a
known glass attenuation factor.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: dac: mcp4725: Add basic support for MCP4726
Akinobu Mita [Sat, 26 Dec 2015 12:17:22 +0000 (21:17 +0900)]
iio: dac: mcp4725: Add basic support for MCP4726

MCP4726 is a single channel 12-bit DAC.  We can support MCP4726 with
a little changes to mcp4725 driver.  In power-down mode, they have
different selection of VOUT pull-down registers.

MCP4726 also has features:
 - Output gain options: 1x, 2x
 - Voltage reference selection: VDD, VREF (Unbuffered or Buffered)

But these are not supported in this change. (1x gain, VDD is selected)

datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/22272C.pdf

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: mcp3422: Add support for MCP3425
Akinobu Mita [Sat, 26 Dec 2015 12:16:14 +0000 (21:16 +0900)]
iio: adc: mcp3422: Add support for MCP3425

The MCP3425 is a single channel up to 16-bit A/D converter which has
features:

- On-Board Programmable Gain Amplifier (PGA):
 - Gains of 1, 2, 4 or 8
- Programmable Data Rate Options:
 - 15 SPS (16 bits), 60 SPS (14 bits), 240 SPS (12 bits)

The mcp3422 driver also supports the MCP3421 which is a single channel.
So we can support MCP3425 with a little changes to mcp3422 driver.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoMerge tag 'iio-for-4.5c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
Greg Kroah-Hartman [Sun, 27 Dec 2015 01:05:25 +0000 (17:05 -0800)]
Merge tag 'iio-for-4.5c' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Third set of new stuff for IIO in the 4.5 cycle.

New driver features
- us5182
  * Add interrupt support and rising / falling threshold events.

Cleanups / fixes to new stuff / minor additions
* Expose the IIO value formatting function for drivers to
  make use of internally.
- ina2xx
   * Fix wrong channel order
   * Fix incorrect reporting of endianness
   * Adding documentation of ABI unique to this device
- mma8452
  * Drop an unused register description
  * Use an enum for the channel index to aid readability
- sca3000
  * Use standard NULL comparison style
- us5182
  * fix an inconsistency in status of enable (a bug with no real effect until
    above patches are applied)
  * refactor the read_raw function to improve maintainability / readability.

8 years agoMerge tag 'iio-for-4.5b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
Greg Kroah-Hartman [Sun, 27 Dec 2015 01:03:33 +0000 (17:03 -0800)]
Merge tag 'iio-for-4.5b' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of IIO new drivers, functionality and cleanups for the 4.5 cycle.

The big one here is the configfs support which has been a long time in the
works but should allow for cleaner ways to do instantiation of those elements
of IIO that aren't directly connected to specific hardware. Lots of cool new
stuff we can use this for in the works!

New core stuff (basically all configfs support related)
* Configfs support
  - Core support (was waiting for a configfs patch that went in around 4.4rc2)
  - A little fixlet to add a configfs.h to contain a reference to the
    configfs_subsystem structure.
* Some infrastructure to simplify handling of software based triggers
  (i.e. ones with no actual hardware associated with them)
* A high resolution timer based trigger.  This has been around for years
    but until the configfs support was ready we didn't have a sensible way
    of instantiating instances of it (the method used for the sysfs_trigger
    has never been really satisfactory)

New Device Support
* AMS iAQ Volatile Organic Compounds sensor support.
* Freescale imx7d ADC driver
* Maxim MAX30100 oximeter driver (note that for these devices most of the
  smart stuff will be in userspace - effectively they are just light sensors
  with some interesting led synchronization as far as the kernel is concerned).
* Microchip mcp3421 support added to the mcp3422 driver.
* TI adc124s021 support added to the adc128s052 driver.
* TI ina219, inda226 power monitors. Note that there is an existing hwmon driver
  for these parts, the usecase is somewhat different so it is unclear at this
  point if the hwmon driver will eventually be replaced by a bridge from
  this driver.  In the meantime the Kconfig dependencies should prevent both
  from being built.

New driver functionality
* us8152d power management support.

Cleanups, fixups
* Use list_for_each_entry_safe instead of list_for_each_safe with the entry
  bit coded longhand.
* Select IRQ_WORK for IIO_DUMMY_EVGEN.  This is a fix that somehow got lost
  when the driver was moved so lets do it again.
* st-accel - drop an unused define.
* vz89x, lidar - optimize i2c transactions by using a single i2c tranfers
  instead of multiple calls where supported (fall back to smbus calls as
  before if not).
* Use dev_get_platdata() in staging drivers: tsl2x7x, adcs and frequency
  drivers instead of direct access to the structure element.

8 years agoiio: adc: ina2xx: Fix incorrect report of data endianness to userspace.
Jonathan Cameron [Tue, 22 Dec 2015 18:51:27 +0000 (18:51 +0000)]
iio: adc: ina2xx: Fix incorrect report of data endianness to userspace.

This was extracted from a reposting of the driver after it had been applied
to the IIO tree.  I have fast tracked it as the driver will be in 4.5 and
it would be nice to fix this trivial issue before it is.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: us5182d: Refactor read_raw function
Adriana Reus [Mon, 14 Dec 2015 12:24:47 +0000 (14:24 +0200)]
iio: light: us5182d: Refactor read_raw function

A bit of refactoring for better readability.
Moved and slightly reorganized all the activity necessary for reading als
and proximity into a different function. This way the switch in read raw
becomes clearer and more compact.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: us5182d: Add interrupt support and events
Adriana Reus [Mon, 14 Dec 2015 12:24:46 +0000 (14:24 +0200)]
iio: light: us5182d: Add interrupt support and events

Add interrupt support for proximity.
Add two threshold events to signal rising and falling directions.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: us5182d: Fix enable status inconcistency
Adriana Reus [Mon, 14 Dec 2015 12:24:45 +0000 (14:24 +0200)]
iio: light: us5182d: Fix enable status inconcistency

When setting als only or proximity only modes make sure that we mark the
other component as disabled. This fix is in preparation of adding event
support because that will make it possible to switch between one-shot and
continuous modes and not tracking these correctly may cause faulty
behaviour (e.g wrongfully considering px enabled and not setting an
appropriate mode in the chip).

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: Make IIO value formating function globally available.
Andrew F. Davis [Mon, 14 Dec 2015 22:35:57 +0000 (16:35 -0600)]
iio: Make IIO value formating function globally available.

Make IIO value formating function globally available to allow IIO drivers
to output values as the core does.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: emxx_udc: use list_first_entry_or_null()
Geliang Tang [Mon, 16 Nov 2015 13:54:46 +0000 (21:54 +0800)]
staging: emxx_udc: use list_first_entry_or_null()

Simplify the code with list_first_entry_or_null().

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/emxx_udc: fix 64-bit warnings
Arnd Bergmann [Wed, 18 Nov 2015 21:02:39 +0000 (22:02 +0100)]
staging/emxx_udc: fix 64-bit warnings

ARCH_SHMOBILE is coming to arm64, which creates new warnings in allmodconfig:

drivers/staging/emxx_udc/emxx_udc.c: In function '_nbu2ss_out_dma':
drivers/staging/emxx_udc/emxx_udc.c:843:45: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)pBuffer);

This is clearly a mistake from confusing a dma_addr_t with a pointer,
so the fix is to use the correct types in two places.

The third warning of this kind is a check for an unaligned pointer,
which should be done by casting the pointer to uintptr_t, not int.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoSTAGING: COMEDI: Using kernel types in plx9080.h
Moritz König [Thu, 17 Dec 2015 15:53:12 +0000 (16:53 +0100)]
STAGING: COMEDI: Using kernel types in plx9080.h

This patch makes plx9080.h use kernel types.

Signed-off-by: Moritz König <moritz.koenig@fau.de>
Signed-off-by: Fabian Lang <fabian.lang@fau.de>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Acked-by: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoSTAGING: COMEDI: Added spaces around binary operators in plx9080.h
Moritz König [Thu, 17 Dec 2015 15:53:11 +0000 (16:53 +0100)]
STAGING: COMEDI: Added spaces around binary operators in plx9080.h

This patch adds spaces around binary operators in plx9080.h.

Signed-off-by: Moritz König <moritz.koenig@fau.de>
Signed-off-by: Fabian Lang <fabian.lang@fau.de>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoSTAGING: COMEDI: Fixed format of comments in plx9080.h
Moritz König [Thu, 17 Dec 2015 15:53:10 +0000 (16:53 +0100)]
STAGING: COMEDI: Fixed format of comments in plx9080.h

This patch fixes the format of comments in plx9080.h.

Signed-off-by: Moritz König <moritz.koenig@fau.de>
Signed-off-by: Fabian Lang <fabian.lang@fau.de>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: comedilib.h: Coding style warning fix for block comments
Jitendra Kumar Khasdev [Tue, 24 Nov 2015 12:22:28 +0000 (17:52 +0530)]
staging: comedi: comedilib.h: Coding style warning fix for block comments

This patch is to comedilib.h file that fixes up following warnings
reported by checkpatch.pl :
I) Block comments use * on subsequent lines.

Apart from it I have remove header file path by base file name as
suggested by community.

Signed-off-by: Jitendra Kumar Khasdev <jkhasdev@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: s526: add macros for counter control reg values
Ian Abbott [Thu, 19 Nov 2015 14:49:08 +0000 (14:49 +0000)]
staging: comedi: s526: add macros for counter control reg values

The driver writes a couple of literal values to the counter
control/status register, 0x8000 to reset the counter, and 0x4000 to load
the counter from preload register 0.  Add a bunch of macros to define
these values and other values for the register, based on the Sensoray
526 manual.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: s526: replace counter mode bitfield struct
Ian Abbott [Thu, 19 Nov 2015 14:49:07 +0000 (14:49 +0000)]
staging: comedi: s526: replace counter mode bitfield struct

The driver uses `struct counter_mode_register_t` to describe the 16-bit
counter mode register as a sequence of bitfield members.  The struct
appears as the type of one of the members of `union cmReg`, the other
member of which is of type `unsigned short`, so the driver can
manipulate the register value as a whole, or as individual fields.
Although this is fairly convenient, it's not that conventional.  The
code also needs to define the bitfield members in ascending or
descending order of the physical bits, depending on whether bitfields
are little- or big-endian.

Rip all that out and replace it with a bunch of macros to set and mask
out bits of the register value, as that's the more conventional way to
do it.  A bonus is that we get rid of a load of CamelCase definitions in
the process.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: check for more errors for zero-length write
Ian Abbott [Wed, 18 Nov 2015 17:55:11 +0000 (17:55 +0000)]
staging: comedi: check for more errors for zero-length write

If the "write" file operation handler, `comedi_write()` is passed 0 for
the amount to write, some error conditions are currently skipped and the
function just returns 0.  Change it to check those error conditions and
return an error value if appropriate.  The trickiest case is the check
for when the previously set up asynchronous command has terminated with
an error.  In that case, `-EPIPE` is returned (as it is for a write of
non-zero length) and the subdevice gets marked as non-busy.

A zero-length write that returns 0 has no other effects, in particular,
it does not cause the subdevice to be marked as non-busy.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: simplify returned errors for comedi_write()
Ian Abbott [Wed, 18 Nov 2015 17:55:10 +0000 (17:55 +0000)]
staging: comedi: simplify returned errors for comedi_write()

In order to perform a "write" file operation, an asynchronous COMEDI
command in the "write" direction needs to have been set up by the
current file object on the COMEDI "write" subdevice associated with the
file object.  If there is a "write" subdevice, but a command has not
been set up by the file object (or is has been set-up in the wrong
direction), `comedi_write()` currently returns one of two error values
`-EINVAL` or `-EACCES`.  `-EACCES` is returned if the command was set up
by a different subdevice, or somewhat randomly, if a COMEDI
"instruction" is currently being processed.  `-EINVAL` is returned in
other cases.  Simplify it by returning `-EINVAL` for all these cases.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: return error on "write" if no command set up
Ian Abbott [Wed, 18 Nov 2015 17:55:09 +0000 (17:55 +0000)]
staging: comedi: return error on "write" if no command set up

The "write" file operation handler, `comedi_write()` returns an error
for pretty much any condition that prevents a "write" going ahead.  One
of the conditions that prevents a "write" going ahead is that no
asynchronous command has been set up, but that currently results in a
return value of 0 (unless COMEDI instructions are being processed or an
asynchronous command has been set up by a different file object).
Change it to return `-EINVAL` in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: allow buffer wraparound in comedi_write()
Ian Abbott [Wed, 18 Nov 2015 17:55:08 +0000 (17:55 +0000)]
staging: comedi: allow buffer wraparound in comedi_write()

`comedi_write()` copies data from the user buffer to the acquisition
data buffer, which is cyclic, using a single call to `copy_from_user()`.
It currently avoids having to deal with wraparound of the cyclic buffer
by limiting the amount it copies (and the amount returned to the user).
Change it to deal with the wraparound using two calls to
`copy_from_user()` if necessary.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: avoid bad truncation of a size_t in comedi_write()
Ian Abbott [Wed, 18 Nov 2015 17:55:07 +0000 (17:55 +0000)]
staging: comedi: avoid bad truncation of a size_t in comedi_write()

At one point in `comedi_write()`, the variable `n` gets assigned to the
minimum of the parameter `nbytes` and the amount of writeable buffer
space.  The way that is done currently is unsafe in the unlikely case
that `nbytes` exceeds `UINT_MAX`, so fix it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: make some variables unsigned in comedi_write()
Ian Abbott [Wed, 18 Nov 2015 17:55:06 +0000 (17:55 +0000)]
staging: comedi: make some variables unsigned in comedi_write()

In `comedi_write()`, the `n` and `m` variables are of type `int`.
Change them to `unsigned int` as they are used to measure a positive
number of bytes.  The `count` variable is also of type `int` and holds
the returned number of bytes written.  Change it to type `ssize_t` to
match the function's return type.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: do extra checks for becoming non-busy for "write"
Ian Abbott [Wed, 18 Nov 2015 17:55:05 +0000 (17:55 +0000)]
staging: comedi: do extra checks for becoming non-busy for "write"

`comedi_write()` is the handler for the "write" file operation for
COMEDI devices.  It mostly runs without using the main mutex of the
COMEDI device, but uses the `attach_lock` rw_semaphore to protect
against the COMEDI device becoming "detached".  A file object can write
data for a COMEDI asynchonous command if it initiated the command.  The
COMEDI subdevice is marked as busy when the command is started.  At some
point, the "write" handler detects that the command has terminated and
so marks the subdevice as non-busy.

In order to mark the subdevice as non-busy, the "write" handler needs to
release the `attach_lock` rw_semaphore and `acquire the main `mutex`.
There is a vulnerable point between the two, so it checks that the
device is still attached after acquiring the mutex.  However, it does
not currently check that the conditions for becoming non-busy still
hold.  Add some more checks that the subdevice is still busy with a
command initiated by the same file object, and that the command is in
the correct direction (in case the subdevice supports both "read" and
"write").

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: rearrange comedi_write() code
Ian Abbott [Wed, 18 Nov 2015 17:55:04 +0000 (17:55 +0000)]
staging: comedi: rearrange comedi_write() code

Rearrange the code in `comedi_write()` to reduce the amount of
indentation.  The code never reiterates the `while` loop once `count`
has become non-zero, so we can check that in the `while` condition to
save an indentation level.  (Note that `nbytes` has been checked to be
non-zero before entering the loop, so we can remove that check.)  Move
the code that makes the subdevice "become non-busy" outside the `while`
loop, using a new flag variable `become_nonbusy` to decide whether it
needs to be done.  This simplifies the wait queue handling so there is a
single place where the task is removed from the wait queue, and we can
remove the `on_wait_queue` flag variable.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: update the MODULE_DESCRIPTION
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:34 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: update the MODULE_DESCRIPTION

Change the MODULE_DESCRIPTION to something more useful than the
generic "Comedi low-level driver".

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: tidy up the comedi comment block
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:33 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: tidy up the comedi comment block

The Description is a bit long winded and the same information is in
the Devices. Shorten the Description and tidy up the Devices.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: move pci_dio_override_cardtype()
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:32 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: move pci_dio_override_cardtype()

This function is called as part of the pci_driver (*probe) before
doing the (*auto_attach) of the comedi driver. For aesthetics, move
the function to a more logical place in the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: move and rename the MAX_*_SUBDEV[SG] defines
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:31 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: move and rename the MAX_*_SUBDEV[SG] defines

For aesthetics, move these defines after the register defines and rename
them to have namespace associated with the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: move and rename enum hw_cards_id
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:30 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: move and rename enum hw_cards_id

For aesthetics, move this enum after the register defines and rename
it to have namespace associated with the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: remove boardinfo 'cardtype'
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:29 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove boardinfo 'cardtype'

This member of the boardinfo is identical to the offset of the boardinfo
in the boardtypes array. It's also passed as the 'context' to the driver
(*auto_attach).

The 'cardtype' is only needed by the (*auto_attach) to determine which
PCI BAR to use and in pci_dio_reset() to handle the board specific code.

Remove the 'cardtype' member and use the 'context' value instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: cleanup PCI-1762 interrupt registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:28 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: cleanup PCI-1762 interrupt registers

For aesthetics, use a common define for the interrupt control and status
registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: rename PCI1752_6_CFC define
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:27 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: rename PCI1752_6_CFC define

For aesthetics, rename this define and fix the alignment.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: cleanup PCI-175[46] interrupt registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:26 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: cleanup PCI-175[46] interrupt registers

For aesthetics, replace these defines with a macro.

Refactor the switch in pci_dio_reset() to use common code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: cleanup PCI-1753 interrupt register defines
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:25 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: cleanup PCI-1753 interrupt register defines

For aesthetics, replace these defines with some macros.

Refactor the switch in pci_dio_reset() to not require the fallthrough
comment.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: use common defines for PCI-1739/175[01] registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:24 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: use common defines for PCI-1739/175[01] registers

These boards use the same offsets for the interrupt control registers.
For aesthetics, remove the current defines and use common ones.

Fix the switch() in pci_dio_reset() to use common code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: use common defines for PCI-173[036] registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:23 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: use common defines for PCI-173[036] registers

These boards use the same offsets for the interrupt control registers.
For aesthetics, remove the current defines and use common ones.

Fix the switch() in pci_dio_reset() to use common code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: cleanup "disable and clear interrupts" comments
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:22 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: cleanup "disable and clear interrupts" comments

For aesthetics, use a common comment for the switch() that disables and clears
interrupts.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: disable channel freeze outside of switch
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:21 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: disable channel freeze outside of switch

For aesthetics, move the disable of the channel freeze for the PCI-1752
and PCI-1756 boards out of the switch used to disable and clear interrupts.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: use a default case in pci_dio_reset()
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:20 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: use a default case in pci_dio_reset()

For aesthetics, use a default case in the switch (board->cardtype) used
to reset the various boards.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: remove defines used for the dio (8255) registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:19 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove defines used for the dio (8255) registers

These defines are only used to initialize the diosubd_data 'addr' members
in the boardinfo. For aesthetics, just open-code the values and remove the
defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: remove defines used for the do registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:18 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove defines used for the do registers

These defines are only used to initialize the diosubd_data 'addr' members
in the boardinfo. For aesthetics, just open-code the values and remove the
defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: reset digital outputs in subdevice init
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:17 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: reset digital outputs in subdevice init

Currently the board reset function also resets the digital output channels
to 0. This works but it makes the reset function a bit messy and each
board type has to be handled special.

Move the digital output reset into the subdevice init where it can be
handle based on the subdevice setup.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: do board reset early in (*auto_attach)
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:16 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: do board reset early in (*auto_attach)

The board reset function disables and clears all interrupts. It also
resets all the digital output channels to 0.

Interrupts are not currently used by this driver. For asthetics, do
the board reset early in the (*auto_attach) to make sure the interrupts
are disabled in case this feature is added.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: remove board reset during (*detach)
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:15 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove board reset during (*detach)

The board reset function disables and clears all interrupts. It also
resets all the digital output channels to 0.

Interrupts are not used by this driver so the disable/clear during the
(*detach) is not necessary.

Reseting all the digital outputs to 0 might not be desired depending
on what the outputs are connected to.

Remove the board reset and just use comedi_pci_detach() directly for
the driver (*detach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: remove defines used for the di registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:14 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove defines used for the di registers

These defines are only used to initialize the diosubd_data 'addr' members
in the boardinfo. For aesthetics, just open-code the values and remove the
defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: remove defines used for the 'timer_regbase'
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:13 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove defines used for the 'timer_regbase'

These defines are only used to initialize the 'timer_regbase' boardinfo.
For aesthetics, just open-code the values and remove the defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: simplify the 'boardid' boardinfo
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:12 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: simplify the 'boardid' boardinfo

The "board id" register is always 4-bits (4 di channels) and the register
used to read the bits is always > 0.

Simplify the 'boardid' boardinfo by replacing it with a 'id_reg' member
and open-coding the subdevice n_chan.

For aesthetics, remove all the *_BOARDID defines and just open-code the
register values in the boardinfo.

Add the missing boardinfo for the pci1739 board id register and increase
the nsubdevs to handle it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: use the diosubd_data 'addr' for di/do s->private
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:11 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: use the diosubd_data 'addr' for di/do s->private

Currently the di/do subdevices store a pointer to the diosubd_data in s->private.
The (*insn_bits) functions then use that to get to the 'addr' needed to access
the registers.

The only member of diosubd_data that is needed by the (*insn_bits) functions is
the 'addr'. For aesthetics, just store the 'addr' in s->private.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: remove need for diosubd_data 'regs' member
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:10 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove need for diosubd_data 'regs' member

Currently the (*insn_bits) functions used the 'regs' member to determine how
many registers need to be read or written to update the subdevice. We can use
the subdevice 'n_chan' to determine this and make the code a bit clearer.

The (*auto_attach) also uses this member to determine how many 8255 devices
need to be initialized. These subdevices do not use the 'chans' member of
diosubd_data. Move the 'regs' value to the 'chans' to allow removing the
'regs' member completely.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: refactor 'io_access' boardinfo
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:09 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: refactor 'io_access' boardinfo

The boards supported by this driver either use 8-bit or 16-bit I/O. The
'io_access' member of the boardinfo is used by the (*auto_attach) to
determine which (*insn_bits) function to use.

Simplify the boardinfo a bit by refactoring the 'io_access' member into
a bit-field flag 'is_16bit'. Use the new flag and remove the switch ()
code in the (*auto_attach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: absorb pci_dio_add_di()
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:08 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: absorb pci_dio_add_di()

This function initializes a digitial input subdevices. For aesthetics,
absorb it into the (*auto_attach).

Remove the improper initialization of the SDF_LSAMPL subdev_flag and
len_chanlist. These are only used by subdevices that support async
commands.

Also, remove the unnecessary 'specflags' from the diosubd_data. Only
the boardid subdevice uses it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: absorb pci_dio_add_do()
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:07 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: absorb pci_dio_add_do()

This function initializes a digitial output subdevice. For aesthetics,
absorb it into the (*auto_attach).

Remove the improper initialization of the SDF_LSAMPL subdev_flag and
len_chanlist. These are only used by subdevices that support async
commands.

Also remove the unnecessary initilaization of the subdevice 'state'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: use a const pointer to the diosubd_data
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:06 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: use a const pointer to the diosubd_data

For aesthetics, use a const pointer to access the diosubd_data in the
boardinfo when doing the (*auto_attach)..

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: post increment 'subdev' in (*auto_attach)
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:05 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: post increment 'subdev' in (*auto_attach)

For aesthetics, post-increment the 'subdev' index when used to get a
comedi_subdevice pointer instead of incrementing it after the subdevice
is initialized.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: remove 'main_pci_region' boardinfo
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:04 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove 'main_pci_region' boardinfo

All the boards use PCI BAR2 for the dev->iobase except for the pci1736
which uses PCI BAR0. Just use the board->cardtype to determine which
PCI BAR to use.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: tidy up comedi driver block comment
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:03 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: tidy up comedi driver block comment

Reformat the bolck comment in the kernel CodingStyle.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: adv_pci_dio: remove unnecessary function separation comments
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:02 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove unnecessary function separation comments

These are not necessary and just add cruft. Remove them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocomedi: ni_6527: Fix coding style - use BIT macro
Ranjith Thangavel [Mon, 16 Nov 2015 16:56:15 +0000 (22:26 +0530)]
comedi: ni_6527: Fix coding style - use BIT macro

BIT macro is used for defining BIT location instead of
shifting operator - coding style issue

Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_mio_common: add "no_channel" versions of some functions
Andrzej Pietrasiewicz [Sat, 14 Nov 2015 18:19:10 +0000 (19:19 +0100)]
staging: comedi: ni_mio_common: add "no_channel" versions of some functions

ni_release_ai_mite_channel(), ni_release_ao_mite_channel(),
ni_release_gpct_mite_channel() and ni_release_cdo_mite_channel()
call functions which interpret -1 as a special value meaning "no channel".
This patch adds explicit "no_channel" versions instead.

On the other hand, after "no_channel" versions are used,
ni_set_ai_dma_channel(), ni_set_ao_dma_channel(),
ni_set_gpct_dma_channel(), ni_set_cdo_dma_channel() are called with actual
"channel" parameter being always unsigned, so their signatures are changed
accordingly.

A side benefit of the changes is suppressesing 4 sparse warnings:
"warning: shift too big (4294967295) for type int".

Signed-off-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: comedi: Fixed multiple commenting and spacing codig style issues.
Daniel H. Hemmingsen [Thu, 12 Nov 2015 16:03:18 +0000 (17:03 +0100)]
Staging: comedi: Fixed multiple commenting and spacing codig style issues.

Fixed multiple comment blocks that didn't comply with the
kernels coding style, and fixed a few spacing issues as well.

Signed-off-by: Daniel H. Hemmingsen <dhh.kernel@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocomedi: cb_pcidda: Fix coding style - use BIT macro
Ranjith Thangavel [Wed, 11 Nov 2015 16:27:51 +0000 (21:57 +0530)]
comedi: cb_pcidda: Fix coding style - use BIT macro

BIT macro is used for defining BIT location instead of
shifting operator - coding style issue

Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocomedi: ni_65xx: Fix coding style - use BIT macro
Ranjith Thangavel [Wed, 11 Nov 2015 16:22:02 +0000 (21:52 +0530)]
comedi: ni_65xx: Fix coding style - use BIT macro

BIT macro is used for defining BIT location instead of
shifting operator - coding style issue

Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocomedi: comedi_parport: Fix coding style - use BIT macro
Ranjith Thangavel [Wed, 11 Nov 2015 15:54:01 +0000 (21:24 +0530)]
comedi: comedi_parport: Fix coding style - use BIT macro

BIT macro is used for defining BIT location instead of
shifting operator - coding style issue

Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: use kmalloc_array instead of kmalloc
Geliang Tang [Tue, 10 Nov 2015 14:41:34 +0000 (22:41 +0800)]
staging: comedi: use kmalloc_array instead of kmalloc

Use kmalloc_array instead of kmalloc to allocate memory for an array.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: dgnc_cls.c: Replaced udelay by usleep_range
Jitendra Kumar Khasdev [Tue, 24 Nov 2015 17:31:13 +0000 (23:01 +0530)]
staging: dgnc: dgnc_cls.c: Replaced udelay by usleep_range

This patch is to file dgnc_cls.c that fixes up udelay function by
usleep_range.
It is safe to use according to the following documentation
Documentation/timers/timers-howto.txt. So that is why I have given
an appropriate time range.

Signed-off-by: Jitendra Kumar Khasdev <jkhasdev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: dgnc: dgnc_tty: Typo error dgnc_wmove comment
Nizam Haider [Sat, 14 Nov 2015 14:40:46 +0000 (20:10 +0530)]
Staging: dgnc: dgnc_tty: Typo error dgnc_wmove comment

Fix Typo errror in the comment section of dgnc_wmove

Signed-off-by: Nizam Haider <nijamh@cdac.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: dgnc: dgnc_neo.c Braces {} should be used on all arms of this statement
Nizam Haider [Sat, 14 Nov 2015 14:40:45 +0000 (20:10 +0530)]
Staging: dgnc: dgnc_neo.c Braces {} should be used on all arms of this statement

Fix Checlpatch warning
HECK: braces {} should be used on all arms of this statement

Signed-off-by: Nizam Haider <nijamh@cdac.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodriver:staging:dgnc Fix spaces preferred around that ...
Bogicevic Sasa [Fri, 13 Nov 2015 14:07:21 +0000 (15:07 +0100)]
driver:staging:dgnc Fix spaces preferred around that ...

This fixes all "spaces preferred around that ..." messages from
checkpatch.pl

Signed-off-by: Bogicevic Sasa <brutallesale@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: Fix a jump label position in osc_get_info()
Markus Elfring [Mon, 21 Dec 2015 18:30:42 +0000 (19:30 +0100)]
staging: lustre: Fix a jump label position in osc_get_info()

The script "checkpatch.pl" pointed out that labels should not be indented.
Thus delete a horizontal tab before the jump label "out"
in the function "osc_get_info".

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: Delete an unnecessary variable initialisation in mgc_process_recover...
Markus Elfring [Mon, 21 Dec 2015 17:24:45 +0000 (18:24 +0100)]
staging: lustre: Delete an unnecessary variable initialisation in mgc_process_recover_log()

The variable "mne_swab" will eventually be set to an appropriate value
from a call of the ptlrpc_rep_need_swab() function.
Thus let us omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: Delete unnecessary goto statements in six functions
Markus Elfring [Mon, 21 Dec 2015 17:15:45 +0000 (18:15 +0100)]
staging: lustre: Delete unnecessary goto statements in six functions

Six goto statements referred to a source code position
directly behind them.
Thus omit such unnecessary jumps.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: obdclass: Declare lu_site_hash_ops as static
Shraddha Barke [Thu, 17 Dec 2015 21:10:30 +0000 (02:40 +0530)]
Staging: lustre: obdclass: Declare lu_site_hash_ops as static

lu_site_hash_ops is used only in this particular file. Thus declare
it as static.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: osc: Declare osc_attr_set as static
Shraddha Barke [Thu, 17 Dec 2015 21:10:29 +0000 (02:40 +0530)]
Staging: lustre: osc: Declare osc_attr_set as static

osc_attr_set is used only in this particular file. Thus declare it
as static.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: osc: Declare as static
Shraddha Barke [Thu, 17 Dec 2015 21:10:28 +0000 (02:40 +0530)]
Staging: lustre: osc: Declare as static

Declare osc_extent_find and osc_unreserve_grant as static since they
are used only in this particular file.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: libcfs: Remove unused libcfs_debug_set_level
Shraddha Barke [Thu, 17 Dec 2015 21:10:27 +0000 (02:40 +0530)]
Staging: lustre: libcfs: Remove unused libcfs_debug_set_level

Function libcfs_debug_set_level is defined but not used. Thus
remove it.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: obdclass: Declare cl_env_peek as static
Shraddha Barke [Thu, 17 Dec 2015 21:10:26 +0000 (02:40 +0530)]
Staging: lustre: obdclass: Declare cl_env_peek as static

Declare cl_env_peek as static since it is used only in this file.
Also remove the EXPORT SYMBOL.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: lnet: Remove functions LNetEQWait and LNetEQGet
Shraddha Barke [Wed, 16 Dec 2015 17:40:17 +0000 (23:10 +0530)]
Staging: lustre: lnet: Remove functions LNetEQWait and LNetEQGet

Functions LNetEQWait and LNetEQGet are defined but not used. Thus
remove it. Also remove corresponding declarations from header file.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: include: Remove unused llog_backup declaration
Shraddha Barke [Wed, 16 Dec 2015 17:40:15 +0000 (23:10 +0530)]
Staging: lustre: include: Remove unused llog_backup declaration

Function llog_backup is declared in header file but not used.
Thus remove it.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>