aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/ni_labpc.c
AgeCommit message (Collapse)Author
2014-08-30staging: comedi: ni_labpc: split common code to ni_labpc_commonIan Abbott
The "ni_labpc" module is a Comedi driver for the National Instruments Lab-PC series of ISA data acquistion boards, and also provides common code for the "ni_labpc_pci" and "ni_labpci_cs" modules (for PCI boards and PCMCIA cards). Split out the common code into a new module "ni_labpc_common", leaving the driver for the ISA boards in the existing "ni_labpc" module. This removes the C preprocessor conditional directives from the resulting ".c" files (although they remain in the included header file "ni_labpc_isadma.h"). Unneccessary `#include` directives have been removed from the resulting ".c" files. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: comedi: ni_labpc: break lines after operatorsIan Abbott
For consistency, break lines before operators, not after. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: comedi: ni_labpc: Logical continuations should be on the previous lineIan Abbott
Fix checkpatch issues "CHECK: Logical continuations should be on the previous line". Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: comedi: ni_labpc: Alignment should match open parenthesisIan Abbott
Fix checkpatch issues "CHECK: Alignment should match open parenthesis". Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: comedi: ni_labpc: use braces on all arms of `if` statementIan Abbott
Fix checkpatch issues "CHECK: braces {} should be used on all arms of this statement". Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: comedi: ni_labpc: remove unnecessary braces in labpc_common_attach()Ian Abbott
Correct checkpatch issue "WARNING: braces {} are not necessary for any arm of this statement". Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-16staging: comedi: 8255: handle memory mapped ioH Hartley Sweeten
The drivers that use this module with memory mapped io all have the ioremap'ed base address stored in the comedi_device 'mmio' member. Introduce a default (*io) function that does 8-bit memory mapped io. Modify subdev_8255_init() so that it takes a flag parameter indicating if the io is port or memory mapped. Make the function static and rename it to __subdev_8255_init(). Introduce two exported wrappers for __subdev_8255_init(): subdev_8255_init() - for drivers that do 8-bit port io subdev_8255_mm_init() - for drivers that do 8-bit memory mapped io Use subdev_8255_mm_init() in the drivers that do 8-bit memory mapped io and remove the private (*io) 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-08-16staging: comedi: 8255: refactor how the (*io) function worksH Hartley Sweeten
Currently, all users of is module that use the default (*io) function pass an 'iobase' to subdev_8255_init() of the form: dev->iobase + OFFSET_TO_8255_BASE_REG Now that the (*io) callback includes the comedi_device 'dev' pointer the 'dev->iobase' does not need to be included. Modify the default (*io) function, subdev_8255_io(), to automatically add the dev->iobase to the address when reading/writing the port. For aesthetics, rename the subdevice private data member to 'regbase'. Also, rename the local variables in this module that are used to access this member. Add a comment in dev_8255_attach() about the 'iobase' that is passed to subdev_8255_init(). For manually attached 8255 devices the io region is requested with __comedi_request_region() which does not set dev->iobase. For these devices the 'regbase' is actually the 'iobase'. Remove the, now unnecessary, dev->iobase from all the callers of subdev_8255_init(). There are a couple drivers that only passed the dev->iobase. For those drivers pass a 'regbase' of 0x00. Note that the das16m1 driver is a bit goofy. The devpriv->extra_iobase is requested using __comedi_request_region() which does not set the dev->iobase. But the starting address passed is dev->iobase + DAS16M1_82C55 so a 'regbase' of DAS16M1_82C55 is passed to subdev_8255_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>
2014-08-16staging: comedi: ni_labpc: tidy up labpc_8255_mmio()H Hartley Sweeten
The 8255 driver (*io) callback now includes the comedi_device pointer. Instead of passing the (cast) pointer to subdev_8255_init(), pass the 'iobase' of the 8255 registers (DIO_BASE_REG). 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-08-16staging: comedi: 8255: add a comedi_device param to the (*io) callbackH Hartley Sweeten
The 8255 driver uses an (*io) callback to read/write the registers of the 8255 device. The default callback provided by the driver uses inb()/outb() calls to access to registers based on an 'iobase' that was initialized during the subdev_8255_init() and a 'port' value. The users of this module can optionally provide a custom (*io) callback to handle the read/write in another manner. Make the (*io) callback a bit more flexible by also passing the comedi_device pointer as a parameter. 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-30staging: comedi: ni_labpc: use the comedi_device 'mmio' memberH Hartley Sweeten
Use the new 'mmio' member in the comedi_device for the ioremap'ed base address. Only the ni_labpc_pci module does the ioremap, its also the only module that sets the 'has_mmio' member in the boardinfo. Remove this member from the boardinfo and use dev->mmio to determine if the I/O is memory mapped. 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-30staging: comedi: ni_labpc: refactor labpc_8255_mmio()H Hartley Sweeten
Refactor the 8255 support code in preperation for using the comedi_device 'mmio' 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-07-30staging: comedi: ni_labpc: don't pass dev->iobase to labpc_counter_set_mode()H Hartley Sweeten
Use the comedi_device parameter that is passed to this function to find the dev->iobase so it does not have to be included in each call. 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-30staging: comedi: ni_labpc: don't pass dev->iobase to labpc_counter_load()H Hartley Sweeten
Use the comedi_device parameter that is passed to this function to find the dev->iobase so it does not have to be included in each call. 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-30staging: comedi: ni_labpc: pass comedi_device to the I/O callbacksH Hartley Sweeten
This driver uses some callbacks in the private data to handle the port mapped or memory mapped I/O used to access the hardware. Pass the comedi_device pointer to the helper functions so that the base address can be found and does not need to be included in each call. Also, remove the inline from the 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>
2014-07-21staging: comedi: drivers: remove unnecessary *_SIZE definesH Hartley Sweeten
Some of the legacy comedi drivers have a *_SIZE define that is only passed to comedi_request_region() to specify the size of the region. Some of the pnp drivers (pci, etc.) also have a *_SIZE define which is unused. For aesthetics, remove these 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-07-17staging: comedi: ni_labpc: tidy up labpc_ai_scan_mode()H Hartley Sweeten
This function checks the cmd->chanlist to determine the scan mode used to sample the analog inputs. All possible modes are checked so the final pr_err() and return 0 can never be reached. Tidy up the function a bit and remove the unreachable code. 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-07-17staging: comedi: ni_labpc: 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-07-16staging: comedi: ni_labpc: checkpatch.pl cleanup (else is not useful)H Hartley Sweeten
Fix the checkpatch.pl warning: WARNING: else is not generally useful after a break or return 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: ni_labpc: use comedi_cmd pointerH Hartley Sweeten
Use a local variable to access the comedi_cmd as a pointer instead of getting to from the comedi_async pointer. 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-03staging: comedi: ni_labpc: fix 8254 timer programmingH Hartley Sweeten
As pointed out by Ian Abbott, the i8254_load() function does not use the I8254_MODE* values to specify the "mode". The labpc_counter_load() function in this driver is passed an I8254_MODE* value so we need to use the i8254_set_mode() and i8254_write() helpers instead of i8254_load() to program the timers. The calls to labpc_counter_load() will not fail so change the return to void and remove all the unnecessary error handling. Similarly, change the return type of labpc_counter_set_mode() to void and remove the unnecessary error handling. 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-04-22staging: comedi: ni_labpc: clarify the cmd->start_arg validationH Hartley Sweeten
This driver supports cmd->start_src sources of TRIG_NOW and TRIG_EXT. Refactor the (*do_cmdtest) to clarify the trivial validation of the cmd->start_arg. This also fixes a bug, the cmd->start_src has the trigger not the cmd->start_arg. 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-04-22staging: comedi: ni_labpc: tidy up the chanlist checkingH Hartley Sweeten
The labpc_ai_chanlist_invalid() function validates that the cmd->chanlist is compatible with the hardware. This is step 5 of the (*do_cmdtest). For aesthetics, rename this function and tidy up the code. To minimize the noise, change the comedi_error(), which is a wrapper around dev_err(), to dev_dbg(). 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-17staging: comedi: ni_labpc: 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(). Also, remove the clearing of the events, comedi_event() does that. In the Kconfig, COMEDI_NI_LABPC already 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-02-14staging: comedi: ni_labpc: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog input end-of-conversion. 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: ni_labpc: sample types are unsignedIan Abbott
Sample values in comedi are generally represented as unsigned values. Change the type of the `data` variable in `labpc_ai_cmd()` from `short` to `unsigned short` for consistency. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26staging: comedi: 8253.h: tidy up the i8253_cascade_ns_to_timer*() usersH Hartley Sweeten
Introduce a couple defines for the common 8254 oscillator base values used in the comedi drivers and remove the custom defines and open coded values. Change the i8253_cascade_ns_to_timer_2div() calls in the drivers to the more generic i8253_cascade_ns_to_timer(). They are identical due to the #define in the 8253.h header. Remove the extra mask by TRIG_ROUND_MASK of the 'round_mode' parameter to i8253_cascade_ns_to_timer(). That function already handles the mask. Tidy up all the calls to i8253_cascade_ns_to_timer(). 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-09-17staging: comedi: ni_labpc: use comedi_range_is_unipolar()H Hartley Sweeten
Use the core provided helper function instead of duplicating it as a private 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>
2013-07-23staging: comedi: ni_labpc: tidy up after DMA code migrationIan Abbott
After migrating the ISA DMA handling code to the "ni_labpc_isadma" module, get rid of an unneeded `#include` and a couple of unused static variables. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: ni_labpc: migrate DMA status handlingIan Abbott
Migrate the code for checking and handling the interrupt status handling for ISA DMA transfers into new a new function `labpc_handle_dma_status()` in the "ni_labpc_isadma" module. Provide a dummy inline function in "ni_labpc_isadma.h" if the "ni_labpc_isadma" module is not being built. The static function `handle_isa_dma()` also needs to move across to the new module. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: ni_labpc: migrate labpc_drain_dma()Ian Abbott
Move `labpc_drain_dma()` into the "ni_labpc_isadma" module. Provide a dummy inline function in "ni_labpc_isadma.h" if the module is not being built. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: ni_labpc: migrate DMA transfer set-upIan Abbott
Migrate the code for setting up an ISA DMA transfer into a new function `labpc_setup_dma()` in the "ni_labpc_isadma" module. Provide a dummy inline function in "ni_labpc_isadma.h" if the "ni_labpc_isadma" module is not being built. The static function `labpc_suggest_transfer_size()` also needs to move across to the new module. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: ni_labpc: move register defs to new fileIan Abbott
The new "ni_labpc_isadma" module will need to access some register definitions from "ni_labpc.c", which is not part of the module's source. Move all the register definitions into a new, common header file "ni_labpc_regs.h". Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: ni_labpc: use labpc_have_dma_chan()Ian Abbott
Call the new static inline function `labpc_have_dma_chan()` from `labpc_ai_cmd()` to check if the ISA DMA channel has been initialized, tidying up the surrounding code and removing an `#ifdef`. If the "ni_labpc_isadma" module is not being built, `labpc_have_dma_chan()` doesn't bother checking the DMA channel and just returns `false`, allowing the compiler to optimize out a small amount of code. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: ni_labpc: migrate DMA channel init & freeIan Abbott
Migrate the code for requesting an ISA DMA channel and a DMA buffer, and the code for freeing them into two new functions in the "ni_labpc_isadma" module: `labpc_init_dma_chan()` and `labpc_free_dma_chan()`. Dummy inline functions are provided in "ni_labpc_isadma.h" if the "ni_labpc_isadma" module is not being built. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: ni_labpc_isadma: new module for ISA DMA supportIan Abbott
It's just an empty module at the moment, selected by COMEDI_NI_LABPC_ISA && ISA_DMA_API && VIRT_TO_BUS, but will be populated by later patches to migrate ISA DMA support for NI Lab-PC cards out of the "ni_labpc" module. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: ni_labpc: don't clear cmd3 bits explicitly in labpc_ai_cmd()Ian Abbott
`labpc_ai_cmd()` calls `labpc_cancel()` which already sets `devpriv->cmd3` to 0. Remove the lines from `labpc_ai_cmd()` that clear specific bits in `devpriv->cmd3` explicitly as they have no effect. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: ni_labpc: fix possible double-free of dma_bufferIan Abbott
If `labpc_attach()` allocates memory for `devpriv->dma_buffer` but fails to request a DMA channel, it frees `devpriv->dma_buffer` but leaves the pointer set. Later, `labpc_detach()` frees `devpriv->dma_buffer` again, which means it has been freed twice in this case. Fix it by only setting `devpriv->dma_buffer` in `labpc_attach()` if the DMA channel was requested successfully. Signed-off-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 Sweeten
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 Sweeten
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-17staging: comedi: drivers: let core handle freeing s->privateH Hartley Sweeten
Introduce a new subdevice runflags, SRF_FREE_SPRIV, and a new helper function, comedi_set_spriv(), that the drivers can use to set the comedi_subdevice private data pointer. The helper function will also set SRF_FREE_SPRIV to allow the comedi core to automatically free the subdevice private data during the cleanup_device() stage of the detach. Currently s->private is only allocated by the 8255, addi_watchdog, amplc_dio200_common, and ni_65xx drivers. All users of those drivers can then have the comedi_spriv_free() calls removed and in many cases the (*detach) can then simply be the appropriate comedi core provided function. The ni_65xx driver uses a helper function, ni_65xx_alloc_subdevice_private(), to allocate the private data. Refactor the function to return an errno or call comedi_set_spriv() instead of returning a pointer to the private data and requiring the caller to handle 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-05-27Merge 3.10-rc3 into staging-nextGreg Kroah-Hartman
We want the changes here, and we resolve the merge conflict that was happening in the nvec_kbd.c file. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-16staging: comedi: ni_labpc: remove *_ai_gain_bits tablesH Hartley Sweeten
The bits needed to set the analog input gain can be simply calculated based on the 'range'. The LabPC versions of the board do not have the '0x10' gain that the LabPC+ board supports. By incrementing the range appropriately the correct gain bits can still be calculated. This allows removing the two gain tables, as well as the export, along with the 'ai_range_code' data in the boardinfo. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-13staging: comedi: ni_labpc: fix build when VIRT_TO_BUS is not definedH Hartley Sweeten
After merging the final tree, the next-20130424 build (powerpc allyesconfig) failed like this: drivers/staging/comedi/drivers/ni_labpc.c: In function 'labpc_ai_cmd': drivers/staging/comedi/drivers/ni_labpc.c:980:9: error: implicit declaration of function 'virt_to_bus' [-Werror=implicit-function-declaration] The virt_to_bus() is only needed for the ISA DMA support in this driver. On powerpc, CONFIG_COMEDI_NI_LABPC_ISA cannot be enabled due to the depends on VIRT_TO_BUS but the PCI driver, ni_labpc_pci, can be enabled. That driver uses the ni_labpc driver for the common support code shared by the ISA, PCI, and PCMCIA boards. The ISA specific support, and the optional ISA DMA support, are currently still in the common ni_labpc driver. The ISA specific code is protected by #if IS_ENABLED(CONFIG_COMEDI_NI_LABPC_ISA) and the ISA DMA support is protected by #ifdef CONFIG_ISA_DMA_API. This allows the ISA support to be enabled on architectures that support VIRT_TO_BUS and optionally enables ISA DMA support if ISA_DMA_API is enabled. Unfortunately, the ISA DMA code uses virt_to_bus(). This results in the build failure for architectures that enable ISA_DMA_API but do not have VIRT_TO_BUS. Add a new member to the private data, dma_addr, to hold the phys_addr_t returned by virt_to_bus() and initialize it in the ISA specific labpc_attach(). For architectures that enable ISA_DMA_API but not VIRT_TO_BUS, this will fix the build error. This is also safe for architectures the enable both options but don't enable COMEDI_NI_LABPC_ISA because the dma channel (devpriv->dma_chan) is only initialized in the ISA specific labpc_attach(). Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-13staging: comedi: remove FSF address from boilerplate textH Hartley Sweeten
Addresses change... Remove the paragraph with the FSF address from all the comedi source files. Also, remove the paragraph about the finding the complete GPL in the COPYING file since it's unnecessary. 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-05-13staging: comedi: ni_labpc: remove range_labpc_1200_ai exportH Hartley Sweeten
The 'ai_range_table' boardinfo is only used to initialize the analog input subdevice s->range_table. We can use the 'is_labpc1200' flag in the boardinfo to determine which range table is needed. This allows making range_labpc_1200_ai static and removing the export as well as removing the 'ai_range_table' from the boardinfo. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-13staging: comedi: ni_labpc: cleanup true/false flags in boardinfoH Hartley Sweeten
The 'register_layout' in the boardinfo can be represented as a true/false flag instead of an enum. Rename the variable to 'is_labpc1200' and change it to an unsigned 1-bit bit-field. The 'has_ao' variable is also a true/false flag. Change it to an unsigned 1-bit bit-field. Reorder the boardinfo data so that the bit-field data is grouped together. For aesthetic reasons, and move the 'const' variables then reorder the boardinfo declarations to match the definition. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-23staging: comedi: ni_labpc: fix legacy driver buildH Hartley Sweeten
CONFIG_COMEDI_NI_LABPC_ISA is a tristate option. #if IS_ENABLED() needs to be used instead of #ifdef in order to build the legacy specific code in this driver. The local variable 'board' is not used in labpc_attach(). Remove it. The labpc_detach() function is only referenced in this file. Make it static. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-23staging: comedi: ni_labpc: remove 'bustype' from boardinfoH Hartley Sweeten
The 'bustype' in the boardinfo 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>
2013-04-23staging: comedi: ni_labpc: remove unnecessary 'bustype' checkH Hartley Sweeten
Only the ISA versions of the LabPC boards support DMA and the devpriv->dma_chan is only set during the ISA board attach if DMA is available. The extra check of the board->bustype is not necessary in labpc_ai_cmd(). 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>