From: Ian Abbott Date: Thu, 4 Apr 2013 13:58:54 +0000 (+0100) Subject: staging: comedi: remove manually unconfigured dynamic devices X-Git-Tag: omap-for-v3.10/dt-fixes-for-merge-window~137^2~294 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ab4ed6ef1c218cac4270cd20a714b83da6907a3;p=pandora-kernel.git staging: comedi: remove manually unconfigured dynamic devices If a dynamically allocated (non-legacy, and automatically configured) comedi device has been successfully unconfigured by use of the `COMEDI_DEVCONFIG` ioctl, then remove the device afterwards. (Dynamically identified comedi devices are identified by their minor device number being `comedi_num_legacy_minors` or greater.) This is done in `comedi_unlocked_ioctl()` on return from `do_devconfig_ioctl()`. Note that there is an unlikely race condition with some other thread that has just called `comedi_file_info_from_minor()` or `comedi_dev_from_minor()` and is about to use the device, but that race condition also exists for automatically removed devices and will be dealt with properly once reference counting of comedi devices has been implemented. We do avoid a race condition between automatic removal and removal by the `COMEDI_DEVCONFIG` ioctl though. Also add an extra precaution in `do_devconfig_ioctl()` to avoid configuring a dynamically allocated device since there is a tight window avoiding the race condition where this could happen and the device is about to be removed anyway. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed