diff options
Diffstat (limited to 'drivers/usb/gadget/file_storage.c')
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index f5ce45c4b2a3..4f57085619b4 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -819,7 +819,7 @@ static void inline put_be32(u8 *buf, u32 val) | |||
819 | buf[0] = val >> 24; | 819 | buf[0] = val >> 24; |
820 | buf[1] = val >> 16; | 820 | buf[1] = val >> 16; |
821 | buf[2] = val >> 8; | 821 | buf[2] = val >> 8; |
822 | buf[3] = val; | 822 | buf[3] = val & 0xff; |
823 | } | 823 | } |
824 | 824 | ||
825 | 825 | ||
@@ -1277,8 +1277,8 @@ static int class_setup_req(struct fsg_dev *fsg, | |||
1277 | { | 1277 | { |
1278 | struct usb_request *req = fsg->ep0req; | 1278 | struct usb_request *req = fsg->ep0req; |
1279 | int value = -EOPNOTSUPP; | 1279 | int value = -EOPNOTSUPP; |
1280 | u16 w_index = ctrl->wIndex; | 1280 | u16 w_index = le16_to_cpu(ctrl->wIndex); |
1281 | u16 w_length = ctrl->wLength; | 1281 | u16 w_length = le16_to_cpu(ctrl->wLength); |
1282 | 1282 | ||
1283 | if (!fsg->config) | 1283 | if (!fsg->config) |
1284 | return value; | 1284 | return value; |
@@ -1345,7 +1345,7 @@ static int class_setup_req(struct fsg_dev *fsg, | |||
1345 | "unknown class-specific control req " | 1345 | "unknown class-specific control req " |
1346 | "%02x.%02x v%04x i%04x l%u\n", | 1346 | "%02x.%02x v%04x i%04x l%u\n", |
1347 | ctrl->bRequestType, ctrl->bRequest, | 1347 | ctrl->bRequestType, ctrl->bRequest, |
1348 | ctrl->wValue, w_index, w_length); | 1348 | le16_to_cpu(ctrl->wValue), w_index, w_length); |
1349 | return value; | 1349 | return value; |
1350 | } | 1350 | } |
1351 | 1351 | ||
@@ -1359,8 +1359,8 @@ static int standard_setup_req(struct fsg_dev *fsg, | |||
1359 | { | 1359 | { |
1360 | struct usb_request *req = fsg->ep0req; | 1360 | struct usb_request *req = fsg->ep0req; |
1361 | int value = -EOPNOTSUPP; | 1361 | int value = -EOPNOTSUPP; |
1362 | u16 w_index = ctrl->wIndex; | 1362 | u16 w_index = le16_to_cpu(ctrl->wIndex); |
1363 | u16 w_value = ctrl->wValue; | 1363 | u16 w_value = le16_to_cpu(ctrl->wValue); |
1364 | 1364 | ||
1365 | /* Usually this just stores reply data in the pre-allocated ep0 buffer, | 1365 | /* Usually this just stores reply data in the pre-allocated ep0 buffer, |
1366 | * but config change events will also reconfigure hardware. */ | 1366 | * but config change events will also reconfigure hardware. */ |
@@ -1469,7 +1469,7 @@ static int standard_setup_req(struct fsg_dev *fsg, | |||
1469 | VDBG(fsg, | 1469 | VDBG(fsg, |
1470 | "unknown control req %02x.%02x v%04x i%04x l%u\n", | 1470 | "unknown control req %02x.%02x v%04x i%04x l%u\n", |
1471 | ctrl->bRequestType, ctrl->bRequest, | 1471 | ctrl->bRequestType, ctrl->bRequest, |
1472 | w_value, w_index, ctrl->wLength); | 1472 | w_value, w_index, le16_to_cpu(ctrl->wLength)); |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | return value; | 1475 | return value; |
@@ -1481,7 +1481,7 @@ static int fsg_setup(struct usb_gadget *gadget, | |||
1481 | { | 1481 | { |
1482 | struct fsg_dev *fsg = get_gadget_data(gadget); | 1482 | struct fsg_dev *fsg = get_gadget_data(gadget); |
1483 | int rc; | 1483 | int rc; |
1484 | int w_length = ctrl->wLength; | 1484 | int w_length = le16_to_cpu(ctrl->wLength); |
1485 | 1485 | ||
1486 | ++fsg->ep0_req_tag; // Record arrival of a new request | 1486 | ++fsg->ep0_req_tag; // Record arrival of a new request |
1487 | fsg->ep0req->context = NULL; | 1487 | fsg->ep0req->context = NULL; |
@@ -1497,8 +1497,7 @@ static int fsg_setup(struct usb_gadget *gadget, | |||
1497 | if (rc >= 0 && rc != DELAYED_STATUS) { | 1497 | if (rc >= 0 && rc != DELAYED_STATUS) { |
1498 | rc = min(rc, w_length); | 1498 | rc = min(rc, w_length); |
1499 | fsg->ep0req->length = rc; | 1499 | fsg->ep0req->length = rc; |
1500 | fsg->ep0req->zero = (rc < w_length && | 1500 | fsg->ep0req->zero = rc < w_length; |
1501 | (rc % gadget->ep0->maxpacket) == 0); | ||
1502 | fsg->ep0req_name = (ctrl->bRequestType & USB_DIR_IN ? | 1501 | fsg->ep0req_name = (ctrl->bRequestType & USB_DIR_IN ? |
1503 | "ep0-in" : "ep0-out"); | 1502 | "ep0-in" : "ep0-out"); |
1504 | rc = ep0_queue(fsg); | 1503 | rc = ep0_queue(fsg); |