aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/ni_atmio.c
AgeCommit message (Collapse)Author
2018-03-19Staging: comedi: drivers: ni_atmio.c: fixed multi-line derefernce issuePratik Jain
Fixed coding style issue. Signed-off-by: Pratik Jain <pratik.jain0509@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06Merge Linus's staging merge point into staging-nextGreg Kroah-Hartman
This resolves the merge issue pointed out by Stephen in drivers/iio/adc/meson_saradc.c. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: ni_atmio: fix license warning.Matthew Giassa
Resolving license check warning for drivers/staging/comedi. Added the license definitions present in the rest of the module and made sure it's aligned with the license (GPL) in the comments for the affected file (ni_atmio.c). Original warning: WARNING: modpost: missing MODULE_LICENSE() in drivers/staging/comedi//drivers/ni_atmio.o see include/linux/module.h for more information. No longer present after change. Signed-off-by: Matthew Giassa <matthew@giassa.net> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: drivers: Remove redundant license textGreg Kroah-Hartman
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-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>
2017-03-09staging: comedi: ni_atmio: make device_ids constIan Abbott
The `device_ids[]` passed to `MODULE_DEVICE_TABLE()` should be `const`. When the "ni_atmio" driver is built-in, gcc warns about `device_ids` being defined but ununsed. Make it `const`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-02staging: comedi: ni_atmio.c: Fix checkpatch warningAnson Jacob
Fix checkpatch.pl warning for 'Statements should start on a tabstop' Convert single line block comment to single line comment Align single line comment Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21staging: comedi: ni_atmio: fix block commentsH Hartley Sweeten
Fix the checkpatch.pl issues: WARNING: Block comments use * on subsequent 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-06-18staging: comedi: ni_atmio: cleanup ni_getboardtype()H Hartley Sweeten
Make this function return a pointer to the boardinfo instead of an index. For aesthetics, rename the function to ni_atmio_probe(). 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: 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-06staging: comedi: ni_atmio: (!foo) preferred over (foo == NULL)H Hartley Sweeten
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-02-07staging: comedi: drivers: ni_atmio: Removed variables that is never usedRickard Strandqvist
Variable ar assigned a value that is never used. I have also removed all the code that thereby serves no purpose. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-11staging: comedi: ni_atmio: 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: drivers: use dev->board_name in request_irq()H Hartley Sweeten
Most of the comedi drivers use the dev->board_name for the id string passed to request_irq(). Fix the couple that still pass something else. Also, propogate the errno from request_irq(). 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-18staging: comedi: ni_atmio: remove printk noise in ni_isapnp_find_board()H Hartley Sweeten
The printk() messages in this function a just added noise. Remove them. 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-18staging: comedi: ni_atmio: convert printk to dev_err in ni_getboardtype()H Hartley Sweeten
Convert these printk() messages to dev_err(). 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-18staging: comedi: ni_atmio: remove board attach noiseH Hartley Sweeten
Remove the printk messages in the (*attach) of this driver. These are just added noise. 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_mio_common: refactor 'num_p0_dio_channels' boardinfoH Hartley Sweeten
All of the board supported by this driver have at least 8 Digital I/O channels. A couple of the PCI boards in ni_pcimio have 32 channels. For aesthetics, change this member of the boardinfo into a bit-field flag, 'has_32dio_chan', and use that when initializing the DIO subdevice to set the number of channels to 32 or 8. 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-16staging: comedi: ni_stc.h: refactor 'aobits' boardinfoH Hartley Sweeten
For aesthetics, change the 'aobits' in the boardinfo to 'ao_maxdata' to remove the need for the calculation of the subdevice 'maxdata'. 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-16staging: comedi: ni_stc.h: refactor 'adbits' boardinfoH Hartley Sweeten
For aesthetics, change the 'adbits' in the boardinfo to 'ai_maxdata' to remove the need for the calculation of the subdevice 'maxdata'. 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-16staging: comedi: ni_stc.h: remove 'ao_unipolar' flag from ni_board_structH Hartley Sweeten
This member of the boardinfo for the NI MIO drivers is used to indicate if the ranges for the analog output subdevice (ao_range_table in the boardinfo) includes any unipolar ranges. If it's not set, the ao_range_table only has bipolar ranges. The 'ao_unipolar' flag is checked when munging the ao data values from the user so that the values for bipolar ranges are converted to 2's complement values before they are written to the hardware. The flag is also used when programming the analog output configuration on non-M series boards for bipolar/unipolar and external reference operation. Simplify the driver a bit by removing this boardinfo flag and just using the comedi_range_is_bipolar() and comedi_range_is_external() helpers to check the range 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-06-29staging: comedi: ni_atmio: remove ATMIO and PCIMIO definesH Hartley Sweeten
These defines were probably intended to be used so that ni_mio_common.c could detect if it was included by a driver that uses ioport or memory mapped register access. This can actually be detected by checking if the 'mite' member in the private data has been allocated. Regardless, the symbols are not used. Just 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>
2014-06-29staging: comedi: ni_stc.h: the boardinfo 'name' should be firstH Hartley Sweeten
By convention, the first member of the boardinfo is a 'const char *' to the board name, especially for those comedi drivers that rely on the comedi core to set dev->board_ptr to the entry matching the board name when doing a legacy (*attach) to a comedi driver. Modify the ni_board_struct appropriately for consistency, although the board name is only used for informational purposes by this driver (only the driver name is matched by the comedi core). For aesthetics, also move the members in the boardinfo declarations. 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-06-29staging: comedi: ni_atmio: tidy up the boardinfoH Hartley Sweeten
For aesthetics, add some whitespace to the boardinfo 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-06-29staging: comedi: ni_atmio: remove NI_SIZE defineH Hartley Sweeten
This define is only used in the comedi_request_region() to specify the size of the region. Remove the define and just open code the value. 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-06-29staging: comedi: ni_atmio: remove '= 0' boardinfo dataH Hartley Sweeten
Remove all the boardinfo data the is set to '0'. They will default to that when the boardinfo is declared. 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-06-29staging: comedi: ni_mio_common.c: remove IRQ_POLARITY definesH Hartley Sweeten
Pass the irq_polarity to ni_E_init() and remove the 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-06-29staging: comedi: ni_mio_common drivers: remove NI_E_IRQ_FLAGS definesH Hartley Sweeten
These defines are only used in the request_irq() calls. Remove them and just open code the 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>
2014-06-29staging: comedi: ni_mio_common.c: remove interrupt_pin() macrosH Hartley Sweeten
Pass the 'interrupt_pin' to ni_E_init() and remove the macros. 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-06-19staging: comedi: ni_stc.h: remove stc read/write callbacks from ni_privateH Hartley Sweeten
The drivers that include ni_mio_common.c set the stc register read/write callbacks to private functions that handle the read/write operations in the correct manner for the hardware. The ni_atmio and ni_mio_cs drivers use identical code to handle the operations. The ni_pcimio driver is a bit different due to the non-windowed setup of the stc registers on the m series boards. For the other boards supported by the ni_pcimio driver, the direct access of the first 8 STC registers is also disabled due to a difference on the 611x devices. These differences can all be handled in the ni_stc_{read,write}[lw]() helpers. Refactor the helpers and remove the callbacks from the private data. Also, move the helper functions the handle the mapping of the windowed STC register offsets to M series register offset from ni_pcimio.c to ni_mio_common.c. 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-19staging: comedi: ni_stc.h: remove read/write callbacks from ni_privateH Hartley Sweeten
The drivers that include ni_mio_common.c set the read/write callbacks to private functions that handle the read/write operations in the correct manner for the hardware. The ni_atmio and ni_mio_cs drivers use ioport register access and the ni_pcimio driver uses memory mapped register access. The memory mapped base address is stored in the 'mite' pointer in the private data which is only allocated and initialized by the ni_pcimio driver. Detect the need for memory mapped register access by checking if the 'mite' pointer is set in the private data and remove the callbacks from the private data. 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-18staging: comedi: ni_stc.h: add read/write callbacks to struct ni_privateH Hartley Sweeten
The {read,write}[bwl] macros used to access the registers in the ni_atmio, ni_mio_cs, and ni_pcimio drivers and the included ni_mio_common.c file all rely on a local variable having a specific name. They also require some of the ni_mio_common code to need a __maybe_unused tag on the devpriv local variable. Remove all the macros by converting them into private functions and storing the callbacks in 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>
2014-06-18staging: comedi: ni_stc.h: remove NI_PRIVATE_COMMON macroH Hartley Sweeten
This macro is used to create the private data structure that is used by the ni_atmio, ni_mio_cs, and ni_pcimio drivers. These drivers all include the ni_mio_common.c source to provide most of the driver functionality. The only driver specific information needed to convert the macro into a proper struct definition is the MAX_N_CALDACS define. This define is used to size a couple array members in the struct. The ni_atmio and ni_mio_cs drivers both define MAX_N_CALDACS as 32. The ni_pcimio driver defines it as (16+16+2). The ni_mio_common file only uses this define to sanity check that the struct members are large enough for the number of channels in the calibration subdevice. Move the MAX_N_CALDACS define to ni_stc.h and set it to the largest number of caldacs (34). The ni_atmio and ni_mio_cs drivers also add one additional member to the private data struct before using the NI_PRIVATE_COMMON macro. For the ni_atmio driver, the struct pnp_dev pointer can be saved in the comedi_device as the 'hw_dev'. The (*detach) of this driver can then use to_pnp_dev() to get it back when detaching the pnp device. In the ni_mio_cs driver, the struct pcmia_device pointer is not used so it can simply be removed. The NI_PRIVATE_COMMON macro can then be converted into a proper struct definition. 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-11-25staging: comedi: ni_pcidio: remove DEBUG defineH Hartley Sweeten
This define is only used to enable some debug messages during the board attach. These are just added noise, remove them as well as the DEBUG define. 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: do not include <linux/delay.h> if its not neededH Hartley Sweeten
Some of the comedi files include this header but don't 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: 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-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-04-19staging: comedi: drivers: free_irq() in comedi_legacy_detach()H Hartley Sweeten
All the legacy comedi drivers now call comedi_legacy_detach() either directly or as part of their (*detach). Move the free_irq() into comedi_legacy_detach() so that the drivers don't have to deal with it. For drivers that then only call comedi_legacy_detach() in their private (*detach), remove the private function and use the helper directly for the (*detach). The amplc_pc236 and ni_labpc drivers are hybrid legacy/PCI drivers. In the detach of a PCI board free_irq() still needs to be handled by the driver. The pcl724 and pcl726 drivers currently have the free_irq() #ifdef'ed out. The comedi_legacy_detach() function sanity checks that the irq has been requested before freeing it so they are safe to convert. For aesthetic reasons, move the #ifdef unused chunk in the pcl816 driver up to the previous #ifdef unused block. The pcmio and pcmuio drivers request multiple irqs and handle the freeing of them. Remove the 'dev->irq = irq[0]' in those drivers so that comedi_legacy_detach() does not attempt to free the irq. 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-19staging: comedi: drivers: use comedi_legacy_detach()H Hartley Sweeten
Use comedi_legacy_detach() to release the I/O region requested by these 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-04-11staging: comedi: ni_atmio: use comedi_request_region()H Hartley Sweeten
Use comedi_request_region() to request the I/O region used by this driver. Remove the noise when the board is first attached as well as the error message when the request_region() fails, comedi_request_reqion() will output the error message if necessary. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15staging: comedi: ni_atmio: fix build error due to missing '; 'H Hartley Sweeten
Fix a build error due to a missing ';' at the end of a line. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reported-by: Geert Uytterhoeven <geert.uytterhoeven@gmail.com> Cc: Kumar Amit Mehta <gmate.amit@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-12staging: comedi: ni_atmio: fix build errorsH Hartley Sweeten
The following commits introduced a couple build errors in this driver due to the removal of some macros in ni_stc.h. commit: f5a1d92b "staging: comedi: ni_stc.h: remove n_ni_boards macro" commit: 6293e357 "staging: comedi: ni_stc.h: remove boardtype macro" The n_ni_boards macro is an open coded version of ARRAY_SIZE. The boardtype macro is removed in favor of using the comedi_board() helper and accessing the boardinfo with a pointer. Fix both issues. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: ni_mio_common: remove devpriv macroH Hartley Sweeten
The ni_mio_common.c file is #include'd by the ni_atmio, ni_mio_cs, and ni_pcimio drivers. Those drivers all have a devpriv macro of this type: This macro relies on a local variable having a specific name. Remove its use in all the files by replacing it with a local variable. Some of the functions in ni_mio_common.c don't always use the devpriv variable due to differences in how the low-level i/o is handled by the driver. Tag the variable in those functions with __maybe_unused to avoid compile warnings. 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>
2012-09-17staging: comedi: ni_mio_common: don't pass config options to ni_E_init()Ian Abbott
`ni_E_init()` doesn't use the second parameter pointing to a `struct comedi_devconfig` passed from a comedi `attach` handler, so remove the parameter. 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>
2012-05-18staging: comedi: cleanup all the comedi_driver 'detach' functionsH Hartley Sweeten
1. Change the return type from int to void All the detach functions, except for the comedi usb drivers, simply return success (0). Plus, the return code is never checked in the comedi core. The comedi usb drivers do return error codes but the conditions can never happen. The first check is: if (!dev) return -EFAULT; This checks that the passed comedi_device pointer is valid. The detach function itself is called using this pointer so it MUST always be valid or there is a bug in the core: if (dev->driver) dev->driver->detach(dev); And the second check: usb = dev->private; if (!usb) return -EFAULT; The dev->private pointer is setup in the attach function to point to the probed usb device. This value could be NULL if the attach fails. But, since the comedi core is going to unload the driver anyway and does not check for errors there is no gain by returning one. After removing these checks from the comedi usb drivers the detach functions required a bit of cleanup. 2. Remove all the printk noise in the detach functions All of the printk output is really just noise. The user did a rmmod to unload the driver, we really don't need to tell them about it. Also, some of the messages are output using: dev_dbg(dev->hw_dev, ... or dev_info(dev->hw_dev, ... Unfortunately the hw_dev value is only used by drivers that are doing DMA. For most drivers this variable is going to be NULL so the output is not going to work as expected. 3. Refactor a couple static 'free_resource' functions into the detach functions. The 'free_resource' function is only being called by the detach and it makes more sense to just absorb the code. 4. Remove a couple unnecessary braces for single statements. 5. Remove unnecessary comments. Most of the comedi drivers appear to be based on the comedi skel driver and have the comments from that driver included. These comments make sense in the skel driver for reference but they don't need to be in any of the actual drivers. 6. Remove all the extra whitespace. It's not needed to make the functions any more readable. 7. Remove the now unused 'attached_successfully' variable in the cb_pcimdda driver. This variable was only used to conditionally output some driver noise during the detach. Since all the printk's have been removed this variable is no longer necessary. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-15staging: comedi: refactor ni_atmio driver and use module_comedi_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive to the end of the source. This is more typical of how other drivers are written and removes the need for the forward declarations. Convert the driver to use the module_comedi_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2011-10-17Staging: comedi: fix brace coding style issue in ni_atmio.cJake Burton
This is a patch to the ni_atmio.c file which fixes a brace and whitespace warning found by the checkpatch.pl tool Signed-off-by: Jake Burton <jake5991@live.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-06-17Staging: comedi: Remove COMEDI_INITCLEANUP macroArun Thomas
Move the init/exit routines to the respective C source files instead of calling COMEDI_INITCLEANUP Signed-off-by: Arun Thomas <arun.thomas@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-03Staging: comedi: bracing fix to ni_atmio.cGraham M Howe
This is a patch to ni_atmio.c file to fix up bracing style problems found by checkpatch.pl tool Signed-off-by: Graham M Howe <gman.1352@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15Staging: Comedi: Lindent changes to comdi driver in staging treeMithlesh Thukral
Lindent changes to comdi driver in staging tree. This patch is followed by the checkpatch.pl error fixes. Did not make them part of this patch as the patch size is already huge. Signed-off-by: Mithlesh Thukral <mithlesh@linsyssoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>