From: Joe Perches <joe@perches.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCHv4] fat: don't use custom hex_to_bin()
Date: Thu, 29 Sep 2011 11:41:47 -0700 [thread overview]
Message-ID: <1317321707.1867.1.camel@Joe-Laptop> (raw)
In-Reply-To: <8762kb8aqj.fsf@devron.myhome.or.jp>
On Fri, 2011-09-30 at 03:27 +0900, OGAWA Hirofumi wrote:
> Joe Perches <joe@perches.com> writes:
>
> >> +
> >> + if (hex2bin(uc, ip + 1, 2) < 0)
> >> return -EINVAL;
> >> - }
> >> - *op++ = ec & 0xFF;
> >> - *op++ = ec >> 8;
> >> +
> >> + *(wchar_t *)op++ = uc[0] << 8 | uc[1];
> >
> > perhaps:
> >
> > __le16 foo;
> >
> > if (hex2bin((u8 *)&foo, ip + 1, 2) < 0)
> > return -EINVAL;
> > *(u16 *)op = le16_to_cpu(foo);
> >
> > op += 2;
>
> I also thought about it. But I think it is not so good, like you had
> mistake. It should actually be "__be16 foo" and "be16_to_cpu()".
>
> If we used sscanf() instead of hex2bin(), I might agree to use
> "le16_to_cpu()" though.
>
> Thanks.
Funny.
I guess that's what I get for reading Andy's comment
and coding that readably.
+ /* The ip contains 2 bytes in little
+ * endian format. We need to get them
+ * in native endian. */
next prev parent reply other threads:[~2011-09-29 18:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-23 11:32 [PATCH] alsa: 6fire: don't use custom hex_to_bin() Andy Shevchenko
2011-09-23 11:32 ` [PATCH] fat: " Andy Shevchenko
2011-09-23 12:05 ` Denys Vlasenko
2011-09-23 12:11 ` Andy Shevchenko
2011-09-27 11:48 ` [PATCHv2] " Andy Shevchenko
2011-09-27 17:19 ` OGAWA Hirofumi
2011-09-27 17:52 ` Andy Shevchenko
2011-09-27 18:06 ` Andy Shevchenko
2011-09-27 23:15 ` OGAWA Hirofumi
2011-09-29 13:07 ` Andy Shevchenko
2011-09-29 14:43 ` OGAWA Hirofumi
2011-09-29 14:54 ` Andy Shevchenko
2011-09-29 15:19 ` OGAWA Hirofumi
2011-09-29 15:10 ` [PATCHv4] " Andy Shevchenko
2011-09-29 15:37 ` Joe Perches
2011-09-29 18:27 ` OGAWA Hirofumi
2011-09-29 18:41 ` Joe Perches [this message]
2011-09-29 19:35 ` OGAWA Hirofumi
2011-09-29 13:15 ` [PATCHv3] " Andy Shevchenko
2011-09-29 14:51 ` OGAWA Hirofumi
2011-09-23 13:22 ` [PATCH] alsa: 6fire: " Takashi Iwai
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=1317321707.1867.1.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox