All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Nazarewicz <mina86@mina86.com>
To: Krzysztof Opasiak <k.opasiak@samsung.com>, balbi@ti.com
Cc: stable@vger.kernel.org, david.fisher1@synopsys.com,
	gregkh@linuxfoundation.org, andrzej.p@samsung.com,
	m.szyprowski@samsung.com, linux-usb@vger.kernel.org,
	Krzysztof Opasiak <k.opasiak@samsung.com>
Subject: Re: [PATCH v3 5/5] usb: gadget: mass_storage: Warn if LUNs ids are not contiguous
Date: Wed, 08 Jul 2015 16:01:00 +0200	[thread overview]
Message-ID: <xa1tzj36bvfn.fsf@mina86.com> (raw)
In-Reply-To: <1436281065-32407-6-git-send-email-k.opasiak@samsung.com>

On Tue, Jul 07 2015, Krzysztof Opasiak wrote:
> According to mass storage specification:
>
> "Logical Unit Numbers on the device shall be numbered contiguously
>  starting from LUN 0 to a maximum LUN of 15 (Fh)"
>
> So let's at least print a warning message that LUNs ids should be
> contiguous.
>
> Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

> ---
>  drivers/usb/gadget/function/f_mass_storage.c |    7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
> index 5fcd9a0..69167ad 100644
> --- a/drivers/usb/gadget/function/f_mass_storage.c
> +++ b/drivers/usb/gadget/function/f_mass_storage.c
> @@ -3042,6 +3042,13 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
>  		return -EINVAL;
>  	}
>  
> +	for (i = 0; i < ARRAY_SIZE(common->luns); ++i)
> +		if (!common->luns[i])
> +			break;
> +
> +	if (ret != i - 1)
> +		pr_err("LUN ids should be contiguous.\n");
> +
>  	opts = fsg_opts_from_func_inst(f->fi);
>  	if (!opts->no_configfs) {
>  		ret = fsg_common_set_cdev(fsg->common, c->cdev,
> -- 
> 1.7.9.5
>

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo--

      reply	other threads:[~2015-07-08 14:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07 14:57 [PATCH v3 0/5] Mass storage fixes and improvements Krzysztof Opasiak
2015-07-07 14:57 ` [PATCH v3 1/5] usb: gadget: mass_storage: Free buffers if create lun fails Krzysztof Opasiak
2015-07-07 14:57 ` [PATCH v3 2/5] usb: gadget: mass_storage: Place EXPORT_SYMBOL_GPL() after func definition Krzysztof Opasiak
2015-07-07 14:57 ` [PATCH v3 3/5] usb: gadget: storage-common: Set FSG_MAX_LUNS to 16 Krzysztof Opasiak
2015-07-07 22:08   ` Sergei Shtylyov
2015-07-07 14:57 ` [PATCH v3 4/5] usb: gadget: mass_storage: Use static array for luns Krzysztof Opasiak
2015-07-08 14:00   ` Michal Nazarewicz
2015-07-20 10:34     ` Krzysztof Opasiak
2015-07-20 13:17       ` Michal Nazarewicz
2015-07-20 14:09         ` Krzysztof Opasiak
2015-07-20 15:16           ` Michal Nazarewicz
2015-07-07 14:57 ` [PATCH v3 5/5] usb: gadget: mass_storage: Warn if LUNs ids are not contiguous Krzysztof Opasiak
2015-07-08 14:01   ` Michal Nazarewicz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xa1tzj36bvfn.fsf@mina86.com \
    --to=mina86@mina86.com \
    --cc=andrzej.p@samsung.com \
    --cc=balbi@ti.com \
    --cc=david.fisher1@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=k.opasiak@samsung.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.