staging: comedi: avoid releasing legacy minors automatically
authorIan Abbott <abbotti@mev.co.uk>
Thu, 4 Apr 2013 13:58:52 +0000 (14:58 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Apr 2013 21:33:17 +0000 (14:33 -0700)
commit38b9722a4414c395c6c1e82cd5f8ee64a23313b8
tree36150235af2fd5525d78f081d7b6f34f34ae5e1b
parent07778393d9a8dbc4b9306d20a8ecfe053771ba93
staging: comedi: avoid releasing legacy minors automatically

`comedi_alloc_board_minor()` is called for both reserved "legacy"
devices created during module initialization, and for dynamically
created devices (via `comedi_auto_config()`).  All the minor device
numbers from 0 to `comedi_num_legacy_minors - 1` are for legacy devices
and all those from `comedi_num_legacy_minors` to
`COMEDI_NUM_BOARD_MINORS - 1` are for dynamically created devices.

`comedi_release_hardware_device()` is called (via
`comedi_auto_unconfig()`) when a dynamically created device is being
removed.  It needs to search the table of minor device numbers to see
which one is associated with the hardware device.  It currently starts
the search at minor device number 0.  Change it to start from
`comedi_num_legacy_minors` to skip over those belonging to legacy
devices.  Also change `comedi_alloc_board_minor()` to skip the legacy
devices when searching for a free minor device number for the
dynamically created device.  (The validity of the `hardware_device`
parameter is used to distinguish the legacy devices from the dynamically
created ones.)

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