Patchwork [U-Boot,1/2] USB-CDC: Do not rename netdev after its registration

login
register
mail settings
Submitter Vitaly Kuzmichev
Date Dec. 28, 2010, 1:59 p.m.
Message ID <1293544772-5175-2-git-send-email-vkuzmichev@mvista.com>
Download mbox | patch
Permalink /patch/76843/
State Accepted
Commit 8f7aa831c36feb08c5af790d88083afa6f945de2
Headers show

Comments

Vitaly Kuzmichev - Dec. 28, 2010, 1:59 p.m.
Calling eth_bind at usb_eth_init time causes renaming of the network
device from 'usb_ether' to 'usb0'. Fixing this to keep the first name.

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
---
 drivers/usb/gadget/ether.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
Remy Bohmer - Dec. 28, 2010, 7:53 p.m.
Hi,

2010/12/28 Vitaly Kuzmichev <vkuzmichev@mvista.com>:
> Calling eth_bind at usb_eth_init time causes renaming of the network
> device from 'usb_ether' to 'usb0'. Fixing this to keep the first name.
>
> Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
> ---

Applied to u-boot-usb
Thanks

Remy

Patch

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 261cf7e..765fbd8 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -30,7 +30,7 @@ 
 
 #include "gadget_chips.h"
 
-#define USB_NET_NAME "usb0"
+#define USB_NET_NAME "usb_ether"
 
 #define atomic_read
 extern struct platform_data brd;
@@ -1687,7 +1687,6 @@  autoconf_fail:
 	}
 
 	dev->net = &l_netdev;
-	strcpy(dev->net->name, USB_NET_NAME);
 
 	dev->cdc = cdc;
 	dev->zlp = zlp;
@@ -1924,7 +1923,7 @@  int usb_eth_initialize(bd_t *bi)
 	int status = 0;
 	struct eth_device *netdev = &l_netdev;
 
-	sprintf(netdev->name, "usb_ether");
+	strlcpy(netdev->name, USB_NET_NAME, sizeof(netdev->name));
 
 	netdev->init = usb_eth_init;
 	netdev->send = usb_eth_send;