profile/ivi/kernel-adaptation-intel-automotive.git
12 years agostaging: bcm: led_control.c: fix whitespaces
Johannes Tenschert [Wed, 7 Dec 2011 17:25:06 +0000 (18:25 +0100)]
staging: bcm: led_control.c: fix whitespaces

Signed-off-by: Johannes Tenschert <Johannes.Tenschert@informatik.stud.uni-erlangen.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: bcm: Alter return value for copy_to/from_user() to "return -EFAULT" when...
Kevin McKinney [Tue, 6 Dec 2011 03:17:03 +0000 (22:17 -0500)]
Staging: bcm: Alter return value for copy_to/from_user() to "return -EFAULT" when an error occurs.

In this clean up patch, I altered functions: copy_to/
from_user() to return -EFAULT when an error occurs.
I also replaced break statements when an error occurs
from copy_to/from_user() with direct returns of -EFAULT.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: bcm: Alter code to move error handling closer to the calls; and remove white...
Kevin McKinney [Fri, 2 Dec 2011 03:02:16 +0000 (22:02 -0500)]
Staging: bcm: Alter code to move error handling closer to the calls; and remove white space, IOCTL_BCM_NVM_WRITE.

This is a clean up patch for IOCTL_BCM_NVM_WRITE
that replaces the assignment of the Status
variable with direct returns of the error code,
replaces the break statements with direct returns,
and removes a white space.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: bcm: Fix double free of 'pReadData' in IOCTL_BCM_NVM_WRITE.
Kevin McKinney [Fri, 2 Dec 2011 03:02:15 +0000 (22:02 -0500)]
Staging: bcm: Fix double free of 'pReadData' in IOCTL_BCM_NVM_WRITE.

This patch fixes a memory error in ioctl,
IOCTL_BCM_NVM_WRITE. While copying data to
user space, if an error occurs, pReadData
is freed. Then, at the end of the ioctl,
pReadData was being freed again.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging/line6: refactor device information and add POD HD 500
Markus Grabner [Mon, 5 Dec 2011 22:51:53 +0000 (23:51 +0100)]
staging/line6: refactor device information and add POD HD 500

This patch refactors the device information code and adds preliminary support for the POD HD 500 device.

Signed-off-by: Markus Grabner <grabner@icg.tugraz.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging/line6: Remove obsolete code
Markus Grabner [Mon, 5 Dec 2011 22:51:52 +0000 (23:51 +0100)]
staging/line6: Remove obsolete code

This patch removes experimental code which is no longer used.

Signed-off-by: Markus Grabner <grabner@icg.tugraz.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: line6/midi.c: Fixed call of obsolete function strict_strtoul
Andor Daam [Mon, 5 Dec 2011 09:10:37 +0000 (10:10 +0100)]
Staging: line6/midi.c: Fixed call of obsolete function strict_strtoul

The obsolete function strict_strtoul should be replaced by the kstrto*
functions.

In this context kstrtou16 should be use, as midi_mask_receive is only
used as unsigned short. All corresponding datatypes were adapted
accordingly.

Signed-off-by: Andor Daam <andor.daam@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: line6/midi.c: Fixed call of obsolete function strict_strtoul
Andor Daam [Mon, 5 Dec 2011 09:09:25 +0000 (10:09 +0100)]
Staging: line6/midi.c: Fixed call of obsolete function strict_strtoul

The function strict_strtoul is obsolete and should be replaced by the
new kstrto* functions.

The variable midi_mask_transmit is only used as unsigned short and the
datatypes of all affected variables were adjusted accordingly.

Signed-off-by: Andor Daam <andor.daam@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: comedi: unlock on error in usbduxsigma_attach()
Dan Carpenter [Wed, 30 Nov 2011 08:42:58 +0000 (11:42 +0300)]
Staging: comedi: unlock on error in usbduxsigma_attach()

We should release the udev->sem lock before returning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: comedi: unlock on error in usbdux_ao_inttrig()
Dan Carpenter [Wed, 30 Nov 2011 08:42:21 +0000 (11:42 +0300)]
Staging: comedi: unlock on error in usbdux_ao_inttrig()

If we had an invalid trignum (anything other than zero is invalid) then
we returned without unlocking.  I've modified this function to just have
one return point.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: enable forcecrt2type as a module parameter
Aaro Koskinen [Mon, 5 Dec 2011 22:10:49 +0000 (00:10 +0200)]
staging: xgifb: enable forcecrt2type as a module parameter

Enable forcecrt2type as a module parameter.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: enable forcecrt2type on XG21
Aaro Koskinen [Mon, 5 Dec 2011 22:10:48 +0000 (00:10 +0200)]
staging: xgifb: enable forcecrt2type on XG21

Make "forcecrt2type" to apply also for XG21. The patch enables user to
switch LVDS LCD ON/OFF without the need to update the video BIOS.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: delete "userom" option
Aaro Koskinen [Mon, 5 Dec 2011 22:10:47 +0000 (00:10 +0200)]
staging: xgifb: delete "userom" option

Delete a redundant option.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: vb_table: delete XGI21_LCDCapList
Aaro Koskinen [Mon, 5 Dec 2011 22:10:46 +0000 (00:10 +0200)]
staging: xgifb: vb_table: delete XGI21_LCDCapList

Delete XGI21_LCDCapList. This data is display specific and does not
belong to the driver. It should be provided by the video BIOS.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: move XGI21_LVDSCapStruct into xgifb_video_info
Aaro Koskinen [Mon, 5 Dec 2011 22:10:45 +0000 (00:10 +0200)]
staging: xgifb: move XGI21_LVDSCapStruct into xgifb_video_info

Move the LVDS data into a device-specific data, and eliminate the global
variable usage.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: disable LVDS on XG27
Aaro Koskinen [Mon, 5 Dec 2011 22:10:44 +0000 (00:10 +0200)]
staging: xgifb: disable LVDS on XG27

XG27 has the second display output already hardcoded to disabled. Just
in case, ensure that it has the LVDS code paths disabled. This will
simplify the future cleanups.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: delete XGIfb_GetXG21LVDSData()
Aaro Koskinen [Mon, 5 Dec 2011 22:10:43 +0000 (00:10 +0200)]
staging: xgifb: delete XGIfb_GetXG21LVDSData()

Delete XGIfb_GetXG21LVDSData() and code which duplicates
xgifb_read_vbios().

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: ReadVBIOSTablData(): rename to xgifb_read_vbios()
Aaro Koskinen [Mon, 5 Dec 2011 22:10:42 +0000 (00:10 +0200)]
staging: xgifb: ReadVBIOSTablData(): rename to xgifb_read_vbios()

Rename the function to xgifb_read_vbios().

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: ReadVBIOSTablData(): copy only a single LVDS entry
Aaro Koskinen [Mon, 5 Dec 2011 22:10:41 +0000 (00:10 +0200)]
staging: xgifb: ReadVBIOSTablData(): copy only a single LVDS entry

Only a single LVDS table entry is needed by the driver.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: ReadVBIOSTablData(): check the BIOS size
Aaro Koskinen [Mon, 5 Dec 2011 22:10:40 +0000 (00:10 +0200)]
staging: xgifb: ReadVBIOSTablData(): check the BIOS size

Check the BIOS size to avoid out of bounds array access. Disable LVDS
in case errors are detected.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: use u8 for video BIOS data
Aaro Koskinen [Mon, 5 Dec 2011 22:10:39 +0000 (00:10 +0200)]
staging: xgifb: use u8 for video BIOS data

Use u8 for video BIOS data.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: delete pjVirtualRomBase
Aaro Koskinen [Mon, 5 Dec 2011 22:10:38 +0000 (00:10 +0200)]
staging: xgifb: delete pjVirtualRomBase

Delete a redundant struct member.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: delete ROMAddr
Aaro Koskinen [Mon, 5 Dec 2011 22:10:37 +0000 (00:10 +0200)]
staging: xgifb: delete ROMAddr

Delete a redundant struct member.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: move video BIOS handling completely to ReadVBIOSTablData()
Aaro Koskinen [Mon, 5 Dec 2011 22:10:36 +0000 (00:10 +0200)]
staging: xgifb: move video BIOS handling completely to ReadVBIOSTablData()

We need the video BIOS only on XG21 and only during the init, so let's
do everything at the same place.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: XGINew_GetXG21Sense(): eliminate video BIOS access
Aaro Koskinen [Mon, 5 Dec 2011 22:10:35 +0000 (00:10 +0200)]
staging: xgifb: XGINew_GetXG21Sense(): eliminate video BIOS access

Remove video BIOS access from the routine, use the flag instead which
is initialized according to the BIOS data.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: ReadVBIOSTablData(): use a pointer to access the array
Aaro Koskinen [Mon, 5 Dec 2011 22:10:34 +0000 (00:10 +0200)]
staging: xgifb: ReadVBIOSTablData(): use a pointer to access the array

Use a pointer variable to make some lines shorter and more readable.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: ReadVBIOSTablData(): rename pVideoMemory
Aaro Koskinen [Mon, 5 Dec 2011 22:10:33 +0000 (00:10 +0200)]
staging: xgifb: ReadVBIOSTablData(): rename pVideoMemory

Rename pVideoMemory to vbios, and also remove volatile at the same go.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: ReadVBIOSTablData(): use ARRAY_SIZE
Aaro Koskinen [Mon, 5 Dec 2011 22:10:32 +0000 (00:10 +0200)]
staging: xgifb: ReadVBIOSTablData(): use ARRAY_SIZE

Use ARRAY_SIZE.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: ReadVBIOSTablData(): rearrange code to avoid nesting
Aaro Koskinen [Mon, 5 Dec 2011 22:10:31 +0000 (00:10 +0200)]
staging: xgifb: ReadVBIOSTablData(): rearrange code to avoid nesting

Rearrange code to avoid deep nesting.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: xgifb: ReadVBIOSTablData(): avoid duplicating code
Aaro Koskinen [Mon, 5 Dec 2011 22:10:30 +0000 (00:10 +0200)]
staging: xgifb: ReadVBIOSTablData(): avoid duplicating code

If the count (j) is 0xff, just do the loop once.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoMerge branch 'work-next' into staging-next
Greg Kroah-Hartman [Thu, 8 Dec 2011 20:22:28 +0000 (12:22 -0800)]
Merge branch 'work-next' into staging-next

12 years agostaging:iio: Fix scan mask update
Lars-Peter Clausen [Thu, 8 Dec 2011 17:35:53 +0000 (18:35 +0100)]
staging:iio: Fix scan mask update

When updating the scan mask we have to check the actual scan mask for if the
channel is already enabled, not the matching scan mask from the available
scan masks. The bit will already be set there and as a result the actual
scan mask will not get updated and the channel stays disabled.

Also fix the return value of iio_scan_el_store which would return 1 instead of
the number of bytes written if the channel was already active in the scan mask.

Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoMerge branch 'work-next' into staging-next
Greg Kroah-Hartman [Thu, 8 Dec 2011 20:16:43 +0000 (12:16 -0800)]
Merge branch 'work-next' into staging-next

12 years agostaging:iio: Fix sw_ring memory corruption
Lars-Peter Clausen [Thu, 8 Dec 2011 17:35:51 +0000 (18:35 +0100)]
staging:iio: Fix sw_ring memory corruption

The sw_ring does not properly handle the case where the write pointer already
has wrapped around, the read pointer has not and the remaining buffer space at
the end is enough to fill the read buffer:

  +-----------------------------------+
  |     |              |##data##|     |
  +-----------------------------------+
     write_p        read_p

In this case the current code will copy all available data to the buffer and
as a result will write beyond the bounds of the buffer and cause a memory
corruption.

To address this issue this patch adds code to calculate the available buffer
space and makes sure that the number of bytes to copy does not exceed this
number. This allows the code which copies the data around to be simplified as
it only has to consider two cases: Read wraps around and read does not wrap
around.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio: Fix typo
Lars-Peter Clausen [Thu, 8 Dec 2011 17:20:37 +0000 (18:20 +0100)]
staging:iio: Fix typo

Fix a small typo in the iio_modifer enum.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:buffer.h update struct buffer docs.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:30 +0000 (22:18 +0000)]
staging:iio:buffer.h update struct buffer docs.

These docs have lagged recent developments.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:buffer struct iio_buffer doesn't need an indio_dev pointer.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:29 +0000 (22:18 +0000)]
staging:iio:buffer struct iio_buffer doesn't need an indio_dev pointer.

In all existing cases, the calls are coming from a location where
the indio_dev is already available.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:buffer scrap to_iio_buffer as it no longer has meaning.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:28 +0000 (22:18 +0000)]
staging:iio:buffer scrap to_iio_buffer as it no longer has meaning.

Now buffers do not have a specific dev structure, this is garbage.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:buffer stop allowing for read_last callback.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:27 +0000 (22:18 +0000)]
staging:iio:buffer stop allowing for read_last callback.

No longer needed now we don't allow sysfs acccess to buffer data.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:ring_sw don't provide read last function.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:26 +0000 (22:18 +0000)]
staging:iio:ring_sw don't provide read last function.

No longer needed as we don't have drivers providing sysfs access
to buffered data.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:max1363 stop reading from buffer for sysfs access
Jonathan Cameron [Mon, 5 Dec 2011 22:18:25 +0000 (22:18 +0000)]
staging:iio:adc:max1363 stop reading from buffer for sysfs access

No known use case and makes in kernel interface work more complex.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:ad799x stop reading from buffer for sysfs accesses
Jonathan Cameron [Mon, 5 Dec 2011 22:18:24 +0000 (22:18 +0000)]
staging:iio:adc:ad799x stop reading from buffer for sysfs accesses

No known use case and makes in kernel interface work more complex.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:ad7887 stop reading from buffer for sysfs access.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:23 +0000 (22:18 +0000)]
staging:iio:adc:ad7887 stop reading from buffer for sysfs access.

No known use case and complicates in kernel interface work.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:ad7993 stop reading from buffer for sysfs raw read.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:22 +0000 (22:18 +0000)]
staging:iio:adc:ad7993 stop reading from buffer for sysfs raw read.

No known usecase and makes in kernel interface work more complex.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:ad7606 remove buffer access to data from sysfs read.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:21 +0000 (22:18 +0000)]
staging:iio:adc:ad7606 remove buffer access to data from sysfs read.

No known use case and complicates in kernel interface work.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:ad7606 remove buffer access for sysfs interfaces.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:20 +0000 (22:18 +0000)]
staging:iio:adc:ad7606 remove buffer access for sysfs interfaces.

No known use case and complicates in kernel interface work.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:ad7476 scrap read from buffer for sysfs access.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:19 +0000 (22:18 +0000)]
staging:iio:adc:ad7476 scrap read from buffer for sysfs access.

No known use case and complicates in kernel interface work.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:ad7192 scrap read from buffer for sysfs access.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:18 +0000 (22:18 +0000)]
staging:iio:adc:ad7192 scrap read from buffer for sysfs access.

No known use case and complicates in kernel interface work.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:accel:lis3l02dq scrap reading from buffer for sysfs access.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:17 +0000 (22:18 +0000)]
staging:iio:accel:lis3l02dq scrap reading from buffer for sysfs access.

No obvious usecase and complicates in kernel interface work.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:buffer remove unused owner field from struct iio_buffer
Jonathan Cameron [Mon, 5 Dec 2011 22:18:16 +0000 (22:18 +0000)]
staging:iio:buffer remove unused owner field from struct iio_buffer

Legacy of having multiple chrdevs that never got cleaned up.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio: scrap scan_count and ensure all drivers use active_scan_mask
Jonathan Cameron [Mon, 5 Dec 2011 22:18:15 +0000 (22:18 +0000)]
staging:iio: scrap scan_count and ensure all drivers use active_scan_mask

Obviously drivers should only use this for pushing to buffers.
They need buffer->scan_mask for pulling from them post demux.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:buffer move setup ops from buffer instance to iio_dev
Jonathan Cameron [Mon, 5 Dec 2011 22:18:14 +0000 (22:18 +0000)]
staging:iio:buffer move setup ops from buffer instance to iio_dev

These callbacks should not be buffer instance specific.
Hence move them out of the buffer.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio: remove userspace access to bytes per datum.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:13 +0000 (22:18 +0000)]
staging:iio: remove userspace access to bytes per datum.

There are no known reasons why userspace should want this value.
It can be established from the buffer description anyway.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:buffer drop bpe field.
Jonathan Cameron [Mon, 5 Dec 2011 22:18:12 +0000 (22:18 +0000)]
staging:iio:buffer drop bpe field.

Has no remaining users.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:max1363 add datasheet_name entries.
Jonathan Cameron [Mon, 5 Dec 2011 21:56:01 +0000 (21:56 +0000)]
staging:iio:adc:max1363 add datasheet_name entries.

Kind of obvious for this device but useful
for testing purposes.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio: core: add datasheet_name to chan_spec
Jonathan Cameron [Mon, 5 Dec 2011 21:56:00 +0000 (21:56 +0000)]
staging:iio: core: add datasheet_name to chan_spec

This allows for matching against the name given
on a datasheet, however silly/inconsistent it might
be.

Useful for in kernel interfaces.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:max1363 correctly set channels as big endian.
Jonathan Cameron [Mon, 5 Dec 2011 21:37:16 +0000 (21:37 +0000)]
staging:iio:adc:max1363 correctly set channels as big endian.

Also, the differential channels should always have been signed.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:max1363 use new demuxing support.
Jonathan Cameron [Mon, 5 Dec 2011 21:37:15 +0000 (21:37 +0000)]
staging:iio:adc:max1363 use new demuxing support.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio: add demux optionally to path from device to buffer
Jonathan Cameron [Mon, 5 Dec 2011 21:37:14 +0000 (21:37 +0000)]
staging:iio: add demux optionally to path from device to buffer

This gives you only what you ask for which is handy
for some devices with weird scan combinations.

Routes all data flow through a core utility function.
That and this demuxing support will be needed to do
demuxing to multiple destinations in kernel.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio: make iio_sw_buffer_preenable much more general.
Jonathan Cameron [Mon, 5 Dec 2011 21:37:13 +0000 (21:37 +0000)]
staging:iio: make iio_sw_buffer_preenable much more general.

Also introduces active_scan_mask storage to tell the core what is
really being currently captured from the device (different from
what is desired as often has bonus channels).

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio: add hook to allow core to perform scan related config.
Jonathan Cameron [Mon, 5 Dec 2011 21:37:12 +0000 (21:37 +0000)]
staging:iio: add hook to allow core to perform scan related config.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:buffer add a cache of the timestamp scan index.
Jonathan Cameron [Mon, 5 Dec 2011 21:37:11 +0000 (21:37 +0000)]
staging:iio:buffer add a cache of the timestamp scan index.

Basically avoids looking it up lots of times.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:find iio channel from scan index util function
Jonathan Cameron [Mon, 5 Dec 2011 21:37:10 +0000 (21:37 +0000)]
staging:iio:find iio channel from scan index util function

Useful for getting to the channel based on scan mask alone.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio: Remove redundant spi driver bus initialization
Lars-Peter Clausen [Mon, 5 Dec 2011 15:53:05 +0000 (16:53 +0100)]
staging:iio: Remove redundant spi driver bus initialization

In ancient times it was necessary to manually initialize the bus field of an
spi_driver to spi_bus_type. These days this is done in spi_register_driver() so
we can drop the manual assignment.

The patch was generated using the following coccinelle semantic patch:
// <smpl>
@@
identifier _driver;
@@
 struct spi_driver _driver = {
  .driver = {
- .bus = &spi_bus_type,
  },
 };
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:dac: Add AD5380 driver
Lars-Peter Clausen [Tue, 6 Dec 2011 09:07:02 +0000 (10:07 +0100)]
staging:iio:dac: Add AD5380 driver

This patch adds support for the Analog Devices D5380, AD5381,
AD5382, AD5383, AD5384, AD5390, AD5391, AD5392 multi-channel
Digital to Analog Converters.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:dac: Add AD5764 driver
Lars-Peter Clausen [Mon, 5 Dec 2011 16:05:41 +0000 (17:05 +0100)]
staging:iio:dac: Add AD5764 driver

This patch adds support for the Analog Devices AD5764, AD5764R, AD5744, AD5744R
quad channel analog-to-digital converter.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:adc:max1363 actually make timestamp controllable
Jonathan Cameron [Sun, 4 Dec 2011 20:44:36 +0000 (20:44 +0000)]
staging:iio:adc:max1363 actually make timestamp controllable

Previously timestamps were always on in this driver.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:generic_buffer example - handle endian differences
Jonathan Cameron [Sun, 4 Dec 2011 19:10:59 +0000 (19:10 +0000)]
staging:iio:generic_buffer example - handle endian differences

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging:iio:Documentation: cleanup properly in buffer handling code
Jonathan Cameron [Sun, 4 Dec 2011 19:10:58 +0000 (19:10 +0000)]
staging:iio:Documentation: cleanup properly in buffer handling code

Eating the endian description for now.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoiio: light sensor: Improve granularity of tsl2583 lux values.
Bryan Freed [Fri, 2 Dec 2011 22:19:30 +0000 (14:19 -0800)]
iio: light sensor: Improve granularity of tsl2583 lux values.

When illuminance0_calibbias gets 4000 (for a 4x multiplier), we see lux
granularity of 4.  Reversing the order of the right shift and multiplication
retains the precision of the unadjusted lux value.

Signed-off-by: Bryan Freed <bfreed@chromium.org>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: iio/accel: Added a range check for val in store_measurement_mode()
Andreas Ruprecht [Fri, 2 Dec 2011 16:30:23 +0000 (17:30 +0100)]
Staging: iio/accel: Added a range check for val in store_measurement_mode()

In sca3000_store_measurement_mode() we use val to and it with a mask.
This mask is only two bits long (as we are only interested in the
lowest two bits), so a value bigger than 3 was silently ignored so
far.

Now this function will return -EINVAL, if val is bigger than 3.

Signed-off-by: Andreas Ruprecht <rupran@einserver.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: iio/accel: Changed data type of mask in store_measurement_mode() to u8
Andreas Ruprecht [Fri, 2 Dec 2011 16:56:55 +0000 (17:56 +0100)]
Staging: iio/accel: Changed data type of mask in store_measurement_mode() to u8

In sca3000_store_measurement_mode() we parse a value from a string
buffer via kstrtou8, and store the parsed value into a u8 after
and-ing it with mask.

As we are only interested in the lowest two bits here and mask is
initialized with a fixed value 0x03, mask may as well be a u8.

Signed-off-by: Andreas Ruprecht <rupran@einserver.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: hv: update TODO file
Greg Kroah-Hartman [Thu, 1 Dec 2011 18:38:42 +0000 (10:38 -0800)]
Staging: hv: update TODO file

Hank is no longer at Microsoft, so remove his email address as it
bounces.

Cc: KY Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: hv: remove hv_mouse driver as it's now in the hid directory
Greg Kroah-Hartman [Thu, 1 Dec 2011 18:37:09 +0000 (10:37 -0800)]
Staging: hv: remove hv_mouse driver as it's now in the hid directory

This removes the hv_mouse driver as it's now in Jiri's HID tree in the
"proper" place.

Cc: KY Srinivasan <kys@microsoft.com>
Cc: Jiri Kosina <jikos@jikos.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: VME: Remove typedefs
Martyn Welch [Thu, 1 Dec 2011 17:06:29 +0000 (17:06 +0000)]
Staging: VME: Remove typedefs

The use of typedefs is discouraged, remove them.

Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: hv: storvsc: Implement per device memory pools
K. Y. Srinivasan [Thu, 1 Dec 2011 12:59:20 +0000 (04:59 -0800)]
Staging: hv: storvsc: Implement per device memory pools

The current code implemented a per-HBA memory pool mechanism. For IDE disks
managed by this driver, there is a one to one correspondance between the
block device and the associated virtual HBA and since currently only IDE devices
can be the boot device, this addressed the deadlock issues that were raised during
the review process. This patch implements a per-lun memory pool mechanism.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: hv: storvsc: Fix a bug in copy_from_bounce_buffer()
K. Y. Srinivasan [Thu, 1 Dec 2011 12:59:19 +0000 (04:59 -0800)]
Staging: hv: storvsc: Fix a bug in copy_from_bounce_buffer()

Fix a bug in copy_from_bounce_buffer().

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: hv: storvsc: Fix a bug in storvsc_command_completion()
K. Y. Srinivasan [Thu, 1 Dec 2011 12:59:18 +0000 (04:59 -0800)]
Staging: hv: storvsc: Fix a bug in storvsc_command_completion()

Fix a bug in storvsc_command_completion() that leaks memory when scatter/gather
lists are used on the "write" side.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: hv: storvsc: Cleanup storvsc_device_alloc()
K. Y. Srinivasan [Thu, 1 Dec 2011 12:59:17 +0000 (04:59 -0800)]
Staging: hv: storvsc: Cleanup storvsc_device_alloc()

The code in storvsc_device_alloc() is not needed as this would be
done by default. Get rid of it. We still keep the function as we use
this hook to allocate per-LUN memory pools in a later patch.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: hv: storvsc: Disable clustering
K. Y. Srinivasan [Thu, 1 Dec 2011 12:59:16 +0000 (04:59 -0800)]
Staging: hv: storvsc: Disable clustering

Disable clustering, since the host side on Hyper-V requires that
each I/O element not exceed the page size. As part of this
cleanup, get rid of the function to merge bvecs, as the primary
reason for this function was to avoid having an element exceed
the page size.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agonet/hyperv: Add support for promiscuous mode setting
Haiyang Zhang [Wed, 30 Nov 2011 15:19:08 +0000 (07:19 -0800)]
net/hyperv: Add support for promiscuous mode setting

Add code to accept promiscuous mode setting, and pass it to
RNDIS filter.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agonet/hyperv: Fix long lines in netvsc.c
Haiyang Zhang [Wed, 30 Nov 2011 15:19:07 +0000 (07:19 -0800)]
net/hyperv: Fix long lines in netvsc.c

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: line6: NULL dereference in dev_err()
Dan Carpenter [Wed, 30 Nov 2011 08:43:41 +0000 (11:43 +0300)]
Staging: line6: NULL dereference in dev_err()

"line6" hasn't been set at this point and we should be using
&interface->dev instead.

Gcc would have complained about this if it weren't for the fact that we
initialized line6 to NULL.  I removed the initialization.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: hv: mousevsc: Properly add the hid device
K. Y. Srinivasan [Wed, 30 Nov 2011 16:52:23 +0000 (08:52 -0800)]
Staging: hv: mousevsc: Properly add the hid device

We need to properly add the hid device to correctly initialize the
sysfs state. While this patch is against the staging tree; Jiri,
please pick up this patch as you merge the Hyper-V mouse driver.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reported-by: Fuzhou Chen <fuzhouch@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: lttng: cleanup one-bit signed bitfields
Mathieu Desnoyers [Thu, 1 Dec 2011 14:31:18 +0000 (09:31 -0500)]
staging: lttng: cleanup one-bit signed bitfields

* Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Sparse complains that these signed bitfields look "dubious".  The
> problem is that instead of being either 0 or 1 like people would expect,
> signed one bit variables like this are either 0 or -1.  It doesn't cause
> a problem in this case but it's ugly so lets fix them.

* walter harms (wharms@bfs.de) wrote:
> hi,
> This patch looks ok to me but this design is ugly by itself.
> It should be replaced by an uchar uint whatever or use a
> real bool (obviously not preferred by this programmes).

bool :1, uchar :1 or uint :1 could make sense. uchar:1/bool:1 won't save
any space here, because the surrounding fields are either uint or
pointers, so alignment will just add padding.

I try to use int/uint whenever possible because x86 CPUs tend to get
less register false-dependencies when using instructions modifying the
whole register (generated by using int/uint types) rather than only part
of it (uchar/char/bool). I only use char/uchar/bool when there is a
clear wanted space gain.

The reason why I never use the bool type within a structure when I want
a compact representation is that bool takes a whole byte just to
represent one bit:

struct usebitfield {
    int a;
    unsigned int f:1, g:1, h:1, i:1, j:1;
    int b;
};

struct usebool {
    int a;
    bool f, g, h, i, j;
    int b;
};

struct useboolbf {
    int a;
    bool f:1, g:1, h:1, i:1, j:1;
    int b;
};

int main()
{
    printf("bitfield %d bytes, bool %d bytes, boolbitfield %d bytes\n",
            sizeof(struct usebitfield), sizeof(struct usebool),
            sizeof(struct useboolbf));
}

result:

bitfield 12 bytes, bool 16 bytes, boolbitfield 12 bytes

This is because each bool takes one byte, while the bitfields are put in
units of "unsigned int" (or bool for the 3rd struct). So in this
example, we need 5 bytes + 3 bytes alignment for the bool, but only 4
bytes to hold the "unsigned int" unit for the bitfields.

The choice between bool and bitfields must also take into account the
frequency of access to the variable, because bitfields require mask
operations to access the selected bit(s). You will notice that none of
these bitfields are accessed on the tracing fast-path: only in
slow-paths. Therefore, space gain is more important than speed here.

One might argue that I have so few of these fields here that it does not
make an actual difference to go for bitfield or bool. I am just trying
to choose types best suited for their intended purpose, ensuring they
are future-proof and will allow simply adding more fields using the same
type, as needed.

So I guess I'll go for uint :1.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agolttng wrapper: add missing include to kallsyms wrapper
Mathieu Desnoyers [Wed, 30 Nov 2011 18:34:18 +0000 (13:34 -0500)]
lttng wrapper: add missing include to kallsyms wrapper

Needed to keep bissectability.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agolttng lib: ring buffer move null pointer check to open
Mathieu Desnoyers [Wed, 30 Nov 2011 18:34:16 +0000 (13:34 -0500)]
lttng lib: ring buffer move null pointer check to open

* Dan Carpenter <dan.carpenter@oracle.com> wrote:
> The patch c844b2f5cfea: "lttng lib: ring buffer" from Nov 28, 2011,
> leads to the following Smatch complaint:
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c +86
> +lib_ring_buffer_mmap_buf()
>          warn: variable dereferenced before check 'buf' (see line 79)
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
>     78          unsigned long length = vma->vm_end - vma->vm_start;
>     79          struct channel *chan = buf->backend.chan;
>                                        ^^^^^^^^^^^^^^^^^
> Dereference.
>
>     80          const struct lib_ring_buffer_config *config = chan->backend.config;
>     81          unsigned long mmap_buf_len;
>     82
>     83          if (config->output != RING_BUFFER_MMAP)
>     84                  return -EINVAL;
>     85
>     86          if (!buf)
>                     ^^^^
> Check.
>
>     87                  return -EBADF;
>     88

Let's move the NULL buf check to the file "open", where it belongs. The
"open" file operation is the actual interface between lib ring buffer
and the modules using it.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agolttng lib: ring buffer remove duplicate null pointer
Mathieu Desnoyers [Wed, 30 Nov 2011 18:34:15 +0000 (13:34 -0500)]
lttng lib: ring buffer remove duplicate null pointer

* Dan Carpenter <dan.carpenter@oracle.com> wrote:
> The patch c844b2f5cfea: "lttng lib: ring buffer" from Nov 28, 2011,
> leads to the following Smatch complaint:
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c +33
> +lib_ring_buffer_fault()
>          warn: variable dereferenced before check 'buf' (see line 26)
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
>     25          struct lib_ring_buffer *buf = vma->vm_private_data;
>     26          struct channel *chan = buf->backend.chan;
>                                        ^^^^^^^^^^^^^^^^^
> Dereference.
>
>     27          const struct lib_ring_buffer_config *config = chan->backend.config;
>     28          pgoff_t pgoff = vmf->pgoff;
>     29          struct page **page;
>     30          void **virt;
>     31          unsigned long offset, sb_bindex;
>     32
>     33          if (!buf)
>                     ^^^^
> Check.
>
>     34                  return VM_FAULT_OOM;
>     35

This check is performed at mapping setup time in
lib_ring_buffer_mmap_buf() already, so we can safely remove this
duplicata.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agolttng lib: ring buffer: remove stale null-pointer
Mathieu Desnoyers [Wed, 30 Nov 2011 18:34:14 +0000 (13:34 -0500)]
lttng lib: ring buffer: remove stale null-pointer

* Dan Carpenter <dan.carpenter@oracle.com> wrote:
[...]
> The patch c844b2f5cfea: "lttng lib: ring buffer" from Nov 28, 2011,
> leads to the following Smatch complaint:
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c +1150
> +lib_ring_buffer_print_buffer_errors()
>          warn: variable dereferenced before check 'chan' (see line 1143)
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c
>   1142  {
>   1143          const struct lib_ring_buffer_config *config =
> +chan->backend.config;
>
> +^^^^^^^^^^^^^^^^^^^^
> Dereference.
>
>   1144          unsigned long write_offset, cons_offset;
>   1145
>   1146          /*
>   1147           * Can be called in the error path of allocation when
>   1148           * trans_channel_data is not yet set.
>   1149           */
>   1150          if (!chan)
>                 ^^^^^^^^^
> Check.  At first glance the comment seems out of date, I think check can
> be removed safely.
>
>   1151                  return;
>   1152          /*

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agortl8192e: Rename clashing symbols
Sean MacLennan [Wed, 30 Nov 2011 20:18:52 +0000 (15:18 -0500)]
rtl8192e: Rename clashing symbols

The "rtl8192e: Export symbols" patch exported three functions already
exported by the rtl8192u driver. This patch renames the three functions:
  Dot11d_Init => dot11d_init
  HTUpdateSelfAndPeerSetting => HT_update_self_and_peer_setting
  IsLegalChannel => rtllib_legal_channel

Signed-off-by: Sean MacLennan <seanm@seanm.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: android: ram_console: pass in a boot info string
Colin Cross [Tue, 25 Oct 2011 21:31:58 +0000 (14:31 -0700)]
staging: android: ram_console: pass in a boot info string

Allow the board file to pass a boot info string through the
platform data that is appended to the /proc/last_kmsg file.

[moved the .h file to drivers/staging/android/ to be self-contained - gregkh]

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoandroid: logger: bump up the logger buffer sizes
JP Abgrall [Fri, 12 Aug 2011 04:33:35 +0000 (21:33 -0700)]
android: logger: bump up the logger buffer sizes

(port from common android-2.6.39
  commit: 11430f16545205c614dd5bd58e4a7ee630fc0f9f)

events: (no change, 256)
main: 64 -> 256
radio: 64 -> 256
system: 64 -> 256

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoandroid: lowmemorykiller: Fix arguments to lowmem_shrink
Colin Cross [Wed, 22 Jun 2011 23:05:47 +0000 (16:05 -0700)]
android: lowmemorykiller: Fix arguments to lowmem_shrink

The arguments to shrink functions have changed, update
lowmem_shrink to match.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: android: lowmemorykiller: Ignore shmem pages in page-cache
Arve Hjønnevåg [Wed, 24 Nov 2010 01:29:04 +0000 (17:29 -0800)]
staging: android: lowmemorykiller: Ignore shmem pages in page-cache

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: android: lowmemorykiller: Update arguments of shrinker for 2.6.35
Colin Cross [Sun, 22 Aug 2010 00:25:42 +0000 (17:25 -0700)]
staging: android: lowmemorykiller: Update arguments of shrinker for 2.6.35

Signed-off-by: Colin Cross <ccross@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: android: lowmemorykiller: Remove bitrotted codepath
San Mehat [Thu, 6 May 2010 22:43:46 +0000 (15:43 -0700)]
staging: android: lowmemorykiller: Remove bitrotted codepath

Now that we're murder-synchronous, this code path will never be
called (and if it does, it doesn't tell us anything useful other
than we killed a task that was already being killed by somebody
else but hadn't gotten its' signal yet)

Signed-off-by: San Mehat <san@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: binder: Fix memory corruption via page aliasing
Christopher Lais [Sat, 1 May 2010 20:51:48 +0000 (15:51 -0500)]
staging: binder: Fix memory corruption via page aliasing

binder_deferred_release was not unmapping the page from the buffer
before freeing it, causing memory corruption.  This only happened
when page(s) had not been freed by binder_update_page_range, which
properly unmaps the pages.

This only happens on architectures with VIPT aliasing.

To reproduce, create a program which opens, mmaps, munmaps, then closes
the binder very quickly.  This should leave a page allocated when the
binder is released.  When binder_deferrred_release is called on the
close, the page will remain mapped to the address in the linear
proc->buffer.  Later, we may map the same physical page to a different
virtual address that has different coloring, and this may cause
aliasing to occur.

PAGE_POISONING will greatly increase your chances of noticing any
problems.

Signed-off-by: Christopher Lais <chris+android@zenthought.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: android: lowmemkiller: Substantially reduce overhead during reclaim
San Mehat [Wed, 5 May 2010 18:38:42 +0000 (11:38 -0700)]
staging: android: lowmemkiller: Substantially reduce overhead during reclaim

This patch optimizes lowmemkiller to not do any work when it has an outstanding
kill-request. This greatly reduces the pressure on the task_list lock
(improving interactivity), as well as improving the vmscan performance
when under heavy memory pressure (by up to 20x in tests).

Note: For this enhancement to work, you need CONFIG_PROFILING

Signed-off-by: San Mehat <san@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agostaging: android: lowmemorykiller: Don't try to kill the same pid over and over
San Mehat [Mon, 26 Apr 2010 22:11:04 +0000 (15:11 -0700)]
staging: android: lowmemorykiller: Don't try to kill the same pid over and over

  Under certain circumstances, a process can take awhile to
handle a sig-kill (especially if it's in a scheduler group with
a very low share ratio). When this occurs, lowmemkiller returns
to vmscan indicating the process memory has been freed - even
though the process is still waiting to die. Since the memory
hasn't actually freed, lowmemkiller is called again shortly after,
and picks the same process to die; regardless of the fact that
it has already been 'scheduled' to die and the memory has already
been reported to vmscan as having been freed.

  Solution is to check fatal_signal_pending() on the selected
task, and if it's already pending destruction return; indicating
to vmscan that no resources were freed on this pass.

Signed-off-by: San Mehat <san@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 years agoStaging: android: binder: Create dedicated workqueue for binder deferred work
Arve Hjønnevåg [Thu, 22 Apr 2010 22:53:23 +0000 (15:53 -0700)]
Staging: android: binder: Create dedicated workqueue for binder deferred work

Some drivers flush the global workqueue when closed. This would deadlock if
the last reference to the file was released from the binder.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>