All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: fangxiaozhi 00110321 <fangxiaozhi@huawei.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	zihan@huawei.com, Lin.Lei@huawei.com, greg@kroah.com,
	neil.yi@huawei.com, wangyuhua@huawei.com, huqiao36@huawei.com,
	balbi@ti.com, mdharm-usb@one-eyed-alien.net
Subject: Re: [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
Date: Tue, 08 Jan 2013 12:58:35 +0100	[thread overview]
Message-ID: <2911670.8BWQ5fqvtm@linux-5eaq.site> (raw)
In-Reply-To: <20130108105730.GB3983@breakpoint.cc>

On Tuesday 08 January 2013 11:57:30 Sebastian Andrzej Siewior wrote:
> > +static int usb_stor_huawei_scsi_init(struct us_data *us)
> > +{
> > +     int result = 0;
> > +     int act_len = 0;
> > +     struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
> > +     char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
> > +                     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
> > +     
> > +     memset(bcbw, 0, sizeof(struct bulk_cb_wrap));
> > +     bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
> > +     bcbw->Tag = 0;
> > +     bcbw->DataTransferLength = 0;
> > +     bcbw->Flags = bcbw->Lun = 0;
> > +     bcbw->Length = sizeof(rewind_cmd);
> 
> I asked earlier and I ask again: why memset to zero followed by init to zero.
> Could we stick to one thing?

We shouldn't. The compiler will do the right thing. This is for the human
reader. You tell the reader that you want.

a) a clean slate to start with
b) you issue a command with certain parameters specified. That these
parameters are zero is beside the point. The point is telling the reader
which parameters are important here.

	Regards
		Oliver

PS: What about endianness of bcbw->Length?


  reply	other threads:[~2013-01-08 11:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-05  2:57 [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command fangxiaozhi 00110321
2013-01-08 10:57 ` Sebastian Andrzej Siewior
2013-01-08 11:58   ` Oliver Neukum [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-01-23  6:07 fangxiaozhi 00110321
2012-12-12 10:20 [PATCH 1/1]linux-usb: optimize " fangxiaozhi 00110321
2012-12-12 10:28 ` Felipe Balbi
2012-12-12 10:51 ` Alan Cox
     [not found]   ` <910F9D9E13B84F4C8FA771DC9BDE99F326FBFB54@szxeml546-mbs.china.huawei.com>
2012-12-14  9:31     ` Alan Cox
2012-12-14  9:33       ` Oliver Neukum
2012-12-14 10:28         ` Fangxiaozhi (Franko)
2012-12-14 10:42           ` Oliver Neukum

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=2911670.8BWQ5fqvtm@linux-5eaq.site \
    --to=oneukum@suse.de \
    --cc=Lin.Lei@huawei.com \
    --cc=balbi@ti.com \
    --cc=fangxiaozhi@huawei.com \
    --cc=greg@kroah.com \
    --cc=huqiao36@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mdharm-usb@one-eyed-alien.net \
    --cc=neil.yi@huawei.com \
    --cc=sebastian@breakpoint.cc \
    --cc=wangyuhua@huawei.com \
    --cc=zihan@huawei.com \
    /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.