summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi
AgeCommit message (Collapse)Author
2012-06-11staging/comedi: fix build for USB not enabledRandy Dunlap
Calls to optional subsystems cannot be made indiscriminately. Enclose all of the usb helper functions inside #if IS_ENABLED(CONFIG_USB) to fix these build errors. (The pci helper functions are OK since there are stubs in linux/pci.h for the called functions when PCI is not enabled. Possibly the same could be done for the called USB functions.) ERROR: "usb_deregister" [drivers/staging/comedi/comedi.ko] undefined! ERROR: "usb_register_driver" [drivers/staging/comedi/comedi.ko] undefined! Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> 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-18staging: comedi: remove all 'default N' in KconfigH Hartley Sweeten
Remove all the 'default N' lines in the comedi Kconfig. They should all be 'default n' but that is the default anyway. 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-16staging: comedi: Add helper macro for comedi usb driver boilerplateH Hartley Sweeten
Introduce the module_comedi_usb_driver macro, and the associated register/unregister functions, which is a convenience macro for comedi usb driver modules similar to module_platform_driver. It is intended to be used by drivers where the init/exit section does nothing but register/unregister the comedi driver and associated usb driver. By using this macro it is possible to eliminate a few lines of boilerplate code per comedi usb driver. Also, when registering the usb driver check for failure and unregister the comedi driver. 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-16staging: comedi: Convert struct addi_board initialization to C99 formatH Hartley Sweeten
Convert the struct addi_board initialization to C99 format and remove all the NULL or 0 initializers. This makes maintaining and editing the code simpler and less error prone. 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-16staging: comedi: refactor das16 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. Refactor some of the other functions to remove the remaining 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>
2012-05-16staging: comedi: refactor contec_pci_dio driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver to the end of the source. This is more typical of how other drivers are written and removes the need for the forward declarations. Refactor some of the other functions to remove the remaining forward declarations. Remove some unused code stubs that are in #if 0 / #endif blocks. Convert the driver to use the module_comedi_pci_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>
2012-05-16staging: comedi: refactor daqboard2000 driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-16staging: comedi: refactor das1800 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>
2012-05-15staging: comedi: refactor adv_pci1710 driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor adv_pci1_dio driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor adl_pci9118 driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_driver() macro which makes the code smaller and a bit simpler. While moving the struct boardtype, convert it to C99 initializers to improve code readability. This results is a slight increase in the total lines of code. 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 amplc_pci224 driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor amplc_pci230 driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor cb_pcidas64 driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor cb_pcidas driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor cb_pcidda driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor cb_pcidio driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor cb_pcimdas driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor cb_pcimdda driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor comedi_bond 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>
2012-05-15staging: comedi: refactor comedi_parport 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>
2012-05-15staging: comedi: refactor comedi_test 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>
2012-05-15staging: comedi: refactor das16m1 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. Refactor some of the other functions to remove the remaining 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>
2012-05-15staging: comedi: refactor das6402 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>
2012-05-15staging: comedi: refactor dt2801 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. Refactor some of the other functions to remove the remaining 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>
2012-05-15staging: comedi: refactor dt2811 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. Refactor some of the other functions to remove the remaining 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>
2012-05-15staging: comedi: refactor gsc_hpdi driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor ii_pci20kc 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>
2012-05-15staging: comedi: refactor ni_pcidio driver and use module_comedi_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-15staging: comedi: refactor ni_at_a2150 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>
2012-05-15staging: comedi: refactor ni_at_ao 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>
2012-05-15staging: comedi: refactor ni_atmio16d 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>
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>
2012-05-15staging: comedi: refactor unioxx5 driver to remove forward declarationsH Hartley Sweeten
Refactor of the unioxx5 comedi driver to remove all the forward declarations. 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-14staging: comedi: refactor ni_pcimio driver and use module_comedi_pci_driverH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_drive and struct pci_driver 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_pci_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>
2012-05-14staging: comedi: Use module_comedi_pci_driver and standardize driversH Hartley Sweeten
Convert the refactored comedi pci drivers to use the module_comedi_pci_driver() macro which makes the code smaller and a bit simpler. In the process, rename some of the symbols in the driver to standardize the comedi pci drivers. Based on the driver {name}: 1) Rename the comedi_driver to {name}_driver. 2) Use a static string {name} for the comedi_driver.driver_name. 3) Rename the pci probe/remove functions to {name)_pci_probe/remove. 4) Rename the pci id_table to {name}_pci_table. 5) Add the static string {name} for the pci_driver.name. 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-14staging: comedi: Add helper macro for comedi pci driver boilerplateH Hartley Sweeten
Introduce the module_comedi_pci_driver macro, and the associated register/unregister functions, which is a convenience macro for comedi pci driver modules similar to module_platform_driver. It is intended to be used by drivers where the init/exit section does nothing but register/unregister the comedi driver and associated pci driver. By using this macro it is possible to eliminate a few lines of boilerplate code per comedi pci driver. Add a check to make sure that the pci_driver->name is set. Once all the comedi pci drivers have been fixed this will be removed. Also, when registering the pci driver check for failure and unregister the comedi driver. 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-14staging: comedi: register sysfs device attributes with driver coreH Hartley Sweeten
Currently the sysfs device attributes are created by the comedi core after each comedi device is created. This can lead to a race condition where userspace gets an add event before the files are created. Register the device attributes with the comedi class so that the driver core handles creating them and we avoid the race. 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-09staging: comedi: refactor sysfs files in comedi_fops.cH Hartley Sweeten
Refactor the sysfs attributes and functions to remove the need for the forward declarations and use the DEVICE_ATTR macro to define them. Instead of individually creating sysfs device attribute files, wrap them in an attribute_group and use the sysfs_create_group function to create them. 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-09staging: comedi: rtf520: las0, las1, and lcfg are void __iomem *H Hartley Sweeten
The las0, las1, and lcfg variables in struct rtdPrivate are all ioremap'ed pci resources and should be void __iomem * not void *. This quiets a lot of sparse warings for the writel and readl like: warning: incorrect type in argument 1 (different address spaces)    expected void const volatile [noderef] <asn:2>*addr    got void *<noident> warning: incorrect type in argument 2 (different address spaces)    expected void volatile [noderef] <asn:2>*addr    got void * 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-09staging: comedi: mite: mite_io_addr and daq_io_addr are void __iomem *H Hartley Sweeten
The mite_io_addr and daq_io_addr variables in struct mite_struct are both ioremap'ed pci resources and should be void __iomem * not void *. This quiets a lot of sparse warings for the write[lwb],read[lwb] calls in the comedi mite drives like: warning: incorrect type in argument 1 (different address spaces) expected void const volatile [noderef] <asn:2>*addr got void *<noident> warning: incorrect type in argument 2 (different address spaces) expected void volatile [noderef] <asn:2>*addr got void * It also exposed some warnings in the mite ni_660x driver where the daq_io_address was getting cast as a void *const. 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-09staging: comedi: rename addi CamelCase function pointersH Hartley Sweeten
Rename the CamelCase variable names for the ADDI subdevice functions. This makes the code a bit cleaner and easier to follow. This will also help with converting the struct addi_board boardtypes array to C99 style initialization to help with maintaining the code. 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-09staging: comedi: refactor dt2814 driver and use module_comedi_driverH Hartley Sweeten
Move the struct comedi_driver to the end of the source and refactor the code to remove 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>
2012-05-09staging: comedi: refactor dt282x driver to remove forward declarationsH Hartley Sweeten
Move the struct comedi_driver and variables 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>
2012-05-09staging: comedi: refactor dt3000 driver to remove forward declarationsH Hartley Sweeten
Move the module_init/module_exit routines and the associated struct comedi_driver and other variables to the end of the source. This is more typical of how other drivers are written. Also, refactor a couple of the pci helper functions used during the attach. The removes the need for the forward declarations. 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-09staging: comedi: refactor dyna_pci10xx driver to remove forward declarationsH Hartley Sweeten
Move the struct comedi_driver and associated variables to the end of the source. This is more typical of how other drivers are written and removes the need for the forward declarations. 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-09staging: comedi: refactor the icp_multi driver to remove forward declarationsH Hartley Sweeten
Move the setup_channel_list function forward in the souce and the struct comedi_driver and associated variables to the end of the source. This is more typical of how other drivers are written and removes the need for the forward declarations. Remove the unnecessary comments for the attach/detach functions. Change the initialization of struct boardtype to c99 syntax and remove the comments. 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>
2012-05-09staging: comedi: refactor jr3_pci driver to remove forward declarationsH Hartley Sweeten
Move the struct comedi_driver and associated variables to the end of the source. This is more typical of how other drivers are written and removes the need for the forward declarations. 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-09staging: comedi: refactor me4000 driver to remove forward declarationsH Hartley Sweeten
Move the struct comedi_driver, attach/detach functions, and associated variables to the end of the source. This is more typical of how other drivers are written and removes the need for most of the forward declarations. 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>