GitHub/moto-9609/android_kernel_motorola_exynos9610.git
11 years agoiio:trigger: fix sysfs name on list mutex
Denis CIOCCA [Mon, 23 Sep 2013 10:49:00 +0000 (11:49 +0100)]
iio:trigger: fix sysfs name on list mutex

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:iio-trig-bfin-timer: Fix compile error
Lars-Peter Clausen [Fri, 27 Sep 2013 13:50:00 +0000 (14:50 +0100)]
staging:iio:iio-trig-bfin-timer: Fix compile error

This patch fixes the following compile errors for the iio-trig-bfin-timer
driver:
drivers/staging/iio/trigger/iio-trig-bfin-timer.c: In function ‘iio_bfin_tmr_frequency_store’:
drivers/staging/iio/trigger/iio-trig-bfin-timer.c:121: error: invalid storage class for function ‘iio_bfin_tmr_frequency_show’
drivers/staging/iio/trigger/iio-trig-bfin-timer.c:118: warning: ISO C90 forbids mixed declarations and code
drivers/staging/iio/trigger/iio-trig-bfin-timer.c:135: error: initializer element is not constant
...

The issue was introduced in commit e5e26dd5 ("staging: iio: replace
strict_strto*() with kstrto*()") by leaving an excess opening bracket.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:ti_am335x_adc ensure that IIO_KFIFO_BUF is not selected witout IIO_BUFFER
Jonathan Cameron [Wed, 25 Sep 2013 20:37:00 +0000 (21:37 +0100)]
iio:ti_am335x_adc ensure that IIO_KFIFO_BUF is not selected witout IIO_BUFFER

This avoids build problems such iio_push_to_buffers* not being defined.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
11 years agoiio: dac: ad5446: Add support for AD5641
Aida Mynzhasova [Mon, 23 Sep 2013 14:19:00 +0000 (15:19 +0100)]
iio: dac: ad5446: Add support for AD5641

This patch adds support for the AD5641 single channel,
14-bit, buffered voltage output DAC.

Signed-off-by: Aida Mynzhasova <aida.mynzhasova@skitlab.ru>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: pressure-core: st: Provide support for the Vdd_IO power supply
Lee Jones [Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)]
iio: pressure-core: st: Provide support for the Vdd_IO power supply

The power to some of the sensors are controlled by regulators. In most
cases these are 'always on', but if not they will fail to work until
the regulator is enabled using the relevant APIs. This patch allows for
the Vdd_IO power supply to be specified by either platform data or
Device Tree.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: pressure-core: st: Provide support for the Vdd power supply
Lee Jones [Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)]
iio: pressure-core: st: Provide support for the Vdd power supply

The power to some of the sensors are controlled by regulators. In most
cases these are 'always on', but if not they will fail to work until
the regulator is enabled using the relevant APIs. This patch allows for
the Vdd power supply to be specified by either platform data or Device
Tree.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoMerge tag 'iio-for-3.13a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Sun, 22 Sep 2013 18:30:12 +0000 (11:30 -0700)]
Merge tag 'iio-for-3.13a' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

First round of new drivers, functionality and cleanups for IIO in the 3.13 cycle

A number of new drivers and some new functionality + a lot of cleanups
all over IIO.

New Core Elements

1) New INT_TIME info_mask element for integration time, which may have
   different effects on measurement noise and similar, than an amplifier
   and hence is different from existing SCALE.  Already existed in some
   drivers as a custom attribute.

2) Introduce a iio_push_buffers_with_timestamp helper to cover the common
   case of filling the last 64 bits of data to be passed to the buffer with
   a timestamp.  Applied to lots of drivers. Cuts down on repeated code and
   moves a slightly fiddly bit of logic into a single location.

3) Introduce info_mask_[shared_by_dir/shared_by_all] elements to allow support
   of elements such as sampling_frequency which is typically shared by all
   input channels on a device.  This reduces code and makes these controls
   available from in kernel consumers of IIO devices.

New drivers

1) MCP3422/3/4 ADC

2) TSL4531 ambient light sensor

3) TCS3472/5 color light sensor

4) GP2AP020A00F ambient light / proximity sensor

5) LPS001WP support added to ST pressure sensor driver.

New driver functionality

1) ti_am335x_adc Add buffered sampling support.
   This device has a hardware fifo that is fed directly into an IIO kfifo
   buffer based on a watershed interrupt.  Note this will act as an example
   of how to handle this increasingly common type of device.
   The only previous example - sca3000 - take a less than optimal approach
   which is largely why it is still in staging.
   A couple of little cleanups for that new functionality followed later.

Core cleanups:

1) MAINTAINERS - Sachin actually brought my email address up to date because
   I said I'd do it and never got around to it :)

2) Assign buffer list elements as single element lists to simplify the
   iio_buffer_is_active logic.

3) wake_up_interruptible_poll instead of wake_up_interruptible to only wake
   up threads waiting for poll notifications.

4) Add O_CLOEXEC flag to anon_inode_get_fd call for IIO event interface.

5) Change iio_push_to_buffers to take a void * pointer so as to avoid some
   annoying and unnecessary type casts.

6) iio_compute_scan_bytes incorrectly took a long rather than unsigned long.

7) Various minor tidy ups.

Driver cleanups (in no particular order)

1) Another set of devm_ allocations patches from Sachin Kamat.

2) tsl2x7x - 0 to NULL cleanup.

3) hmc5843 - fix missing > in MODULE_AUTHOR

4) Set of strict_strto* to kstrto* conversions.

5) mxs-lradc - fix ordering of resource removal to match creation

6) mxs-lradc - add MODULE_ALIAS

7) adc7606 - drop a work pending test duplicated in core functions.

8) hmc5843 - devm_ allocation patch

9) Series of redundant breaks removed.

10) ad2s1200 - pr_err -> dev_err

11) adjd_s311 - use INT_TIME

12)  ST sensors - large set of cleanups from Lee Jones and removed restriction
    to using only triggers provided by the st_sensors themselves from
    Dennis Ciocca.

13) dummy and tmp006 provide sampling_frequency via info_mask_shared_by_all.

14) tcs3472 - fix incorrect buffer size and wrong device pointer used in
    suspend / resume functions.

15) max1363 - use defaults for buffer setup ops as provided by the triggered
    buffer helpers as they are the same as were specified in max1363 driver.

16) Trivial tidy ups in a number of other drivers.

11 years agoiio: ti_am335x_adc: cleanup error case
Zubair Lutfullah [Sun, 22 Sep 2013 08:20:00 +0000 (09:20 +0100)]
iio: ti_am335x_adc: cleanup error case

Driver is functional without this error case. Cleaned up.

Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: ti_am335x_adc: cleanup trigger related code
Zubair Lutfullah [Sun, 22 Sep 2013 08:20:00 +0000 (09:20 +0100)]
iio: ti_am335x_adc: cleanup trigger related code

Trigger related headers and variables are not needed
as driver is now based on INDIO_BUFFER_HARDWARE mode

Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: ti_am335x_adc: fix static in function header
Zubair Lutfullah [Sun, 22 Sep 2013 08:20:00 +0000 (09:20 +0100)]
iio: ti_am335x_adc: fix static in function header

Static is missing in function header. Corrected.

Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:press: Register buffer also without specific trigger
Denis CIOCCA [Wed, 18 Sep 2013 09:00:00 +0000 (10:00 +0100)]
iio:press: Register buffer also without specific trigger

This patch fix buffer registration that allows to use generic IIO trigger.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:magn: Register buffer also without specific trigger
Denis CIOCCA [Wed, 18 Sep 2013 09:00:00 +0000 (10:00 +0100)]
iio:magn: Register buffer also without specific trigger

This patch fix buffer registration that allows to use generic IIO trigger.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:gyro: Register buffer also without specific trigger
Denis CIOCCA [Wed, 18 Sep 2013 09:00:00 +0000 (10:00 +0100)]
iio:gyro: Register buffer also without specific trigger

This patch fix buffer registration that allows to use generic IIO trigger.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:accel: Register buffer also without specific trigger
Denis CIOCCA [Wed, 18 Sep 2013 09:00:00 +0000 (10:00 +0100)]
iio:accel: Register buffer also without specific trigger

This patch fix buffer registration that allows to use generic IIO trigger.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: magn-core: st: Clean up error handling in probe()
Lee Jones [Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)]
iio: magn-core: st: Clean up error handling in probe()

Reduce the amount of those unnecessary goto calls, as in most cases
we can simply return immediately. We also only call for the IRQ number
once and use that value throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: gyro-core: st: Clean up error handling in probe()
Lee Jones [Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)]
iio: gyro-core: st: Clean up error handling in probe()

Reduce the amount of those unnecessary goto calls, as in most cases
we can simply return immediately. We also only call for the IRQ number
once and use that value throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: accel-core: st: Clean up error handling in probe()
Lee Jones [Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)]
iio: accel-core: st: Clean up error handling in probe()

Reduce the amount of those unnecessary goto calls, as in most cases
we can simply return immediately. We also only call for the IRQ number
once and use that value throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: pressure: st: Add support for new LPS001WP pressure sensor
Lee Jones [Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)]
iio: pressure: st: Add support for new LPS001WP pressure sensor

Here we use existing practices to introduce support for another
pressure/temperature sensor, the LPS001WP.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: pressure-core: st: Clean-up probe() function
Lee Jones [Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)]
iio: pressure-core: st: Clean-up probe() function

This patch contains some pretty basic clean-ups in probe() pertaining to
the simplification of error handling and a couple of readability adaptions.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
Lee Jones [Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)]
iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()

Gets rid of those unnecessary gotos.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor()
Lee Jones [Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)]
iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor()

Strip out all those unnecessary gotos and just return the error right away.

Aids to simplicity and reduces code.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: sensors-core: st: Support sensors which don't have a Data Ready pin
Lee Jones [Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)]
iio: sensors-core: st: Support sensors which don't have a Data Ready pin

Not all ST's sensors support data ready, so let's make the declaration
of one conditional.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:ade7758: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 13:00:00 +0000 (14:00 +0100)]
staging:iio:ade7758: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:dummy: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 13:00:00 +0000 (14:00 +0100)]
staging:iio:dummy: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:mxs-lradc: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
staging:iio:mxs-lradc: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:ad799x: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
staging:iio:ad799x: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:ad7606: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
staging:iio:ad7606: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:lis3l02dq: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
staging:iio:lis3l02dq: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:gp2ap020a00f: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:gp2ap020a00f: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:tcs3472: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:tcs3472: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:adjd_s311: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:adjd_s311: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:mpu6050: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:mpu6050: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:adis_lib: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:adis_lib: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:adis16400: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:adis16400: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:itg3200: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:itg3200: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:st_sensors: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:st_sensors: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Denis Ciocca <denis.ciocca@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:max1363: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:max1363: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:at91_adc: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:at91_adc: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:ad_sigma_delta: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad_sigma_delta: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:ad7923: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad7923: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:ad7887: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad7887: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:ad7476: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad7476: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:ad7298: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad7298: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:ad7266: Use iio_push_to_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad7266: Use iio_push_to_buffers_with_timestamp()

Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:bma180: Use iio_push_buffers_with_timestamp()
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:bma180: Use iio_push_buffers_with_timestamp()

Makes the code shorter and a bit less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: Add iio_push_buffers_with_timestamp() helper
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio: Add iio_push_buffers_with_timestamp() helper

Drivers using software buffers often store the timestamp in their data buffer
before calling iio_push_to_buffers() with that data buffer. Storing the
timestamp in the buffer usually involves some ugly pointer arithmetic. This
patch adds a new helper function called iio_push_buffers_with_timestamp() which
is similar to iio_push_to_buffers but takes an additional timestamp parameter.
The function will help to hide to uglyness in one central place instead of
exposing it in every driver. If timestamps are enabled for the IIO device
iio_push_buffers_with_timestamp() will store the timestamp as the last element
in buffer, before passing the buffer on to iio_push_buffers(). The buffer needs
large enough to hold the timestamp in this case. If timestamps are disabled
iio_push_buffers_with_timestamp() will behave just like iio_push_buffers().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Cc: Josh Wu <josh.wu@atmel.com>
Cc: Denis Ciocca <denis.ciocca@gmail.com>
Cc: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Cc: Ge Gao <ggao@invensense.com>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: Pass scan mask as unsigned long
Peter Meerwald [Wed, 18 Sep 2013 21:10:00 +0000 (22:10 +0100)]
iio: Pass scan mask as unsigned long

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: Fix tcs3472 dev-to-indio_dev conversion in suspend/resume
Peter Meerwald [Wed, 18 Sep 2013 21:47:00 +0000 (22:47 +0100)]
iio: Fix tcs3472 dev-to-indio_dev conversion in suspend/resume

dev_to_iio_dev() is a false friend

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: ti_am335x_adc: Add continuous sampling support
Zubair Lutfullah [Thu, 19 Sep 2013 06:24:00 +0000 (07:24 +0100)]
iio: ti_am335x_adc: Add continuous sampling support

Previously the driver had only one-shot reading functionality.
This patch adds continuous sampling support to the driver.

Continuous sampling starts when buffer is enabled.
HW IRQ wakes worker thread that pushes samples to userspace.
Sampling stops when buffer is disabled by userspace.

Patil Rachna (TI) laid the ground work for ADC HW register access.
Russ Dill (TI) fixed bugs in the driver relevant to FIFOs and IRQs.

I fixed channel scanning so multiple ADC channels can be read
simultaneously and pushed to userspace.
Restructured the driver to fit IIO ABI.
And added INDIO_BUFFER_HARDWARE mode.

Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Russ Dill <Russ.Dill@ti.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: ti_am335x_adc: optimize memory usage
Zubair Lutfullah [Thu, 19 Sep 2013 06:24:00 +0000 (07:24 +0100)]
iio: ti_am335x_adc: optimize memory usage

12 bit ADC data is stored in 32 bits of storage.
Change from u32 to u16 to reduce wasted memory.

Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoinput: ti_am335x_tsc: Enable shared IRQ for TSC
Zubair Lutfullah [Thu, 19 Sep 2013 06:24:00 +0000 (07:24 +0100)]
input: ti_am335x_tsc: Enable shared IRQ for TSC

Enable shared IRQ to allow ADC to share IRQ line from
parent MFD core. Only FIFO0 IRQs are for TSC and handled
on the TSC side.

Step mask would be updated from cached variable only previously.
In rare cases when both TSC and ADC are used, the cached
variable gets mixed up.
The step mask is written with the required mask every time.

Rachna Patil (TI) laid ground work for shared IRQ.

Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: at91_adc: Cocci spatch "noderef"
Thomas Meyer [Thu, 19 Sep 2013 21:42:00 +0000 (22:42 +0100)]
iio: at91_adc: Cocci spatch "noderef"

sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: Make available scan_masks const in ad7266
Peter Meerwald [Tue, 17 Sep 2013 21:33:00 +0000 (22:33 +0100)]
iio: Make available scan_masks const in ad7266

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: Minor cleanups of industrialio-buffer
Peter Meerwald [Tue, 17 Sep 2013 22:42:00 +0000 (23:42 +0100)]
iio: Minor cleanups of industrialio-buffer

adding one return value check
fix one kerneldoc

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging/lustre: fix coccinelle warnings
Fengguang Wu [Sun, 15 Sep 2013 02:56:25 +0000 (19:56 -0700)]
staging/lustre: fix coccinelle warnings

drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c:217:2-3: Unneeded semicolon

Removes unneeded semicolon.

Generated by: coccinelle/misc/semicolon.cocci

CC: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dgap: Fix typo in staging/dgap
Masanari Iida [Fri, 13 Sep 2013 15:17:02 +0000 (00:17 +0900)]
staging: dgap: Fix typo in staging/dgap

Correct spelling typo in comments.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dgnc: Fix typo in staging/dgnc
Masanari Iida [Fri, 13 Sep 2013 15:46:31 +0000 (00:46 +0900)]
staging: dgnc: Fix typo in staging/dgnc

Correct spelling typo in comments

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8712: re-use native mac_pton() helper
Andy Shevchenko [Fri, 13 Sep 2013 14:59:43 +0000 (17:59 +0300)]
staging: rtl8712: re-use native mac_pton() helper

There is a nice helper to parse MAC. Let's use it and remove custom
implementation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dwc2: Fix typo in staging/dwc2
Masanari Iida [Fri, 13 Sep 2013 14:34:36 +0000 (23:34 +0900)]
staging: dwc2: Fix typo in staging/dwc2

Correct spelling typo in comments

Singend-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: silicom: introduce bp_dev_get_idx_bsf() and use it
Andy Shevchenko [Fri, 13 Sep 2013 06:44:31 +0000 (09:44 +0300)]
staging: silicom: introduce bp_dev_get_idx_bsf() and use it

There are two places where duplicate code is located. Moreover, there is a
custom implementation of the sscanf() functionality. This patch makes code
quite simplier and cleaner.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: lustre: remove unnecessary braces
Jon Bernard [Fri, 13 Sep 2013 17:29:30 +0000 (13:29 -0400)]
Staging: lustre: remove unnecessary braces

This is a patch to the lvfs_lib.c file that removes unnecessary braces from an
if statement found by the checkpatch.pl tool.

Signed-off-by: Jon Bernard <jbernard@tuxion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: lustre: fix formatting mistake in Kconfig
Jon Bernard [Wed, 11 Sep 2013 20:41:53 +0000 (16:41 -0400)]
Staging: lustre: fix formatting mistake in Kconfig

Signed-off-by: Jon Bernard <jbernard@tuxion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: lustre: fix a brace coding style issue in fsfilt.c
Jon Bernard [Fri, 13 Sep 2013 00:04:22 +0000 (20:04 -0400)]
Staging: lustre: fix a brace coding style issue in fsfilt.c

This is a patch to the fsfilt.c file that fixes up a brace warning found by the
checkpatch.pl tool.

Signed-off-by: Jon Bernard <jbernard@tuxion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: lustre: fix assignment in if condition in fsfilt.c
Jon Bernard [Fri, 13 Sep 2013 00:04:33 +0000 (20:04 -0400)]
Staging: lustre: fix assignment in if condition in fsfilt.c

This is a patch to the fsfilt.c file that fixes up three assignment in if
condition errors found by the checkpatch.pl tool.

Signed-off-by: Jon Bernard <jbernard@tuxion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: speakup: kobjects.c: Use correct values when changing voice.
Christopher Brannon [Wed, 11 Sep 2013 17:05:27 +0000 (10:05 -0700)]
staging: speakup: kobjects.c: Use correct values when changing voice.

When a new voice is selected, we set volume and pitch appropriate for
the voice.  We need to use the numeric index corresponding to the
voice when indexing into the volume and pitch tables, rather than
the raw user input that was used to select the voice.
Note that using the raw input can also lead to an invalid memory read
in the case of invalid or malicious user input.

Signed-off-by: Christopher Brannon <chris@the-brannons.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/speakup/kobjects.c: Code improvement.
Raphael S.Carvalho [Mon, 2 Sep 2013 22:20:18 +0000 (19:20 -0300)]
staging/speakup/kobjects.c: Code improvement.

Well, there is no need to use strcmp since we can make a test of similar semantic by using the var_id field of param.
I moved the test into the VAR_NUM:VAR_TIME case since VAR_STRING will never be "voice".

spk_xlate isn't used anymore (in line 628), then there is no difference between using cp and buf in VAR_STRING case.
Besides, buf is a const char and those changes remove one uneeded line.

I created the function spk_reset_default_value because it clarifies the code and allows code reusing.

Signed-off-by: Raphael S.Carvalho <raphael.scarv@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: speakup: Add dependencies for ISA card drivers
Ben Hutchings [Sun, 1 Sep 2013 18:55:58 +0000 (19:55 +0100)]
Staging: speakup: Add dependencies for ISA card drivers

Several speakup drivers are for ISA cards and are useless on systems
without ISA slots.  Make them depend on ISA || COMPILE_TEST.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warning in rtl8188eu/core/rtw_xmit.c
Larry Finger [Wed, 4 Sep 2013 20:56:11 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warning in rtl8188eu/core/rtw_xmit.c

Smatch reports the following:
  CHECK   drivers/staging/rtl8188eu/core/rtw_xmit.c
drivers/staging/rtl8188eu/core/rtw_xmit.c:1570 dequeue_one_xmitframe() info: ignoring unreachable code.

This code uses a while construction that has an unconditional break. This part
of the code was restructured to use an if statement and the dead code was
removed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warnings in core/rtw_recv.c
Larry Finger [Wed, 4 Sep 2013 20:56:10 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warnings in core/rtw_recv.c

Smatch reports the following:
drivers/staging/rtl8188eu/core/rtw_recv.c:211 rtw_free_recvframe() warn: variable dereferenced before check 'precvframe' (see line 207)
drivers/staging/rtl8188eu/core/rtw_recv.c:1803 amsdu_to_msdu() warn: variable dereferenced before check 'sub_skb' (see line 1784)

The code was rearranged to eliminate the dereference before the check.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warning in hal/HalPhyRf_8188e.c
Larry Finger [Wed, 4 Sep 2013 20:56:09 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warning in hal/HalPhyRf_8188e.c

Smatch reported the following warning:
drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c:1876 PHY_APCalibrate_8188E() info: ignoring unreachable code.

Once the unreachable code was removed, the entire routine was removed, which
led to the warning that phy_APCalibrate_8188E() was not used. It was also deleted
along with some unused defines.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warning in core/rtw_wlan_util.c
Larry Finger [Wed, 4 Sep 2013 20:56:08 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warning in core/rtw_wlan_util.c

A misplaced _func_exit_ macro leads to the following smatch warning:
drivers/staging/rtl8188eu/core/rtw_wlan_util.c:1105 rtw_check_bcn_info() info: ignoring unreachable code.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warnings in odm_HWConfig.c
Larry Finger [Wed, 4 Sep 2013 20:56:06 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warnings in odm_HWConfig.c

Smatch reports the following warnings:
drivers/staging/rtl8188eu/hal/odm_HWConfig.c:302 odm_RxPhyStatus92CSeries_Parsing() error: buffer overflow 'pPhyInfo->RxPwr' 2 <= 2
drivers/staging/rtl8188eu/hal/odm_HWConfig.c:319 odm_RxPhyStatus92CSeries_Parsing() error: buffer overflow 'pPhyInfo->RxMIMOSignalStrength' 2 <= 2
drivers/staging/rtl8188eu/hal/odm_HWConfig.c:322 odm_RxPhyStatus92CSeries_Parsing() error: buffer overflow 'pPhyStaRpt->path_rxsnr' 2 <= 2
drivers/staging/rtl8188eu/hal/odm_HWConfig.c:322 odm_RxPhyStatus92CSeries_Parsing() error: buffer overflow 'pPhyInfo->RxSNR' 2 <= 2
drivers/staging/rtl8188eu/hal/odm_HWConfig.c:323 odm_RxPhyStatus92CSeries_Parsing() error: buffer overflow 'pPhyStaRpt->path_rxsnr' 2 <= 2
drivers/staging/rtl8188eu/hal/odm_HWConfig.c:323 odm_RxPhyStatus92CSeries_Parsing() error: buffer overflow 'dm_odm->PhyDbgInfo.RxSNRdB' 2 <= 2

These warnings are again due to the number of radio patchs being increased
to 3 without adjustments to the array sizes.

A duplicate and redundant definition was also removed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warnings in core/rtw_xmit.c
Larry Finger [Wed, 4 Sep 2013 20:56:05 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warnings in core/rtw_xmit.c

Smatch reports the following:
drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c:1500 hal_EfusePgPacketWriteData() info: ignoring unreachable code.
drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c:2188 Hal_ReadTxPowerInfo88E() error: buffer overflow 'pHalData->Index24G_CCK_Base[rfPath]' 14 <= 14
drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c:2190 Hal_ReadTxPowerInfo88E() error: buffer overflow 'pHalData->Index24G_BW40_Base[rfPath]' 14 <= 14
drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c:2196 Hal_ReadTxPowerInfo88E() error: buffer overflow 'pHalData->Index24G_CCK_Base[rfPath]' 14 <= 14
drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c:2197 Hal_ReadTxPowerInfo88E() error: buffer overflow 'pHalData->Index24G_BW40_Base[rfPath]' 14 <= 14

The first of these is trivial. The rest are due to an off-by-one error
in a loop over the channels.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warnings for hal/rtl8188e_phycfg.c
Larry Finger [Wed, 4 Sep 2013 20:56:04 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warnings for hal/rtl8188e_phycfg.c

Smatch reports the following:
drivers/staging/rtl8188eu/hal/rtl8188e_phycfg.c:857 getTxPowerIndex88E() error: buffer overflow 'pHalData->BW20_24G_Diff' 2 <= 2
drivers/staging/rtl8188eu/hal/rtl8188e_phycfg.c:864 getTxPowerIndex88E() error: buffer overflow 'pHalData->BW20_24G_Diff' 2 <= 2

The array in question is large enough to handle RADIO_PATH_X, where X is A or B.
The lines in question refer to RADIO_PATH_C, which is defined as 2.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warning in os_dep/ioctl_linux.c
Larry Finger [Wed, 4 Sep 2013 20:56:03 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warning in os_dep/ioctl_linux.c

Smatch reports the following:
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:4891 set_group_key() warn: missing break? reassigning 'keylen'

As it suggests, there is a missing break statement.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warnings in os_dep/ioctl_linux.c
Larry Finger [Wed, 4 Sep 2013 20:56:02 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warnings in os_dep/ioctl_linux.c

Smatch reports the following:
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:941 rtw_wx_set_pmkid() warn: add some parenthesis here?
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:1042 rtw_wx_get_range() warn: assigning (-78) to unsigned variable 'range->avg_qual.level'
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:2629 rtw_get_ap_info() warn: add some parenthesis here?
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:4043 rtw_rereg_nd_name() warn: add some parenthesis here?
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:4052 rtw_rereg_nd_name() warn: add some parenthesis here?

The warnings calling for adding parentheses all have "if (!memcmp() == true)" and
are fixed by removing the "==true" part.

The warning where a negative number is stored in an unsigned variable is fixed
by biasing the result by 256.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warning in hal/usb_ops_linux.c
Larry Finger [Wed, 4 Sep 2013 20:56:01 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warning in hal/usb_ops_linux.c

Smatch reports the following warning:
drivers/staging/rtl8188eu/hal/usb_ops_linux.c:614 usb_read_port() warn: variable dereferenced before check 'precvbuf' (see line 611)

Fixing this particular warning required some refactoring of the code.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warning in os_dep/osdep_service.c
Larry Finger [Wed, 4 Sep 2013 20:56:00 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warning in os_dep/osdep_service.c

Smatch reports the following warning:
drivers/staging/rtl8188eu/os_dep/osdep_service.c:634 rtw_change_ifname() warn: variable dereferenced before check 'padapter' (see line 630)

The dereference in question is deferred until the validity of 'padapter' is verified.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix a smatch warnings in core/rtw_recv.c
Larry Finger [Wed, 4 Sep 2013 20:55:59 +0000 (15:55 -0500)]
staging: r8188eu: Fix a smatch warnings in core/rtw_recv.c

Smatch reports the following:
drivers/staging/rtl8188eu/os_dep/recv_linux.c:227 rtw_recv_indicatepkt() warn: variable dereferenced before check 'precv_frame' (see line 139)

The test in this location is removed and added in the free routine.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix some smatch errors in core/rtw_efuse.c
Larry Finger [Wed, 4 Sep 2013 20:55:58 +0000 (15:55 -0500)]
staging: r8188eu: Fix some smatch errors in core/rtw_efuse.c

Smatch reports the following situations:

drivers/staging/rtl8188eu/core/rtw_efuse.c:589 rtw_efuse_map_write() error: buffer overflow 'newdata' 8 <= 8
drivers/staging/rtl8188eu/core/rtw_efuse.c:598 rtw_efuse_map_write() error: buffer overflow 'newdata' 8 <= 8
drivers/staging/rtl8188eu/core/rtw_efuse.c:681 rtw_BT_efuse_map_write() error: buffer overflow 'newdata' 8 <= 8
drivers/staging/rtl8188eu/core/rtw_efuse.c:690 rtw_BT_efuse_map_write() error: buffer overflow 'newdata' 8 <= 8

In these cases, it is possible to write beyond the end of an array.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Remove unreachable code in core/rtw_br_ext.c
Larry Finger [Wed, 4 Sep 2013 20:55:57 +0000 (15:55 -0500)]
staging: r8188eu: Remove unreachable code in core/rtw_br_ext.c

In this file, a "return -1" immediately follows a "return 0". Remove the
second line.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warning in core/rtw_ieee80211.
Larry Finger [Wed, 4 Sep 2013 20:55:56 +0000 (15:55 -0500)]
staging: r8188eu: Fix smatch warning in core/rtw_ieee80211.

Smatch shows the following warning:
drivers/staging/rtl8188eu/core/rtw_ieee80211.c:161 rtw_set_ie() info: ignoring unreachable code.

The cause is a module exit tracing statement after a return.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch warning in os_dep/usb_intf.c
Larry Finger [Wed, 4 Sep 2013 20:55:55 +0000 (15:55 -0500)]
staging: r8188eu: Fix smatch warning in os_dep/usb_intf.c

Smatch reports the following warning:

  CHECK   drivers/staging/rtl8188eu/os_dep/usb_intf.c
drivers/staging/rtl8188eu/os_dep/usb_intf.c:740 rtw_usb_if1_init() info: redundant null check on padapter->HalData calling kfree()

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix smatch error in core/rtw_mlme_ext.c
Larry Finger [Wed, 4 Sep 2013 20:55:54 +0000 (15:55 -0500)]
staging: r8188eu: Fix smatch error in core/rtw_mlme_ext.c

Smatch reports the following warning:
"drivers/staging/rtl8188eu/core/rtw_mlme_ext.c:8328 mlme_evt_hdl()
 error: buffer overflow 'wlanevents' 24 <= 24"

  8321          /*  checking if event code is valid */
  8322          if (evt_code >= MAX_C2HEVT) {
                    ^^^^^^^^^^^^^^^^^^^^^^
  8323                  RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nEvent Code(%d) mismatch!\n", evt_code));
  8324                  goto _abort_event_;
  8325          }
  8326
  8327          /*  checking if event size match the event parm size */
  8328          if ((wlanevents[evt_code].parmsize != 0) &&
                     ^^^^^^^^^^^^^^^^^^^^
  8329              (wlanevents[evt_code].parmsize != evt_sz)) {
  8330                  RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_,
  8331                           ("\nEvent(%d) Parm Size mismatch (%d vs %d)!\n",
  8332                           evt_code, wlanevents[evt_code].parmsize, evt_sz));
  8333                  goto _abort_event_;
  8334          }

This warning results because the number of items in "enum rtw_c2h_event",
which determines the value of MAX_C2HEVT, is one more than in "struct wlanevents".
Adding an extra dummy event to the latter fixes the problem.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8188eu: Fix Smatch off-by-one warning in hal/rtl8188e_hal_init.c
Larry Finger [Wed, 4 Sep 2013 20:55:53 +0000 (15:55 -0500)]
staging: r8188eu: Fix Smatch off-by-one warning in hal/rtl8188e_hal_init.c

Smatch reports the following warning:
"drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c:2008
Hal_ReadPowerValueFromPROM_8188E()
 error: buffer overflow 'pwrInfo24G->IndexBW40_Base[rfPath]' 5 <= 5"

drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
  2005                          /* 2.4G default value */
  2006                          for (group = 0; group < MAX_CHNL_GROUP_24G; group++) {
  2007                                  pwrInfo24G->IndexCCK_Base[rfPath][group] =      EEPROM_DEFAULT_24G_INDEX;
  2008                                  pwrInfo24G->IndexBW40_Base[rfPath][group] =     EEPROM_DEFAULT_24G_INDEX;

The reason is that IndexCCK_Base[] has MAX_CHNL_GROUP_24G elements, but
IndexBW40_Base is smaller by 1. Make them both have MAX_CHNL_GROUP_24G
elements.

Reported by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6655: Remove commented out block with compare_ether_addr
Joe Perches [Sun, 1 Sep 2013 22:41:00 +0000 (15:41 -0700)]
staging: vt6655: Remove commented out block with compare_ether_addr

compare_ether_addr is being removed so remove
even the commented out code referring to it.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: Convert uses of compare_ether_addr to ether_addr_equal
Joe Perches [Sun, 1 Sep 2013 19:15:47 +0000 (12:15 -0700)]
Staging: Convert uses of compare_ether_addr to ether_addr_equal

Preliminary to removing compare_ether_addr altogether:

Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.

Additionally:

Used is_zero_ether_addr, removed now unused variable
Converted uses of &foo[0] to foo

Done via cocci script: (and a little typing)

$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
- !compare_ether_addr(a, b)
+ ether_addr_equal(a, b)

@@
expression a,b;
@@
- compare_ether_addr(a, b)
+ !ether_addr_equal(a, b)

@@
expression a,b;
@@
- !ether_addr_equal(a, b) == 0
+ ether_addr_equal(a, b)

@@
expression a,b;
@@
- !ether_addr_equal(a, b) != 0
+ !ether_addr_equal(a, b)

@@
expression a,b;
@@
- ether_addr_equal(a, b) == 0
+ !ether_addr_equal(a, b)

@@
expression a,b;
@@
- ether_addr_equal(a, b) != 0
+ ether_addr_equal(a, b)

@@
expression a,b;
@@
- !!ether_addr_equal(a, b)
+ ether_addr_equal(a, b)

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: wlan-ng: cfg80211.c: replaced printk() with netdev_warn()
Avinash Kumar [Fri, 6 Sep 2013 16:14:51 +0000 (21:44 +0530)]
staging: wlan-ng: cfg80211.c: replaced printk() with netdev_warn()

replaced printk functions used for debug messages by respective netdev_warn
netdev_err functions.

Signed-off-by: Avinash Kumar <avi.kp.137@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: wlan-ng: hfa384x_usb.c: replaced printk() debugs with netdev_warn()/netdev_err()
Avinash Kumar [Fri, 6 Sep 2013 16:51:49 +0000 (22:21 +0530)]
staging: wlan-ng: hfa384x_usb.c: replaced printk() debugs with netdev_warn()/netdev_err()

replaced the printk debug lines with respective netdev_warn()/netdev_err()

Signed-off-by: Avinash kumar <avi.kp.137@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: fwserial: wrap a line that exceeds 80 characters
Jon Bernard [Tue, 10 Sep 2013 22:00:01 +0000 (18:00 -0400)]
Staging: fwserial: wrap a line that exceeds 80 characters

This is a patch to fwserial.c that wraps a line which previously exceeded the 80
character limit warning found by checkpatch.pl.  This driver is now warning and
error free, according to checkpatch.pl

Signed-off-by: Jon Bernard <jbernard@tuxion.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: nvm: fixed space prohibition
Aldo Iljazi [Tue, 10 Sep 2013 15:44:39 +0000 (18:44 +0300)]
Staging: bcm: nvm: fixed space prohibition

Fixed space prohibition before semicolon, particularly:

nvm.c:106: WARNING: space prohibited before semicolon
nvm.c:1098: WARNING: space prohibited before semicolon
nvm.c:1279: WARNING: space prohibited before semicolon
nvm.c:2834: WARNING: space prohibited before semicolon
nvm.c:3361: WARNING: space prohibited before semicolon
nvm.c:4453: WARNING: space prohibited before semicolon

Signed-off-by: Aldo Iljazi <neonsync1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: rtl8188eu: rtw_wlan_util.c: Fixed checkpatch.pl warnings.
Faris de Haan [Tue, 10 Sep 2013 08:38:23 +0000 (10:38 +0200)]
Staging: rtl8188eu: rtw_wlan_util.c: Fixed checkpatch.pl warnings.

Fixed a few of the coding style issues reported by checkpatch.pl

Signed-off-by: Faris de Haan <farisdehaan@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dgrp: Remove casting the return value which is a void pointer
Jingoo Han [Mon, 9 Sep 2013 05:17:32 +0000 (14:17 +0900)]
staging: dgrp: Remove casting the return value which is a void pointer

Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: rtl8188eu: checkpatch.pl warnings removed
Faris de Haan [Mon, 9 Sep 2013 15:34:44 +0000 (17:34 +0200)]
Staging: rtl8188eu: checkpatch.pl warnings removed

Fixed some of the coding style issues reported by checkpatch.pl

Signed-off-by: Faris de Haan <farisdehaan@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: bcm: InterfaceMisc.c: fixed styling issue in casting (foo*)->(foo *)
Avinash Kumar [Thu, 5 Sep 2013 17:32:16 +0000 (23:02 +0530)]
staging: bcm: InterfaceMisc.c: fixed styling issue in casting (foo*)->(foo *)

fixed styling issue in pointer typecast.

Signed-off-by: Avinash Kumar <avi.kp.137@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: et131x: Add some items to the TODO list
Mark Einon [Wed, 11 Sep 2013 13:14:46 +0000 (14:14 +0100)]
staging: et131x: Add some items to the TODO list

Adding some trivial formatting suggestions made by Dan Carpenter to
the TODO.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: et131x: Removing some unecessary braces
Mark Einon [Wed, 11 Sep 2013 13:14:45 +0000 (14:14 +0100)]
staging: et131x: Removing some unecessary braces

Remove braces from a few single line if statements.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: et131x: Remove unused rcv_pend_lock spinlock
Mark Einon [Wed, 11 Sep 2013 13:14:44 +0000 (14:14 +0100)]
staging: et131x: Remove unused rcv_pend_lock spinlock

The rcv_pend_lock spinlock isn't used anymore. remove it.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: et131x: Remove unused spinlock
Mark Einon [Wed, 11 Sep 2013 13:14:43 +0000 (14:14 +0100)]
staging: et131x: Remove unused spinlock

phy_lock is no longer used in any useful code, it's all been moved into
a phy_device. Remove the lock definition and init.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dgnc: removes parentheses around return statements
Lidza Louina [Mon, 9 Sep 2013 19:01:23 +0000 (15:01 -0400)]
staging: dgnc: removes parentheses around return statements

This patch removes parentheses around return
statements. They aren't needed.

Signed-off-by: Lidza Louina <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>