Subject: Re: [PATCH] add %pM printf format specifier

From: Harvey Harrison <[email-masked]>
Date: Sun, 26 Oct 2008 12:01:14 -0700

On Sun, 2008-10-26 at 09:30 +0100, Johannes Berg wrote:
> static char *ip6_string(char *buf, char *end, be16 *addr, int field_width, int precision, int flags)
> {
> 	char ip6[8*5];
> 	char *p = ip6;
> 	int i;
> 	u16 tmp;
> 
> 	for (i=0; i<7; i++) {
> 		tmp = cpu_to_le16(addr[i]);

		tmp = be16_to_cpup(addr + i);

> 		p = pack_hex_byte(p, tmp >> 8);
> 		p = pack_hex_byte(p, tmp & 0xFF);
> 		if (!(flags & SPECIAL))
> 			*p++ = ':';
> 	}
> 	tmp = cpu_to_le16(addr[7]);

	tmp = be16_to_cpup(addr + 7);

Or maybe just cast addr to char * and avoid the byteswapping altogether.

Just a thought,

Harvey