((u16 *) buf)[0] = cpu_to_le16 (dum->port_status); ((u16 *) buf)[1] = cpu_to_le16 (dum->port_status >> 16); 
((__le16 *) buf)[0] = cpu_to_le16 (dum->port_status); ((__le16 *) buf)[1] = cpu_to_le16 (dum->port_status >> 16); 
static int dummy_hub_control (	struct usb_hcd	*hcd,	u16		typeReq,	u16		wValue,	u16		wIndex,	char		*buf,	u16		wLength) {	struct dummy	*dum;	int		retval = 0;	unsigned long	flags;	dum = hcd_to_dummy (hcd);	spin_lock_irqsave (&dum->lock, flags);	switch (typeReq) {	case ClearHubFeature:		break;	case ClearPortFeature:		switch (wValue) {		case USB_PORT_FEAT_SUSPEND:			if (dum->port_status & USB_PORT_STAT_SUSPEND) {				/* 20msec resume signaling */				dum->resuming = 1;				dum->re_timeout = jiffies +						msecs_to_jiffies(20);			}			break;		case USB_PORT_FEAT_POWER:			if (dum->port_status & USB_PORT_STAT_POWER)				dev_dbg (dummy_dev(dum), "power-off\n");			/* FALLS THROUGH */		default:			dum->port_status &= ~(1 << wValue);			set_link_state (dum);		}		break;	case GetHubDescriptor:		hub_descriptor ((struct usb_hub_descriptor *) buf);		break;	case GetHubStatus:		*(u32 *) buf = __constant_cpu_to_le32 (0);		break;	case GetPortStatus:		if (wIndex != 1)			retval = -EPIPE;		/* whoever resets or resumes must GetPortStatus to		 * complete it!!		 */		if (dum->resuming &&				time_after_eq (jiffies, dum->re_timeout)) {			dum->port_status |= (USB_PORT_STAT_C_SUSPEND << 16);			dum->port_status &= ~USB_PORT_STAT_SUSPEND;		}		if ((dum->port_status & USB_PORT_STAT_RESET) != 0 &&				time_after_eq (jiffies, dum->re_timeout)) {			dum->port_status |= (USB_PORT_STAT_C_RESET << 16);			dum->port_status &= ~USB_PORT_STAT_RESET;			if (dum->pullup) {				dum->port_status |= USB_PORT_STAT_ENABLE;				/* give it the best speed we agree on */				dum->gadget.speed = dum->driver->speed;				dum->gadget.ep0->maxpacket = 64;				switch (dum->gadget.speed) {				case USB_SPEED_HIGH:					dum->port_status |=						USB_PORT_STAT_HIGH_SPEED;					break;				case USB_SPEED_LOW:					dum->gadget.ep0->maxpacket = 8;					dum->port_status |=						USB_PORT_STAT_LOW_SPEED;					break;				default:					dum->gadget.speed = USB_SPEED_FULL;					break;				}			}		}		set_link_state (dum);		((u16 *) buf)[0] = cpu_to_le16 (dum->port_status);		((u16 *) buf)[1] = cpu_to_le16 (dum->port_status >> 16);		break;	case SetHubFeature:		retval = -EPIPE;		break;	case SetPortFeature:		switch (wValue) {		case USB_PORT_FEAT_SUSPEND:			if (dum->active) {				dum->port_status |= USB_PORT_STAT_SUSPEND;				/* HNP would happen here; for now we				 * assume b_bus_req is always true.				 */				set_link_state (dum);				if (((1 << USB_DEVICE_B_HNP_ENABLE)						& dum->devstatus) != 0)					dev_dbg (dummy_dev(dum),							"no HNP yet!\n");			}			break;		case USB_PORT_FEAT_POWER:			dum->port_status |= USB_PORT_STAT_POWER;			set_link_state (dum);			break;		case USB_PORT_FEAT_RESET:			/* if it's already enabled, disable */			dum->port_status &= ~(USB_PORT_STAT_ENABLE					| USB_PORT_STAT_LOW_SPEED					| USB_PORT_STAT_HIGH_SPEED);			/* 50msec reset signaling */			dum->re_timeout = jiffies + msecs_to_jiffies(50);			/* FALLS THROUGH */		default:			if ((dum->port_status & USB_PORT_STAT_POWER) != 0) {				dum->port_status |= (1 << wValue);				set_link_state (dum);			}		}		break;	default:		dev_dbg (dummy_dev(dum),			"hub control req%04x v%04x i%04x l%d\n",			typeReq, wValue, wIndex, wLength);		/* "protocol stall" on error */		retval = -EPIPE;	}	spin_unlock_irqrestore (&dum->lock, flags);	if ((dum->port_status & PORT_C_MASK) != 0)		usb_hcd_poll_rh_status (hcd);	return retval;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/cc095b0b5b653dca3e106710a72ba28b5bb7456b/dummy_hcd.c/buggy/drivers/usb/gadget/dummy_hcd.c