GitHub/LineageOS/android_kernel_samsung_universal7580.git
11 years agostaging: sep: Fix typo in printk within sep driver
Masanari Iida [Wed, 27 Mar 2013 16:14:56 +0000 (01:14 +0900)]
staging: sep: Fix typo in printk within sep driver

Correct spelling typo in printk.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agodrivers/staging/zcache/zcache-main.c: fix build
Andrew Morton [Tue, 26 Mar 2013 21:58:14 +0000 (14:58 -0700)]
drivers/staging/zcache/zcache-main.c: fix build

flush_dcache_page() takes a page*, not a void*.  It breaks ia64.

Remove this and another unused function.  Warnings remain:

drivers/staging/zcache/zcache-main.c: In function '__check_disable_cleancache':
drivers/staging/zcache/zcache-main.c:1837: warning: return from incompatible pointer type
drivers/staging/zcache/zcache-main.c: In function '__check_disable_frontswap':
drivers/staging/zcache/zcache-main.c:1838: warning: return from incompatible pointer type
drivers/staging/zcache/zcache-main.c: In function '__check_disable_frontswap_ignore_nonactive':
drivers/staging/zcache/zcache-main.c:1842: warning: return from incompatible pointer type

Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: fix labpc_calib_insn_write()
H Hartley Sweeten [Tue, 26 Mar 2013 17:27:33 +0000 (10:27 -0700)]
staging: comedi: ni_labpc: fix labpc_calib_insn_write()

The comedi core expects the (*insn_write) operations to write insn->n
values and return the number of values actually wrote.

Make this function work like the core expects.

As Ian Abbott pointed out for the eeprom writes, we really only need
to write the last value to the caldac. The preceding data would be
overwritten anyway.

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_labpc: fix labpc_calib_insn_read()
H Hartley Sweeten [Tue, 26 Mar 2013 17:27:11 +0000 (10:27 -0700)]
staging: comedi: ni_labpc: fix labpc_calib_insn_read()

The comedi core expects the (*insn_read) operations to read insn->n
values and return the number of values actually read.

Make this function work like the core expects.

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_labpc: simplify labpc_range_is_unipolar()
H Hartley Sweeten [Tue, 26 Mar 2013 17:26:38 +0000 (10:26 -0700)]
staging: comedi: ni_labpc: simplify labpc_range_is_unipolar()

As Ian Abbott pointed out, this helper function can be simplified
by just checking if the 'min' value is >= 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: ni_labpc: fix labpc_eeprom_insn_write()
H Hartley Sweeten [Tue, 26 Mar 2013 17:25:57 +0000 (10:25 -0700)]
staging: comedi: ni_labpc: fix labpc_eeprom_insn_write()

The comedi core expects the (*insn_write) operations to write insn->n
values and return the number of values actually wrote.

Make this function work like the core expects.

As Ian Abbott pointed out, we really only need to write the last value
to the eeprom. The preceding data would be overwritten anyway.

Also, remove the noise about invalid channels.

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: vt6656: remove unused functions
Andres More [Tue, 26 Mar 2013 22:12:26 +0000 (17:12 -0500)]
staging: vt6656: remove unused functions

Removed defined symbols not being used elsewhere.
Only compile tested.

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: davinci: Fix typo in staging/media/davinci
Masanari Iida [Tue, 26 Mar 2013 15:23:28 +0000 (00:23 +0900)]
staging: davinci: Fix typo in staging/media/davinci

Correct spelling typo in staging/media/davinci

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: wlan-ng: prism2usb.c: fix printk(KERN_ERR... to dev_err(dev, ...
Nick Østergaard [Tue, 26 Mar 2013 13:17:10 +0000 (14:17 +0100)]
staging: wlan-ng: prism2usb.c: fix printk(KERN_ERR... to dev_err(dev, ...

Fix checkpatch warning. Change printk(KERN_ERR ... to dev_err(dev ...

Signed-off-by: Nick Østergaard <oe.nick@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dwc2: fix wrong setting of DMA masks
Paul Zimmerman [Tue, 26 Mar 2013 00:03:36 +0000 (17:03 -0700)]
staging: dwc2: fix wrong setting of DMA masks

We were setting the DMA masks in dwc2_driver_probe(), but that is
before the driver parameters have been set to their default values.
That meant the DMA masks could be set wrong. Fix it by moving the
DMA mask setting into dwc2_hcd_init(), after the driver parameters
have been set.

Reported-by: Matthijs Kooijman <matthijs@stdin.nl>
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dwc2: remove unneeded arguments from two functions
Paul Zimmerman [Tue, 26 Mar 2013 00:03:35 +0000 (17:03 -0700)]
staging: dwc2: remove unneeded arguments from two functions

Remove the unneeded struct device *dev argument from dwc2_hcd_init()
and dwc2_hcd_remove(), and pass in the value through the hsotg->dev
member instead

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dwc2: always release host channel after dequeueing
Matthijs Kooijman [Mon, 25 Mar 2013 19:00:25 +0000 (12:00 -0700)]
staging: dwc2: always release host channel after dequeueing

Previously, when an active urb was dequeued, its host channel would
not always be released. There is some special handling for this in
dwc2_hc_chhltd_intr_dma, but when it was the last urb/qtd in its qh, a
safeguard in dwc2_hc_n_intr would short-circuit and prevent the regular
interrupt handlers from running, without releasing the channel.

This is easily triggered when using a 3G modem using the option driver.
Opening and closing any ttyUSBx device will eat up a host channel that
is forever unusable from that point on.

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
[paulz@synopsys.com: fixed comment style and added a couple of NULL checks]
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: Fix stuck in scanning with variable uScanChannel.
Malcolm Priestley [Mon, 25 Mar 2013 19:50:44 +0000 (19:50 +0000)]
staging: vt6656: Fix stuck in scanning with variable uScanChannel.

When pMgmt->uScanChannel > pDevice->byMaxChannel scanning ends
but no SIOCGIWSCAN(scan done) message is sent. This section of code is
duplicate of that in WLAN_CMD_SCAN_END which sends scan done.
So remove it and jump eCommandState to WLAN_CMD_SCAN_END.

Increment uScanChannel on !ChannelValid.

At WLAN_CMD_SCAN_END reset uScanChannel to 0 when done.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: remove MC_DISABLE macro
H Hartley Sweeten [Fri, 22 Mar 2013 22:57:40 +0000 (15:57 -0700)]
staging: comedi: s626: remove MC_DISABLE macro

This macro relies on a local variable having a specific name. Replace
it with a new helper function, s626_mc_disable().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: remove MC_ENABLE macro
H Hartley Sweeten [Fri, 22 Mar 2013 22:57:21 +0000 (15:57 -0700)]
staging: comedi: s626: remove MC_ENABLE macro

This macro relies on a local variable having a specific name. Replace
it with a new helper function, s626_mc_enable().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: #ifdef out a block of unused code
H Hartley Sweeten [Fri, 22 Mar 2013 22:57:02 +0000 (15:57 -0700)]
staging: comedi: s626: #ifdef out a block of unused code

Currently the unused s626_ai_rinsn() function is commented out with
/* ... */ on every line of the function. Remove those by using an

This block will be removed once it is determined that it really
is not needed.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: cleanup comedi_lrange table
H Hartley Sweeten [Fri, 22 Mar 2013 22:56:32 +0000 (15:56 -0700)]
staging: comedi: s626: cleanup comedi_lrange table

Reformat the whitespace in the comedi_lrange table and use the
BIP_RANGE() macro instead of generic RANGE() macro.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: factor counter interrupt handling from s626_irq_handler()
H Hartley Sweeten [Fri, 22 Mar 2013 22:56:13 +0000 (15:56 -0700)]
staging: comedi: s626: factor counter interrupt handling from s626_irq_handler()

Factor the code that handles the counter interrupt out of s626_irq_handler().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: factor eos interrupt handling from s626_irq_handler()
H Hartley Sweeten [Fri, 22 Mar 2013 22:55:51 +0000 (15:55 -0700)]
staging: comedi: s626: factor eos interrupt handling from s626_irq_handler()

Factor the code that handles the end of scan interrupt out of
s626_irq_handler().

Remove the printk noise when cfc_write_to_buffer() fails. The user
can't do anything about it anyway.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: use a local var for the s->async in s626_irq_handler()
H Hartley Sweeten [Fri, 22 Mar 2013 22:55:29 +0000 (15:55 -0700)]
staging: comedi: s626: use a local var for the s->async in s626_irq_handler()

The comedi_async pointer is used a number of times in this function.
For aesthetic reasons, use a local variable for the pointer.

Also, since was already have a pointer to the "cmd" use that in the
for loop instead of s->async->cmd (or even async->cmd).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: cleanup "subdevice" and "cmd" in s626_irq_handler()
H Hartley Sweeten [Fri, 22 Mar 2013 22:55:07 +0000 (15:55 -0700)]
staging: comedi: s626: cleanup "subdevice" and "cmd" in s626_irq_handler()

The comedi_subdevice in this function is actually the dev->read_subdev
that was initialized during the attach of the board. Use that instead
of accessing the dev->subdevices array directly.

Also, get the comedi_cmd used in s626_irq_handler() when the function
is first entered.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: factor dio interrupt handling from s626_irq_handler()
H Hartley Sweeten [Fri, 22 Mar 2013 22:54:45 +0000 (15:54 -0700)]
staging: comedi: s626: factor dio interrupt handling from s626_irq_handler()

Factor the code that checks and handles the dio interrupts out of
s626_irq_handler().

This allows reducing the number of indents in the code and makes it
easier to follow.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: s626: simplify dio register access
H Hartley Sweeten [Fri, 22 Mar 2013 22:54:20 +0000 (15:54 -0700)]
staging: comedi: s626: simplify dio register access

This driver has three dio subdevices, each with 16 channels. These
subdevices use hardware registers that are spaced 0x10 bytes apart
for each "group" of 16 channels.

Create new macros to get the correct addresses for each register
based on the dio "group". Use the s->private (void *) to hold the
"group" number to use in the subdevice functions.

This allows removing struct dio_private and all its uses. It also
removes the ugly casts used to get the register address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: fix labpc_eeprom_insn_read()
H Hartley Sweeten [Fri, 22 Mar 2013 16:57:48 +0000 (09:57 -0700)]
staging: comedi: ni_labpc: fix labpc_eeprom_insn_read()

The comedi core expects the (*insn_read) operations to read insn->n
values and return the number of values actually read.

Make this function work like the core expects.

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_labpc: return bool from labpc_use_continuous_mode()
H Hartley Sweeten [Fri, 22 Mar 2013 16:57:26 +0000 (09:57 -0700)]
staging: comedi: ni_labpc: return bool from labpc_use_continuous_mode()

This is a simple true/false test, return bool instead of int.

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_labpc: cleanup trigger setting in labpc_ai_cmd()
H Hartley Sweeten [Fri, 22 Mar 2013 16:56:48 +0000 (09:56 -0700)]
staging: comedi: ni_labpc: cleanup trigger setting in labpc_ai_cmd()

The (*do_cmdtest) already validated the cmd sources so the default
cases in the switch() statements can never happen.

Preclear to trigger bits and change the switch() statements to simple
if() tests to set the bits.

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_labpc: remove board attach noise
H Hartley Sweeten [Fri, 22 Mar 2013 16:56:25 +0000 (09:56 -0700)]
staging: comedi: ni_labpc: remove board attach noise

Remove the kernel noise in labpc_common_attach() as well as a couple
obvious comments.

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_labpc: dma requires an interrupt
H Hartley Sweeten [Fri, 22 Mar 2013 16:55:54 +0000 (09:55 -0700)]
staging: comedi: ni_labpc: dma requires an interrupt

DMA support only works if an interrupt is available.

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_labpc: allow board to attach without dma
H Hartley Sweeten [Fri, 22 Mar 2013 16:55:30 +0000 (09:55 -0700)]
staging: comedi: ni_labpc: allow board to attach without dma

If the dma channel is not available this driver will still work
with interrupts for the analog input subdevice command support.

In addition, only dma channels 1 and 3 are valid for the ISA
devices.

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_labpc: allow board to attach without interrupt
H Hartley Sweeten [Fri, 22 Mar 2013 16:55:08 +0000 (09:55 -0700)]
staging: comedi: ni_labpc: allow board to attach without interrupt

If the interrupt is not available this driver will still work
with command support disabled for the analog input subdevice.

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_labpc: return error from labpc_counter_set_mode()
H Hartley Sweeten [Fri, 22 Mar 2013 16:54:41 +0000 (09:54 -0700)]
staging: comedi: ni_labpc: return error from labpc_counter_set_mode()

Make sure labpc_counter_set_mode() was successfull and return any
errno back to the caller.

For the if/else conditions that either load the counter of just set
the mode, use a common error patch to check for the error.

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_labpc: cleanup labpc_counter_load() usage
H Hartley Sweeten [Fri, 22 Mar 2013 16:54:16 +0000 (09:54 -0700)]
staging: comedi: ni_labpc: cleanup labpc_counter_load() usage

For aesthetic reasons, move the labpc_counter_load() function so
it's by the labpc_counter_set_mode() function.

Update all the labpc_counter_load() calls so that the I8254_MODE*
enums are used instead of the open coded values.

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_labpc: introduce labpc_counter_set_mode()
H Hartley Sweeten [Fri, 22 Mar 2013 16:53:49 +0000 (09:53 -0700)]
staging: comedi: ni_labpc: introduce labpc_counter_set_mode()

Introduce labpc_counter_set_mode() which is a wrapper around the
i8254_set_mode() helpers to program the 8254 timers. Use the new
function instead of directly writing to the timer mode register
with a "magic" number.

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_labpc: remove inline from labpc_counter_load()
H Hartley Sweeten [Fri, 22 Mar 2013 16:53:20 +0000 (09:53 -0700)]
staging: comedi: ni_labpc: remove inline from labpc_counter_load()

Let the compiler figure out if this function should be inlined.

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_labpc: move a couple of the #define's
H Hartley Sweeten [Fri, 22 Mar 2013 16:52:15 +0000 (09:52 -0700)]
staging: comedi: ni_labpc: move a couple of the #define's

For aesthetic reasons, move a couple of the #defines in this file
so that the register map defines are first.

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_labpc: clean up register map
H Hartley Sweeten [Fri, 22 Mar 2013 16:51:45 +0000 (09:51 -0700)]
staging: comedi: ni_labpc: clean up register map

Rename the register map defines to better match the National
Instruments Register-Level Programming Manual for the labpc.

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_labpc: clean up multi-line comments
H Hartley Sweeten [Fri, 22 Mar 2013 16:51:23 +0000 (09:51 -0700)]
staging: comedi: ni_labpc: clean up multi-line comments

Clean up the multi-line comments at the beginning of the file
so that they follow the CodingStyle.

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_labpc: fix a > 80 char line issue
H Hartley Sweeten [Fri, 22 Mar 2013 16:50:56 +0000 (09:50 -0700)]
staging: comedi: ni_labpc: fix a > 80 char line issue

Fix a checkpatch.pl warning about a line over 80 characters.

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_labpc: introduce labpc_ai_wait_for_data()
H Hartley Sweeten [Fri, 22 Mar 2013 16:50:31 +0000 (09:50 -0700)]
staging: comedi: ni_labpc: introduce labpc_ai_wait_for_data()

Introduce a helper function to wait for the a/d conversion to
complete.

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_labpc: introduce labpc_read_adc_fifo()
H Hartley Sweeten [Fri, 22 Mar 2013 16:50:03 +0000 (09:50 -0700)]
staging: comedi: ni_labpc: introduce labpc_read_adc_fifo()

Introduce a helper function to read the a/d conversion result
from the fifo.

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_labpc: introduce labpc_setup_cmd6_reg()
H Hartley Sweeten [Fri, 22 Mar 2013 16:49:34 +0000 (09:49 -0700)]
staging: comedi: ni_labpc: introduce labpc_setup_cmd6_reg()

Introduce a helper function to set the COMMAND6_REG.

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_labpc:use labpc_cancel() to remove some common code
H Hartley Sweeten [Fri, 22 Mar 2013 16:49:10 +0000 (09:49 -0700)]
staging: comedi: ni_labpc:use labpc_cancel() to remove some common code

The labpc_cancel() function can be used by the labpc_ai_insn_read() and
labpc_ai_cmd() functions to disable the ai subdevice.

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_labpc: introduce labpc_ai_set_chan_and_gain()
H Hartley Sweeten [Fri, 22 Mar 2013 16:48:44 +0000 (09:48 -0700)]
staging: comedi: ni_labpc: introduce labpc_ai_set_chan_and_gain()

Introduce a helper function to set the channel and gain bits in the
COMMAND1_REG.

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_labpc: cleanup local var declarations in labpc_ai_insn_read()
H Hartley Sweeten [Fri, 22 Mar 2013 16:48:19 +0000 (09:48 -0700)]
staging: comedi: ni_labpc: cleanup local var declarations in labpc_ai_insn_read()

Determine the chan, range, and aref when the variables are declared.

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_labpc: cleanup local var declarations in labpc_ai_cmd()
H Hartley Sweeten [Fri, 22 Mar 2013 16:47:51 +0000 (09:47 -0700)]
staging: comedi: ni_labpc: cleanup local var declarations in labpc_ai_cmd()

Determine the scan_mode early and get the proper chanspec so that
the chan, range, and aref can be determined when the variables are
declared.

labpc_ai_chanlist_invalid() checks that all the range and aref values
in the chanlist are the same so, for consistency, use the same chanspec
used to get the chan.

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_labpc: remove unnecessary test of dev->irq
H Hartley Sweeten [Fri, 22 Mar 2013 16:47:20 +0000 (09:47 -0700)]
staging: comedi: ni_labpc: remove unnecessary test of dev->irq

The ai subdevice (*do_cmd) pointer is only initialized if the
driver has successfully requested the interrupt. The extra test
in labpc_ai_cmd() is not necessary.

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_labpc: move declaration of local var 'irq_flags'
H Hartley Sweeten [Fri, 22 Mar 2013 16:46:53 +0000 (09:46 -0700)]
staging: comedi: ni_labpc: move declaration of local var 'irq_flags'

In labpc_ai_cmd(), move the declaration of the local variable
'irq_flags' to remove the need for the extra #ifdef/#endif.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: remove DRV_NAME
H Hartley Sweeten [Fri, 22 Mar 2013 16:46:28 +0000 (09:46 -0700)]
staging: comedi: ni_labpc: remove DRV_NAME

Remove the DRV_NAME define and just open code the string in the
comedi_driver and pci_driver declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: use dev->board_name instead of DRV_NAME
H Hartley Sweeten [Fri, 22 Mar 2013 16:46:05 +0000 (09:46 -0700)]
staging: comedi: ni_labpc: use dev->board_name instead of DRV_NAME

In labpc_common_attach(), initialize the dev->board_name early and
use that instead of DRV_NAME when allocating the resources.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: move declaration of local var 'dma_flags'
H Hartley Sweeten [Fri, 22 Mar 2013 16:45:41 +0000 (09:45 -0700)]
staging: comedi: ni_labpc: move declaration of local var 'dma_flags'

In labpc_common_attach(), move the declaration of the local variable
'dma_flags' to remove the need for the extra #ifdef/#endif.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: tidy up subdevice init
H Hartley Sweeten [Fri, 22 Mar 2013 16:45:13 +0000 (09:45 -0700)]
staging: comedi: ni_labpc: tidy up subdevice init

Add some whitespace to the subdevice init.

Remove the unnecessary comment about adding command support to
the analog input subdevice and change the 'maxdata' value to hex
as this is more common in comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: fix 8255 dio subdevice init
H Hartley Sweeten [Fri, 22 Mar 2013 16:44:38 +0000 (09:44 -0700)]
staging: comedi: ni_labpc: fix 8255 dio subdevice init

The subdev_8255_init() function can fail. Check for failure and
return the errno.

Consolidate the mmio/ioport calls to subdev_8255_init(). The callback
function can be added with a simple ? : test and the cast of the iobase
is not necessary.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: fix command support with analog input subdevice
H Hartley Sweeten [Fri, 22 Mar 2013 16:43:45 +0000 (09:43 -0700)]
staging: comedi: ni_labpc: fix command support with analog input subdevice

An interrupt is required for command support to work with the
analog input subdevice. When used with the ISA driver, enabling
the interrupt is optional. Fix the subdevice init so that command
support is only enabled if the irq is available.

Add some whitespace to the subdevice init. Change the 'maxdata'
value to hex as this is more common in comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: rename subdevice (*insn_{read, write}) functions
H Hartley Sweeten [Fri, 22 Mar 2013 16:43:14 +0000 (09:43 -0700)]
staging: comedi: ni_labpc: rename subdevice (*insn_{read, write}) functions

For aesthetic reasons, and to make grepping easier, rename all the
subdevice (*insn_read) and (*insn_write) functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: introduce labpc_range_is_unipolar()
H Hartley Sweeten [Fri, 22 Mar 2013 16:42:48 +0000 (09:42 -0700)]
staging: comedi: ni_labpc: introduce labpc_range_is_unipolar()

Introduce a helper function to determine if a range selection is
bipolar or unipolar.

This allows removing the static data 'labpc_range_is_unipolar' and
'labpc_plus_is_unipolar' as well as the boardinfo 'ai_range_is_unipolar'.

For consistency, also use the helper in labpc_ao_winsn() when
checking the range.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: rename boardinfo 'memory_mapped_io'
H Hartley Sweeten [Fri, 22 Mar 2013 16:42:18 +0000 (09:42 -0700)]
staging: comedi: ni_labpc: rename boardinfo 'memory_mapped_io'

Rename the boardinfo 'memory_mapped_io' to 'has_mmio'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: rename local var 'thisboard'
H Hartley Sweeten [Fri, 22 Mar 2013 16:41:48 +0000 (09:41 -0700)]
staging: comedi: ni_labpc: rename local var 'thisboard'

For aesthetic reasons, rename the local variable 'thisboard' to
'board'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: tidy up range table declarations
H Hartley Sweeten [Fri, 22 Mar 2013 16:39:22 +0000 (09:39 -0700)]
staging: comedi: ni_labpc: tidy up range table declarations

Tidy up all the tables used to indicate the bipolar/unipolar
type of the range. the gain bits used to set the range, and the
comedi_lrange.

Remove a couple unnecessary #define's used to indicate the size
of the tables as well as some unnecessary comments.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: rename some of the private data variables
H Hartley Sweeten [Fri, 22 Mar 2013 16:41:22 +0000 (09:41 -0700)]
staging: comedi: ni_labpc: rename some of the private data variables

For aesthetic reasons, rename the 'command*_bits' and 'status*_bits'
variables in the private data in order to shorten some of the long
lines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: remove 'volatile' from private data
H Hartley Sweeten [Fri, 22 Mar 2013 16:40:58 +0000 (09:40 -0700)]
staging: comedi: ni_labpc: remove 'volatile' from private data

As indicated by checkpatch.pl, "WARNING: Use of volatile is usually
wrong: ...". The variables in the private data that are marked
volatile don't need to be. Remove the volatile.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: cleanup the boardinfo
H Hartley Sweeten [Fri, 22 Mar 2013 16:40:36 +0000 (09:40 -0700)]
staging: comedi: ni_labpc: cleanup the boardinfo

For aesthetic reasons, add some whitespace to the boardinfo.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: remove "dummy" pci boardinfo entry
H Hartley Sweeten [Fri, 22 Mar 2013 16:40:13 +0000 (09:40 -0700)]
staging: comedi: ni_labpc: remove "dummy" pci boardinfo entry

This driver uses the comedi auto config mechanism to attach to PCI
boards. The "dummy" entry in the boardinfo table is not needed.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: remove boardinfo data that is set to '0'
H Hartley Sweeten [Fri, 22 Mar 2013 16:39:50 +0000 (09:39 -0700)]
staging: comedi: ni_labpc: remove boardinfo data that is set to '0'

It's not necessary to initialize the boardinfo data that is set
to '0'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: remove forward declarations 4
H Hartley Sweeten [Fri, 22 Mar 2013 16:38:36 +0000 (09:38 -0700)]
staging: comedi: ni_labpc: remove forward declarations 4

Move the analog input support functions to remove the need for the
remaining forward declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: remove forward declarations 3
H Hartley Sweeten [Fri, 22 Mar 2013 16:38:10 +0000 (09:38 -0700)]
staging: comedi: ni_labpc: remove forward declarations 3

Move the interrupt/dma support functions to remove the need for
some of the forward declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: move the analog output support functions
H Hartley Sweeten [Fri, 22 Mar 2013 16:37:37 +0000 (09:37 -0700)]
staging: comedi: ni_labpc: move the analog output support functions

For aesthetic reasons, move the analog output support functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: remove forward declarations 2
H Hartley Sweeten [Fri, 22 Mar 2013 16:37:04 +0000 (09:37 -0700)]
staging: comedi: ni_labpc: remove forward declarations 2

Move the eeprom/caldac support functions to remove the need for
some of the forward declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: remove forward declarations 1
H Hartley Sweeten [Fri, 22 Mar 2013 16:36:34 +0000 (09:36 -0700)]
staging: comedi: ni_labpc: remove forward declarations 1

Move the comedi_driver (*attach), (*auto_attach), and (*detach)
functions as well as a couple of the attach helper functions to
remove the need for a number of the forward declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: add some whitespace to the *_driver declarations
H Hartley Sweeten [Fri, 22 Mar 2013 16:36:00 +0000 (09:36 -0700)]
staging: comedi: ni_labpc: add some whitespace to the *_driver declarations

For aesthetic reasons, add some whitespace to the comedi_driver and
pci_driver as well as the pci device table declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: remove thisboard macro
H Hartley Sweeten [Fri, 22 Mar 2013 16:34:39 +0000 (09:34 -0700)]
staging: comedi: ni_labpc: remove thisboard macro

The 'thisboard' macro relies on a local variable having a specific
name and yields a pointer derived from that local variable.

Replace the macro with a local variable and use the comedi_board()
helper to get the const pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: rename labpc_board_struct
H Hartley Sweeten [Fri, 22 Mar 2013 16:34:09 +0000 (09:34 -0700)]
staging: comedi: ni_labpc: rename labpc_board_struct

For aesthetic reasons, rename labpc_board_struct to labpc_boardinfo.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: Kconfig: update CONFIG_AMPLC_DIO200_PCI help text
Ian Abbott [Tue, 19 Mar 2013 09:43:01 +0000 (09:43 +0000)]
staging: comedi: Kconfig: update CONFIG_AMPLC_DIO200_PCI help text

After splitting support for PCI cards out of the "amplc_dio200" module
into "amplc_dio200_pci", the help text needs updating.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: split into ISA, PCI and common
Ian Abbott [Mon, 18 Mar 2013 17:19:09 +0000 (17:19 +0000)]
staging: comedi: amplc_dio200: split into ISA, PCI and common

Split the "amplc_dio200" comedi driver module into separate driver
modules for ISA and PCI boards with a common module for the shared code.

Keep the old name "amplc_dio200" for the ISA board driver as the module
may be modprobed with this name by a script.  (If the script uses insmod
it will need modifying to load the "amplc_dio200_common" module first.)

Use the module name "amplc_dio200_pci" for the PCI board driver.  On
most systems this will be auto-loaded.

Use the module name "amplc_dio200_common" for the module containing the
shared code.  This is normally loaded as a dependency of the other two
modules.

"amplc_dio200_common" exports the following functions:

* `amplc_dio200_common_attach()`: this is basically the old
  `dio200_common_attach()` from the combined driver module.  It is
  called from the driver-specific attach or auto-attach routines.
* `amplc_dio200_common_detach()`: this is most of the old
  `dio200_detach()`.  It is called from the driver-specific detach
  routine.
* `amplc_dio200_set_enhance()`: this is a new function called during
  initialization of PCIe cards to enable "enhanced" mode.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: refactor dio200_handle_read_intr()
Ian Abbott [Mon, 18 Mar 2013 17:19:08 +0000 (17:19 +0000)]
staging: comedi: amplc_dio200: refactor dio200_handle_read_intr()

Refactor `dio200_handle_read_intr()` to fix checkpatch warning about too
many leading tabs.  Factor out the part that puts the scan data into the
asynchronous command data buffer and checks for end of acquisition into
new function `dio200_read_scan_intr()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: don't check bus-type in dio200_common_attach()
Ian Abbott [Mon, 18 Mar 2013 17:19:07 +0000 (17:19 +0000)]
staging: comedi: amplc_dio200: don't check bus-type in dio200_common_attach()

The "amplc_dio200" driver is going to be split into separate drivers for
ISA and PCI cards with a common module containing most of the code.  We
don't want the common module code to depend on whether ISA boards, PCI
boards, or both are supported.  Currently, `dio200_common_attach()` and
`dio200_detach()` optimize out the code to support a timer subdevice
when built to support ISA boards only.  Remove the `if (DO_PCI)` tests
which optimize out that code.  Unfortunately, this will expand the
module's code size for an ISA-only driver a bit.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: remove dio200_report_attach()
Ian Abbott [Mon, 18 Mar 2013 17:19:06 +0000 (17:19 +0000)]
staging: comedi: amplc_dio200: remove dio200_report_attach()

`dio200_report_attach()` is called from `dio200_common_attach()` to
report the successful attachment of a supported board.  It includes
various information about the board.  Replace the function with a simple
acknowledgement that the attachment completed successfully.  The
`dio200_attach()` and `dio200_auto_attach()` functions also output an
message during the attachment.  Include extra information in those
messages to compensate for the removal of the information output by
`dio200_report_attach()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: remove DIO200_DRIVER_NAME
Ian Abbott [Mon, 18 Mar 2013 17:19:05 +0000 (17:19 +0000)]
staging: comedi: amplc_dio200: remove DIO200_DRIVER_NAME

Remove the `DIO200_DRIVER_NAME` macro which expands to the driver name
"amplc_dio200".  Use the board name from our `struct dio200_board` when
requesting resources.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: set board_name before common attach
Ian Abbott [Mon, 18 Mar 2013 17:19:04 +0000 (17:19 +0000)]
staging: comedi: amplc_dio200: set board_name before common attach

`dio200_common_attach()` is called from `dio200_attach()` for ISA boards
and from `dio200_auto_attach()` for PCI boards.  `dio200_auto_attach()`
assigns `dev->board_name` (where `dev` is the `struct comedi_device *`
under consideration) before calling `dio200_common_attach()`.  Do the
same in `dio200_attach()` so it can be used there before the call to
`dio200_common_attach()`.  This makes the assignment in
`dio200_common_attach()` unnessary, so remove the assignment from there.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: dio200_common_attach() return 0
Ian Abbott [Mon, 18 Mar 2013 17:19:03 +0000 (17:19 +0000)]
staging: comedi: amplc_dio200: dio200_common_attach() return 0

Change the successful return value of `dio200_common_attach()` from 1 to
0.  This is propagated as the return value from the driver's "attach"
(`dio200_attach()`) or "auto_attach" (`dio200_auto_attach()`) handler.
Any non-negative value will do, but 0 is more conventional than 1.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: shrink struct dio200_subdev_intr
Ian Abbott [Mon, 18 Mar 2013 17:19:02 +0000 (17:19 +0000)]
staging: comedi: amplc_dio200: shrink struct dio200_subdev_intr

Shave a few bytes off the size of `struct dio200_subdev_intr` by
rearranging members and changing two of them to bit-fields.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: embed board layout in board structure
Ian Abbott [Mon, 18 Mar 2013 17:19:01 +0000 (17:19 +0000)]
staging: comedi: amplc_dio200: embed board layout in board structure

The amplc_dio200 driver supports both ISA and PCI boards, some of which
are quite similar.  The driver takes advantage of this by defining a
"board layout" structure `struct dio200_layout` along with an array of
this structure `dio200_layouts[]` and an enumerated type for the indices
into this array `enum dio200_layout_idx`.  The main board information
structure `struct dio200_board` contains a `layout` member holding an
enumerated index into the array of layouts and the enumerated layout
values are used to designate the indices in the initializer of
`dio200_layouts[]`.

We would like to split the ISA and PCI support into separate driver
modules and having the shared layouts makes this slightly awkward as the
enumerated values are condionally present depending on whether the
driver is configured to support ISA, PCI, or both.

Embed the `struct dio200_layout` into the main board information
structure `struct dio200_board` to make things simpler, discarding
`dio200_layouts[]` and the `enum dio200_layout_idx` in the process.
Only two of the layouts were used by more than one board anyway (each of
which was used by one ISA and one PCI board).

While we're at it, change the `has_int_sce`, `has_clk_gat_sce` and
`has_enhancements` members of `struct dio200_layout` to `bool:1`
bit-fields to save a few bytes.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: Simplify PCI board look-up
Ian Abbott [Mon, 18 Mar 2013 17:19:00 +0000 (17:19 +0000)]
staging: comedi: amplc_dio200: Simplify PCI board look-up

Set the `driver_data` member of each element (apart from the sentinel)
of our PCI device table `dio200_pci_table[]` to the index of the
corresponding element of our private PCI board details
`dio200_pci_boards[]`.  This index appears in the context parameter of
our auto_attach routine `dio200_auto_attach()`.  In this function,
nename the parameter to `context_model` and use it to set
`dev->board_ptr` to point to an element of `dio200_pci_boards[] directly
by index instead of calling `dio200_find_pci_board()` to search for the
element whose `devid` member matches the PCI device ID.

Remove `dio200_find_pci_board()` and the `devid` member of `struct
dio200_board`.  Also remove the `model` member of `struct dio200_board`
and the `enum dio200_model` type as we can do without them.  The only
function that uses the `model` member is `dio200_auto_attach()`, so use
the `context_model` parameter instead.

Define the enumerated value for each PCI board in new type `enum
dio200_pci_model` which replaces `enum dio200_model` minus the
enumerated values for the ISA boards (so the numeric values for the PCI
boards have changed).  Use these enumerated values to designate the
initializer for each element of `dio200_pci_boards[]`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: don't check bus type in attach
Ian Abbott [Mon, 18 Mar 2013 17:18:59 +0000 (17:18 +0000)]
staging: comedi: amplc_dio200: don't check bus type in attach

Since the legacy attach routine `dio200_attach()` is only called for board
names matching an entry in our array of ISA boards
`dio200_isa_boards[]`, and it is reasonable to expect all elements of
`dio200_isa_boards[]` to have their `bustype` member initialized
correctly to `isa_bustype`, don't bother checking the bus type in
`dio200_attach()`.  Add `if (!DO_ISA) return -EINVAL` to optimize out
the remainder of the function if `CONFIG_COMEDI_AMPLC_DIO200_ISA` is not
defined.

Similarly, don't bother checking the bus type in
`dio200_find_pci_board()` as it is reasonable to expect all elements of
`dio200_pci_boards[]` to have their `bustype` member initialized
correctly to `pci_bustype`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: amplc_dio200: split dio200_boards[] into ISA & PCI
Ian Abbott [Mon, 18 Mar 2013 17:18:58 +0000 (17:18 +0000)]
staging: comedi: amplc_dio200: split dio200_boards[] into ISA & PCI

Split `dio200_boards[]` into `dio200_isa_boards[]` for ISA cards and
`dio200_pci_boards[]` for PCI cards.  Only initialize the board-name
look-up members of `struct comedi_driver amplc_dio200_driver` if the ISA
part of the driver is enabled in the kernel config
(`CONFIG_COMEDI_AMPLC_DIO200_ISA`) using the array of ISA boards
(`dio200_isa_boards[]`).  The driver doesn't allow manual configuration
of PCI devices, so there is no point having the comedi core match the
names of the PCI boards before it calls our driver's legacy attach
routine (`dio200_attach()`).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: propagate error code
Eduardo Valentin [Tue, 19 Mar 2013 14:54:28 +0000 (10:54 -0400)]
staging: ti-soc-thermal: propagate error code

While writing talert thresholds, propagate the error code from
ti_bandgap_update_alert_threshold to the caller of
_ti_bandgap_write_threshold.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: fix bitfield writing while updating thresholds
Eduardo Valentin [Tue, 19 Mar 2013 14:54:27 +0000 (10:54 -0400)]
staging: ti-soc-thermal: fix bitfield writing while updating thresholds

Wrong threshold cold values may be written with current implementation.
This patch fixes the threshold update function by simplifying the
bitfield manipulation sequence.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: fix condition to apply hyst
Eduardo Valentin [Tue, 19 Mar 2013 14:54:26 +0000 (10:54 -0400)]
staging: ti-soc-thermal: fix condition to apply hyst

While updating talert thresholds, threshold cold must
always be lower than threshold hot. This patch fixes
the function ti_bandgap_update_alert_threshold to only
change the thresholds by applying a hysteresis when
they violate this condition.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: fix several kernel-doc warnings and error
Eduardo Valentin [Tue, 19 Mar 2013 14:54:25 +0000 (10:54 -0400)]
staging: ti-soc-thermal: fix several kernel-doc warnings and error

This patch updates the documentation to remove
all warnings and errors reported by scripts/kernel-doc.
Most are missing arguments due to wrong format.

Cc: Nishanth Menon <nm@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostating: ti-soc-thermal: use sizeof(*pointer) while allocating
Eduardo Valentin [Tue, 19 Mar 2013 14:54:24 +0000 (10:54 -0400)]
stating: ti-soc-thermal: use sizeof(*pointer) while allocating

Follow Documentation/CodingStyle and use sizeof(*pointer)
instead of sizeof(struct type).

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: split writable data from readonly data
Eduardo Valentin [Tue, 19 Mar 2013 14:54:23 +0000 (10:54 -0400)]
staging: ti-soc-thermal: split writable data from readonly data

This patch changes the data structures of this driver so
that readonly data can reside only in the conf pointer.
Now each register has a struct to hold its configuration info,
to be used base on chip version for instance, and a
struct of values to be written, like register shadow and priv data.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: make unexported functions local
Eduardo Valentin [Tue, 19 Mar 2013 14:54:22 +0000 (10:54 -0400)]
staging: ti-soc-thermal: make unexported functions local

Move _ti_bandgap_write_threshold and _ti_bandgap_read_threshold to static
area, as they are local functions.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: rename symbols to use better prefix
Eduardo Valentin [Tue, 19 Mar 2013 14:54:21 +0000 (10:54 -0400)]
staging: ti-soc-thermal: rename symbols to use better prefix

As this driver has been renamed to cope with the chips it
is supposed to support, this patch also changes the symbol
names to use a proper prefix, so it is not suggestive that
this driver supports only OMAP devices.

Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Benoit <b-cousson@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: rename Kconfig options
Eduardo Valentin [Tue, 19 Mar 2013 14:54:20 +0000 (10:54 -0400)]
staging: ti-soc-thermal: rename Kconfig options

This patch renames the Kconfig options to cope with
the new naming convention.

Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Benoit <b-cousson@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rename omap-thermal driver to ti-soc-thermal
Eduardo Valentin [Tue, 19 Mar 2013 14:54:19 +0000 (10:54 -0400)]
staging: rename omap-thermal driver to ti-soc-thermal

Because this driver will support also OMAP derivatives,
this patch does a big rename inside this driver, so it
better fits its usage.

This patch only renames the directory, file names,
includes, Makefiles and Kconfig includes.

Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Benoit <b-cousson@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: rename bg_ptr to bgp
Eduardo Valentin [Tue, 19 Mar 2013 14:54:18 +0000 (10:54 -0400)]
staging: omap-thermal: rename bg_ptr to bgp

Use a shorter name to bandgap pointer.

Cc: Benoit <b-cousson@ti.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: fix return value
Eduardo Valentin [Tue, 19 Mar 2013 14:54:17 +0000 (10:54 -0400)]
staging: omap-thermal: fix return value

Return the proper error value in _omap_bandgap_read_threshold.

Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: csr: Fix typos in csr
Masanari Iida [Thu, 21 Mar 2013 16:20:46 +0000 (01:20 +0900)]
staging: csr: Fix typos in csr

Correct spelling typos in comment witin csr.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: imx-drm: ipu-common: Fix sparse warnings
Fabio Estevam [Sat, 23 Mar 2013 22:43:32 +0000 (19:43 -0300)]
staging: imx-drm: ipu-common: Fix sparse warnings

Fix the following sparse warnings:

drivers/staging/imx-drm/ipu-v3/ipu-common.c:232:42: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/imx-drm/ipu-v3/ipu-common.c:232:42:    expected struct ipu_ch_param [noderef] <asn:2>*base
drivers/staging/imx-drm/ipu-v3/ipu-common.c:232:42:    got struct ipu_ch_param *p
drivers/staging/imx-drm/ipu-v3/ipu-common.c:233:42: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/imx-drm/ipu-v3/ipu-common.c:233:42:    expected struct ipu_ch_param [noderef] <asn:2>*base
drivers/staging/imx-drm/ipu-v3/ipu-common.c:233:42:    got struct ipu_ch_param *p
drivers/staging/imx-drm/ipu-v3/ipu-common.c:234:42: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/imx-drm/ipu-v3/ipu-common.c:234:42:    expected struct ipu_ch_param [noderef] <asn:2>*base
drivers/staging/imx-drm/ipu-v3/ipu-common.c:234:42:    got struct ipu_ch_param *p
drivers/staging/imx-drm/ipu-v3/ipu-common.c:237:42: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/imx-drm/ipu-v3/ipu-common.c:237:42:    expected struct ipu_ch_param [noderef] <asn:2>*base
drivers/staging/imx-drm/ipu-v3/ipu-common.c:237:42:    got struct ipu_ch_param *p
drivers/staging/imx-drm/ipu-v3/ipu-common.c:238:42: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/imx-drm/ipu-v3/ipu-common.c:238:42:    expected struct ipu_ch_param [noderef] <asn:2>*base
drivers/staging/imx-drm/ipu-v3/ipu-common.c:238:42:    got struct ipu_ch_param *p
drivers/staging/imx-drm/ipu-v3/ipu-common.c:239:42: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/imx-drm/ipu-v3/ipu-common.c:239:42:    expected struct ipu_ch_param [noderef] <asn:2>*base
drivers/staging/imx-drm/ipu-v3/ipu-common.c:239:42:    got struct ipu_ch_param *p

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sb105x: Fix typo in comments and printk
Masanari Iida [Sun, 24 Mar 2013 14:24:00 +0000 (23:24 +0900)]
staging: sb105x: Fix typo in comments and printk

Correct spelling typos in comments and printk in
staging/sb105x

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vme: fix for a potential NULL pointer dereference
Kumar Amit Mehta [Mon, 25 Mar 2013 05:37:48 +0000 (22:37 -0700)]
staging: vme: fix for a potential NULL pointer dereference

Audit the return value of cdev_alloc and hence fixes a potential NULL pointer
dereferencing.

Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>