summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers/dt9812.c
AgeCommit message (Collapse)Author
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>
2016-08-21staging: comedi: drivers: replace le16_to_cpu() with usb_endpoint_maxp()Cheah Kok Cheong
Use macro introduced in commit 939f325f4a0f ("usb: add usb_endpoint_maxp() macro") Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-13Staging: comedi: dt9812: Use mutex instead of semaphoreKsenija Stanojevic
Replace binary semaphore with mutex. Mutex also gives better performance than semaphore. Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12staging: comedi: dt9812: reword comments to fix checkpatch.pl issuesH Hartley Sweeten
Reword the block comments to fix the checkpatch.pl issues about: WARNING: Block comments use * on subsequent lines WARNING: Block comments use a trailing */ on a separate line For consistency, also reword the previous comments. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12staging: comedi: dt9812: rename F020_MASK_DACxCN_DACxENH Hartley Sweeten
Rename this CamelCase 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>
2015-10-12staging: comedi: dt9812: tidy up multi-line commentH Hartley Sweeten
Reformat the multi-line comment in the kernel CodingStyle. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-28staging: comedi: dt9812: include new "comedi_usb.h" headerIan Abbott
Include the new "../comedi_usb.h" header instead of <linux/usb.h> and "../comedidev.h", which will now get included indirectly. 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-03staging: comedi: drivers: replace SDF_WRITEABLE with SDF_WRITABLEH Hartley Sweeten
As indicated in the comedi.h uapi header, SDF_WRITEABLE was a spelling error in the API, SDF_WRITABLE is prefered. For aesthetics, replace all the SDF_WRITEABLE uses with SDF_WRITABLE. 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-30staging: comedi: dt9812: use comedi_subdevice 'readback'H Hartley Sweeten
Use the new comedi_subdevice 'readback' member and the core provided (*insn_read) for the readback of the analog output subdevice channels. 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: dt9812: checkpatch.pl cleanup (missing blank line)H Hartley Sweeten
Fix 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>
2013-12-17staging: delete non-required instances of include <linux/init.h>Paul Gortmaker
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-07staging: comedi: dt9812: remove ifdefed out enumsIan Abbott
Remove the #if'd out DT9812_DEVID_... enumerated constants and line up the comments for the others. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17staging: comedi: drivers: use comedi_dio_update_state() for simple casesH Hartley Sweeten
Use comedi_dio_update_state() to handle the boilerplate code to update the subdevice s->state for simple cases where the hardware is updated when any channel is modified. Also, fix a bug in the amplc_pc263 and amplc_pci263 drivers where the current state is not returned in data[1]. 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-31staging: comedi: dt9812: Resolve different base types warnings.Shaun Laing
Resolves warnings from the "sparse" checker of the form "warning: incorrect type in assignment (different base types)". Signed-off-by: Shaun Laing <shaun@xresource.ca> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-29staging: comedi: dt9812: remove duplicated include from dt9812.cWei Yongjun
Remove duplicated include. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: dt9812: Resolves sparse endian warnings.Shaun Laing
Resolves warnings from the "sparse" checker of the form "warning: cast to restricted __le??". Signed-off-by: Shaun Laing <shaun@xresource.ca> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> 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-05-21staging: comedi: dt9812: use comedi_to_usb_dev()H Hartley Sweeten
Use the helper function to get a usb_device pointer from a comedi_device pointer. This removes the need for also getting the usb_interface pointer in some cases. 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-16staging: comedi: dt9812: do not allow attaching to unsupported devicesH Hartley Sweeten
The DT9812 is part of the ECONseries of USB Data Acquisition Modules. This driver only supports the DT9812-10V and DT9812-2.5V versions of the module. Do not attach to the device if an unsupported module is detected. 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-16staging: comedi: dt9812: default the analog input gain to 1H Hartley Sweeten
The 'default' case should never happen. In case it does, default the gain to '1'. 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-16staging: comedi: dt9812: usb_bulk_msg() timeout is in millisecondsH Hartley Sweeten
The timeout values passed to usb_bulk_msg() should be in milliseconds not jiffies. 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-16staging: comedi: dt9812: remove some #if 0'ed out codeH Hartley Sweeten
The struct dt9812_usb_cmd definition contains some #if 0'ed out code that would cause build errors if enabled. Just remove 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-16staging: comedi: dt9812: use dev->class_dev for all dev_{level} messagesH Hartley Sweeten
For consistency in the driver, use dev->class_dev for the device in all the dev_{level} messages. 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-16staging: comedi: dt9812: remove pr_fmt()H Hartley Sweeten
There are no pr_{level} messages in this driver. Remove the pr_fmt(). 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-16staging: comedi: dt9812: cleanup analog out subdevice (*insn_write)H Hartley Sweeten
For aesthetic reasons, rename the function to help with grepping and rename some of the local vars. The dt9812_analog_out() function can fail. Make sure to check for any failure and return the errno. The comedi core expects the (*insn_write) functions to return either an errno or the number of samples written. Change the final return to insn->n to make this clearer. 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-16staging: comedi: dt9812: cleanup analog out subdevice (*insn_read)H Hartley Sweeten
For aesthetic reasons, rename the function to help with grepping and rename some of the local vars. This function returns the current analog output value for the channel that is cached in the private data. Absorb dt9812_analog_out_shadow() into this function to make it more concise. The comedi core expects the (*insn_read) functions to return either an errno or the number of samples read. Change the final return to insn->n to make this clearer. 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-16staging: comedi: dt9812: cleanup analog in subdevice (*insn_read)H Hartley Sweeten
For aesthetic reasons, rename the function to help with grepping and rename some of the local vars. dt9812_analog_in() can fail. Make sure to check for any failure and return the errno. The comedi core expects the (*insn_read) functions to return either an errno or the number of samples read. Change the final return to insn->n to make this clearer. 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-16staging: comedi: dt9812: convert digital out subdevice to (*insn_bits)H Hartley Sweeten
Currently the (*insn_write) function for the digital output subdevice only sets the state for a single channel. It's more efficent to use the (*insn_bits) function and allow setting the state for all the channels. The comedi core can use the (*insn_bits) to emulate the (*insn_write) if needed. Also, use the subdevice 'state' variable to hold the current state of the channels instead of 'do_shadow' in 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>
2013-05-16staging: comedi: dt9812: convert digital in subdevice to (*insn_bits)H Hartley Sweeten
Currently the (*insn_read) function for the digital input subdevice returns the state for a single channel. It's more efficent to use the (*insn_bits) function and return the state for all the channels. The comedi core can use the (*insn_bits) to emulate the (*insn_read) if needed. 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-16staging: comedi: dt9812: remove unused variables from private dataH Hartley Sweeten
The vendor, product, and serial numbers read from the usb device are only used for a dev_info() message about the device after it is reset. Reading these values might not be required for the usb device to function. For now just remove the variables from the private data and just use local variables. 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-16staging: comedi: dt9812: convert to use comedi (*auto_attach)H Hartley Sweeten
Converting this driver to use the comedi (*auto_attach) mechanism allows pushing the usb (*probe) into the comedi (*auto_attach) and the usb (disconnect) into the comedi (*detach). This removes the disconnect between the usb driver and the comedi driver. Now when the comedi driver is attached it will always have a usb device associated with it. This removes the 16 usb device limitation and allows bringing all the private data into a single struct that can be kzalloc'ed when the comedi driver is (*auto_attached). It also allows removing the the sanity checks that make sure a usb device is connected to the comedi device in the helper functions. For aesthetic reasons, add some whitespace to the subdevice init. Also, fix the analog out subdevice. There are 2 analog output channels available on the usb device. 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-16staging: comedi: dt9812: factor the device reset out of dt9812_probe()H Hartley Sweeten
When this driver is converted to the comedi (*auto_attach) mechanism the device reset will be done during the (*auto_attach). To make the conversion cleaner, factor the device reset out of the (*probe). 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-16staging: comedi: dt9812: factor the endpoint setup out of dt9812_probe()H Hartley Sweeten
When this driver is converted to the comedi (*auto_attach) mechanism the endpoint setup will be done during the (*auto_attach). To make the conversion cleaner, factor the endpoint setup out of the (*probe). 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-16staging: comedi: dt9812: remove 'interface' from usb private dataH Hartley Sweeten
The usb_interface * is only used in the usb (*probe) and (*disconnect). Remove the pointer to the 'interface' in the usb private data. For aesthetic reasons, rename the variable 'interface' to simply 'intf' in the (*probe) and (*disconnect). 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-16staging: comedi: dt9812: move shadow values to private dataH Hartley Sweeten
The analog and digital out shadow values are only used by the comedi_device. Move the variables from the usb private data to the comedi private data. Also, rename them to something a bit shorter. Move the initialization of the shadow values from the usb probe to the comedi attach. Also rename the flag used to determine the initial value from 'range_2_5' to 'is_unipolar'. 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-16staging: comedi: dt9812: use module_comedi_usb_driver()H Hartley Sweeten
Now that the semaphore used by the comedi_driver is initialized when the comedi_device private data is allocated, the module_init() in this driver just clears the 'slot' data before calling comedi_usb_driver_register(). This static data will already be cleared when the driver is loaded. Replace the module_{init,exit}() with the module_comedi_usb_driver() macro to remove the boilerplate 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>
2013-05-16staging: comedi: dt9812: move the sempaphore used by the comedi_driverH Hartley Sweeten
The semaphore in the struct slot_dt9812 is used by the comedi_driver when reading and writing to the usb device. It has no real association with the 'slot'. The 'slot' is protected with a static semaphore in the driver. Move the semaphore into the comedi_device private data and initialize it after the private data is allocated. 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-16staging: comedi: dt9812: pass the comedi_device * to dt9812_analog_out_shadow()H Hartley Sweeten
For aesthetic reasons, instead of passing the 'slot' pointer, pass the comedi_device pointer to this function and rename the local var 'result' to simply 'ret'. 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-16staging: comedi: dt9812: tidy up the usb endpoint enumerationH Hartley Sweeten
Only the command_{write,read} usb endpoints are used by this driver. Remove the message_pipe, and {read,write}_stream endpoint information from the usb private data. Rename the variables used for command endpoints to help keep the lines < 80 chars. Also, rename a couple of the local variables used to enumerate the endpoints to also help keep the lines < 80 chars. 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-16staging: comedi: dt9812: pass the comedi_device * to dt9812_analog_out()H Hartley Sweeten
For aesthetic reasons, instead of passing the struct usb_dt9812 pointer, pass the comedi_device pointer to this function and rename the local variable 'result' to simply 'ret'. 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-16staging: comedi: dt9812: pass the comedi_device * to dt9812_configure_mux()H Hartley Sweeten
For aesthetic reasons, instead of passing the struct usb_dt9812 pointer, pass the comedi_device pointer to this 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-05-16staging: comedi: dt9812: pass the comedi_device * to dt9812_configure_gain()H Hartley Sweeten
For aesthetic reasons, instead of passing the struct usb_dt9812 pointer, pass the comedi_device pointer to this function. Tidy up the function and use the comedi_device class_dev for the dev_err() message. 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-16staging: comedi: dt9812: pass the comedi_device * to dt9812_analog_in()H Hartley Sweeten
For aesthetic reasons, instead of passing the 'slot' pointer, pass the comedi_device pointer to this function and rename the local var 'result' to simply 'ret'. 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-16staging: comedi: dt9812: pass the comedi_device * to dt9812_digital_out_shadow()H Hartley Sweeten
For aesthetic reasons, instead of passing the 'slot' pointer, pass the comedi_device pointer to this function and rename the local var 'result' to simply 'ret'. 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-16staging: comedi: dt9812: pass the comedi_device * to dt9812_digital_out()H Hartley Sweeten
For aesthetic reasons, instead of passing the 'slot' pointer, pass the comedi_device pointer to this function and rename the local var 'result' to simply 'ret'. Also, initialize the 'reg', and 'value' when they are declared. 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-16staging: comedi: dt9812: pass the comedi_device * to dt9812_digital_in()H Hartley Sweeten
For aesthetic reasons, instead of passing the 'slot' pointer, pass the comedi_device pointer to this function and rename the local var 'result' to simply 'ret'. Remove the commented out printk(). 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-16staging: comedi: dt9812: tidy up usb_bulk_msg() callsH Hartley Sweeten
To clarify the code, add a local variable for the struct usb_device pointer used in the usb_blk_msg() calls. It's not necessary to initialize the 'count' when writing to the usb device. The 'count' variable is used to get back the number of bytes actually sent. Just return the usb_blk_msg() result when it is the last operation in a 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-05-16staging: comedi: dt9812: remove attaching by serial numberH Hartley Sweeten
Currently this driver supports attaching 16 usb devices to 16 comedi devices. The user can pass the 32-bit serial number of the usb device when attaching to force a comedi device to attach to a specific usb device. It's also possible to attach a comedi device without having an attached usb device. When the device is first opened the comedi_device (*open) function in this driver then checks to see if a usb device has been attached. If so the subdevice information is updated based on the usb device and the comedi device is then operational. If a usb device is not attached the (*open) returns -ENODEV. To simplify converting this driver to the comedi (*auto_attach) mechanism, remove the attaching by serial number option. Modify the usb (*probe) so that the first available slot is used. If all the slots are used return -ENODEV. Modify the comedi (*attach) so that the first unused slot that has an attached usb device is used. If all the slots are used return -ENODEV. Since this ensures that the comedi device has an attached usb device, remove the (*open) function and fully initialize the subdevices during the (*attach). Fix the comedi (*detach) so that the slot is made available after detaching. 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>