[U-Boot] [PATCH 7/9] net: tsec: Use portable types and accessors for BDs

Claudiu Manoil
2013-10-04T08:35:56Z

On 10/4/2013 6:12 AM, Timur Tabi wrote:
> On Mon, Sep 30, 2013 at 4:44 AM, Claudiu Manoil
> <claudiu.manoil@freescale.com> wrote:
>> +#define GET_BD_STAT(T, i) be16_to_cpu((__force __be16)T##BD(i).status)
>> +#define SET_BD_STAT(T, i, v) T##BD(i).status = (__force __u16)cpu_to_be16(v)
>> +#define GET_BD_BLEN(T, i) be16_to_cpu((__force __be16)T##BD(i).length)
>> +#define SET_BD_BLEN(T, i, v) T##BD(i).length = (__force __u16)cpu_to_be16(v)
>> +#define GET_BD_BPTR(T, i) be32_to_cpu((__force __be32)T##BD(i).bufptr)
>> +#define SET_BD_BPTR(T, i, v) T##BD(i).bufptr = (__force __u32)cpu_to_be32(v)
>
> This is pretty ugly. There's got to be a better way to handle this.
> Are you going to be doing stuff like this for every driver for
> bi-endian hardware?
>
> Some time ago I suggest that we re-purpose iowrite() and ioread() to
> be native-endian, and not just little endian. I think something like
> that would make more sense than hacky macros like this.
>
>
Hi Timur,

We dropped these macros in favor of the in_be/out_be() I/O accessors
(see http://patchwork.ozlabs.org/patch/280285/).

Regards,
Claudiu