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 Tue, 25 Oct 2011, Yuping Luo wrote:

> 2011/10/20 Michal Nazarewicz <mina86@xxxxxxxxxx>:
> > On Thu, 20 Oct 2011 03:01:47 -0700, Yuping Luo <lypingsh@xxxxxxxxx> wrote:
> >>
> >> @@ -2027,9 +2037,9 @@ static int do_scsi_command(struct fsg_common
> >> *common)
> >>
> >>        case READ_6:
> >>                i = common->cmnd[4];
> >> -               common->data_size_from_cmnd = (i == 0 ? 256 : i) <<
> >> -                               common->curlun->blkbits;
> >> -               reply = check_command(common, 6, DATA_DIR_TO_HOST,
> >> +               common->data_size_from_cmnd = (i == 0 ? 256 : i);
> >
> > At this point parens are not really needed.
> >
> agree, the following is more readable
>         common->data_size_from_cmnd = (i == 0) ? 256 : i;

This is a matter of personal taste.  I find it less readable.

In order to parse that expression correctly, you have to know whether
the '=' operator has higher or lower precedence than the '?' operator.  
I can't be bothered to remember details like that, so I always put the
entire right-hand argument of the assignment inside parens.

(Of course, then I face the problem of whether '==' has higher or lower 
precedence than '?'.  It may be illogical, but I'm more willing to deal 
with that ambiguity than the other one.)

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