[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87bou5inkk.fsf@devron.myhome.or.jp>
Date: Wed, 28 Sep 2011 08:15:55 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-kernel@...r.kernel.org,
Denys Vlasenko <vda.linux@...glemail.com>
Subject: Re: [PATCHv2] fat: don't use custom hex_to_bin()
Andy Shevchenko <andy.shevchenko@...il.com> writes:
> Actually here we will change endianess.
> So, my question is what endianess is right here? If the original code
> okay, then patch should be rewritten like this:
>
> rc = hex2bin(op++, ip + 3, 1);
> if (rc < 0)
> return -EINVAL;
>
> rc = hex2bin(op++, ip + 1, 1);
> if (rc < 0)
> return -EINVAL;
Original code may work only for little endian. Well, anyway, the output
should be wchar_t (u16) of native endian.
So, I think it should be something like
u8 uc[2];
if (hex2bin(uc, ip + 1, 2) < 0)
return -EINVAL;
*(wchar_t *)op = uc[0] << 8 | uc[1];
This should be readable more.
Thanks.
--
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists