[RFC PATCH 00/30] staging: comedi: dt9812: cleanup driver

Ian Abbott abbotti at mev.co.uk
Tue May 7 13:31:42 UTC 2013


On 2013-05-03 21:39, H Hartley Sweeten wrote:
> Since the merge window is now open, this series is posted as an RFC.
> Any comments would be appreciated. I'm hoping to get any issues
> addressed so the series will be ready when the staging tree is
> opened after the merge window closes.
>
> This comedi driver is for a USB device and should be using the
> comedi (*auto_attach) mechanism to attach to the device. Currently
> the driver is a bit of a mess has a huge disconnect between the
> loading of the usb_driver and the attaching of the comedi_device.
> Right now this driver will even allow attaching to the comedi_device
> even if the usb device is not attached to the system.
>
> This series cleans up the driver and moves all the USB (*probe)
> functionality into the comedi (*auto_attach) and the USB (*disconnect)
> into the comedi (*detach). This ensures that a usb device is attached
> before the comedi core does the (*auto_attach) to attach to the device.
> This also allows consolidating all the private data into one struct
> and makes the driver a lot easier to understand.
>
> Some of these patches could probably be combined. Any comments are
> welcome.

Jolly good.  I started doing this myself on Friday but only got half way.

Some other things I noticed that haven't been fixed yet....

The timeout values such as '1 * HZ' in the calls to usb_bulk_msg() 
should be in milliseconds, not jiffies.  This was a change to the API 
that never got applied to this driver for some reason.  So instead of '1 
* HZ', use '1000'.

dt9812_configure_gain() should probably set rmw->value to something in 
the default case, although it shouldn't get there.  I just made made it 
the same as the DT9812_GAIN_1 case, setting rmw->value to 0x00.

rt9812_reset_device() (or dt9812_reset_device() if renamed) should bail 
out with an error if the device ID is not supported, i.e. not one of 
DT9812_DEVID_DT9812_10 or DT9812_DEVID_DT9812_2PT5.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-



More information about the devel mailing list