Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: comedi: vmk80xx: remove private data 'attached'

The 'attached' flag in the private data is set after the comedi_driver
(*auto_attach) function has completed successfully.

The only places it's checked are in rudimentary_check(), which does
some basic sanity checks before doing any of the subdevice operations,
and vmk80xx_auto_attach(), which is the comedi_driver (*auto_attach)
function.

The (*auto_attach) function can only be called as the result of a
successfull usb_driver (*probe). Part of the probe is to locate a
free slot in the static private data array. All free slots are
initialized to '0' so the 'attached' flag will always be cleared.

Remove the unneccessary 'attached' flag in the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

H Hartley Sweeten and committed by
Greg Kroah-Hartman
29d6dd33 b105ad8a

-7
-7
drivers/staging/comedi/drivers/vmk80xx.c
··· 210 210 unsigned char *usb_rx_buf; 211 211 unsigned char *usb_tx_buf; 212 212 unsigned long flags; 213 - int attached; 214 213 }; 215 214 216 215 static struct vmk80xx_private vmb[VMK80XX_MAX_BOARDS]; ··· 527 528 { 528 529 if (!devpriv) 529 530 return -EFAULT; 530 - if (!devpriv->attached) 531 - return -ENODEV; 532 531 if (dir & DIR_IN) { 533 532 if (test_bit(TRANS_IN_BUSY, &devpriv->flags)) 534 533 return -EBUSY; ··· 1277 1280 s->insn_write = vmk80xx_pwm_winsn; 1278 1281 } 1279 1282 1280 - devpriv->attached = 1; 1281 - 1282 1283 up(&devpriv->limit_sem); 1283 1284 1284 1285 return 0; ··· 1295 1300 break; 1296 1301 if (i == VMK80XX_MAX_BOARDS) 1297 1302 ret = -ENODEV; 1298 - else if (vmb[i].attached) 1299 - ret = -EBUSY; 1300 1303 else 1301 1304 ret = vmk80xx_attach_common(dev, &vmb[i]); 1302 1305 mutex_unlock(&glb_mutex);