profile/ivi/kernel-adaptation-intel-automotive.git
11 years agostaging: comedi: jr3_pci: fix iomem dereference
Ian Abbott [Thu, 27 Sep 2012 16:45:27 +0000 (17:45 +0100)]
staging: comedi: jr3_pci: fix iomem dereference

Correct a direct dereference of I/O memory to use an appropriate I/O
memory access function.  Note that the pointer being dereferenced is not
currently tagged with `__iomem` but I plan to correct that for 3.7.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: drivers: use comedi_fc.h cmdtest helpers
H Hartley Sweeten [Wed, 26 Sep 2012 21:11:10 +0000 (14:11 -0700)]
staging: comedi: drivers: use comedi_fc.h cmdtest helpers

Use the cfc_check_trigger_src() helper for Step 1 in all the
driver cmdtest functions.

Use the cfc_check_trigger_is_unique() helper for Step 2 in all
the driver cmdtest functions. Note that single source triggers
do not need to be checked, they are already unique if they pass
Step 1.

For aesthetic reasons, change the comments in the cmdtest
functions for steps 1 and 2 so that they are all the same.

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>
11 years agoStaging: winbond: usb_free_urb(NULL) is safe
Harsh Kumar [Wed, 26 Sep 2012 18:06:15 +0000 (23:36 +0530)]
Staging: winbond: usb_free_urb(NULL) is safe

usb_free_urb(NULL) is safe. So, the check was removed.

Signed-off-by: Harsh Kumar <harsh1kumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: winbond: checkpatch cleanup
Harsh Kumar [Wed, 26 Sep 2012 18:05:42 +0000 (23:35 +0530)]
Staging: winbond: checkpatch cleanup

checkpatch cleanup: Corrected wrong placement of a brace and line exceeding 80 characters

Signed-off-by: Harsh Kumar <harsh1kumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: winbond: Removed undesired spaces, lines and tabs
Harsh Kumar [Wed, 26 Sep 2012 18:04:42 +0000 (23:34 +0530)]
Staging: winbond: Removed undesired spaces, lines and tabs

checkpatch cleanup: Removed some undesired spaces, lines and tabs to comply with coding style.

Signed-off-by: Harsh Kumar <harsh1kumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: winbond: Typo corrections in comments
Harsh Kumar [Wed, 26 Sep 2012 18:03:39 +0000 (23:33 +0530)]
Staging: winbond: Typo corrections in comments

Few typo corrections in comments

Signed-off-by: Harsh Kumar <harsh1kumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: winbond: Changed c99 comments to c89 comments
Harsh Kumar [Wed, 26 Sep 2012 17:54:45 +0000 (23:24 +0530)]
Staging: winbond: Changed c99 comments to c89 comments

checkpatch cleanup: Changed c99 comments to c89 comments

Signed-off-by: Harsh Kumar <harsh1kumar@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: r8712u: Do not queue cloned skb
Larry Finger [Wed, 26 Sep 2012 19:01:31 +0000 (14:01 -0500)]
staging: r8712u: Do not queue cloned skb

Some post-3.4 kernels have a problem when a cloned skb is used in the
RX path. This patch handles one such case for r8712u.

The patch was suggested by Eric Dumazet.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [v3.4+]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_mio_common: always lock in ni_ai_poll()
Ian Abbott [Mon, 24 Sep 2012 15:27:59 +0000 (16:27 +0100)]
staging: comedi: ni_mio_common: always lock in ni_ai_poll()

`ni_ai_poll()` currently acquires (and later releases) the comedi
device's spin-lock iff `in_interrupt()` returns 0.  However, it is only
called during processing of a `COMEDI_POLL` ioctl so `in_interrupt()`
will always return 0 in this case.  Remove this test and acquire/release
the spin-lock unconditionally.  This eliminates a sparse warning about
different lock contexts for basic block.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: add FIXME comment
Ian Abbott [Mon, 24 Sep 2012 16:20:53 +0000 (17:20 +0100)]
staging: comedi: s626: add FIXME comment

`s626_enc_insn_config()` is the `insn_config()` handler for a counter
subdevice.  The `data[0]` value is supposed to be one of the
`INSN_CONFIG_...` constants defined in "comedi.h" indicating the type of
configuration instruction, but this function seems to be using it as a
variable value to preload the counter with.  Various values of `data[0]`
are going to cause `check_insn_config_length()` in the comedi core
("comedi_fops.c") to return an error, and this function won't be called
in those cases.  Most other values will log a warning to the kernel log.

It's not entirely clear what constant should be checked for in
`data[0]`, so add a "FIXME" comment for now.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: don't dereference insn->data
Ian Abbott [Mon, 24 Sep 2012 16:20:52 +0000 (17:20 +0100)]
staging: comedi: s626: don't dereference insn->data

`s626_enc_insn_config()` is incorrectly dereferencing `insn->data` which
is a pointer to user memory.  It should be dereferencing the separate
`data` parameter that points to a copy of the data in kernel memory.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s526: fix if() check in s526_gpct_winsn()
H Hartley Sweeten [Mon, 24 Sep 2012 20:50:48 +0000 (13:50 -0700)]
staging: comedi: s526: fix if() check in s526_gpct_winsn()

This if() check was flipped from a test for valid data params
to a test for invalid params.

As pointed out by Dan Carpenter, the orignal test was:

if ((data[1] > data[0]) && (data[0] > 0)) {

the flipped test should be:

if (data[1] <= data[0]) ...

Add the missing '='.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: cleanup comments in s626_initialize()
H Hartley Sweeten [Mon, 24 Sep 2012 20:39:14 +0000 (13:39 -0700)]
staging: comedi: s626: cleanup comments in s626_initialize()

Cleanup the comments to follow the coding style of the kernel.

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>
11 years agostaging: comedi: s626: remove clear of kzalloc'ed data
H Hartley Sweeten [Mon, 24 Sep 2012 20:38:53 +0000 (13:38 -0700)]
staging: comedi: s626: remove clear of kzalloc'ed data

The private data is kzalloc'ed. There is no need to set any
of the initial data to '0'.

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>
11 years agostaging: comedi: s626: remove 'WDInterval' from private data
H Hartley Sweeten [Mon, 24 Sep 2012 20:38:39 +0000 (13:38 -0700)]
staging: comedi: s626: remove 'WDInterval' from private data

This variable is never used in the driver. Just 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>
11 years agostaging: comedi: s626: remove 'ChargeEnabled' from private data
H Hartley Sweeten [Mon, 24 Sep 2012 20:38:22 +0000 (13:38 -0700)]
staging: comedi: s626: remove 'ChargeEnabled' from private data

This variable is never used in the driver. Just 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>
11 years agostaging: comedi: s626: remove 'IsBoardRevA' comment
H Hartley Sweeten [Mon, 24 Sep 2012 20:38:07 +0000 (13:38 -0700)]
staging: comedi: s626: remove 'IsBoardRevA' comment

IsBoardRevA is not defined in the driver. Remove the comment
about 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>
11 years agostaging: comedi: s626: #if 0 out the "SAA7146 BUG WORKAROUND"
H Hartley Sweeten [Mon, 24 Sep 2012 20:37:52 +0000 (13:37 -0700)]
staging: comedi: s626: #if 0 out the "SAA7146 BUG WORKAROUND"

Until it's determined if this workaround can be removed, block
out the code with an #if 0/#endif and remove the individual
comments on each line.

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>
11 years agostaging: comedi: s626: remove 'allocatedBuf' from private data
H Hartley Sweeten [Mon, 24 Sep 2012 20:37:36 +0000 (13:37 -0700)]
staging: comedi: s626: remove 'allocatedBuf' from private data

This variable is only used to count the number of dma buffers
allocated during the attach. If an allocation fails, the attach
function exits with -ENOMEM. When this variable is checked later
it will always be == 2. Just remove the variable and the check.

This allows bringing the code back an indent level in
s626_initialize(). Note, coding style issues in this function
are not addressed yet.

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>
11 years agostaging: comedi: s626: add final attach message
H Hartley Sweeten [Mon, 24 Sep 2012 20:37:19 +0000 (13:37 -0700)]
staging: comedi: s626: add final attach message

Add a simple dev_info() message after a successfull attach.
Change the final return to '0' to indicate success.

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>
11 years agostaging: comedi: s626: remove unneeded clear of private data
H Hartley Sweeten [Mon, 24 Sep 2012 20:24:42 +0000 (13:24 -0700)]
staging: comedi: s626: remove unneeded clear of private data

The private data is kzalloc'ed. All the variables in it are
initially '0'.

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>
11 years agostaging: comedi: s626: factor out the board init code
H Hartley Sweeten [Mon, 24 Sep 2012 20:24:27 +0000 (13:24 -0700)]
staging: comedi: s626: factor out the board init code

To make the attach a bit cleaner, factor the board init code
out of attach_pci() into a new function.

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>
11 years agostaging: comedi: s626: cleanup request_irq in s626_attach_pci()
H Hartley Sweeten [Mon, 24 Sep 2012 20:24:12 +0000 (13:24 -0700)]
staging: comedi: s626: cleanup request_irq in s626_attach_pci()

Only set dev->irq if request_irq is successfull.

Remove the kernel message noise.

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>
11 years agostaging: comedi: s626: factor out the dma buffer allocation
H Hartley Sweeten [Mon, 24 Sep 2012 20:23:57 +0000 (13:23 -0700)]
staging: comedi: s626: factor out the dma buffer allocation

To make the attach a bit cleaner, factor the dma buffer allocation
out of attach_pci() into a new function.

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>
11 years agostaging: comedi: s626: remove unnecessary checks of 'devpriv->base_addr'
H Hartley Sweeten [Mon, 24 Sep 2012 20:23:40 +0000 (13:23 -0700)]
staging: comedi: s626: remove unnecessary checks of 'devpriv->base_addr'

'devpriv->base_addr' is valid from this point on in the attach_pci()
function. Remove the unnecessary checks.

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>
11 years agostaging: comedi: s626: cleanup ioremap()
H Hartley Sweeten [Mon, 24 Sep 2012 20:23:22 +0000 (13:23 -0700)]
staging: comedi: s626: cleanup ioremap()

The local variable 'resourceStart' is only used in the ioremap()
to hold the PCI bar 0 base address. Just use the pci_resource_start()
directly in the ioremap().

Also, instead of assuming the resource size for the ioremap, use
pci_resource_len() to get the actual size.

Remove the kernel noise when the ioremap fails and change the error
code from -ENODEV to -ENOMEM.

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>
11 years agostaging: comedi: s626: remove 'got_regions' from private data
H Hartley Sweeten [Mon, 24 Sep 2012 20:23:07 +0000 (13:23 -0700)]
staging: comedi: s626: remove 'got_regions' from private data

This variable is only used as a flag to indicate that the pci device
has been enabled and needs to be disabled in the detach. Use the
comedi_device 'iobase' for this and remove the private data variable.

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>
11 years agostaging: comedi: s626: remove unneeded local variable in attach_pci()
H Hartley Sweeten [Mon, 24 Sep 2012 20:22:50 +0000 (13:22 -0700)]
staging: comedi: s626: remove unneeded local variable in attach_pci()

The 'result' variable is only used to check the return from
comedi_pci_enable(). Just reuse the 'ret' variable.

Also, remove the kernel noise and use the error code from
comedi_pci_enable() instead of returning -ENODEV.

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>
11 years agostaging: comedi: s626: use dev->board_name for resource name
H Hartley Sweeten [Mon, 24 Sep 2012 20:22:31 +0000 (13:22 -0700)]
staging: comedi: s626: use dev->board_name for resource name

Instead of the literal string "s626", use the dev->board_name for
the resource name when enabling the PCI device and requesting the
irq.

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>
11 years agostaging: comedi: s626: store the pci_dev in the comedi_device
H Hartley Sweeten [Mon, 24 Sep 2012 20:22:10 +0000 (13:22 -0700)]
staging: comedi: s626: store the pci_dev in the comedi_device

Use the hw_dev pointer in the comedi_device struct to hold the
pci_dev instead of carrying it in the private data.

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>
11 years agostaging: comedi: s626: use attach_pci callback
H Hartley Sweeten [Mon, 24 Sep 2012 20:21:53 +0000 (13:21 -0700)]
staging: comedi: s626: 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 not 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>
11 years agostaging: comedi: s626: remove boardinfo
H Hartley Sweeten [Mon, 24 Sep 2012 20:21:30 +0000 (13:21 -0700)]
staging: comedi: s626: remove boardinfo

This driver only supports one board type. Move the used board info
out of the boardinfo struct and 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>
11 years agostaging: comedi: ni_daq_700: add AI subdevice
Ian Abbott [Fri, 21 Sep 2012 11:05:47 +0000 (12:05 +0100)]
staging: comedi: ni_daq_700: add AI subdevice

Add subdevice 1 as an analog input (AI) subdevice.  It currently only
supports basic, software-triggered acquisitions.

This is mostly the work of Fred Brooks (MODULE_AUTHOR), but he based his
update on an older version of the driver.  I applied the relevant
changes with a few tweaks: adding an explicit `udelay(1)` in a timeout
loop, replacing binary constants with hex, renaming functions, replacing
`printk()` calls, removing exported symbols, removing (very) incomplete
comedi "command" support, and making some coding-style changes.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_daq_700: rename functions for DIO subdevice
Ian Abbott [Fri, 21 Sep 2012 11:05:46 +0000 (12:05 +0100)]
staging: comedi: ni_daq_700: rename functions for DIO subdevice

Rename `subdev_700_insn()` to `daq700_dio_insn_bits()` and
`subdev_700_insn_config()` to `daq700_dio_insn_config()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_daq_700: use prefix daq700
Ian Abbott [Fri, 21 Sep 2012 11:05:45 +0000 (12:05 +0100)]
staging: comedi: ni_daq_700: use prefix daq700

Rename a few functions and variables to use the prefix `daq700` instead
of the prefix or suffix `dio700`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Remove typedef for _stCPacketClassificationRuleSI and call directly.
Kevin McKinney [Mon, 24 Sep 2012 03:07:17 +0000 (23:07 -0400)]
Staging: bcm: Remove typedef for _stCPacketClassificationRuleSI and call directly.

This patch removes typedef for
_stCPacketClassificationRuleSI, changes the
name of the struct to bcm_packet_class_rules,
and updates the comments appropriately . In
addition, any calls to typedefs
"CCPacketClassificationRuleSI,
stCPacketClassificationRuleSI,
or *pstCPacketClassificationRuleSI" are changed
to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Remove typedef for _stPhsRuleSI and call directly.
Kevin McKinney [Mon, 24 Sep 2012 03:07:16 +0000 (23:07 -0400)]
Staging: bcm: Remove typedef for _stPhsRuleSI and call directly.

This patch removes typedef for _stPhsRuleSI,
changes the name of the struct to
bcm_phs_rules, and updates the comments
appropriately. In addition, any
calls to typedefs "stPhsRuleSI,
*pstPhsRuleSI, or CPhsRuleSI" are
changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Remove typedef for _stConvergenceSLTypes and call directly.
Kevin McKinney [Mon, 24 Sep 2012 03:07:15 +0000 (23:07 -0400)]
Staging: bcm: Remove typedef for _stConvergenceSLTypes and call directly.

This patch removes typedef for _stConvergenceSLTypes,
changes the name of the struct to
bcm_convergence_types, and updates the
comments appropriately. In addition, any
calls to typedefs "stConvergenceSLTypes,
CConvergenceSLTypes, and *pstConvergenceSLTypes"
are changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Remove typedef for _stServiceFlowParamSI and call directly.
Kevin McKinney [Mon, 24 Sep 2012 03:07:14 +0000 (23:07 -0400)]
Staging: bcm: Remove typedef for _stServiceFlowParamSI and call directly.

This patch removes typedef for _stServiceFlowParamSI,
changes the name of the struct to
bcm_connect_mgr_params, and updates the
comments appropriately. In addition, any
calls to typedefs "stServiceFlowParamSI,
*pstServiceFlowParamSI, and CServiceFlowParamSI"
are changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Remove typedef for _stLocalSFAddRequest and call directly.
Kevin McKinney [Mon, 24 Sep 2012 03:07:13 +0000 (23:07 -0400)]
Staging: bcm: Remove typedef for _stLocalSFAddRequest and call directly.

This patch removes typedef for _stLocalSFAddRequest,
and changes the name of the struct to
bcm_add_request. In addition, any
calls to typedefs "stLocalSFAddRequest or
*pstLocalSFAddRequest" are changed to
call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Remove typedef for _stLocalSFAddIndication and call directly.
Kevin McKinney [Mon, 24 Sep 2012 03:07:12 +0000 (23:07 -0400)]
Staging: bcm: Remove typedef for _stLocalSFAddIndication and call directly.

This patch removes typedef for _stLocalSFAddIndication,
and changes the name of the struct to
bcm_add_indication. In addition, any
calls to typedefs "stLocalSFAddIndication,
*pstLocalSFAddIndication, stLocalSFChangeRequest,
*pstLocalSFChangeRequest, stLocalSFChangeIndication,
or *pstLocalSFChangeIndication " are changed to
call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Remove typedef for _stLocalSFDeleteRequest and call directly.
Kevin McKinney [Mon, 24 Sep 2012 03:07:11 +0000 (23:07 -0400)]
Staging: bcm: Remove typedef for _stLocalSFDeleteRequest and call directly.

This patch removes typedef for _stLocalSFDeleteRequest,
and changes the name of the struct to
bcm_del_request. In addition, any
calls to typedefs "stLocalSFDeleteRequest or
*pstLocalSFDeleteRequest" are
changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: Remove typedef for stLocalSFDeleteIndication and call directly.
Kevin McKinney [Mon, 24 Sep 2012 03:07:10 +0000 (23:07 -0400)]
Staging: bcm: Remove typedef for stLocalSFDeleteIndication and call directly.

This patch removes typedef for
stLocalSFDeleteIndication, and
changes the name of the struct to
bcm_del_indication. In addition, any
calls to the following typedef
"stLocalSFDeleteIndication" are changed to call
the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8712: fix foo* bar (foo*) errors reported by checkpatch
Devendra Naga [Sun, 23 Sep 2012 16:57:23 +0000 (12:57 -0400)]
staging: rtl8712: fix foo* bar (foo*) errors reported by checkpatch

fixes the following errors:

drivers/staging/rtl8712/rtl871x_security.c:61: ERROR: "foo * bar" should
be "foo *bar"
drivers/staging/rtl8712/rtl871x_security.c:291: ERROR: "foo * bar"
should be "foo *bar"
drivers/staging/rtl8712/rtl871x_security.c:323: ERROR: "foo * bar"
should be "foo *bar"
drivers/staging/rtl8712/rtl871x_security.c:1371: ERROR: "(foo*)" should
be "(foo *)"

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8712: fix a foo * bar errors reported by checkpatch
Devendra Naga [Sun, 23 Sep 2012 16:57:22 +0000 (12:57 -0400)]
staging: rtl8712: fix a foo * bar errors reported by checkpatch

fixes the following error:

drivers/staging/rtl8712/rtl8712_xmit.c:379:  ERROR: "foo * bar" should
be "foo *bar"

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8712: remove assignment of 0 to a static global variable
Devendra Naga [Sun, 23 Sep 2012 16:57:21 +0000 (12:57 -0400)]
staging: rtl8712: remove assignment of 0 to a static global variable

fixes the following checkpatch warning:

drivers/staging/rtl8712/os_intfs.c:99: ERROR: do not initialise statics
to 0 or NULL

as statics are always initialised to 0.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rts5139: use kzalloc() to close an info leak
Dan Carpenter [Sun, 23 Sep 2012 16:31:30 +0000 (19:31 +0300)]
staging: rts5139: use kzalloc() to close an info leak

If we don't fill the whole buffer then there is information leaked to
the user.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging "wlan-ng" Fix typos.
Justin P. Mattock [Mon, 24 Sep 2012 16:16:57 +0000 (09:16 -0700)]
staging "wlan-ng" Fix typos.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: winbond: Removed undesired spaces, lines and tabs
Harsh Kumar [Wed, 26 Sep 2012 05:33:15 +0000 (11:03 +0530)]
Staging: winbond: Removed undesired spaces, lines and tabs

checkpatch cleanup: Removed some undesired spaces, lines and tabs to comply with coding style.

Signed-off-by: Harsh Kumar <harsh1kumar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: winbond: Changed c99 comments to c89 comments
Harsh Kumar [Wed, 26 Sep 2012 05:32:47 +0000 (11:02 +0530)]
Staging: winbond: Changed c99 comments to c89 comments

checkpatch cleanup: Changed c99 comments to c89 comments

Signed-off-by: Harsh Kumar <harsh1kumar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge tag 'iio-for-v3.7e' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Tue, 25 Sep 2012 22:52:56 +0000 (15:52 -0700)]
Merge tag 'iio-for-v3.7e' of git://git./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.

11 years agostaging: winbond: Coding Style correction and removal of unused macro
Harsh Kumar [Mon, 24 Sep 2012 14:57:04 +0000 (20:27 +0530)]
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 *

Signed-off-by: Harsh Kumar <harsh1kumar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sbe-2t3e3: fix error handling in t3e3_init_channel()
Alexey Khoroshilov [Tue, 25 Sep 2012 12:56:02 +0000 (16:56 +0400)]
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).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging:iio:dummy: Fix potential NULL pointer dereference
Lars-Peter Clausen [Wed, 12 Sep 2012 11:06:00 +0000 (12:06 +0100)]
staging:iio:dummy: Fix potential NULL pointer dereference

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.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agopower: battery: Generic battery driver using IIO
anish kumar [Fri, 21 Sep 2012 16:10:00 +0000 (17:10 +0100)]
power: battery: Generic battery driver using IIO

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>
11 years agoHID: hid-sensor-hub: Fix sensor_hub_probe error handling
Axel Lin [Wed, 19 Sep 2012 15:30:00 +0000 (16:30 +0100)]
HID: hid-sensor-hub: Fix sensor_hub_probe error handling

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>
11 years agoHID: hid-sensor-hub: Remove hdev->claimed setting
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>
11 years agoiio: adc: add new lp8788 adc driver
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.

 Patch v3.
 Fix wrong size of allocating iio private data.
 Fix coding styles.

 Patch v2.
 Support RAW and SCALE interface for IIO consumer.
 Clean up the iio channel spec macro.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:ad7780: Add support for the ad7170/ad7171
Lars-Peter Clausen [Fri, 21 Sep 2012 13:29:00 +0000 (14:29 +0100)]
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>
11 years agostaging:iio:ad7780: Make powerdown GPIO optional
Lars-Peter Clausen [Fri, 21 Sep 2012 13:29:00 +0000 (14:29 +0100)]
staging:iio:ad7780: Make powerdown GPIO optional

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>
11 years agostaging:iio:sca3000: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
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>
11 years agostaging:iio:lis3l02dq: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
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>
11 years agostaging:iio:ade7759: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
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>
11 years agostaging:iio:ade7758: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
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>
11 years agostaging:iio:ade7754: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
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>
11 years agostaging:iio:ade7753: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
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>
11 years agostaging:iio:adis16400: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
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>
11 years agostaging:iio:adis16200: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
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>
11 years agoiio: inkern: clean up error return code
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>
11 years agoiio: inkern: put the IIO device when it fails to allocate memory
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>
11 years agoiio: dac/ad5755: signedness bug in ad5755_setup_pdata()
Dan Carpenter [Wed, 19 Sep 2012 06:27:00 +0000 (07:27 +0100)]
iio: dac/ad5755: signedness bug in ad5755_setup_pdata()

We need "ret" to be signed for the error handling to work correctly.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: hid-sensors: Prevent crash during hot-unplug
Srinivas Pandruvada [Thu, 20 Sep 2012 00:15:00 +0000 (01:15 +0100)]
iio: hid-sensors: Prevent crash during hot-unplug

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>
11 years agostaging: comedi: ni_labpc: don't pass struct comedi_cmd by value
Ian Abbott [Wed, 19 Sep 2012 18:37:42 +0000 (19:37 +0100)]
staging: comedi: ni_labpc: don't pass struct comedi_cmd by value

`labpc_suggest_transfer_size()` has a parameter of type `struct
comedi_cmd` passed by value.  Change it to pass by pointer reference.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: das1800: don't pass struct comedi_cmd by value
Ian Abbott [Wed, 19 Sep 2012 18:37:41 +0000 (19:37 +0100)]
staging: comedi: das1800: don't pass struct comedi_cmd by value

Various functions in das1800.c take a `struct comedi_cmd` parameter by
value.  Change them to pass the parameter by reference instead.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: das16: pass struct comedi_cmd by reference
Ian Abbott [Wed, 19 Sep 2012 18:37:40 +0000 (19:37 +0100)]
staging: comedi: das16: pass struct comedi_cmd by reference

Change `das16_suggest_transfer_size()` to take a pointer to the `struct
comedi_cmd` instead of passing it by value.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: fix memory leak for saved channel list
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>
11 years agostaging: comedi: ni_labpc: pass ai scan mode through various functions
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>
11 years agostaging: comedi: 8253: mmio address is a void __iomem *
H Hartley Sweeten [Thu, 20 Sep 2012 00:06:47 +0000 (17:06 -0700)]
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>
11 years agostaging: comedi: kcomedilib: fix a __user space access issue
H Hartley Sweeten [Thu, 20 Sep 2012 00:26:53 +0000 (17:26 -0700)]
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>
11 years agostaging: comedi: me_daq: use attach_pci callback
H Hartley Sweeten [Wed, 19 Sep 2012 23:21:49 +0000 (16:21 -0700)]
staging: comedi: me_daq: 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.

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>
11 years agostaging: comedi: me_daq: use request_firmware()
H Hartley Sweeten [Wed, 19 Sep 2012 23:21:29 +0000 (16:21 -0700)]
staging: comedi: me_daq: use request_firmware()

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>
11 years agostaging: comedi: usbdux: remove usbdux_attach
H Hartley Sweeten [Wed, 19 Sep 2012 23:21:13 +0000 (16:21 -0700)]
staging: comedi: usbdux: remove usbdux_attach

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>
11 years agostaging: comedi: usbduxfast: remove usbduxfast_attach
H Hartley Sweeten [Wed, 19 Sep 2012 23:20:57 +0000 (16:20 -0700)]
staging: comedi: usbduxfast: remove usbduxfast_attach

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>
11 years agostaging: comedi: usbduxsigma: remove usbduxsigma_attach
H Hartley Sweeten [Wed, 19 Sep 2012 23:20:38 +0000 (16:20 -0700)]
staging: comedi: usbduxsigma: remove usbduxsigma_attach

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>
11 years agostaging: comedi: s526: rename s526_ai_config
H Hartley Sweeten [Wed, 19 Sep 2012 22:13:10 +0000 (15:13 -0700)]
staging: comedi: s526: rename s526_ai_config

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>
11 years agostaging: comedi: s526: remove struct s526GPCTConfig
H Hartley Sweeten [Wed, 19 Sep 2012 22:12:54 +0000 (15:12 -0700)]
staging: comedi: s526: remove struct s526GPCTConfig

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>
11 years agostaging: comedi: s526: cleanup s526_gpct_winsn()
H Hartley Sweeten [Wed, 19 Sep 2012 22:12:33 +0000 (15:12 -0700)]
staging: comedi: s526: cleanup s526_gpct_winsn()

Use a local variable for the iobase of the channel being written.
This makes the outw() calls a bit cleaner.

Rearrange the switch () so that the actual write to the device
can be common regardless of 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>
11 years agostaging: comedi: s526: cleanup s526_gpct_insn_config()
H Hartley Sweeten [Wed, 19 Sep 2012 22:12:17 +0000 (15:12 -0700)]
staging: comedi: s526: cleanup s526_gpct_insn_config()

Use a local variable for the iobase of the channel being configured.
This makes the outw() calls a bit cleaner.

Remove the unnecessary casting of the values being written to
the channel registers.

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>
11 years agostaging: comedi: s526: cleanup s526_gpct_rinsn()
H Hartley Sweeten [Wed, 19 Sep 2012 22:12:01 +0000 (15:12 -0700)]
staging: comedi: s526: cleanup s526_gpct_rinsn()

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>
11 years agostaging: comedi: s526: rename local var used for CR_CHAN() value
H Hartley Sweeten [Wed, 19 Sep 2012 22:11:37 +0000 (15:11 -0700)]
staging: comedi: s526: rename local var used for CR_CHAN() value

Rename the local variable used to hold the unpacked CR_CHAN() value
to help keep the lines < 80 chars.

Also, since the insn->chanspec variable is an unsigned int, change
the type of the local variable to match.

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>
11 years agostaging: comedi: s526: remove boardinfo
H Hartley Sweeten [Wed, 19 Sep 2012 22:11:20 +0000 (15:11 -0700)]
staging: comedi: s526: remove boardinfo

This driver only supports one board type and only the "name",
"gpct_chans", and "have_dio" information is being used anyway.

Just remove the boardinfo to keep the driver simple.

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>
11 years agostaging: comedi: s526: remove cut-and-paste comments from skel driver
H Hartley Sweeten [Wed, 19 Sep 2012 22:11:04 +0000 (15:11 -0700)]
staging: comedi: s526: remove cut-and-paste comments from skel driver

These comments are not necessary, they are just cut-and-paste from
the skel driver.

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>
11 years agostaging: comedi: s526: remove unused s526_ports array
H Hartley Sweeten [Wed, 19 Sep 2012 22:10:47 +0000 (15:10 -0700)]
staging: comedi: s526: remove unused s526_ports array

This array was used to debug dump the registers. The debug
dump has been removed so this array is no longer needed.

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>
11 years agostaging: comedi: s526: remove printk noise
H Hartley Sweeten [Wed, 19 Sep 2012 22:10:33 +0000 (15:10 -0700)]
staging: comedi: s526: remove printk noise

Remove the function trace printk noise.

Change the final attach message into a simple 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>
11 years agostaging: comedi: s526: remove unreachable code in s526_attach()
H Hartley Sweeten [Wed, 19 Sep 2012 22:10:15 +0000 (15:10 -0700)]
staging: comedi: s526: remove unreachable code in s526_attach()

The code after the return in this function can never execute.
Just 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>
11 years agostaging: comedi: s526: remove unneeded check in s526_gpct_rinsn()
H Hartley Sweeten [Wed, 19 Sep 2012 22:09:57 +0000 (15:09 -0700)]
staging: comedi: s526: remove unneeded check in s526_gpct_rinsn()

The comedi core validates insn->n before calling this function.
Remove the unnecessary check.

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>
11 years agostaging: comedi: s526: remove commented out debug messages
H Hartley Sweeten [Wed, 19 Sep 2012 22:09:40 +0000 (15:09 -0700)]
staging: comedi: s526: remove commented out debug messages

These messages should be removed from the final driver.

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>
11 years agostaging: comedi: s526: remove ADDR_CHAN_REG macro
H Hartley Sweeten [Wed, 19 Sep 2012 22:09:21 +0000 (15:09 -0700)]
staging: comedi: s526: remove ADDR_CHAN_REG macro

This macro relies on a local variable having a specific name.

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>
11 years agostaging: comedi: s526: remove ADDR_REG macro
H Hartley Sweeten [Wed, 19 Sep 2012 22:09:07 +0000 (15:09 -0700)]
staging: comedi: s526: remove ADDR_REG macro

This macro relies on a local variable having a specific name.

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>
11 years agostaging: comedi: s526: remove devpriv macro
H Hartley Sweeten [Wed, 19 Sep 2012 22:08:52 +0000 (15:08 -0700)]
staging: comedi: s526: remove devpriv macro

This macro relies on a local variable having a specific name.

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>