u16 wIndex = ctrl->wIndex; u16 wValue = ctrl->wValue; u16 wLength = ctrl->wLength; 
u16 wIndex = le16_to_cpu(ctrl->wIndex); u16 wValue = le16_to_cpu(ctrl->wValue); u16 wLength = le16_to_cpu(ctrl->wLength); 
static int gs_setup_standard(struct usb_gadget *gadget,	const struct usb_ctrlrequest *ctrl){	int ret = -EOPNOTSUPP;	struct gs_dev *dev = get_gadget_data(gadget);	struct usb_request *req = dev->dev_ctrl_req;	u16 wIndex = ctrl->wIndex;	u16 wValue = ctrl->wValue;	u16 wLength = ctrl->wLength;	switch (ctrl->bRequest) {	case USB_REQ_GET_DESCRIPTOR:		if (ctrl->bRequestType != USB_DIR_IN)			break;		switch (wValue >> 8) {		case USB_DT_DEVICE:			ret = min(wLength,				(u16)sizeof(struct usb_device_descriptor));			memcpy(req->buf, &gs_device_desc, ret);			break;#ifdef CONFIG_USB_GADGET_DUALSPEED		case USB_DT_DEVICE_QUALIFIER:			if (!gadget->is_dualspeed)				break;			ret = min(wLength,				(u16)sizeof(struct usb_qualifier_descriptor));			memcpy(req->buf, &gs_qualifier_desc, ret);			break;		case USB_DT_OTHER_SPEED_CONFIG:			if (!gadget->is_dualspeed)				break;			/* fall through */#endif /* CONFIG_USB_GADGET_DUALSPEED */		case USB_DT_CONFIG:			ret = gs_build_config_buf(req->buf, gadget->speed,				wValue >> 8, wValue & 0xff,				gadget->is_otg);			if (ret >= 0)				ret = min(wLength, (u16)ret);			break;		case USB_DT_STRING:			/* wIndex == language code. */			ret = usb_gadget_get_string(&gs_string_table,				wValue & 0xff, req->buf);			if (ret >= 0)				ret = min(wLength, (u16)ret);			break;		}		break;	case USB_REQ_SET_CONFIGURATION:		if (ctrl->bRequestType != 0)			break;		spin_lock(&dev->dev_lock);		ret = gs_set_config(dev, wValue);		spin_unlock(&dev->dev_lock);		break;	case USB_REQ_GET_CONFIGURATION:		if (ctrl->bRequestType != USB_DIR_IN)			break;		*(u8 *)req->buf = dev->dev_config;		ret = min(wLength, (u16)1);		break;	case USB_REQ_SET_INTERFACE:		if (ctrl->bRequestType != USB_RECIP_INTERFACE				|| !dev->dev_config				|| wIndex >= GS_MAX_NUM_INTERFACES)			break;		if (dev->dev_config == GS_BULK_CONFIG_ID				&& wIndex != GS_BULK_INTERFACE_ID)			break;		/* no alternate interface settings */		if (wValue != 0)			break;		spin_lock(&dev->dev_lock);		/* PXA hardware partially handles SET_INTERFACE;		 * we need to kluge around that interference.  */		if (gadget_is_pxa(gadget)) {			ret = gs_set_config(dev, use_acm ?				GS_ACM_CONFIG_ID : GS_BULK_CONFIG_ID);			goto set_interface_done;		}		if (dev->dev_config != GS_BULK_CONFIG_ID				&& wIndex == GS_CONTROL_INTERFACE_ID) {			if (dev->dev_notify_ep) {				usb_ep_disable(dev->dev_notify_ep);				usb_ep_enable(dev->dev_notify_ep, dev->dev_notify_ep_desc);			}		} else {			usb_ep_disable(dev->dev_in_ep);			usb_ep_disable(dev->dev_out_ep);			usb_ep_enable(dev->dev_in_ep, dev->dev_in_ep_desc);			usb_ep_enable(dev->dev_out_ep, dev->dev_out_ep_desc);		}		ret = 0;set_interface_done:		spin_unlock(&dev->dev_lock);		break;	case USB_REQ_GET_INTERFACE:		if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE)		|| dev->dev_config == GS_NO_CONFIG_ID)			break;		if (wIndex >= GS_MAX_NUM_INTERFACES				|| (dev->dev_config == GS_BULK_CONFIG_ID				&& wIndex != GS_BULK_INTERFACE_ID)) {			ret = -EDOM;			break;		}		/* no alternate interface settings */		*(u8 *)req->buf = 0;		ret = min(wLength, (u16)1);		break;	default:		printk(KERN_ERR "gs_setup: unknown standard request, type=%02x, request=%02x, value=%04x, index=%04x, length=%d\n",			ctrl->bRequestType, ctrl->bRequest,			wValue, wIndex, wLength);		break;	}	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/1bbc169621cbe502b9143a27eb12802a0f1d43a0/serial.c/buggy/drivers/usb/gadget/serial.c