Re: [PATCH] gadget: mass_storage: make mass_storage support multi-luns with different logic block size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 20 Oct 2011, Yuping Luo wrote:

> I send the whole fixed patch for your review, if desirable , Barry
> will send one formal patch for push

> --- a/drivers/usb/gadget/file_storage.c
> +++ b/drivers/usb/gadget/file_storage.c

> @@ -2683,6 +2704,14 @@ static int get_next_command(struct fsg_dev *fsg)
>  		bh->state = BUF_STATE_EMPTY;
> 
>  	} else {		// USB_PR_CB or USB_PR_CBI
> +		struct usb_request	*req;
> +		struct fsg_bulk_cb_wrap	*cbw;
> +
> +		/* update lun */
> +		bh = fsg->next_buffhd_to_fill;
> +		req = bh->outreq;
> +		cbw = req->buf;
> +		fsg->lun = cbw->Lun;
> 
>  		/* Wait for the next command to arrive */
>  		while (fsg->cbbuf_cmnd_size == 0) {

This part is wrong.  The new code has to be added at the end of the 
block, not the beginning -- at the beginning the new command may not 
even have been received yet.  Also, the CB and CBI transports don't use 
CBWs.

What you have to add is (after the spin_unlock_irq):

		fsg->lun = fsg->cmnd[1] >> 5;

Just like the declaration in check_command().  In fact, with this 
addition you can remove the line in check_command() that says:

		fsg->lun = lun;		// Use LUN from the command

You really should test new code before submitting patches.  Proper 
testing would have revealed these errors.

Alan Stern

--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux