Re: [patch] video/s255drv: cleanup. remove uneeded NULL check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't have any problems with this patch in particular but would like
to note that this driver could use a little refactoring.

One thing I noticed just while glancing at the code is that the return
value from s2255_probe_v4l is not checked in s2255_probe. As a result
the driver could fail to register some or all of it's video device
nodes and still continue to load.

Also the use of kref, while needed in this driver due to the number of
video nodes created, is probably a bit overused. In my opinion
video_unregister_device should be called in the usb disconnect
callback for each registered video device. This ensures that no future
calls to open will occur for that device. Subsequently, once all
applications have stopped using the previously registered
video_device, the release callback of the video_device struct will
fire. Therefore if the device kref is incremented for each registered
video device (during probe) and then properly decremented during the
video_device release callback for each device the device driver's
structure may then be freed. This approach should lead to a much
cleaner implementation of the open, release, and disconnect callbacks.

Regards,

David Ellingsworth
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux