Merge tag 'iio-for-v3.7e' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Fifth round of new drivers and device support for the IIO
subsystem in the 3.7 cycle.
Here we have a mixed bag of new stuff, minor fixes and
more major fixes for drivers added earlier in this cycle.
1) A number of fixes for the HID sensors code added in previous
pull request. Typical stuff that has become apparent as more eyes
have looked at the code post merging. Similar case for the ad5755 dac.
2) Cleanups of error handing in inkern.c - again typical stuff to see
as code comes into heavier use and people notice the naughty short
cuts that snuck in originally and kindly fix them.
3) A series from Lars that removes some incorrect error handling
from the remove functions of a number of drivers. These have been
there for a very long time hence I'm not pushing these out for the
3.6 cycle.
4) Support for more parts in the ad7780 driver.
5) A driver for the adcs on the lp8788 power management unit
6) A client driver for IIO to allow it's ADCs to be used for
battery status measurement. Note this driver has some dependencies
on some utility functions added to IIO in this series, hence it is
coming via this tree rather than Anton's.
7) A null pointer dereference bug in the 'fake' driver. I'm not
doing this as a fix for the 3.6 cycle because it only effects
'fake' hardware and that code is typically only used by people
investigating how IIO works as part of writing new drivers. Hence
it's hardly a critical fix.
staging: winbond: Coding Style correction and removal of unused macro
Removed an unused macro. Plus, couple of grammatical and coding style fixes.
1) The macro _INLINE is not used anywhere. Anyways __inline is not portable.
2) Changed comment from "Not use" to "Unused" make it grammatically correct and
to fit in 80 word limit.
3.) Removed space after *
staging: sbe-2t3e3: fix error handling in t3e3_init_channel()
t3e3_init_channel() incorrectly handles errors in several places:
it returns zero and does not deallocate all required resources.
The patch fixes that places.
Found by Linux Driver Verification project (linuxtesting.org).
If the config contains CONFIG_IIO_BUFFER=y and CONFIG_IIO_SIMPLE_DUMMY_BUFFER=n
iio_simple_dummy_configure_buffer() is stubbed out and iio_buffer_register() is
not. As a result we try to register a buffer which has not been configured.
This will causes a NULL pointer deref in iio_buffer_register. To solve this
issue move the iio_buffer_register() call to iio_simple_dummy_configure_buffer(),
so it will only be called if iio_simple_dummy_configure_buffer() has been called.
Driver to allow use of the ADC drivers supported by the IIO
subsystem for battery status monitoring. Connecting this
driver to the relevant IIO device requires registration of
the appropriate iio_map structure array by the IIO device
driver (usually from platform data). If specified the driver
will also make use of a gpio to provide interrupt driven
notification that the battery is fully charged.
In last version:
Addressed concerns raised by lars:
a. made the adc_bat per device.
b. get the IIO channel using hardcoded channel names.
c. Minor issues related to gpio_is_valid and some code
refactoring.
In V1:
Addressed concerns raised by Anton:
a. changed the struct name to gab(generic adc battery).
b. Added some functions to neaten the code.
c. Some minor coding guidelines changes.
d. Used the latest function introduce by lars:
iio_read_channel_processed to streamline the code.
In V2:
Addressed concerns by lars:
a. No need of allocating memory for channels.Make it array.
b. Code restructring, coding style and following kernel guidelines changes
suggested by him.
In V3:
Addressed conerns by Anton:
a. Added the copyright.
b. Coding guidelines changes suggested by him.
c. Added Makefile and Kconfig
Signed-off-by: anish kumar <anish198519851985@gmail.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fix below issues:
1. In the case of goto err_close, hid_hw_stop(hdev) is called twice. Fix it.
2. If fails to allocate MFD device name, we also need to free all
successfully allocated names in previous iterations.
3. In sensor_hub_remove(), Call hid_hw_close() before hid_hw_stop().
4. Adjust unnecessary change lines for hid_err.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Axel Lin [Wed, 19 Sep 2012 15:30:00 +0000 (16:30 +0100)]
HID: hid-sensor-hub: Remove hdev->claimed setting
Current implementation of hid_hw_start() allows connect_mask to be 0.
Setting hdev->claimed = HID_CLAIMED_INPUT before calling hid_hw_start()
is not necessary. Remove it.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Kim, Milo [Mon, 17 Sep 2012 09:35:00 +0000 (10:35 +0100)]
iio: adc: add new lp8788 adc driver
TI LP8788 PMU provides regulators, battery charger, ADC,
RTC, backlight driver and current sinks.
This patch enables the LP8788 ADC functions.
The LP8788 ADC has several ADC input selection and supports 12bit resolution.
Internal operation of getting ADC is access to registers of LP8788.
The LP8788 ADC uses exported functions for accessing these registers.
(exported by LP8788 MFD device driver)
This driver supports IIO_CHAN_INFO_RAW and SCALE.
So the IIO consumer can calculate the value with raw and scale.
The unit of scale is micro.
(ADC Input Selection)
Voltage: battery voltage (MAX 5.0, 5.5 and 6.0V)
charger input voltage
four general ADC inputs
coin cell voltage
Current: battery charging current
Temperature: IC temperature
(The IIO map for the IIO consumer)
The ADC input is configurable in the platform side.
Even though this platform data is not defined,
the default IIO map is created for supporting the power supply driver.
The battery voltage and temperature are used inside this driver.
(History)
Patch v6.
(a) Fix scale value for each ADC input selection
Voltage and current type are mili unit and temperature is degree.
To calculate the IC temperature,
temp = raw * scaleint + (raw * scalepart)/ 1000000, scaleint is always 0.
= raw * 0.061050, raw: 0 ~ 4095
Then range of IC temperature(ADC result) is 0 ~ 250'C
(b) Reorganization of the IIO channel Spec
Remove address, scan_type and scan_index and rollback the datasheet name.
The reason why 'address' field is unnecessary is no relation with each channel.
Moreover, to get the raw ADC value, the address info is not only one register
but also several registers.
Therefore specific function(lp8788_get_adc_result) is called rather than
using one 'address' field.
(c) Fix coding style
Remove duplicated checking routine while unregistering the IIO map.
Fix code for space and parenthesis.
Patch v5.
Fix default consumer name as 'lp8788-charger'.
Add mutex for ADC read operation.
Reorganization on lp8788_adc_read_raw().
Patch v4.
Fix adc_raw function: support RAW and SCALE channel info.
Change LP8788 ADC platform data - iio map.
Enables the default IIO map.
staging:iio:ad7780: Add support for the ad7170/ad7171
The ad7170/ad7171 have a software interface similar to the ad7780. They do not
have an external pin which allows to change the internal gain and the what is
used for the gain bit in the ad7780/ad7781 becomes part of the check pattern.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Some designs hardwire the PDRST pin to always on. In this case there is no GPIO
to control the mode of the device, so make the GPIO optional. Since now all of
the the platform data fields are optional now, make the platform data as a whole
optional as well.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:sca3000: Do not return a error in remove function
In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.
The errors which the driver tries to handle in the remove function are
non-critical, so we can just ignore them and continue to free all resources and
remove the IIO device.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:lis3l02dq: Do not return a error in remove function
In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.
The errors which the driver tries to handle in the remove function are
non-critical, so we can just ignore them and continue to free all resources and
remove the IIO device.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:ade7759: Do not return a error in remove function
In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.
The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:ade7758: Do not return a error in remove function
In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.
The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:ade7754: Do not return a error in remove function
In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.
The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:ade7753: Do not return a error in remove function
In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.
The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:adis16400: Do not return a error in remove function
In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.
The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:adis16200: Do not return a error in remove function
In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.
The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Kim, Milo [Tue, 18 Sep 2012 04:56:00 +0000 (05:56 +0100)]
iio: inkern: clean up error return code
When the IIO consumer tries to get specific IIO channel,
few error cases can be happened.
(a) Memory allocation failure
(b) No matched ADC channel error
(c) Invalid input arguments
This patch enables cleaning up error handling in case of (a) and (b).
In error handling code,
(a): the reference count of the IIO device should be decreased.
(b): the allocated memory should be freed with restoring the reference count.
Therefore iio_deivce_put() is called in both cases.
This can be handled in the last error statement.
Additionally, integer variable is used for stating each error case explicitly.
Then, the error returns as ERR_PTR() with this value.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Kim, Milo [Tue, 18 Sep 2012 04:55:00 +0000 (05:55 +0100)]
iio: inkern: put the IIO device when it fails to allocate memory
The reference count of the IIO device is increased if the IIO map has
matched consumer name.
After then, it tries to allocate the iio_channel which is used by the consumer.
If it fails to allocate memory, the reference count should be decreased.
This patch enables restoring the reference count of the IIO device.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
When hid sensor hub is unplugged, there is a crash in
iio_device_unregister_trigger_consumer.
In a typical IIO driver when remove is called, it will unregister and free
trigger and then it will call iio_device_free.
The function iio_trigger_free() will free the allocated memory for trigger.
If this trigger was assigned to iio_dev->trig, then it should be set to NULL.
Othewise when iio_device_free() is called later, it finally calls
iio_device_unregsister_trigger(), which checks for
if (indio_dev->trig)
iio_trigger_put(indio_dev->trig);
If indio_dev->trig is not set to NULL, it calls iio_trigger_put on a bad
pointer causing crash.
This scenerio can happen in any driver, which is storing trigger pointer in
iio_dev structure and following current procedure during remove.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Ian Abbott [Wed, 19 Sep 2012 18:37:39 +0000 (19:37 +0100)]
staging: comedi: fix memory leak for saved channel list
When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel
list, it frees any previously allocated channel list in
`async->cmd.chanlist` and replaces it with the new one. However, if the
device is ever removed (or "detached") the cleanup code in
`cleanup_device()` in "drivers.c" does not free this memory so it is
lost.
A sensible place to free the kernel copy of the channel list is in
`do_become_nonbusy()` as at that point the comedi asynchronous command
associated with the channel list is no longer valid. Free the channel
list in `do_become_nonbusy()` instead of `do_cmd_ioctl()` and clear the
pointer to prevent it being freed more than once.
Note that `cleanup_device()` could be called at an inappropriate time
while the comedi device is open, but that's a separate bug not related
to this this patch.
Cc: stable@vger.kernel.org Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 19 Sep 2012 18:37:37 +0000 (19:37 +0100)]
staging: comedi: ni_labpc: pass ai scan mode through various functions
Pass the `enum scan_mode` value calculated by `labpc_ai_scan_mode()` as
a parameter to various other functions so they don't have to call it
themselves. Amongst others, the affected functions include
`labpc_adc_timing()`, `labpc_ai_convert_period()` and
`labpc_ai_scan_period()`.
`labpc_adc_timing()` calls `labpc_ai_convert_period()` and
`labpc_ai_scan_period()` in several places, but the returned values are
the same each time, so change it to just call those functions once and
re-use the return values.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: 8253: mmio address is a void __iomem *
The inline functions for accessing a memory mapped 8254 device
are using a void * for the 'base_address' of the device. Memory
mapped io using the read/write functions should be using a
void __iomem * for the address.
Fixing these exposed a couple other void * / void __iomem *
issues in the ni_labpc driver.
This fixes a number of sparse warnings like:
warning: incorrect type in argument 2 (different address spaces)
expected void volatile [noderef] <asn:2>*addr
got void *
warning: incorrect type in argument 1 (different address spaces)
expected void const volatile [noderef] <asn:2>*addr
got void *<noident>
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: kcomedilib: fix a __user space access issue
The 'data' field in struct comedi_insn is an unsigned int __user *.
The comedi core copies this data to kernel space before passing it
on to a drivers insn_bits/insn_config method.
kcomedilib provides an interface for external kernel modules to
use the comedi drivers. This interface creates a comedi_insn
that is then passed to the comedi drivers insn_bits/insn_config
method. Unfortunately, kcomedilib is using the comedi_insn 'data'
field directly which results in some sparse warnings:
warning: incorrect type in argument 4 (different address spaces)
expected unsigned int *<noident>
got unsigned int [noderef] <asn:1>*data
warning: incorrect type in assignment (different address spaces)
expected unsigned int [noderef] <asn:1>*[addressable] [assigned] data
got unsigned int *<noident>
Fix this by passing the kernel data directly, as a separate parameter,
instead of trying to put in into the comedi_insn 'data' field. This is
how the comedi core handles the data from user space.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Convert this PCI driver to use the comedi PCI auto config attach
mechanism by adding an 'attach_pci' callback function. Since the
driver does not require any external configuration options. and
the legacy 'attach' callback is now optional, remove it.
Also, make the boardinfo 'name' unique for the different board types.
Use this name when requesting the PCI resources. Change the printk
at the end of the attach into a dev_info.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This driver requires loading a firmware file for the fpga. This
is currently being done by passing the firmware data using the
COMEDI_DEVCONFIG ioctl through the attach() hook in the driver.
This does not work for auto-configured PCI devices due to the
firmware loading options not being set in the comedi_devconfig
parameter passed to the driver.
Change the driver so it gets the firmware using request_firmware()
and ignore any firmware options passed in the comedi_devconfig.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This driver originally used the 'attach' method in order to get
the firmware for the device from the comedi_config utility. It
now uses request_firmware_nowait() in the usb_driver probe to
get this firmware.
Since this driver has an 'attach_usb' method in the comedi_driver,
the 'attach' method can be removed because it is now optional.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This driver originally used the 'attach' method in order to get
the firmware for the device from the comedi_config utility. It
now uses request_firmware_nowait() in the usb_driver probe to
get this firmware.
Since this driver has an 'attach_usb' method in the comedi_driver,
the 'attach' method can be removed because it is now optional.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This driver originally used the 'attach' method in order to get
the firmware for the device from the comedi_config utility. It
now uses request_firmware_nowait() in the usb_driver probe to
get this firmware.
Since this driver has an 'attach_usb' method in the comedi_driver,
the 'attach' method can be removed because it is now optional.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
For aesthetic reasons, rename the private data variable
's526_ai_config' to simply 'ai_config'. Its private data
and does not need the 's526_' namespace.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The enum in this struct is used by the driver to know how the
gpct channels have been configured. Instead of using the private
enum S526_GPCT_APP_CLASS, we can just use the INSN_CONFIG_* value
that was passed in data[0] to the s526_gpct_insn_config().
The data array in this struct in never used. It actually could
cause a BUG since it assumes that the data pointer passed to
s526_gpct_insn_config() always has 6 values but the comments
indicate that there are really only 4 or 5.
Remove the s526GPCTConfig struct and associated S526_GPCT_APP_CLASS
enum and just use and unsigned int array in the private data to
hold the gpct configuration.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use a local variable for the iobase of the channel being read.
This makes the inw() calls a bit cleaner.
Move the masking of the read data to make the value stored in
the data array a bit clearer.
The comedi core expects insn_read functions to return the number
of insn data values read. For this function, the final value of
'i' is correct but change the return to 'insn->n' just to make
it clear.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The comedi_insn 'data' pointer is a __user pointer that is
passed into the kernel using an ioctl. The comedi core copies
this data to kernel space in do_insnlist_ioctl() and then
passes that kernel data to the drivers as a separate parameter.
The drivers never need to access the data through the insn->data
pointer.
This fixes a number of sparse warnings about:
warning: dereference of noderef expression
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This adds a i.MX51/53/6 IPU (Image Processing Unit) KMS driver. The
driver has been tested on the i.MX51 babbage board, the i.MX53 LOCO
board and the i.MX6q sabrelite board in different clone mode and dual
head setups.
The IPU is the Image Processing Unit found on i.MX51/53/6 SoCs. It
features several units for image processing, this patch adds support
for the units needed for Framebuffer support, namely:
This patch is based on the Freescale driver, but follows a different
approach. The Freescale code implements logical idmac channels and
the handling of the subunits is hidden in common idmac code pathes
in big switch/case statements. This patch instead just provides code
and resource management for the different subunits. The user, in this
case the framebuffer driver, decides how the different units play
together.
This adds support for parallel displays for i.MX. It consists
of a drm encoder/connector pair which eventually passes EDID
data from the devicetree to the drm core.
Kevin McKinney [Fri, 21 Sep 2012 02:43:44 +0000 (22:43 -0400)]
Staging: bcm: Remove typedef for _stIM_sfHostNotify and call directly.
This patch removes typedef for _stIM_sfHostNotify,
changes the name of the struct from
_stIM_sfHostNotify to bcm_stim_sfhostnotify.
In addition, any calls to the following typedef
"stIM_sfHostNotify" are changed to call the
struct directly.
Signed-off-by: Kevin McKinney <klmckinney1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: tidspbridge: fix return value check in dsp_wdt_init()
In case of error, the function clk_get() returns ERR_PTR()
and never returns NULL pointer. The NULL test in the error
handling should be replaced with IS_ERR().
dpatch engine is used to auto generated this patch.
(https://github.com/weiyj/dpatch)
staging: sbe-2t3e3: use -ve error return codes in dc_init_descriptor_list
the dc_init_descriptor_list actually returns a +ve error return codes,
which is abnormal as other functions in kernel return -ve error codes on
failure. so replace the return codes of this function with -ve values
to make the consistency with the other functions in kernel.
Also make the dc_init_descriptor_list static as its never called
anywhere except in this file and move the function prototype from the
headerfile into the c file as its referred only in this c file.
staging:ced1401: remove read write callbacks from fops
As the driver says that read and writes should not be performed
and instead the user to kernel transactions are performed through
ioctl interface, remove these functions as they are not required
staging/rts_pstor: Delete some lines (dev_info() and dev_err()) in rtsx.c
fixed some coccinelle warnings.
+ drivers/staging/rts_pstor/rtsx.c:397:16-19: ERROR: dev is NULL but dereferenced.
drivers/staging/rts_pstor/rtsx.c:447:16-19: ERROR: dev is NULL but dereferenced.
drivers/staging/rts_pstor/rtsx.c:358:16-19: ERROR: dev is NULL but dereferenced.
staging: omap-thermal: bandgap: fix setting of alert thresholds
There was an error in check for the valid temperature in
function temp_to_adc_conversion. The temperature value was
compared with higher limit for less than condition as well,
resulting in returning -EINVAL. Corrected the check condition
to properly check for lower and higher temperature limits.
staging: usbip: vhci_hcd: Fixed oops during removal of vhci_hcd
In response to "usbip detach -p [port_number]" user command,vhci_shutdown_connection() gets
executed which kills tcp_tx,tcp_rx kernel threads but doesn't set thread pointers to NULL.
so, at the time of vhci_hcd removal vhci_shutdown_connection() again tries to kill kernel
threads which are already killed.
staging: usbip: stub_dev: Fixed oops during removal of usbip_host
stub_shutdown_connection() should set kernel thread pointers to NULL after killing them.
so that at the time of usbip_host removal stub_shutdown_connection() doesn't try to kill kernel threads
which are already killed.
Ian Abbott [Tue, 18 Sep 2012 18:46:58 +0000 (19:46 +0100)]
staging: comedi: don't dereference user memory for INSN_INTTRIG
`parse_insn()` is dereferencing the user-space pointer `insn->data`
directly when handling the `INSN_INTTRIG` comedi instruction. It
shouldn't be using `insn->data` at all; it should be using the separate
`data` pointer passed to the function. Fix it.
Ian Abbott [Tue, 18 Sep 2012 18:46:59 +0000 (19:46 +0100)]
staging: comedi: sparse warning in insn_rw_emulate_bits()
`insn_rw_emulate_bits()` is used to emulate the `INSN_READ` and
`INSN_WRITE` comedi instructions for subdevices that don't have an
`insn_read()` or `insn_write()` handler but do have an `insn_bits()`
handler.
The function fills in a temporary `struct comedi_insn` called `new_insn`
to pass to the subdevice's `insn_bits()` handler. In doing so, it sets
the `new_insn.data` pointer to point to a temporary data array. This
results in a warning from "sparse" because the `data` pointer in `struct
comedi_insn` has the `__user` tag. The subdevice's `insn_bits()`
handler ignores it anyway as it gets passed a pointer to the temporary
data array in a separate parameter. Don't bother setting
`new_insn.data`; just leave it set to `NULL` (done by an earlier
`memset()`).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 18 Sep 2012 18:46:57 +0000 (19:46 +0100)]
staging: comedi: fix sparse warning in do_devconfig_ioctl()
For the COMEDI_DEVCONFIG ioctl, the user application may embed a pointer
to firmware data within a designated element (or two elements for 64-bit
pointers) of the `options[]` array in the `struct comedi_devconfig`.
`do_devconfig_ioctl()` calls `comedi_aux_data()` to extract the pointer
value. It needs to be treated as a `__user` pointer so the firmware
data can be copied into kernel memory, so cast the result of
`comedi_aux_data()` to avoid a "sparse" warning. This is not ideal but
`comedi_aux_data()` is called elsewhere in a wholly kernel memory
context so we can't just change its return type to include the `__user`
tag.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: daqboard2000: remove local variable in daqboard2000_attach_pci()
The 'pci_base' variable is only used to hold the pci_resource_start()
value used to ioremap the pci bars. Remove the local variable and just
use pci_resource_start() directly in the ioremap.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change the whitespace of the range table to avoid the > 80 char
lines and the ugly line breaks. Convert the RANGE() values into
the appropriate {BIP,UNI}_RANGE().
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: daqboard2000: use attach_pci callback
Convert this PCI driver to use the comedi PCI auto config attach
mechanism by adding an 'attach_pci' callback function. Since the
driver does not require any external configuration options. and
the legacy 'attach' callback is now optional, remove it.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: daqboard2000: use request_firmware()
This driver requires loading a firmware file for the cpld. This
is currently being done by passing the firmware data using the
COMEDI_DEVCONFIG ioctl through the attach() hook in the driver.
This does not work for auto-configured PCI devices due to the
firmware loading options not being set in the comedi_devconfig
parameter passed to the driver.
Change the driver so it gets the firmware using request_firmware()
and ignore any firmware options passed in the comedi_devconfig.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In this driver the PCI bar 2 resource is being ioremap'ed to a
void * in the private data. This void * is then being cast to a
struct daqboard2000_hw * that defines all the registers used by
the driver.
This is causing a number of sparse warnings similar to:
warning: incorrect type in argument 1 (different address space)
expected void const volatile [noderef] <asn:2>*addr
got void *
Change the type in the private data to void __iomem * to correctly
store the ioremap'ed address.
Remove struct daqboard2000_hw and change the contents to #define's
for the register memory map.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: comedi_fops: cast the cmd->chanlist to the correct address space
Rename 'chanlist_saver' to 'user_chanlist' to avoid confusion that
it's actually a __user *.
The chanlist pointer in comedi_cmd is still a user space pointer when
the comedi_cmd is copied with copy_from_user() in do_cmd_ioctl() and
do_cmdtest_ioctl(). This pointer needs to be cast when it is saved in
user_chanlist in order to preserve its address space.
The copy_from_user() call to copy the chanlist to the kernel space
comedi_command requires the second parameter to be a __user pointer.
Use the correctly cast user_chanlist instead of cmd->chanlist.
Before the comedi_cmd is copied back to user space, the saved
user_chanlist pointer is restored. Cast the user_chanlist again so
that the address space matches the comedi_cmd.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Acked-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: comedi_fops: rename user_cmd in do_cmdtest_ioctl
This local variable is used to hold the comedi_cmd that is passed
to the kernel as the argument to the COMEDI_CMDTEST ioctl. Its filled
in with a copy_from_user() call. The name 'user_cmd' is a bit
confusing since it's actually kernel data.
Rename the local variable to 'cmd' to avoid the confusion.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Acked-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: comedi_fops: rename user_cmd in do_cmd_ioctl
This local variable is used to hold the comedi_cmd that is passed
to the kernel as the argument to the COMEDI_CMD ioctl. Its filled
in with a copy_from_user() call. The name 'user_cmd' is a bit
confusing since it's actually kernel data.
Rename the local variable to 'cmd' to avoid the confusion.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Acked-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: comedi_fops: rename the __user *cmd param in do_cmd_ioctl
This parameter is actually the unsigned long arg passed in the ioctl.
comedi_unlocked_ioctl() casts it as a (struct comedi_cmd __user *)
when calling do_cmd_ioctl(). Rename the variable to keep this clear.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Acked-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: comedi.h: remove __user tag from chanlist
The 'chanlist' is passed to the kernel from user space with the
COMEDI_CMD and COMEDI_CMDTEST ioctls. The do_cmd_ioctl() and
do_cmdtest_ioctl() functions in comedi_fops.c copy this data
to/from user space to kernel space correctly.
Unfortunately, this data is copied back into a struct comedi_cmd
so when the cmd is passed down to the drivers they still see the
pointer as __user data. This results is a number of sparse errors
such as:
warning: dereference of noderef expression
warning: incorrect type in argument 2 (different address spaces)
expected void const *<noident>
got unsigned int [noderef] <asn:1>*chanlist
warning: incorrect type in argument 3 (different address spaces)
expected unsigned int *chanlist
got unsigned int [noderef] <asn:1>*chanlist
warning: incorrect type in assignment (different address spaces)
expected unsigned int *ai_chanlist
got unsigned int [noderef] <asn:1>*chanlist
The two functions in comedi_fops are the only ones that need the
__user tag. Remove the tag so that all the drivers see the chanlist
pointer in the correct address space.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Acked-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>