Messages in this thread | | | From | Po-Yu Chuang <> | Date | Fri, 14 Jan 2011 14:49:45 +0800 | Subject | Re: [PATCH] net: add Faraday FTMAC100 10/100 Ethernet driver |
| |
Dear Joe,
On Fri, Jan 14, 2011 at 7:05 AM, Joe Perches <joe@perches.com> wrote: > On Thu, 2011-01-13 at 19:49 +0800, Po-Yu Chuang wrote: >> From: Po-Yu Chuang <ratbert@faraday-tech.com> > [] >> + if (is_zero_ether_addr(netdev->dev_addr)) { >> + random_ether_addr(netdev->dev_addr); >> + dev_info(&netdev->dev, "generated random MAC address " >> + "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x.\n", >> + netdev->dev_addr[0], netdev->dev_addr[1], >> + netdev->dev_addr[2], netdev->dev_addr[3], >> + netdev->dev_addr[4], netdev->dev_addr[5]); > > Sorry, one other thing. > There are kernel specific printf extensions for pointer types. > (look at lib/vsprintf.c) There's one for mac addresses: "%pM". > This could be done as: > > netdev_info(netdev, "Generated random MAC address: %pM\n", > netdev->dev_addr);
Wow, this is pretty beautiful. Thanks.
best regards, Po-Yu Chuang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |