static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id){	struct usb_device *udev = interface_to_usbdev (intf);	struct usb_xpad *xpad = NULL;	struct usb_endpoint_descriptor *ep_irq_in;	char path[64];	int i;		for (i = 0; xpad_device[i].idVendor; i++) {		if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) &&		    (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct))			break;	}		if ((xpad = kmalloc (sizeof(struct usb_xpad), GFP_KERNEL)) == NULL) {		err("cannot allocate memory for new pad");		return -ENOMEM;	}	memset(xpad, 0, sizeof(struct usb_xpad));		xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN,				       SLAB_ATOMIC, &xpad->idata_dma);	if (!xpad->idata) {		kfree(xpad);		return -ENOMEM;	}	xpad->irq_in = usb_alloc_urb(0, GFP_KERNEL);        if (!xpad->irq_in) {		err("cannot allocate memory for new pad irq urb");		usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma);                kfree(xpad);		return -ENOMEM;        }		ep_irq_in = &intf->cur_altsetting->endpoint[0].desc;		usb_fill_int_urb(xpad->irq_in, udev,			 usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress),			 xpad->idata, XPAD_PKT_LEN, xpad_irq_in,			 xpad, ep_irq_in->bInterval);	xpad->irq_in->transfer_dma = xpad->idata_dma;	xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;		xpad->udev = udev;		xpad->dev.id.bustype = BUS_USB;	xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor);	xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct);	xpad->dev.id.version = le16_to_cpu(udev->descriptor.bcdDevice);	xpad->dev.dev = &intf->dev;	xpad->dev.private = xpad;	xpad->dev.name = xpad_device[i].name;	xpad->dev.phys = xpad->phys;	xpad->dev.open = xpad_open;	xpad->dev.close = xpad_close;		usb_make_path(udev, path, 64);	snprintf(xpad->phys, 64,  "%s/input0", path);		xpad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);		for (i = 0; xpad_btn[i] >= 0; i++)		set_bit(xpad_btn[i], xpad->dev.keybit);		for (i = 0; xpad_abs[i] >= 0; i++) {				signed short t = xpad_abs[i];				set_bit(t, xpad->dev.absbit);				switch (t) {			case ABS_X:			case ABS_Y:			case ABS_RX:			case ABS_RY:	/* the two sticks */				xpad->dev.absmax[t] =  32767;				xpad->dev.absmin[t] = -32768;				xpad->dev.absflat[t] = 128;				xpad->dev.absfuzz[t] = 16;				break;			case ABS_Z:			case ABS_RZ:	/* the triggers */				xpad->dev.absmax[t] = 255;				xpad->dev.absmin[t] = 0;				break;			case ABS_HAT0X:			case ABS_HAT0Y:	/* the d-pad */				xpad->dev.absmax[t] =  1;				xpad->dev.absmin[t] = -1;				break;		}	}		input_register_device(&xpad->dev);		printk(KERN_INFO "input: %s on %s", xpad->dev.name, path);		usb_set_intfdata(intf, xpad);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/05f091ab4c8c1f12f8dd38ee789489904fea327d/xpad.c/buggy/drivers/usb/input/xpad.c