openwrt/staging/blogic.git
10 years agostaging: comedi: pcl818: tidy up the remaining register defines
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:25 +0000 (11:30 -0700)]
staging: comedi: pcl818: tidy up the remaining register defines

For aesthetics, rename the timer/counter enable request register
and define its bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: tidy up the remaining register defines
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:24 +0000 (11:30 -0700)]
staging: comedi: pcl816: tidy up the remaining register defines

For aesthetics, rename the clear INT request register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: tidy up the remaining register defines
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:23 +0000 (11:30 -0700)]
staging: comedi: pcl812: tidy up the remaining register defines

The PCL812_CNTENABLE define is not used in this driver. Remove it.

For aesthetics, rename the software trigger register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: cleanup ai_cmd()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:22 +0000 (11:30 -0700)]
staging: comedi: pcl818: cleanup ai_cmd()

Rename this function so it has namespace associated with the driver.

The cmd->scan_begin_src is always TRIG_FOLLOW and the only valid
cmd->convert_src is TRIG_TIMER or TRIG_EXT so pcl818_ai_cmd_mode()
is always called with a 'mode' of 1 or 3. The 'mode' actually indicates
the trigger source.

Absorb pcl818_ai_cmd_mode() into this function and simplify the code.

This also removes the need for a forward declaration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: absorb pcl818_ai_mode13dma_int()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:21 +0000 (11:30 -0700)]
staging: comedi: pcl818: absorb pcl818_ai_mode13dma_int()

Absorb this function into pcl818_ai_cmd_mode() and simplify the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: define the mode register bits
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:20 +0000 (11:30 -0700)]
staging: comedi: pcl818: define the mode register bits

Define the bits in the register to remove the magic values.

Tidy up pcl818_ai_cancel(). The 0x73 mask of the value read from
the control register will disable dma and interrupts but it does
not change the trigger mode. So the software trigger following it
might not work.

Just disable the trigger and clear any pending end-of-conversion.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: define the mode register bits
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:19 +0000 (11:30 -0700)]
staging: comedi: pcl816: define the mode register bits

Define the bits in the register to remove the magic values.

Fix pcl816_ai_cancel(). The 0x73 mask of the value read from the control
register will not stop the A/D as indicated by the comment. This would just
clear the DS1, POE, and EXT bits which would only disable the external
trigger. Setting the control register to '0' would then stop the A/D which
means the software trigger following it would not work. Just disable the
trigger and clear any pending end-of-conversion.

Make sure the A/D trigger is disabled at the end of the (*insn_read).

Remove a couple unnecessary devpriv->dev checks. The pcl816_ai_cmd() and
pcl816_ai_poll() functions are only hooked up when devpriv->dma is valid.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: define the mode register bits
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:18 +0000 (11:30 -0700)]
staging: comedi: pcl812: define the mode register bits

For aesthetics, rename this register.

Define the bits in the register to remove the magic values.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: cleanup setup_channel_list()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:17 +0000 (11:30 -0700)]
staging: comedi: pcl818: cleanup setup_channel_list()

Move this function to remove the need for the forward declaration. Rename it
so it has namespace associated with the driver. Remove the unnecessary
comedi_subdevice parameter from the function.

The hardware has per-channel programmable gain. This function first sets the
range for each channel then sets the mux register to automatically scan the
channels.

The use of 'muxonechan' when programming the ranges is incorrect. Only the low
4-bits are supposed to be set when programming the ranges.

Introduce a couple helper functions to set the range for a channel and to set
the first/last channels to scan.

Tidy up the range and mux register defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: cleanup setup_channel_list()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:16 +0000 (11:30 -0700)]
staging: comedi: pcl816: cleanup setup_channel_list()

Move this function to remove the need for the forward declaration. Rename it
so it has namespace associated with the driver. Remove the unnecessary
comedi_subdevice parameter from the function.

The hardware has per-channel programmable gain. This function first sets the
range for each channel then sets the mux register to automatically scan the
channels.

Remove the need for the 'ai_act_chanlist' member in the private data. It is
only used to set the first/last channel to scan.

Introduce a couple helper functions to set the range for a channel and to set
the first/last channels to scan.

Tidy up the range and mux register defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: cleanup setup_range_channel()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:15 +0000 (11:30 -0700)]
staging: comedi: pcl812: cleanup setup_range_channel()

Move this function to remove the need for the forward declaration. Rename it
so it has namespace associated with the driver. Remove the unnecessary
comedi_subdevice parameter from the function.

The hardware does not support analog input channel scanning so the mux and
range need to be set before each (*insn_read) and when advancing to the next
channel in an async command. Instead of storing the last chan/range in the
private data just store the chanspec to determine if the mux and range need
to be changed.

Refactor pcl812_reset() a bit so we can use the helper function to set the
mux and range.

Define the bits in the mux register to remove the magic values.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: define the status register bits
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:14 +0000 (11:30 -0700)]
staging: comedi: pcl812: define the status register bits

Define the bits in the status register.

Writing any value to the status register clears any pending interrupt.
For aesthetics, rename the status register and remove the "clrint"
register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: define the status register bits
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:13 +0000 (11:30 -0700)]
staging: comedi: pcl816: define the status register bits

Define the bits in the status register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: define the status register bits
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:12 +0000 (11:30 -0700)]
staging: comedi: pcl818: define the status register bits

Define the bits in the status register and remove the magic values.

Writing any value to the status register clears any pending interrupt.
For aesthetics, rename the status register and remove the "clrint"
register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: tidy up analog input registers
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:11 +0000 (11:30 -0700)]
staging: comedi: pcl818: tidy up analog input registers

For aesthetics, rename the analog input register defines and convert
the offsets to hex.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: tidy up analog input registers
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:10 +0000 (11:30 -0700)]
staging: comedi: pcl816: tidy up analog input registers

For aesthetics, rename the analog input register defines and convert
the offsets to hex.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: tidy up analog input registers
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:09 +0000 (11:30 -0700)]
staging: comedi: pcl812: tidy up analog input registers

For aesthetics, rename the analog input register defines and convert
the offsets to hex.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: introduce pcl812_ai_soft_trig()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:08 +0000 (11:30 -0700)]
staging: comedi: pcl812: introduce pcl812_ai_soft_trig()

Introduce a helper function to start a software triggered analog input
conversion.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: introduce pcl816_ai_soft_trig()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:07 +0000 (11:30 -0700)]
staging: comedi: pcl816: introduce pcl816_ai_soft_trig()

Introduce a helper function to start a software triggered analog input
conversion.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: introduce pcl818_ai_soft_trig()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:06 +0000 (11:30 -0700)]
staging: comedi: pcl818: introduce pcl818_ai_soft_trig()

Introduce a helper function to start a software triggered analog input
conversion.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: introduce pcl818_ai_clear_eoc()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:05 +0000 (11:30 -0700)]
staging: comedi: pcl818: introduce pcl818_ai_clear_eoc()

Introduce a helper function to clear the end-of-conversion flag.

This flag is set when an analog input conversion is finished and the
hardware generates an interrupt request. Writing any value to the
register resets the flag and re-enables the interrupt.

Remove the clearing of the flag in pcl818_handle_eoc(). The interrupt
function will handle clearing the flag.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: introduce pcl816_ai_clear_eoc()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:04 +0000 (11:30 -0700)]
staging: comedi: pcl816: introduce pcl816_ai_clear_eoc()

Introduce a helper function to clear the end-of-conversion flag.

This flag is set when an analog input conversion is finished and the
hardware generates an interrupt request. Writing any value to the
register resets the flag and re-enables the interrupt.

Move the call in pcl816_ai_cancel() so that the flag is reset after
stopping the A/D.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: introduce pcl812_ai_clear_eoc()
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:03 +0000 (11:30 -0700)]
staging: comedi: pcl812: introduce pcl812_ai_clear_eoc()

Introduce a helper function to clear the end-of-conversion flag.

This flag is set when an analog input conversion is finished and the
hardware generates an interrupt request. Writing any value to the
register resets the flag and re-enables the interrupt.

Remove a redundant call in pcl812_ai_cancel().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: tidy up the analog input (*insn_read)
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:02 +0000 (11:30 -0700)]
staging: comedi: pcl812: tidy up the analog input (*insn_read)

For aesthetics, move this function out of the async command support
code.

For safety, the INT request (end-of-conversion flag) should be cleared
before doing each conversion and after the final data sample is read.
The driver currently does not do this.

Refactor the function a bit so it's more like the pcl818 and pcl816
drivers and use common code to clear the flag for a timeout and after
the last sample.

Do a bit of other tidying up during the move.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: tidy up the analog input (*insn_read)
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:01 +0000 (11:30 -0700)]
staging: comedi: pcl816: tidy up the analog input (*insn_read)

For aesthetics, move this function out of the async command support
code.

For safety, the INT request (end-of-conversion flag) should be cleared
before doing each conversion and after the final data sample is read.
This driver does that but it's a bit awkward with the initial clear being
outside the for loop that reads the samples.

Refactor the function a bit so it's more like the pcl818 driver and we
can use common code to clear the flag for a timeout and after the last
sample.

Do a bit of other tidying up during the move.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: tidy up the analog input (*insn_read)
H Hartley Sweeten [Tue, 4 Mar 2014 18:30:00 +0000 (11:30 -0700)]
staging: comedi: pcl818: tidy up the analog input (*insn_read)

For aesthetics, move this function out of the async command support
code.

For safety, the INT request (end-of-conversion flag) should be cleared
before doing each conversion and after the final data sample is read.
This driver already clears the flag before starting a conversion but it
does not clear the flag after the final sample.

Refactor the function a bit so that the flag is cleared for a conversion
timeout and after the last sample.

Do a bit of other tidying up during the move.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: tidy up the analog output subdevice
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:59 +0000 (11:29 -0700)]
staging: comedi: pcl818: tidy up the analog output subdevice

For aesthetics, tidy up the analog output subdevice code.

Change the regsiter map defines to simplify the code.

Move the analog subdevice support functions out of the analog input
support functions. Tidy them up a bit during the move.

Reverse the logic of the subdevice init and add some whitespace.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: tidy up the analog output subdevice
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:58 +0000 (11:29 -0700)]
staging: comedi: pcl812: tidy up the analog output subdevice

For aesthetics, tidy up the analog output subdevice code.

Change the regsiter map defines to simplify the code.

Move the analog subdevice support functions out of the analog input
support functions. Tidy them up a bit during the move.

Add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: move pcl816_reset()
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:57 +0000 (11:29 -0700)]
staging: comedi: pcl816: move pcl816_reset()

For aesthetics, move this function to follow the pcl812 and pcl818 drivers
better.

Remove the commented out cut-and-paste code from the pcl818 driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: tidy up the digital subdevices
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:56 +0000 (11:29 -0700)]
staging: comedi: pcl818: tidy up the digital subdevices

For aesthetics, tidy up the digtial subdevice code.

Rename the register map defines for the digital input and output ports.

Move the two digital subdevice (*insn_bits) functions out of the analog
support functions. Tidy them up a bit during the move.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: add support for digital subdevices
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:55 +0000 (11:29 -0700)]
staging: comedi: pcl816: add support for digital subdevices

The PCL-816 boards have 16 digital inputs and 16 digtial outputs. Add the
subdevice support for these channels.

Allocate additional subdevice space to the analog outputs. This code is
not currently in the driver so mark the subdevice as COMEDI_SUBD_UNUSED.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: tidy up the digital subdevices
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:54 +0000 (11:29 -0700)]
staging: comedi: pcl812: tidy up the digital subdevices

For aesthetics, tidy up the digtial subdevice code.

rename the register map defines for the digital input and output ports.

Move the two digital subdevice (*insn_bits) functions out of the analog
support functions. Tidy them up a bit during the move.

Add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: consolidate the common interrupt code
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:53 +0000 (11:29 -0700)]
staging: comedi: pcl818: consolidate the common interrupt code

The DMA, FIFO, and EOC interrupt handler functions, that are called by
the _real_ interrupt function, always return IRQ_HANDLED. Change the
return type for these functions to void and move the final return to
the real interrupt function.

Change the parameters to the handler functions to the comedi_device and
comedi_subdevice pointers.

At some point in the handler functions the interrupt request is cleared.
Move this to the real interrupt function.

Also at some point in the handlers, comedi_event() is called to pass any
events to the comedi subsystem. Move this to the real interrupt function
also.

For aesthetics, and to clarify the code, rename the interrupt function and
the handler functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: consolidate the interrupt code
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:52 +0000 (11:29 -0700)]
staging: comedi: pcl816: consolidate the interrupt code

This driver only supports interrupt driven DMA transfers for async
command support. Absorb the interrupt_pcl816_ai_mode13_dma() helper
into the interrupt handler to clarify the code.

At some point during the interrupt, comedi_event() is called to pass
any events to the comedi subsystem. Move this to the interrupt handler.
Add a comedi_event() call to pcl816_ai_poll() due to the removal of
the call from transfer_from_dma_buf().

For aesthetics, rename the interrupt function so it has namespace
associated with the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: consolidate the common interrupt code
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:51 +0000 (11:29 -0700)]
staging: comedi: pcl812: consolidate the common interrupt code

The DMA and EOC interrupt handler functions, that are called by the
_real_ interrupt function, always return IRQ_HANDLED. Change the
return type for these functions to void and move the final return to
the real interrupt function.

Change the parameters to the handler functions to the comedi_device and
comedi_subdevice pointers.

At some point in the handler functions the interrupt request is cleared.
Move this to the real interrupt function.

Also at some point in the handlers, comedi_event() is called to pass any
events to the comedi subsystem. Move this to the real interrupt function
also.

For aesthetics, and to clarify the code, rename the interrupt function and
the handler functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: remove 'ai_mode' from private data
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:50 +0000 (11:29 -0700)]
staging: comedi: pcl818: remove 'ai_mode' from private data

This member of the private data is not needed. We can determine the
interrupt mode based on the 'dma' and 'usefifo' members.

Refactor the interrupt handler and the (*cancel) function to not use
the 'ai_mode' and remove the setting of this member in the (*do_cmd)
heler functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: remove 'int816_mode' from private data
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:49 +0000 (11:29 -0700)]
staging: comedi: pcl816: remove 'int816_mode' from private data

This member of the private data is not needed.

Refactor the interrupt handler and the (*cancel) function to not use
the 'int816_mode' and remove the setting of this member in the (*do_cmd)
heler function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: exit interrupt quick when there is nothing to do
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:48 +0000 (11:29 -0700)]
staging: comedi: pcl818: exit interrupt quick when there is nothing to do

If an async ai command is not running or the ai_mode is 0 the interrupt
routine doesn't do anything other than spew some noise and clear the
interrupt request in the hardware.

Because this driver is manually attached, the "premature interrupt"
check in the interrupt handler should never happen. The interrupt is
only hooked up during the attach and it's released during the detach.

Combine these checks so that the interrupt function exits quick if it
has nothing to handle. Remove the noise.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: exit interrupt quick when there is nothing to do
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:47 +0000 (11:29 -0700)]
staging: comedi: pcl816: exit interrupt quick when there is nothing to do

If an async ai command is not running or the int816_mode is 0 the
interrupt routine doesn't do anything other than spew some noise and
clear the interrupt request in the hardware.

Because this driver is manually attached, the "premature interrupt"
check in the interrupt handler should never happen. The interrupt is
only hooked up during the attach and it's released during the detach.

Combine these checks so that the interrupt function exits quick if it
has nothing to handle. Remove the noise.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: remove "spurious interrupt" noise
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:46 +0000 (11:29 -0700)]
staging: comedi: pcl812: remove "spurious interrupt" noise

Because this driver is manually attached, the "spurious interrupt"
check in the interrupt handler should never happen. The interrupt is
only hooked up during the attach and it's released during the detach.

Leave the check but remove the noise. Also make sure to clear the
interrupt request in the hardware.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: fix (*cancel) when cmd->stop_src == TRIG_NONE
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:45 +0000 (11:29 -0700)]
staging: comedi: pcl818: fix (*cancel) when cmd->stop_src == TRIG_NONE

When using DMA, the async command (*cancel) operation is delayed until the
current DMA transfer is complete. When the DMA transfer finishes the interrupt
routine detects this and calls the (*cancel) again which should then cancel the
async command.

The current logic does not work when cmd->stop_src == TRIG_NONE. In this case
the (*cancel) function keeps delaying the cancel. The actual DMA does stop
because the DMA handler is not called to setup the next transfer but the
(*cancel) code is never executed.

Rename the 'irq_was_now_closed' flag in the private data to 'ai_cmd_canceled'
to clarify what it is.

Only set the flag in the (*cancel) when a DMA transfer is running and the
async command has not already been canceled. The interrupt routine then does
not need all the extra checks.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: clarify 'irq_was_now_closed' flag in private data
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:44 +0000 (11:29 -0700)]
staging: comedi: pcl816: clarify 'irq_was_now_closed' flag in private data

This flag in the private data is set when an async command is canceled with
the ai (*cancel) operation. Rename the flag to 'ai_cmd_canceled' to clarify
its use.

Move the check for the flag in the interrupt handler. If the async command
was canceled there is no reason to handle the interrupt. Just clear interrupt
and return.

Also, make sure to clear the interrupt when the device is not attached.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: reduce indent level in pcl818_ai_cancel()
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:43 +0000 (11:29 -0700)]
staging: comedi: pcl818: reduce indent level in pcl818_ai_cancel()

If an async command is not running the (*cancel) function doesn't do
anything. Exit the function early if this is the case.

This allows reducing the indent level in the rest of the function.

Also, move the setting of the 'irq_was_now_closed' to the only place
wher it actually gets left set to 1 and remove the goto.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: reduce indent level in pcl816_ai_cancel()
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:42 +0000 (11:29 -0700)]
staging: comedi: pcl816: reduce indent level in pcl816_ai_cancel()

If an async command is not running the (*cancel) function doesn't do
anything. Exit the function early if this is the case.

This allows reducing the indent level in the rest of the function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: factor out the common "dropout" detect code
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:41 +0000 (11:29 -0700)]
staging: comedi: pcl818: factor out the common "dropout" detect code

The DMA, FIFO, and EOC interrupt handlers all have common code that
checks for channel dropout when running an async command.

Factor this common code into a helper function.

Only return the sample if the channel is valid. The EOC handler was
previously returning the value then checking for channel dropout.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: introduce pcl818_ai_get_fifo_sample()
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:40 +0000 (11:29 -0700)]
staging: comedi: pcl818: introduce pcl818_ai_get_fifo_sample()

To clarify the code, introduce a helper function to read the analog
input data sample from the FIFO and optionally return the channel
that the sample was for. The channel is used to check for dropped
samples.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: fix PCL818_FI_DATAHI
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:39 +0000 (11:29 -0700)]
staging: comedi: pcl818: fix PCL818_FI_DATAHI

The A/D FIFO uses two registers to get each analog data sample.
PCL818_FI_DATALO is the LSB of the data and PCL818_FI_DATAHI is
the MSB of the data. The current define for PCL818_FI_DATAHI is
incorrect and results in the LSB getting read twice.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: factor out the common "next ai chan" code
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:38 +0000 (11:29 -0700)]
staging: comedi: pcl818: factor out the common "next ai chan" code

The DMA, FIFO, and EOC interrupt handlers all have common code that
bumps the counters in the private data that keep track of what channel
is being sampled next and when all the data has been sampled.

Factor this common code into a helper function.

Make sure the COMEDI_CB_BLOCK event is set when advancing to the next
channel so that when the comedi_event() is finally called the core will
wake the async_queue to return the analog input data.

Also, make sure the COMEDI_CB_EOS event is set at the completion of each
scan.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: factor out the "next ai chan" code
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:37 +0000 (11:29 -0700)]
staging: comedi: pcl816: factor out the "next ai chan" code

Factor out the code that bumps the counters in the private data that keep
track of what channel is being samples next and when all the data has been
sampled.

Don't clear the events in the driver. The comedi core will clear the events
at the end of the comedi_event().

Make sure the COMEDI_CB_BLOCK event is set when advancing to the next
channel so that when the comedi_event() is finally called the core will
wake the async_queue to return the analog input data.

Also, make sure the COMEDI_CB_EOS event is set at the completion of each
scan.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: factor out the common "next ai chan" code
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:36 +0000 (11:29 -0700)]
staging: comedi: pcl812: factor out the common "next ai chan" code

The DMA and EOC interrupt handlers all have common code that bumps the
counters in the private data that keep track of what channel is being
sampled next and when all the data has been sampled.

Factor this common code into a helper function.

Don't clear the events in the driver. The comedi core will clear the events
at the end of the comedi_event().

Make sure the COMEDI_CB_BLOCK event is set when advancing to the next
channel so that when the comedi_event() is finally called the core will
wake the async_queue to return the analog input data.

Also, make sure the COMEDI_CB_EOS event is set at the completion of each
scan.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: only hook up async command support if DMA is available
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:35 +0000 (11:29 -0700)]
staging: comedi: pcl816: only hook up async command support if DMA is available

This driver only supports async commands if a DMA channel is available. Modify
the subdevice init so that the command support only gets hooked up if we can
do DMA.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: remove unreachable interrupt handler code
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:34 +0000 (11:29 -0700)]
staging: comedi: pcl816: remove unreachable interrupt handler code

According to the users manual, when using interrupt (non-DMA) transfers
this hardware generates an interrupt at the start of a conversion. This
requires the interrupt routine to busywait until the end-of-conversion.
It appears this was unreliable and interrupt only async command support
was removed at some time. Async command support is still available when
DMA is used.

Remove the unreachable interrupt only handler code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: interrupt handlers should not busywait
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:33 +0000 (11:29 -0700)]
staging: comedi: pcl818: interrupt handlers should not busywait

The interrupt is only generated by the hardware at the completion of
an A/D conversion. Because of this the sanity check to make sure that
the A/D conversion is complete and data is available is probably
unnecessary but it doesn't hurt anything.

The busywait loop is a different issue. Interrupt routines should not
busywait. That's just mean...

Remove the bustwait and use pcl818_ai_eoc() to check for the end-of-
conversion.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: interrupt handlers should not busywait
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:32 +0000 (11:29 -0700)]
staging: comedi: pcl812: interrupt handlers should not busywait

The interrupt is only generated by the hardware at the completion of
an A/D conversion. Because of this the sanity check to make sure that
the A/D conversion is complete and data is available is probably
unnecessary but it doesn't hurt anything.

The busywait loop is a different issue. Interrupt routines should not
busywait. That's just mean...

Remove the bustwait and use pcl812_ai_eoc() to check for the end-of-
conversion.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: remove 'dmasamplesize' from private data
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:31 +0000 (11:29 -0700)]
staging: comedi: pcl816: remove 'dmasamplesize' from private data

This member of the private data is not used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: remove 'ai_data_len' from private data
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:30 +0000 (11:29 -0700)]
staging: comedi: pcl812: remove 'ai_data_len' from private data

This member of the private data is only used in the initial dma setup.
Refactor that code to not need it and remove the member.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: factor out dma setup to helper functions
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:29 +0000 (11:29 -0700)]
staging: comedi: pcl818: factor out dma setup to helper functions

To assist in cleaning up the the rest of the driver, factor the initial
dma setup and the next dma buffer setup into helper functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: factor out dma setup to helper functions
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:28 +0000 (11:29 -0700)]
staging: comedi: pcl816: factor out dma setup to helper functions

To assist in cleaning up the the rest of the driver, factor the initial
dma setup and the next dma buffer setup into helper functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: factor out dma setup to helper functions
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:27 +0000 (11:29 -0700)]
staging: comedi: pcl812: factor out dma setup to helper functions

To assist in cleaning up the the rest of the driver, factor the initial
dma setup and the next dma buffer setup into helper functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: remove 'neverending_ai' from private data
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:26 +0000 (11:29 -0700)]
staging: comedi: pcl818: remove 'neverending_ai' from private data

This member of the private data is not needed. We can check the stop_src
to determine this information:

  neverending_ai -> cmd->stop_src == TRIG_NONE
  !neverending_ai -> cmd->stop_src == TRIG_COUNT

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: remove 'ai_neverending' from private data
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:25 +0000 (11:29 -0700)]
staging: comedi: pcl816: remove 'ai_neverending' from private data

This member of the private data is not needed. We can check the stop_src
to determine this information:

  ai_neverending -> cmd->stop_src == TRIG_NONE
  !ai_neverending -> cmd->stop_src == TRIG_COUNT

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: remove 'ai_neverending' from private data
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:24 +0000 (11:29 -0700)]
staging: comedi: pcl812: remove 'ai_neverending' from private data

This member of the private data is not needed. We can check the stop_src
to determine this information:

  ai_neverending -> cmd->stop_src == TRIG_NONE
  !ai_neverending -> cmd->stop_src == TRIG_COUNT

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: fix board resource region request
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:23 +0000 (11:29 -0700)]
staging: comedi: pcl818: fix board resource region request

Some of the PCL-818 compatible boards have a FIFO that can be used
when running analog input async commands. This FIFO increased the
resource range used by the driver.

Request the correct resources used by the board even if the FIFO is
not used. This prevents another driver from trying to use the I/O
space.

Modify the attach so that the 'usefifo' flag is only set if we have
and IRQ, the board has a FIFO, and the user wahts to use it.

Fix pcl818_reset() so that the FIFO is always flushed and disabled
if it exists.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: remove pcl818_check()
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:22 +0000 (11:29 -0700)]
staging: comedi: pcl818: remove pcl818_check()

This function is a _very_ simplified probe that tried to verify that
the driver is being attached to a PCL-818 compatible board. The function
simply writes some values to specific registers then reads back the
values to see if they are the same.

It's possible that the user could try to attach this driver to a non-
compatible board but the check would still pass depending on the register
map of the board.

Just remove the buggy function to simplify the attach a bit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: remove pcl816_check()
H Hartley Sweeten [Tue, 4 Mar 2014 18:29:21 +0000 (11:29 -0700)]
staging: comedi: pcl816: remove pcl816_check()

This function is a _very_ simplified probe that tried to verify that
the driver is being attached to a PCL-816 compatible board. The function
simply writes some values to specific registers then reads back the
values to see if they are the same.

It's possible that the user could try to attach this driver to a non-
compatible board but the check would still pass depending on the register
map of the board.

Just remove the buggy function to simplify the attach a bit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Simplify and cleanup dgap_init_module function
Mark Hounschell [Thu, 6 Mar 2014 20:25:19 +0000 (15:25 -0500)]
staging: dgap: Simplify and cleanup dgap_init_module function

This patch simplifies and cleans up the dgap_init_module function. It also fixes
a possible double free condition as a result pci_unregister_driver possibly
being called twice.

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Remove printks associated with sysfile creation
Mark Hounschell [Thu, 6 Mar 2014 18:57:55 +0000 (13:57 -0500)]
staging: dgap: Remove printks associated with sysfile creation

This patch removes printks associated with sysfile creation
and changes the dgap_create_driver_sysfiles function to return
an int so we can check for errors in the sysfile creation
process.

The printk's were flagged by checkpatch but then
driver_create_file was flagged by checkpatch for
not checking its return. So we remove the printk's
and check the return of driver_create_file.

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Remove some dead code
Mark Hounschell [Thu, 6 Mar 2014 18:03:33 +0000 (13:03 -0500)]
staging: dgap: Remove some dead code

This patch removes more dead code and code associated
with that dead code. The from_user variable in the
dgap_tty_write function was never true. The code under
its test was never being executed. So variables and
functions supporting only that code are also dead.

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: fix a few more 80+ lines as reported by checkpatch
Mark Hounschell [Wed, 5 Mar 2014 20:54:51 +0000 (15:54 -0500)]
staging: dgap: fix a few more 80+ lines as reported by checkpatch

This patch fixes a few 80+ char lines as reported by checkpatch

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: fix a few more 80+ lines as reported by checkpatch
Mark Hounschell [Wed, 5 Mar 2014 20:54:50 +0000 (15:54 -0500)]
staging: dgap: fix a few more 80+ lines as reported by checkpatch

This patch fixes a few 80+ char lines as reported by checkpatch

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: fix a few more 80+ lines as reported by checkpatch
Mark Hounschell [Thu, 6 Mar 2014 18:02:45 +0000 (13:02 -0500)]
staging: dgap: fix a few more 80+ lines as reported by checkpatch

This patch fixes a few 80+ char lines as reported by checkpatch

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: fix a few 80+ char lines as reported by checkpatch
Mark Hounschell [Tue, 4 Mar 2014 21:03:12 +0000 (16:03 -0500)]
staging: dgap: fix a few 80+ char lines as reported by checkpatch

This patch fixes a few of the many 80+ character lines
as reported by checkpatch

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: fix suspect code indent for conditional statements checkpatch warning
Mark Hounschell [Tue, 4 Mar 2014 21:03:11 +0000 (16:03 -0500)]
staging: dgap: fix suspect code indent for conditional statements checkpatch warning

This patch fixes a checkpatch warning for
suspect code indent for conditional statements

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: fix checkpatch warning on sscanf usage
Mark Hounschell [Tue, 4 Mar 2014 21:03:10 +0000 (16:03 -0500)]
staging: dgap: fix checkpatch warning on sscanf usage

This patch fixes a checkpatch warning for not checking
the return value of sscanf.

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Remove module param and sysfs var rawreadok
Mark Hounschell [Tue, 4 Mar 2014 21:03:09 +0000 (16:03 -0500)]
staging: dgap: Remove module param and sysfs var rawreadok

This patch removes the rawreadok module param and sysfs var
previously used to enable flip buffer bypass. Code dealing
with that param was removed previously.

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: remove unnecessary dgap_global_lock
Mark Hounschell [Tue, 4 Mar 2014 21:03:08 +0000 (16:03 -0500)]
staging: dgap: remove unnecessary dgap_global_lock

dgap_global_lock is no longer required. This patch
removes it.

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Don't remove sysfs group we failed to create
Mark Hounschell [Tue, 4 Mar 2014 21:03:07 +0000 (16:03 -0500)]
staging: dgap: Don't remove sysfs group we failed to create

We should not remove a sysfs group we failed to create

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: fix some pr_warns with new lines in the string
Mark Hounschell [Mon, 3 Mar 2014 21:36:25 +0000 (16:36 -0500)]
staging: dgap: fix some pr_warns with new lines in the string

This patch fixes some pr_warns that have newline
chars in the string because they mess up the
output.

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Add curly braces back in for Multi-line indent block
Mark Hounschell [Mon, 3 Mar 2014 21:36:24 +0000 (16:36 -0500)]
staging: dgap: Add curly braces back in for Multi-line indent block

Multi-line indent blocks get curly braces for readability.

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro
Mark Hounschell [Tue, 4 Mar 2014 14:33:46 +0000 (09:33 -0500)]
staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro

This patch replaces the DGAP_VERIFY_BOARD macro with
the dgap_verify_board function because of checkpatch error.

Signed-off-by: Mark Hounschell <markh@compro.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Remove more degug/tracing code
Mark Hounschell [Mon, 3 Mar 2014 21:36:22 +0000 (16:36 -0500)]
staging: dgap: Remove more degug/tracing code

This patch removes more, if not all, of the debug/tracing code

Signed-off-by: Mark Hounschell <markh@compro.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Fix various previously missed checkpatch errors
Mark Hounschell [Mon, 3 Mar 2014 18:45:42 +0000 (13:45 -0500)]
staging: dgap: Fix various previously missed checkpatch errors

This patch fixes various small checkpatch errors
I missed in patches 01-10.

Remove check for kfree of brd->channels as kfree is safe.
Also there is no need to set it to NULL after freeing it.

Remove a useless cast for a kzalloc return value.

Remove double negative test in a white space fix line.

Signed-off-by: Mark Hounschell <markh@compro.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Fix printk related errors as reported by checkpatch
Mark Hounschell [Mon, 3 Mar 2014 19:20:51 +0000 (14:20 -0500)]
staging: dgap: Fix printk related errors as reported by checkpatch

This patch fixes some printk related errors report by checkpatch.

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging:dgap: Fix externs should be avoided in .c files as reported by checkpatch
Mark Hounschell [Mon, 3 Mar 2014 14:37:22 +0000 (09:37 -0500)]
staging:dgap: Fix externs should be avoided in .c files as reported by checkpatch

This patch fixes "externs should be avoided in .c files"
in dgap.c as reported by checkpatch

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: unisys: virthba: Add dependency on SCSI
Ken Cox [Thu, 6 Mar 2014 19:39:30 +0000 (13:39 -0600)]
Staging: unisys: virthba: Add dependency on SCSI

If CONFIG_SCSI is not enabled, compiling virthba.c goes horribly wrong with
undefined symbols.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: Give exported symbols unique names
Ken Cox [Wed, 5 Mar 2014 20:52:25 +0000 (14:52 -0600)]
staging: unisys: Give exported symbols unique names

Many exported symbols had very generic names.  This commit changes the names
so that they will be unique.

Signed-off-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: remove unreferenced utility functions.
Ken Cox [Wed, 5 Mar 2014 20:52:24 +0000 (14:52 -0600)]
staging: unisys: remove unreferenced utility functions.

A number of functions were used for debug at one time but that code has been
removed.

Signed-off-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: cxt1e1: removed version string declaration
Shaun Laing [Thu, 6 Mar 2014 15:26:14 +0000 (08:26 -0700)]
staging: cxt1e1: removed version string declaration

Removed the unneeded pmcc4_OSSI_release version string, as well as the now
unused 'release' element of the sbe_card_info struct.  This also resolves a
sparse "should it be static" warning.

Signed-off-by: Shaun Laing <shaun@xresource.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8712: fix an error test in start_drv_threads()
Dan Carpenter [Wed, 5 Mar 2014 08:43:19 +0000 (11:43 +0300)]
Staging: rtl8712: fix an error test in start_drv_threads()

Testing for "if (IS_ERR(padapter->cmdThread) < 0)" doesn't make sense.
The kthread_run() function returns error pointers on error pointers on
error so it should just be "if (IS_ERR(padapter->cmdThread))".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8712: fix some confusing indenting
Dan Carpenter [Wed, 5 Mar 2014 11:26:50 +0000 (14:26 +0300)]
staging: rtl8712: fix some confusing indenting

These set off a static checker warning about "warn: add curly braces?",
but actually the code it correct, it's just the indenting which is
wrong.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: usbip: vhci_sysfs.c: check return value of sscanf
John de la Garza [Thu, 6 Mar 2014 18:36:34 +0000 (10:36 -0800)]
staging: usbip: vhci_sysfs.c: check return value of sscanf

Added code to check return value of sscanf.

Signed-off-by: John de la Garza <john@jjdev.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoMerge tag 'iio-for-3.15c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Thu, 6 Mar 2014 19:33:04 +0000 (11:33 -0800)]
Merge tag 'iio-for-3.15c' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Third IIO new drivers and cleanups series for 3.15.

New driver
* Xilinx XADC driver -  This has been ready for a while but was awaiting
  a device tree ack (or as it turns out 3+ weeks).

Cleanup
* Drop some unreachable code from mag3110 highlighted by smatch.

Fix
* vf610 - introduced this cycle - put a possible negative error code
  into an unsigned long. Another smatch find - this one promoted by
  guilt that Dan was busy fixing all our messups.

10 years agodrivers: staging: rtl8187se: refactor wmm_param_update
Axel Rasmussen [Tue, 4 Mar 2014 07:12:57 +0000 (00:12 -0700)]
drivers: staging: rtl8187se: refactor wmm_param_update

The function rtl8180_wmm_param_update contained two blocks of code which
were nearly identical. This patch combines those two blocks into a
single function, to reduce code duplication, and do fix some
checkpatch.pl warnings about excessively long lines due to the large
number of indents that were needed for the original blocks of code.

Signed-off-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: rtl8187se: wrap excessively long lines
Axel Rasmussen [Tue, 4 Mar 2014 07:12:56 +0000 (00:12 -0700)]
drivers: staging: rtl8187se: wrap excessively long lines

Signed-off-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: rtl8187se: fixed checkpatch.pl errors
Axel Rasmussen [Tue, 4 Mar 2014 07:12:55 +0000 (00:12 -0700)]
drivers: staging: rtl8187se: fixed checkpatch.pl errors

The definition of the driver's ChannelPlan array produced a large number
of checkpatch.pl errors. This patch fixes all of them by adding spaces
and wrapping the resulting overly-long lines.

Signed-off-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: rtl8187se: fixed broken indentation
Axel Rasmussen [Tue, 4 Mar 2014 07:12:54 +0000 (00:12 -0700)]
drivers: staging: rtl8187se: fixed broken indentation

A section of code in the function rtl8180_tx was indented for no reason,
causing numerous checkpatch.pl warnings.

Signed-off-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: rtl8187se: wrap excessively long lines
Axel Rasmussen [Tue, 4 Mar 2014 07:12:53 +0000 (00:12 -0700)]
drivers: staging: rtl8187se: wrap excessively long lines

Signed-off-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: rtl8187se: wrap excessively long lines
Axel Rasmussen [Tue, 4 Mar 2014 07:12:52 +0000 (00:12 -0700)]
drivers: staging: rtl8187se: wrap excessively long lines

Signed-off-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: rtl8187se: wrap excessively long lines
Axel Rasmussen [Tue, 4 Mar 2014 07:12:51 +0000 (00:12 -0700)]
drivers: staging: rtl8187se: wrap excessively long lines

Signed-off-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: rtl8187se: refactor/clean signal smoothing
Axel Rasmussen [Tue, 4 Mar 2014 07:12:50 +0000 (00:12 -0700)]
drivers: staging: rtl8187se: refactor/clean signal smoothing

Signed-off-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>