 /* * DRIVER POLICY CHOICE:  you may want to do this differently. * One thing to avoid is reusing a bcdDevice revision code * with different host-visible configurations or behavior * restrictions -- using ep1in/ep2out vs ep1out/ep3in, etc */ if (gadget_is_net2280 (gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0201); } else if (gadget_is_pxa (gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0203); #if 0 } else if (gadget_is_sh(gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0204); /* SH has only one configuration; see "loopdefault" */ device_desc.bNumConfigurations = 1; /* FIXME make 1 == default.bConfigurationValue */ #endif } else if (gadget_is_sa1100 (gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0205); } else if (gadget_is_goku (gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0206); } else if (gadget_is_mq11xx (gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0207); } else if (gadget_is_omap (gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0208); } else if (gadget_is_lh7a40x(gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0209); } else if (gadget_is_n9604(gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210); } else if (gadget_is_pxa27x(gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211); } else if (gadget_is_s3c2410(gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212); } else if (gadget_is_at91(gadget)) { device_desc.bcdDevice = __constant_cpu_to_le16 (0x0213); } else { 
gcnum = usb_gadget_controller_number (gadget); if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16 (0x0200 + gcnum); else { 
zero_bind (struct usb_gadget *gadget){	struct zero_dev		*dev;	struct usb_ep		*ep;	/* Bulk-only drivers like this one SHOULD be able to	 * autoconfigure on any sane usb controller driver,	 * but there may also be important quirks to address.	 */	usb_ep_autoconfig_reset (gadget);	ep = usb_ep_autoconfig (gadget, &fs_source_desc);	if (!ep) {autoconf_fail:		printk (KERN_ERR "%s: can't autoconfigure on %s\n",			shortname, gadget->name);		return -ENODEV;	}	EP_IN_NAME = ep->name;	ep->driver_data = ep;	/* claim */		ep = usb_ep_autoconfig (gadget, &fs_sink_desc);	if (!ep)		goto autoconf_fail;	EP_OUT_NAME = ep->name;	ep->driver_data = ep;	/* claim */	/*	 * DRIVER POLICY CHOICE:  you may want to do this differently.	 * One thing to avoid is reusing a bcdDevice revision code	 * with different host-visible configurations or behavior	 * restrictions -- using ep1in/ep2out vs ep1out/ep3in, etc	 */	if (gadget_is_net2280 (gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0201);	} else if (gadget_is_pxa (gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0203);#if 0	} else if (gadget_is_sh(gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0204);		/* SH has only one configuration; see "loopdefault" */		device_desc.bNumConfigurations = 1;		/* FIXME make 1 == default.bConfigurationValue */#endif	} else if (gadget_is_sa1100 (gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0205);	} else if (gadget_is_goku (gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0206);	} else if (gadget_is_mq11xx (gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0207);	} else if (gadget_is_omap (gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0208);	} else if (gadget_is_lh7a40x(gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0209);	} else if (gadget_is_n9604(gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210);	} else if (gadget_is_pxa27x(gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211);	} else if (gadget_is_s3c2410(gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);	} else if (gadget_is_at91(gadget)) {		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0213);	} else {		/* gadget zero is so simple (for now, no altsettings) that		 * it SHOULD NOT have problems with bulk-capable hardware.		 * so warn about unrcognized controllers, don't panic.		 *		 * things like configuration and altsetting numbering		 * can need hardware-specific attention though.		 */		printk (KERN_WARNING "%s: controller '%s' not recognized\n",			shortname, gadget->name);		device_desc.bcdDevice = __constant_cpu_to_le16 (0x9999);	}	/* ok, we made sense of the hardware ... */	dev = kmalloc (sizeof *dev, SLAB_KERNEL);	if (!dev)		return -ENOMEM;	memset (dev, 0, sizeof *dev);	spin_lock_init (&dev->lock);	dev->gadget = gadget;	set_gadget_data (gadget, dev);	/* preallocate control response and buffer */	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);	if (!dev->req)		goto enomem;	dev->req->buf = usb_ep_alloc_buffer (gadget->ep0, USB_BUFSIZ,				&dev->req->dma, GFP_KERNEL);	if (!dev->req->buf)		goto enomem;	dev->req->complete = zero_setup_complete;	device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket;#ifdef CONFIG_USB_GADGET_DUALSPEED	/* assume ep0 uses the same value for both speeds ... */	dev_qualifier.bMaxPacketSize0 = device_desc.bMaxPacketSize0;	/* and that all endpoints are dual-speed */	hs_source_desc.bEndpointAddress = fs_source_desc.bEndpointAddress;	hs_sink_desc.bEndpointAddress = fs_sink_desc.bEndpointAddress;#endif	if (gadget->is_otg) {		otg_descriptor.bmAttributes |= USB_OTG_HNP,		source_sink_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;		loopback_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;	}	if (gadget->is_otg) {		otg_descriptor.bmAttributes |= USB_OTG_HNP,		source_sink_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;		loopback_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;	}	usb_gadget_set_selfpowered (gadget);	init_timer (&dev->resume);	dev->resume.function = zero_autoresume;	dev->resume.data = (unsigned long) dev;	if (autoresume) {		source_sink_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;		loopback_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;	}	gadget->ep0->driver_data = dev;	INFO (dev, "%s, version: " DRIVER_VERSION "\n", longname);	INFO (dev, "using %s, OUT %s IN %s\n", gadget->name,		EP_OUT_NAME, EP_IN_NAME);	snprintf (manufacturer, sizeof manufacturer, "%s %s with %s",		system_utsname.sysname, system_utsname.release,		gadget->name);	return 0;enomem:	zero_unbind (gadget);	return -ENOMEM;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/91e79c91fab10f5790159d8d0c1d16da2a9653f9/zero.c/clean/drivers/usb/gadget/zero.c