Thread (1 message) 1 message, 1 author, 2011-01-14

Re: [PATCH] net: add Faraday FTMAC100 10/100 Ethernet driver

From: Po-Yu Chuang <hidden>
Date: 2011-01-14 06:50:12
Also in: lkml

Dear Joe,

On Fri, Jan 14, 2011 at 7:05 AM, Joe Perches [off-list ref] wrote:
On Thu, 2011-01-13 at 19:49 +0800, Po-Yu Chuang wrote:
quoted
From: Po-Yu Chuang <redacted>
[]
quoted
+     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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help