linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Michael Buesch <mb@bu3sch.de>
Cc: John W Linville <linville@tuxdriver.com>,
	chunkeey@web.de, linux-wireless@vger.kernel.org
Subject: Re: [RFC/RFT] p54: Fix sparse warnings
Date: Fri, 12 Sep 2008 13:52:52 -0500	[thread overview]
Message-ID: <48CABA84.2060404@lwfinger.net> (raw)
In-Reply-To: <200809122036.03553.mb@bu3sch.de>

Michael Buesch wrote:
> On Friday 12 September 2008 20:16:03 Larry Finger wrote:
>>  struct bootrec {
>>  	__le32 code;
>>  	__le32 len;
>> -	u32 data[0];
>> +	/* Most references to the data section that follows are for u32
>> +	 * quantities; however, one is for an le16 quantity. The union
>> +	 * below avoids a cast and makes the usage clearer. */
>> +	union {
>> +		u32 data[0];
>> +		__le16 data16[0];
>> +	};
>>  } __attribute__((packed));
> 
> I suggest you change
> 	u32 data[0];
> to
> 	__le32 data_le32[0];
> and also add
> 	__be32 data_be32[0];
> to the union. This avoids another few casts.
> (Maybe you don't even need the __le32 variant. I didn't check all the code).

No, it won't avoid any casts. The program uses the data area 7 times 
in native-cpu order, once as be32, and once in little-endian order 
(the one that was fixed by the union).

I will add the packed attribute as suggested in your other email.

Thanks for the review,

Larry

  parent reply	other threads:[~2008-09-12 18:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-12 18:16 [RFC/RFT] p54: Fix sparse warnings Larry Finger
2008-09-12 18:36 ` Michael Buesch
2008-09-12 18:39   ` Michael Buesch
2008-09-12 18:52   ` Larry Finger [this message]
2008-09-13 12:40     ` Michael Buesch
2008-09-13 15:40       ` Larry Finger
2008-09-17 16:15         ` Pavel Roskin
2008-09-17 17:16           ` Larry Finger

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=48CABA84.2060404@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=chunkeey@web.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mb@bu3sch.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).