aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/pcmuio.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-11-28staging: comedi: drivers: Remove redundant license textGreg Kroah-Hartman1-10/+0
Now that the SPDX tag is in all comedi files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: add SPDX identifiers to all greybus driver filesGreg Kroah-Hartman1-0/+1
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>
2016-06-17staging:comedi:Use unsigned int instead of unsignedNikita Eshkeev1-1/+1
This patch fixed the checkpatch.pl warning: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: Nikita Eshkeev <kastolom@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03staging: comedi: pcmuio: remove #include "comedi_fc.h"Ian Abbott1-15/+14
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: alignment should match open parenthesisH Hartley Sweeten1-1/+1
Fix the alignment issues in all the comedi drivers. 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-06staging: comedi: drivers/*.c: fix common misspellingsH Hartley Sweeten1-1/+1
Fix these common misspellings: s/dependancy/dependency s/occured/occurred s/informations/information s/intialize/initialize s/serveral/several s/interrups/interrupts s/acknowledgement/acknowledgment s/suppport/support s/writting/writing 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-09staging: comedi: pcmuio: rewrite "Devices:" lineIan Abbott1-2/+1
Rewrite the "Devices:" line in the comedi "driver" comment to conform to the usual comedi format for this line. The line should be a comma-separated list where the first item is in the following format: [Manufacturer] BOARD-NAME (comedi-board-name) The "[Manufacturer]" and/or "(comedi-board-name)" parts may be omitted from following items, in which case the parts from the preceding item are used. The "Devices:" line may be continued continued over several lines by using one or more spaces at the start of each continuation line (not counting the space after the "*" in the block comment). 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-11-05staging: comedi: pcmuio: use comedi_async 'scans_done' to detect EOAH Hartley Sweeten1-11/+3
Remove the private data member 'stop_count' 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-10-29staging: comedi: pcmuio: use comedi_buf_write_samples()H Hartley Sweeten1-5/+3
The dev->read_subdev used in this driver for async commands returns 32-bit samples and should have the SDF_LSAMPL subdev_flag set. It also returns the full scan with each sample so it should have the SDF_PACKED subdev_flag set. Add the missing subdev_flags and use comedi_buf_write_samples() to add the sample to the async buffer. The COMEDI_CB_BLOCK and COMEDI_CB_EOS events will be automatically handled by the core. Remove the unnecessary events 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: pcmuio: use comedi_handle_events()H Hartley Sweeten1-13/+3
Use comedi_handle_events() to automatically (*cancel) the async command for an end-of-acquisition or if an error/overflow occurs. Also, comedi_handle_events() does nothing if no events are set so the local variable 'oldevents' can be removed. 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: pcmuio: return void from pcmuio_start_intr()H Hartley Sweeten1-14/+4
This function always returns '0' so the comedi_event() is never done by the callers. Change the return type to void and remove the comedi_event() dead 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>
2014-09-11staging: comedi: pcmuio: 'stop_count' is always 'stop_arg'H Hartley Sweeten1-10/+1
When the cmd->stop_src == TRIG_COUNT, the 'stop_count' is the cmd->stop_arg. For any other stop_src the 'stop_count' is 0, which is also the cmd->stop_arg. Simplify the 'stop_count' initialization. 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: pcmuio: remove 'continuous' from private dataH Hartley Sweeten1-5/+1
This member of the private data is set based on the cmd->stop_src. Just use the cmd->stop_src directly 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>
2014-09-11staging: comedi: pcmuio: remove "empty acquisition" async commandH Hartley Sweeten1-16/+3
This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg of 0. This causes the (*do_cmd) to immediately generate a COMEDI_CB_EOA event without acquiring any data. This "empty acquisition" async command is not really useful. Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) and remove the "empty acquisition" 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>
2014-09-11staging: comedi: pcmuio: replace comedi_board() callsIan Abbott1-2/+2
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-16staging: comedi: pcmuio: checkpatch.pl cleanup (missing blank line)H Hartley Sweeten1-0/+1
Fix the checkpatch.pl warning: WARNING: Missing a blank line after declarations 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-05-28staging: comedi: pcmuio: tidy up local variables in pcmuio_handle_intr_subdev()H Hartley Sweeten1-3/+3
Tidy up the local variables so that the comedi_cmd is accessed as a pointer instead of getting to it from the comedi_subdevice pointer. Remove the local variable 'len' and use the cmd->chanlist_len directly. 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 Abbott1-2/+2
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-04-22staging: comedi: pcmuio: fix the cmd->start_arg use for TRIG_INTH Hartley Sweeten1-14/+8
This driver supports a cmd->start_src of TRIG_NOW or TRIG_INT. The cmd->start_arg is trivially validated for both sources to be 0. For a TRIG_INT source, the cmd->start_arg is actually the valid trig_num that is used by the async (*inttrig) callback. Refactor the (*inttrig) function so that the cmd->start_arg is used to check the trig_num instead of the open coded value. For aesthetics, refactor the (*do_cmd) to use if/else instead if the switch when handling the cmd->start_src. 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>
2013-12-06staging: comedi: pcmuio: tidy up pcmuio_start_intr()H Hartley Sweeten1-20/+24
Refactor this function a bit to remove the need for an extra indent level and cleanup some of the odd line breaks. 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>
2013-12-06staging: comedi: pcmuio: tidy up pcmuio_attach()H Hartley Sweeten1-24/+19
Clean up the local variables, 'sdev_no' and 'asic' are both used in simple for () loops. Use the local variable 'i' for both cases. The 'n_subdevs' variable is only used in one place, just remove it. For aesthetics, add some whitespace to the subdevice init and reorder it to follow the more typical style in comedi drivers. Remove the unnecessary init of s->len_chanlist for subdevices that do not support async commands (interrupts). The core will default it to the correct value. 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>
2013-12-06staging: comedi: pcmuio: remove unneeded includeH Hartley Sweeten1-1/+0
The <linux/slab.h> header is no longer needed by this driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-06staging: comedi: pcmuio: fix types of some private data variablesH Hartley Sweeten1-4/+4
The 'enabled_mask' is a bit mask of the channels that are enabled for interrupt detection and should be an unsigned int. The 'stop_count' is a >= 0 value that is set by the unsigned int cmd->stop_arg. Make it an unsigned int. The 'active' and 'continuous' members are flags. Make them unsigned int bit-fields to save a bit of space. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-06staging: comedi: pcmuio: document the spinlock_t variablesH Hartley Sweeten1-2/+4
Add some comments about the two spinlock_t variables in the private data. Also, add come comments for the functions that do not need to lock/unlock the spinlock. 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>
2013-12-06staging: comedi: pcmuio: add inline helpers to get the 'iobase', 'asic', and 'port'H Hartley Sweeten1-13/+37
To reduce the potential for bugs, and better document the code, introduce some inline helper functions to consolidate the calculations needed to get the 'iobase' for a given asic and the 'asic' and 'port' associated with a given 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>
2013-12-06staging: comedi: pcmuio: remove unnecessary mask of triggered channelsH Hartley Sweeten1-7/+3
The 'triggered' value is read directly from the three trigger id registers and does not have any extra data that needs masked off. Remove the 'mytrig' local variable and just use 'triggered' directly. 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>
2013-12-06staging: comedi: pcmuio: fix pcmuio_dio_insn_bits()H Hartley Sweeten1-15/+20
This dio subdevice (*insn_bits) function does not follow the "norm" for comedi drivers. It also _appears_ to return the incorrect state of the channels. Use the comedi_dio_update_state() helper to handle the boilerplate for updating the output channel state. Due to the hardware we then need to invert the state and mask the input channels before updating the outputs. Then read the hardware and invert the result to get the current true state of the dio 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>
2013-12-06staging: comedi: pcmuio: remove subdevice private dataH Hartley Sweeten1-67/+65
The subdevice private data is only needed for each 'asic' not for each subdevice. Since the 'asic' can be calculated easily from the subdevice we can merge the subdevice private data members directly into the private data. This removes the need to kcalloc/free the subdevice private data and saves a bit of space. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-06staging: comedi: pcmuio: remove 'asic' member from subdevice private dataH Hartley Sweeten1-15/+3
The 'asic' associated with a subdevice can be easily calculated. The functions that use this member in the subdevice private data can only be called by the subdevices that support interrupts. Just calculate the 'asic' when needed and remove the member variable and sanity checks. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-06staging: comedi: pcmuio: tidy up pcmuio_handle_asic_interrupt()H Hartley Sweeten1-29/+15
Unfortunatly, since there could be two asics, we can't use dev->read_subdev to get the subdevice. But, the comedi_subdevice associated with the 'asic' can easily be calculated. This allows removing the for () loop that searched for the correct subdevice. Tidy up the function. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-06staging: comedi: pcmuio: spinlock protect pcmuio_{write, read}()H Hartley Sweeten1-8/+10
Currently only the pcmuio_handle_asic_interrupt() function uses the spinlock in the private data to protect the read of the paged interrupt id registers. All accesses to the paged registers should be protected to ensure that the page is not changed until the access is complete. Move the lock/unlock into the pcmuio_{write,read}() functions to make sure the access completes correctly. Rename the spinlock to variable to clarify its use. 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>
2013-12-06staging: comedi: pcmuio: fix interrupt requestsH Hartley Sweeten1-41/+40
Legacy (ISA) interrupts are not sharable so this driver should not be passing the IRQF_SHARED flag when requesting the interrupts. This driver supports two board types: PCM-UIO48 with one asic (one interrupt source) PCM-UIO96 with two asics (two interrupt sources) The PCM-UIO96 has a jumper that allows the two interrupt sources to share an interrupt. This is safe for legacy interrupts as long as the "shared" interrupt is handled by a single driver. Modify the request_irq() code in this driver to correctly request the interrupts. For the PCM-UI048 case (one asic) only one request_irq() is needed. For the PCM-UIO96 (two asics) there are three cases: 1) irq is shared, one request_irq() call 2) only one asic has an irq, one request_irq() call 3) two irqs, two request_irq() calls The irq for the first asic (dev->irq) will be requested during the attach if required. The comedi core will handle the freeing of this irq during the detach. The irq for the second asic (devpriv->irq2) will also be requested during the attach if required. The freeing of this irq will be handled by the driver during the detach. Move the board reset and interrupt request code so it occurs early in the attach. We can then check dev->irq and devpriv->irq2 to see if the subdevice command support actually needs to be initialized. This also simplifies the interrupt handler. The irq can be simply checked against dev->irq and devpriv->irq2 to see which asic caused the interrupt. Add a call to pcmuio_reset() in the (*detach) to make sure the interrupts are disabled before freeing the irqs. 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>
2013-10-16staging: comedi: pcmuio: sample types are unsignedIan Abbott1-2/+2
Sample values in comedi are generally represented as unsigned values. Change `pcmuio_handle_intr_subdev()` in the "pcmuio" module to use unsigned sample values for consistency. Also, make the order in which `pcmuio_handle_intr_subdev()` writes the two sample values (each actually containing up to 16 1-bit sample values) independent of the host byte ordering. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-22staging: comedi: pcmuio: fix possible NULL deref on detachIan Abbott1-5/+6
pcmuio_detach() is called by the comedi core even if pcmuio_attach() returned an error, so `dev->private` might be `NULL`. Check for that before dereferencing it. Also, as pointed out by Dan Carpenter, there is no need to check the pointer passed to `kfree()` is non-NULL, so remove that check. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: comedi: drivers: use comedi_dio_insn_config() for simple casesH Hartley Sweeten1-16/+8
Convert the drivers with simple, per channel programmable i/o, to use the comedi_dio_insn_config() helper function. All of these pass a 'mask' of '0' to comedi_dio_insn_config() this causes the per channel mask to be used to configure the i/o direction. 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>
2013-07-23staging: comedi: don't rely on comedidev.h to include headersH Hartley Sweeten1-0/+1
comedidev.h is the main kernel header for comedi. Every comedi driver includes this header which then includes a number of <linux/*> headers. All the drivers need <linux/module.h> and some of them need <linux/delay.h>. The rest are not needed by any of the drivers. Remove all the includes in comedidev.h except for <linux/dma-mapping.h>, which is needed to pick up the enum dma_data_direction for the comedi_subdevice definition, and "comedi.h", which is the uapi header for comedi. Add <linux/module.h> to all the comedi drivers and <linux/delay.h> to the couple that need it. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: use comedi_alloc_devpriv()H Hartley Sweeten1-2/+1
Use the helper function to allocate memory and set the comedi_device private data pointer. This removes the dependency on slab.h from most of the drivers so remove the global #include in comedidev.h and the local #include in some of the drivers. 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>
2013-06-24staging: comedi: pcmuio: fix namespace for all private functionsH Hartley Sweeten1-4/+4
Rename a couple private functions so they have the same namespace as 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>
2013-06-24staging: comedi: pcmuio: return 0 for successful attachH Hartley Sweeten1-1/+1
Returning 0 for success is more common. 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>
2013-06-24staging: comedi: pcmuio: remove dev_dbg() noise during attachH Hartley Sweeten1-10/+0
This is just added noise. 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>
2013-06-24staging: comedi: pcmuio: use preferred form for passing the size of a structH Hartley Sweeten1-3/+1
As suggested by the 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>
2013-06-24staging: comedi: pcmuio: cleanup remaining #define'sH Hartley Sweeten1-25/+12
Remove all the unused #define's and add namespace to the ones that are used. 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>
2013-06-24staging: comedi: pcmuio: cleanup DIO subdevice (*insn_{bits,config})H Hartley Sweeten1-75/+29
Use the pcmuio_{read,write}() helpers to read/write all 24 channels instead of handling the digital I/O as three separate ports. This simplifies both functions with minimal overhead. 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>
2013-06-24staging: comedi: pcmuio: introduce pcmuio_read()H Hartley Sweeten1-21/+24
Introduce a helper function to handle reading a 24-bit value from the three 8-bit registers associated with a "port" or "page". Simplify the for() loop in pcmuio_handle_asic_interrupt() that finds which channels have triggered the interrupt. 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>
2013-06-24staging: comedi: pcmuio: simplify interrupt subdevice initH Hartley Sweeten1-28/+14
Only subdevices 0 and 2 support interrupts. 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>
2013-06-24staging: comedi: pcmuio: remove 'iobases' from subdevice private dataH Hartley Sweeten1-23/+15
The 'asic' and 'port' associated with a given subdevice can easily be found based on the subdevice 'index'. With that information we can then calculate the correct iobase and register offset needed to read/ write the 8-bit ports. 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>
2013-06-24staging: comedi: pcmuio: remove 'iobase' from private dataH Hartley Sweeten1-7/+4
It's simple enough to calculate the iobase when needed. Remove this member 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>
2013-06-24staging: comedi: pcmuio: simplify 'n_subdevs' and 's->n_chan'H Hartley Sweeten1-14/+3
The number of subdevices needed by the driver is based on the 'num_asics' reported by the boardinfo and each subdevice always has 24 channels. 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>
2013-06-24staging: comedi: pcmuio: remove unused boardinfoH Hartley Sweeten1-4/+0
These members of the boardinfo are not used by the driver. Remove them. 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>
2013-06-24staging: comedi: pcmuio: kzalloc'ed data does not need clearedH Hartley Sweeten1-3/+0
The 'subpriv' pointer is kzalloc'ed during the attach. 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>