Re: byteorder helpers and void * (was: Re: [PATCH 01/21] lib: add byteorder helpers for the aligned case)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Geert Uytterhoeven <Geert.Uytterhoeven@...>
Cc: Pavel Machek <pavel@...>, Andrew Morton <akpm@...>, LKML <linux-kernel@...>
Date: Tuesday, June 24, 2008 - 10:35 pm

On Tue, 2008-06-24 at 14:54 +0200, Geert Uytterhoeven wrote:

I'm starting to come around to the typechecking argument.  This would
also be a chance to fix the argument ordering in put_analigned_XXXX
that was noticed by others.  As there are already some existing users
in-tree, we could transition gradually by:

1) Introduce typed versions of get/put_unaligned_XXXX, that implies the
byteswap better:
u16 load_unaligned_le16(__le16 *)
void store_unaligned_le16(__le16 *, u16)

Then the aligned helpers could be:
le16_to_cpup -> aligned equivalent of load_unaligned_le16
store_le16(__le16 *, u16)

Implemented as (to allow constant folding)
#define store_le16(ptr, val)	(*(__le16 *)(ptr) = cpu_to_le16((u16)(val)))


It is not meant for generic use, it is just there as a helper for each
arch to wire up it's get_unaligned() macro depending on its endianness,
so each arch doesn't wire up its own version that may or may not have
the size checking.

Anything I missed?

Harvey

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
byteorder helpers and void * (was: Re: [PATCH 01/21] lib: ad..., Geert Uytterhoeven, (Tue Jun 24, 8:54 am)
Re: byteorder helpers and void * (was: Re: [PATCH 01/21] lib..., Harvey Harrison, (Tue Jun 24, 10:35 pm)
Re: byteorder helpers and void * (was: Re: [PATCH 01/21] lib..., Geert Uytterhoeven, (Wed Jun 25, 7:20 am)