Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3701
b: refs/heads/master
c: cc095b0
h: refs/heads/master
i:
  3699: dfa9e8d
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Jun 27, 2005
1 parent 967f49d commit 9428364
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f0706930091902641929f2229bfb106144782c94
refs/heads/master: cc095b0b5b653dca3e106710a72ba28b5bb7456b
40 changes: 23 additions & 17 deletions trunk/drivers/usb/gadget/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ show_function (struct device *dev, struct device_attribute *attr, char *buf)
return 0;
return scnprintf (buf, PAGE_SIZE, "%s\n", dum->driver->function);
}
DEVICE_ATTR (function, S_IRUGO, show_function, NULL);
static DEVICE_ATTR (function, S_IRUGO, show_function, NULL);

/*-------------------------------------------------------------------------*/

Expand Down Expand Up @@ -857,6 +857,9 @@ EXPORT_SYMBOL (usb_gadget_unregister_driver);

#undef is_enabled

/* just declare this in any driver that really need it */
extern int net2280_set_fifo_mode (struct usb_gadget *gadget, int mode);

int net2280_set_fifo_mode (struct usb_gadget *gadget, int mode)
{
return -ENOSYS;
Expand Down Expand Up @@ -1122,7 +1125,6 @@ static int periodic_bytes (struct dummy *dum, struct dummy_ep *ep)

/* high bandwidth mode */
tmp = le16_to_cpu(ep->desc->wMaxPacketSize);
tmp = le16_to_cpu (tmp);
tmp = (tmp >> 11) & 0x03;
tmp *= 8 /* applies to entire frame */;
limit += limit * tmp;
Expand Down Expand Up @@ -1265,9 +1267,14 @@ static void dummy_timer (unsigned long _dum)
struct usb_ctrlrequest setup;
int value = 1;
struct dummy_ep *ep2;
unsigned w_index;
unsigned w_value;

setup = *(struct usb_ctrlrequest*) urb->setup_packet;
if (setup.wLength != urb->transfer_buffer_length) {
w_index = le16_to_cpu(setup.wIndex);
w_value = le16_to_cpu(setup.wValue);
if (le16_to_cpu(setup.wLength) !=
urb->transfer_buffer_length) {
maybe_set_status (urb, -EOVERFLOW);
goto return_urb;
}
Expand Down Expand Up @@ -1297,16 +1304,16 @@ static void dummy_timer (unsigned long _dum)
case USB_REQ_SET_ADDRESS:
if (setup.bRequestType != Dev_Request)
break;
dum->address = setup.wValue;
dum->address = w_value;
maybe_set_status (urb, 0);
dev_dbg (udc_dev(dum), "set_address = %d\n",
setup.wValue);
w_value);
value = 0;
break;
case USB_REQ_SET_FEATURE:
if (setup.bRequestType == Dev_Request) {
value = 0;
switch (setup.wValue) {
switch (w_value) {
case USB_DEVICE_REMOTE_WAKEUP:
break;
case USB_DEVICE_B_HNP_ENABLE:
Expand All @@ -1324,14 +1331,13 @@ static void dummy_timer (unsigned long _dum)
}
if (value == 0) {
dum->devstatus |=
(1 << setup.wValue);
(1 << w_value);
maybe_set_status (urb, 0);
}

} else if (setup.bRequestType == Ep_Request) {
// endpoint halt
ep2 = find_endpoint (dum,
setup.wIndex);
ep2 = find_endpoint (dum, w_index);
if (!ep2) {
value = -EOPNOTSUPP;
break;
Expand All @@ -1343,7 +1349,7 @@ static void dummy_timer (unsigned long _dum)
break;
case USB_REQ_CLEAR_FEATURE:
if (setup.bRequestType == Dev_Request) {
switch (setup.wValue) {
switch (w_value) {
case USB_DEVICE_REMOTE_WAKEUP:
dum->devstatus &= ~(1 <<
USB_DEVICE_REMOTE_WAKEUP);
Expand All @@ -1356,8 +1362,7 @@ static void dummy_timer (unsigned long _dum)
}
} else if (setup.bRequestType == Ep_Request) {
// endpoint halt
ep2 = find_endpoint (dum,
setup.wIndex);
ep2 = find_endpoint (dum, w_index);
if (!ep2) {
value = -EOPNOTSUPP;
break;
Expand All @@ -1383,7 +1388,7 @@ static void dummy_timer (unsigned long _dum)
if (urb->transfer_buffer_length > 0) {
if (setup.bRequestType ==
Ep_InRequest) {
ep2 = find_endpoint (dum, setup.wIndex);
ep2 = find_endpoint (dum, w_index);
if (!ep2) {
value = -EOPNOTSUPP;
break;
Expand Down Expand Up @@ -1535,7 +1540,8 @@ hub_descriptor (struct usb_hub_descriptor *desc)
memset (desc, 0, sizeof *desc);
desc->bDescriptorType = 0x29;
desc->bDescLength = 9;
desc->wHubCharacteristics = __constant_cpu_to_le16 (0x0001);
desc->wHubCharacteristics = (__force __u16)
(__constant_cpu_to_le16 (0x0001));
desc->bNbrPorts = 1;
desc->bitmap [0] = 0xff;
desc->bitmap [1] = 0xff;
Expand Down Expand Up @@ -1581,7 +1587,7 @@ static int dummy_hub_control (
hub_descriptor ((struct usb_hub_descriptor *) buf);
break;
case GetHubStatus:
*(u32 *) buf = __constant_cpu_to_le32 (0);
*(__le32 *) buf = __constant_cpu_to_le32 (0);
break;
case GetPortStatus:
if (wIndex != 1)
Expand Down Expand Up @@ -1621,8 +1627,8 @@ static int dummy_hub_control (
}
}
set_link_state (dum);
((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);
break;
case SetHubFeature:
retval = -EPIPE;
Expand Down

0 comments on commit 9428364

Please sign in to comment.