staging: comedi: cleanup all board minors on module exit
authorIan Abbott <abbotti@mev.co.uk>
Mon, 28 Jan 2013 17:07:39 +0000 (17:07 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jan 2013 10:47:47 +0000 (11:47 +0100)
commit682b911938f8c0e88c8204bb1178c2c7728d5661
tree127e6384cb988bc9a3588ebdf53264d32bb160cf
parent754ab5c0e55dd118273ca2c217c4d95e9fbc8259
staging: comedi: cleanup all board minors on module exit

The comedi core module optionally allocates some legacy board minor
devices on module load and cleans these up on module exit.  These are
used for manual configuration of comedi boards (for those low-level
comedi drivers that support manual configuration - mainly for ISA
boards).  Other board minor devices are created and destroyed
dynamically in response to bus device probe and remove requests.  The
ioctl used for manual configuration (attachment) and removal
(detachment) of devices is COMEDI_DEVCONFIG, but that works for any
board minor device, including those that were originally created
dynamically.

If the COMEDI_DEVCONFIG ioctl is used to manually detach an
automatically created and attached device, commit
7d3135af399e92cf4c9bbc5f86b6c140aab3b88c ("staging: comedi: prevent
auto-unconfig of manually configured devices") ensures that the board
minor will no longer be automatically detached and destroyed by a bus
device remove request.  From that point on the board minor behaves more
like one of the comedi "legacy" board minors.  (There would be some
justification for destroying the board minor instead, but I'd rather
leave that decision until removal of board minors has been
made safer than it currently is.)  Although the board minor behaves more
like a legacy board minor, it is not currently cleaned up on module
exit.  In fact, the module exit code will bug out because this board
minor has not been cleaned up.

Change comedi_cleanup_legacy_minors() (called from the module exit code,
and from the module init code on error) to clean up all board minors.
Rename the function to comedi_cleanup_board_minors() to reflect the
change in functionality.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c
This page took 0.027332 seconds and 5 git commands to generate.