Messages in this thread | | | Subject | Re: [PATCH] misc drivers/net endianness noise | From | Harvey Harrison <> | Date | Tue, 20 May 2008 17:48:00 -0700 |
| |
On Wed, 2008-05-21 at 01:34 +0100, Al Viro wrote: > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> > --- > tx_buf = catc->tx_buf[catc->tx_idx] + catc->tx_ptr; > - *((u16*)tx_buf) = (catc->is_f5u011) ? cpu_to_be16((u16)skb->len) : cpu_to_le16((u16)skb->len); > + if (catc->is_f5u011) > + *(__be16 *)tx_buf = cpu_to_be16(skb->len); > + else > + *(__le16 *)tx_buf = cpu_to_le16(skb->len); > skb_copy_from_linear_data(skb, tx_buf + 2, skb->len);
I was contemplating an api like:
void put_le16(u16 val, __le16 *ptr) { *ptr = cpu_to_le16(val); }
which would allow the above to become:
if (catc->is_f5u011) put_be16(skb->len, tx_buf); else put_le16(skb->len, tx_buf);
Thoughts?
Harvey
| |