diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2013-04-04 13:58:47 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-05 21:33:17 (GMT) |
commit | 3346b798f202bf2f5b5272870ecdb75acec2e752 (patch) | |
tree | 62dc9510cdca136d526dd19d788a65e9d17edcf4 /drivers/staging/comedi/comedi_fops.c | |
parent | 24fb134d1c336b263f75d7659f56a96382aebb56 (diff) | |
download | linux-3346b798f202bf2f5b5272870ecdb75acec2e752.tar.xz |
staging: comedi: add comedi_release_hardware_device()
Add `comedi_release_hardware_device()` as a replacement for the call
sequence `comedi_find_board_minor()`, `comedi_free_board_minor()`. This
is slightly safer as we can make sure nothing funny happens to the found
`comedi_file_info_table[]` entry in the middle of the sequence. Change
`comedi_auto_unconfig()` to call the new function instead of the old
sequence. Remove `comedi_find_board_minor()` as it has no other
callers.
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>
Diffstat (limited to 'drivers/staging/comedi/comedi_fops.c')
-rw-r--r-- | drivers/staging/comedi/comedi_fops.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 8b5fa2f..ce050e4 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2348,7 +2348,7 @@ void comedi_free_board_minor(unsigned minor) comedi_free_board_file_info(comedi_clear_minor(minor)); } -int comedi_find_board_minor(struct device *hardware_device) +void comedi_release_hardware_device(struct device *hardware_device) { int minor; struct comedi_file_info *info; @@ -2357,12 +2357,13 @@ int comedi_find_board_minor(struct device *hardware_device) spin_lock(&comedi_file_info_table_lock); info = comedi_file_info_table[minor]; if (info && info->hardware_device == hardware_device) { + comedi_file_info_table[minor] = NULL; spin_unlock(&comedi_file_info_table_lock); - return minor; + comedi_free_board_file_info(info); + break; } spin_unlock(&comedi_file_info_table_lock); } - return -ENODEV; } int comedi_alloc_subdevice_minor(struct comedi_subdevice *s) |