Re: [PATCH v2] staging: comedi: drivers: let core handle freeing s->private

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

 



On 2013-06-11 01:58, H Hartley Sweeten wrote:
Introduce a new subdevice flag, SDF_FREE_SPRIV, to allow the comedi
core to automatically free the subdevice private data during the
cleanup_device() stage of the detach.

This is an implementation detail that should really be hidden from userspace. With this patch it is exposed through the 'subd_flags' member of 'struct comedi_subdinfo'. That can easily be fixed by masking out the 'SDF_FREE_SPRIV' flag when setting 'us->subd_flags' in 'do_subdinfo_ioctl()'. Ideally, 'SDF_FREE_SPRIV' shouldn't appear in "comedi.h" at all as should be of no interest to userspace.

As we're running out of SDF_ values, we might want to reassign the current 'SDF_FREE_SPRIV' value to some other user-visible meaning at a later date.

We could put the internal flags in a different member of 'struct comedi_subdevice'; either define a new member or abuse the existing 'runflags' member. (A new member could be placed in a 32-bit hole in the structure for 64-bit kernels, so would only use extra space for 32-bit kernels.) (There are various members of 'struct comedi_subdevice' that could be stripped out to save space if necessary, such as 'settling_time_0', 'flags' and 'flaglist'. These were intended to pass various details from drivers to userspace but none of the existing drivers actually set them.)

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux