Skip to content

Commit bb07bd6

Browse files
pcercueigregkh
authored andcommitted
Revert "usb: gadget: u_ether: Do not make UDC parent of the net device"
This reverts commit 321b598. This commit broke USB networking on Ingenic SoCs and maybe elsewhere. The actual reason is unknown; and while a proper fix would be better, we're sitting at -rc7 now, so a revert is justified - and we can work on re-introducing this change for 6.3. Fixes: 321b598 ("usb: gadget: u_ether: Do not make UDC parent of the net device") Signed-off-by: Paul Cercueil <[email protected]> Acked-by: Sascha Hauer <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4ec5183 commit bb07bd6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/usb/gadget/function/u_ether.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g,
798798
net->max_mtu = GETHER_MAX_MTU_SIZE;
799799

800800
dev->gadget = g;
801+
SET_NETDEV_DEV(net, &g->dev);
801802
SET_NETDEV_DEVTYPE(net, &gadget_type);
802803

803804
status = register_netdev(net);
@@ -872,6 +873,8 @@ int gether_register_netdev(struct net_device *net)
872873
struct usb_gadget *g;
873874
int status;
874875

876+
if (!net->dev.parent)
877+
return -EINVAL;
875878
dev = netdev_priv(net);
876879
g = dev->gadget;
877880

@@ -902,6 +905,7 @@ void gether_set_gadget(struct net_device *net, struct usb_gadget *g)
902905

903906
dev = netdev_priv(net);
904907
dev->gadget = g;
908+
SET_NETDEV_DEV(net, &g->dev);
905909
}
906910
EXPORT_SYMBOL_GPL(gether_set_gadget);
907911

0 commit comments

Comments
 (0)