- 16 May, 2013 40 commits
-
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
Because of the usb (*probe) and comedi (*attach) disconnect, the struct slot_dt9812 is used to pass the device data between the usb_driver and the comedi_driver. The variable 'comedi' in this struct is used during the comedi (*attach) to indicate if a slot is currently being used. For aesthetic reasons, rename the variable to 'devpriv' since that is what is actually saved in the pointer. 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>
-
H Hartley Sweeten authored
The comedi private data (dev->private) for this driver is stored in a 'struct comedi_dt9812' that is allocated during the comedi (*attach). For aesthetic reasons, rename this struct to help make its use 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>
-
H Hartley Sweeten authored
In preparation of converting this manually attached comedi driver into an auto attached comedi usb driver, move the usb framework functions to the end of the file. 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>
-
H Hartley Sweeten authored
Remove the sanity check of devpriv, this function can only be called by the comedi core if the private data is allocated. Get the 'chan', 'range' and 'rngmask' from the function parameters when the local variables are declared. For aesthetic reasons, rename the local variable 'err' to 'ret' since that name is more standard. (*insn_read) functions are supposed to return the number of values read or an error code. Change the final return to 'insn->n' to make it 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>
-
H Hartley Sweeten authored
Introduce a helper function to set the buffer used to transfer commands to the usb device. Each command consists of four uint8_t values that are stored at specific indexes in the buffer. The helper function consolidates the code that sets the buffer to reduce coding errors and make the driver a bit easier to understand. Note, the '0xff & rngmask' can be reduced to simply 'rngmask' since the rngmask is always an 8-bit value. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
H Hartley Sweeten authored
Rename this CamelCase function to fix the checkpatch.pl warning. 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>
-
H Hartley Sweeten authored
Rename the local variable to fix the checkpatch.pl warning. 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>
-
H Hartley Sweeten authored
Absorb the usbduxfastsub_stop(), usbduxfastsub_upload(), and usbduxfastsub_start() functions into usbduxfast_upload_firmware(). Each of them just do a usb_control_msg() to the device and output an error message if it fails. A similar message is also output by usbduxfast_upload_firmware() so the extra messages are redundant. We can also share the malloc'ed local buffer needed for the usb_control_msg(). 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>
-
H Hartley Sweeten authored
For aesthetic reasons, move usbduxfast_upload_firmware() near its only caller, usbduxfast_request_firmware(). Also, move the #define for the maximum firmware size so it's with the other firmware defines. 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>
-
H Hartley Sweeten authored
Rename the CamelCase function and just pass the const struct firmware * directly instead of parsing out the data and size. Rename the CamelCasae local val 'fwBuf'. Use goto to provide a common exit path that frees the local buffer for the firmware when an error is encountered. 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>
-
H Hartley Sweeten authored
Fix a line over 80 characters issue reported by checkpatch.pl. 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>
-
H Hartley Sweeten authored
Remove the unnecessary comments and dev_err() 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>
-
H Hartley Sweeten authored
Remove the devpriv sanity check, all the callers have previously verified that its valid. Absorb usbduxfast_unlink_urbs() into this function since it's the only caller and the only thing it does is call usb_kill_urb(). This function will always succeed so just return 0 and remove the local variable '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>
-
H Hartley Sweeten authored
Rename this function so it has namespace associated with the driver. Remove the local variables 'j' and 'ret'. They are not used and the function always returns '0'. 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>
-
H Hartley Sweeten authored
Rename this function so it has namespace associated with the driver. For aesthetic reasons, rename the local variable 'tmp' to 'ret' as this is more common for checking errno values. 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>
-