From: David Miller <davem@davemloft.net>
To: luke.adi@gmail.com
Cc: akpm@osdl.org, samuel@sortiz.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix an inproper alignment accessing in irda protocol stack
Date: Thu, 08 Jun 2006 22:01:25 -0700 (PDT) [thread overview]
Message-ID: <20060608.220125.112621003.davem@davemloft.net> (raw)
In-Reply-To: <489ecd0c0606082045w7456a90et586a3954f1a2fca0@mail.gmail.com>
From: "Luke Yang" <luke.adi@gmail.com>
Date: Fri, 9 Jun 2006 11:45:06 +0800
> /* Construct new discovery info to be used by IrLAP, */
> - u16ho(irlmp->discovery_cmd.data.hints) = irlmp->hints.word;
> +#ifdef __LITTLE_ENDIAN
> + irlmp->discovery_cmd.data.hints[0] = irlmp->hints.word & 0xff;
> + irlmp->discovery_cmd.data.hints[1] = (irlmp->hints.word & 0xff00) >> 8;
> +#else /* ifdef __BIG_ENDIAN */
> + irlmp->discovery_cmd.data.hints[0] = (irlmp->hints.word & 0xff00) >> 8;
> + irlmp->discovery_cmd.data.hints[1] = irlmp->hints.word & 0xff;
> +#endif
Please don't add ugly ifdefs, they are not necessary.
You can use the le16_to_cpu() macro on the hints.word datum,
then pick out the byte you need, as necessary. That way you
don't need to use ifdefs.
next prev parent reply other threads:[~2006-06-09 5:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-08 7:15 Luke Yang
2006-06-08 7:30 ` Andrew Morton
2006-06-09 3:45 ` Luke Yang
2006-06-09 5:01 ` David Miller [this message]
2006-06-14 2:29 ` Luke Yang
2006-06-14 3:42 ` David Miller
2006-06-18 5:14 ` David Miller
2006-07-11 2:12 ` Luke Yang
2006-07-11 3:29 ` David Miller
2006-07-11 4:19 ` Luke Yang
2006-07-11 4:33 ` David Miller
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=20060608.220125.112621003.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luke.adi@gmail.com \
--cc=samuel@sortiz.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®