aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/pcl816.c
AgeCommit message (Collapse)Author
2018-07-11staging: comedi: remove redundant variable segposColin Ian King
Variable segpos is being assigned but is never used hence it is redundant and can be removed. Cleans up clang warning: warning: variable 'segpos' set but not used [-Wunused-but-set-variable] Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: add SPDX identifiers to all greybus driver filesGreg Kroah-Hartman
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/staging/comedi files files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12staging: comedi: pcl816: remove #if 0'ed out codeH Hartley Sweeten
Remove the #if 0'ed out code that would initialize an analog output subdevice. The hardware does not normally support an analog output subdevice. Analog outputs are only supported with additional "piggyback" modules. Support for these modules is not included in 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>
2015-10-12staging: comedi: pcl816: prefer using the BIT macroH Hartley Sweeten
Fix the checkpatch.pl issues. 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>
2015-10-12staging: comedi: pcl816: tidy up multi-line commentsH Hartley Sweeten
Reformat the multi-line comments in the kernel CodingStyle. 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>
2015-07-22staging: comedi: drivers: pcl816.c remove leading spaceChandra S Gorentla
Checkpatch.pl warning - suspect code indent for conditional statements - is corrected Signed-off-by: Chandra S Gorentla <csgorentla@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31staging: comedi/drivers/pcl.* coding style fixesMatthew Needes
pcl812.c / pcl816.c (resend of earlier patch) Fixed indentation problems. Signed-off-by: Matthew Needes <mneedes@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03staging: comedi: pcl816: remove #include "comedi_fc.h"Ian Abbott
As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06staging: comedi: drivers/*.c: remove unnecessary blank linesH Hartley Sweeten
Blank lines are not needed before a close brace '}' or after an open brace '{'. Also remove any multiple blank lines. 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>
2015-03-01staging: comedi: pcl816: convert driver to use the comedi_8254 moduleH Hartley Sweeten
This driver uses an 8254 timer to generate the pacer clock used for analog input data conversion. Convert it to use the comedi_8254 module to provide support for the 8254 timer. 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>
2015-01-17staging: comedi: pcl816: use common function to setup dmaH Hartley Sweeten
THe pcl816_ai_setup_dma() and pcl816_ai_setup_next_dma() functions are similar other than the buffer switch and the inclusion of the "unread_samples" in pcl818_ai_setup_next_dma() when calculating the dma size. Merge these two functions by initializing the 'dma->cur_dma' in the callers and passing '0' for the "unread_samples" when first starting the 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>
2015-01-17staging: comedi: pcl816: simplify the dma->size calculationsH Hartley Sweeten
Currently this driver determines the number of DMA "runs" needed and the size of the "last" DMA transfer in order to perform a command. As long as there are more "runs" required, the dma->size is set to the buffer maxsize. On the last "run" the buffer is set to the "last" size. Refactor the driver to use the comedi core helpers to determine the DMA size based on the buffer maxsize and the number of samples remaining in the command. This allows removing the 'dma_runs_to_end' and 'last_dma_run' mamebers from the private data. 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>
2015-01-17staging: comedi: pcl816: remove depends on ISA_DMA_API limitationH Hartley Sweeten
Use the new comedi_isadma module to provide the ISA DMA support. This removes all the ISA_DMA_API code from this driver and allows the driver to be used on platforms that don't support the ISA_DMA_API. 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>
2015-01-17staging: comedi: pcl816: introduce pcl816_isadma_disable()H Hartley Sweeten
According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be claimed before using any of the ISA DMA routines. Introduce a helper function to disable the ISA DMA controller and add the necessary locking calls. 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>
2015-01-17staging: comedi: pcl816: introduce pcl816_isadma_program()H Hartley Sweeten
Introduce a helper function to program the ISA DMA controller. Program the ISA DMA as described in Documentation/DMA-ISA-LPC.txt. 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>
2015-01-17staging: comedi: pcl816: fix short DMA transactionsH Hartley Sweeten
When the cmd->stop_src == TRIG_COUNT the last DMA transfer might be smaller than the buffer size. This results in invalid data being added to the async buffer. Add a 'size' member to the DMA descriptor and initialize it with the actual size of the DMA transfer. Use that in interrupt and ai subdevice (*poll) function to return the proper number of samples. Use the comedi_bytes_to_samples() helper to convert the byte size to comedi samples in the interrupt handler. 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>
2015-01-17staging: comedi: pcl816: remove VIRT_TO_BUS dependancyH Hartley Sweeten
Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers. This removes the dependancy on VIRT_TO_BUS. 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>
2015-01-17staging: comedi: pcl816: introduce struct pcl816_dma_descH Hartley Sweeten
For aesthetics, introduce a struct to hold the DMA descriptor data. 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>
2015-01-17staging: comedi: pcl816: introduce pcl816_free_dma()H Hartley Sweeten
For aesthetics, move the freeing of the DMA channel and the buffers to a helper 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>
2015-01-17staging: comedi: pcl816: introduce pcl816_alloc_dma()H Hartley Sweeten
The IRA and DMA are optional with this driver but both are required to support async commands. Introduce a helper function to request the IRQ and DMA channel and allocate the buffers. Don't fail the driver attach if the user passed an invalid IRQ or DMA channel or they cannot be requested. 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>
2014-11-05staging: comedi: pcl816: use comedi_async 'scans_done' to detect EOAH Hartley Sweeten
Remove the private data member 'ai_act_scan' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. 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>
2014-11-03staging: comedi: drivers: move comedi_async 'cur_chan' tracking into the coreH Hartley Sweeten
The commedi_async 'cur_chan' member is used to track the current position in the chanlist for a scan. Currently only a couple comedi drivers use this member. For aeshtetics, move the 'cur_chan' tracking into the core for non-SDF_PACKED subdevices. The 'cur_chan' will be updated after reading or writing samples to the async buffer by comedi_inc_scan_progress(). All non-SDF_PACKED subdevices will then automatiaclly track the 'cur_chan'. Some of the drivers use the 'cur_chan' to detect the end of scan event when counting scans. The COMEDI_CB_EOS event is automatically added by the core when the end of scan is detected. The drivers just need to check if the 'cur_chan' is 0 to count the number of scans completed. 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>
2014-11-03staging: comedi: drivers do not need to reset the async->cur_chanH Hartley Sweeten
The comedi core calls comedi_buf_reset() before starting an async command (*do_cmd) and after returning a subdevice to an idle state (*cancel). The drivers do not need to reset the async->cur_chan in those 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>
2014-10-29staging: comedi: pcl816: use comedi_buf_write_samples()H Hartley Sweeten
For aesthetics, use comedi_buf_write_samples() to add the sample to the async buffer. The core will add the COMEDI_CB_BLOCK event when data is written to the async buffer. Remove the unnecessary event in 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>
2014-10-20staging: comedi: pcl816: use comedi_bytes_per_scan()H Hartley Sweeten
This inline function is just a wrapper around comedi_bytes_per_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>
2014-10-20staging: comedi: pcl816: use comedi_handle_events()H Hartley Sweeten
cfc_handle_events() is just a wrapper around comedi_handle_events(). 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>
2014-09-11staging: comedi: pcl816: replace comedi_board() callsIan Abbott
The `comedi_board(dev)` inline function calls just return `dev->board_ptr`. Expand the inline function calls. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21staging: comedi: pcl816: remove forward declarationH Hartley Sweeten
Move check_channel_list() to remove the need for the 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>
2014-07-17staging: comedi: pcl816: remove use of comedi_error()H Hartley Sweeten
The comedi_error() function is just a wrapper around dev_err() that adds the dev->driver->driver_name prefix to the message and a terminating new-line character. The addition of the driver_name is just added noise and some of the users of comedi_error() add unnecessary additional new-line characters. Use dev_err() directly instead of comedi_error() to avoid any confusion and so that all the comedi generated kernel messages have the same format. 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>
2014-06-26staging: comedi: introduce comedi_buf_n_bytes_ready()H Hartley Sweeten
Introduce an inline helper to return the number of bytes that are ready to read from the comedi_async buffer. Use the helper in the comedi drivers that currently do the calculation as part of the (*poll) operation. Also, use the helper in comedi_fops where the calculation is used as part of the subdevice going nonbusy. 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>
2014-05-28staging: comedi: pcl816: use cfc_bytes_per_scan()H Hartley Sweeten
Use the comedi_fc helper to get the number of bytes per 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>
2014-05-28staging: comedi: pcl816: fix DMA 'bytes' calculationH Hartley Sweeten
The calculation for the total number of bytes in the DMA transfer is incorrect. Fix 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>
2014-05-28staging: comedi: pcl816: use comedi_fc helpers to validate timer argH Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the trigger argument when the source is TRIG_TIMER. The minimum test is not needed, this was already validated in Step 3. All the arguments are unsigned int, change the local variable to an unsigned int and rename it for aesthetic reasons. 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>
2014-05-23staging: comedi: pass subdevice to comedi_buf_put()Ian Abbott
Change the parameters of `comedi_buf_put()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The function puts a sample value in the comedi buffer, but currently only deals with 16-bit sample types. A future version could deal with 16 or 32-bit sample types depending on the value of the SDF_LSAMPL subdevice flag. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17staging: comedi: pcl816: use cfc_handle_events()H Hartley Sweeten
Use the comedi_fc helper function to automatically call the subdevice (*cancel) function when needed and call comedi_event(). Update the Kconfig so that COMEDI_PCL816 selects COMEDI_FC. 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>
2014-03-06staging: comedi: pcl816: tidy up the remaining register definesH Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: define the mode register bitsH Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: cleanup setup_channel_list()H Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: define the status register bitsH Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: tidy up analog input registersH Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: introduce pcl816_ai_soft_trig()H Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: introduce pcl816_ai_clear_eoc()H Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: tidy up the analog input (*insn_read)H Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: move pcl816_reset()H Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: add support for digital subdevicesH Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: consolidate the interrupt codeH Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: remove 'int816_mode' from private dataH Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: exit interrupt quick when there is nothing to doH Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: clarify 'irq_was_now_closed' flag in private dataH Hartley Sweeten
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>
2014-03-06staging: comedi: pcl816: reduce indent level in pcl816_ai_cancel()H Hartley Sweeten
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>