*handle = client; client->state &= ~CLIENT_UNBOUND; client->Socket = s; 
*handle = p_dev; p_dev->state &= ~CLIENT_UNBOUND; 
int pcmcia_register_client(client_handle_t *handle, client_reg_t *req){	client_t *client = NULL;	struct pcmcia_socket *s = NULL;	struct pcmcia_device *p_dev = NULL;	struct pcmcia_driver *p_drv = NULL;	/* Look for unbound client with matching dev_info */	down_read(&pcmcia_socket_list_rwsem);	list_for_each_entry(s, &pcmcia_socket_list, socket_list) {		unsigned long flags;		if (s->state & SOCKET_CARDBUS)			continue;		s = pcmcia_get_socket(s);		if (!s)			continue;		spin_lock_irqsave(&pcmcia_dev_list_lock, flags);		list_for_each_entry(p_dev, &s->devices_list, socket_device_list) {			p_dev = pcmcia_get_dev(p_dev);			if (!p_dev)				continue;			if (!(p_dev->client.state & CLIENT_UNBOUND) ||			    (!p_dev->dev.driver)) {				pcmcia_put_dev(p_dev);				continue;			}			p_drv = to_pcmcia_drv(p_dev->dev.driver);			if (!strncmp(p_drv->drv.name, (char *)req->dev_info, DEV_NAME_LEN)) {				client = &p_dev->client;				spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);				goto found;			}			pcmcia_put_dev(p_dev);		}		spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);		pcmcia_put_socket(s);	} found:	up_read(&pcmcia_socket_list_rwsem);	if (!p_dev || !client)		return -ENODEV;	pcmcia_put_socket(s); /* safe, as we already hold a reference from bind_device */	*handle = client;	client->state &= ~CLIENT_UNBOUND;	client->Socket = s;	p_dev->event_callback_args = req->event_callback_args;	p_dev->event_callback_args.client_handle = client;	if (s->state & SOCKET_CARDBUS)		client->state |= CLIENT_CARDBUS;	if ((!(s->state & SOCKET_CARDBUS)) && (s->functions == 0) &&	    (client->Function != BIND_FN_ALL)) {		cistpl_longlink_mfc_t mfc;		if (pccard_read_tuple(s, client->Function, CISTPL_LONGLINK_MFC, &mfc)		    == CS_SUCCESS)			s->functions = mfc.nfn;		else			s->functions = 1;		s->config = kmalloc(sizeof(config_t) * s->functions,				    GFP_KERNEL);		if (!s->config)			goto out_no_resource;		memset(s->config, 0, sizeof(config_t) * s->functions);	}	ds_dbg(1, "register_client(): client 0x%p, dev %s\n",	       client, p_dev->dev.bus_id);	if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) {		if (p_drv->event)			p_drv->event(CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW,				     &p_dev->event_callback_args);	}	return CS_SUCCESS; out_no_resource:	pcmcia_put_dev(p_dev);	return CS_OUT_OF_RESOURCE;} /* register_client */
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/e12a9a93a8417c4f2aa46ce8346c2d27e656b9a2/ds.c/buggy/drivers/pcmcia/ds.c