On Wed, 25 Jul 2012 14:53:00 +0200, Rajaram REGUPATHY <ragupathy.rajaram@xxxxxxxxxxxxxx> wrote:
The short_not_ok field is used by class drivers to indicate udc whether short packet is expected during a particular transfer. In case of mass storage, during command and status phase this field is set as false and set to true during data phase. musb driver uses this field to decide whether to program DMA for mode1. This code is essential for musb driver to program DMA.
There's one thing I don't get. The message talks about musb but the code checks for non Super Speed devices. So maybe the code is correct, maybe it's not, but the message does not really explain it (at least to me). (Also, you probably should wrap the message before 80th column.)
Signed-off-by: Balakumar Rajendran <balakumar.rajendran@xxxxxxxxxxxxxx> Signed-off-by: Rajaram R <ragupathy.rajaram@xxxxxxxxxxxxxx> --- drivers/usb/gadget/f_mass_storage.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index f67b453..db8bf4a 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -878,6 +878,7 @@ static int do_write(struct fsg_common *common) unsigned int amount; ssize_t nwritten; int rc; + struct usb_gadget *gadget = common->cdev->gadget; if (curlun->ro) { curlun->sense_data = SS_WRITE_PROTECTED; @@ -960,6 +961,8 @@ static int do_write(struct fsg_common *common) * the bulk-out maxpacket size. */ set_bulk_out_req_length(common, bh, amount); + if (!gadget_is_superspeed(gadget)) + bh->outreq->short_not_ok = 1; if (!start_out_transfer(common, bh)) /* Dunno what to do if common->fsg is NULL */ return -EIO; @@ -1584,6 +1587,7 @@ static int throw_away_data(struct fsg_common *common) struct fsg_buffhd *bh; u32 amount; int rc; + struct usb_gadget *gadget = common->cdev->gadget; for (bh = common->next_buffhd_to_drain; bh->state != BUF_STATE_EMPTY || common->usb_amount_left > 0; @@ -1617,6 +1621,8 @@ static int throw_away_data(struct fsg_common *common) * the bulk-out maxpacket size. */ set_bulk_out_req_length(common, bh, amount); + if (!gadget_is_superspeed(gadget)) + bh->outreq->short_not_ok = 1; if (!start_out_transfer(common, bh)) /* Dunno what to do if common->fsg is NULL */ return -EIO; @@ -2292,6 +2298,7 @@ static int get_next_command(struct fsg_common *common) { struct fsg_buffhd *bh; int rc = 0; + struct usb_gadget *gadget = common->cdev->gadget; /* Wait for the next buffer to become available */ bh = common->next_buffhd_to_fill; @@ -2303,6 +2310,8 @@ static int get_next_command(struct fsg_common *common) /* Queue a request to read a Bulk-only CBW */ set_bulk_out_req_length(common, bh, US_BULK_CB_WRAP_LEN); + if (!gadget_is_superspeed(gadget)) + bh->outreq->short_not_ok = 0; if (!start_out_transfer(common, bh)) /* Don't know what to do if common->fsg is NULL */ return -EIO;
-- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo-- -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html