kernels/linux-2.4.0/drivers/usb/ibmcam.c
/*
 * ibmcam_find_struct()
 *
 * This code searches the array of preallocated (static) structures
 * and returns index of the first one that isn't in use. Returns -1
 * if there are no free structures.
 *
 * History:
 * 1/27/00  Created.
 */
ibmcam_find_struct()
This code searches the array of preallocated (static) structures
and returns index of the first one that isn't in use. Returns -1
if there are no free structures.


ibmcam_find_struct () This code searches the array of preallocated ( static ) structures and returns index of the first one that isn ' t in use . Returns - 1 if there are no free structures .
static int ibmcam_find_struct(void)
{
	int i, u;
	for (u = 0; u < MAX_IBMCAM; u++) {
		struct usb_ibmcam *ibmcam = &cams[u];
		if (!ibmcam->ibmcam_used) 
		{
			ibmcam->ibmcam_used = 1;	
			for (i=0; i < IBMCAM_NUMFRAMES; i++)
				init_waitqueue_head(&ibmcam->frame[i].wq);
			init_MUTEX(&ibmcam->lock);	
			ibmcam->dev = NULL;
			memcpy(&ibmcam->vdev, &ibmcam_template, sizeof(ibmcam_template));
			return u;
		}
	}
	return -1;
}
static int ibmcam_find_struct ( void ) { int i , u ; for ( u = 0 ; u < MAX_IBMCAM ; u ++ ) { struct usb_ibmcam * ibmcam = & cams [ u ] ; if ( ! ibmcam -> ibmcam_used ) { ibmcam -> ibmcam_used = 1 ; for ( i = 0 ; i < IBMCAM_NUMFRAMES ; i ++ ) init_waitqueue_head ( & ibmcam -> frame [ i ] . wq ) ; init_MUTEX ( & ibmcam -> lock ) ; ibmcam -> dev = NULL ; memcpy ( & ibmcam -> vdev , & ibmcam_template , sizeof ( ibmcam_template ) ) ; return u ; } } return -1 ; }
ibmcam_find_struct()
 This code searches the array of preallocated (static) structures
 and returns index of the first one that isn't in use.
ibmcam_find_struct () This code searches the array of preallocated ( static ) structures and returns index of the first one that isn ' t in use .
/* This one is free */ /* In use now */ /* to 1 == available */