@@ -1591,6 +1591,17 @@ int usbnet_resume (struct usb_interface *intf)
}
EXPORT_SYMBOL_GPL(usbnet_resume);
+void usbnet_link_change(struct usbnet *dev, int link, int need_reset)
+{
+ if (link)
+ netif_carrier_on(dev->net);
+ else
+ netif_carrier_off(dev->net);
+
+ if (need_reset && link)
+ usbnet_defer_kevent(dev, EVENT_LINK_RESET);
+}
+EXPORT_SYMBOL_GPL(usbnet_link_change);
/*-------------------------------------------------------------------------*/
@@ -160,7 +160,7 @@ extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *);
extern int usbnet_suspend(struct usb_interface *, pm_message_t);
extern int usbnet_resume(struct usb_interface *);
extern void usbnet_disconnect(struct usb_interface *);
-
+extern void usbnet_link_change(struct usbnet *dev, int link, int need_reset);
/* Drivers that reuse some of the standard USB CDC infrastructure
* (notably, using multiple interfaces according to the CDC
This patch introduces the API of usbnet_link_change, so that usbnet can trace the link change, which may help to implement the later runtime PM triggered by usb ethernet link change. Signed-off-by: Ming Lei <ming.lei@canonical.com> --- drivers/net/usb/usbnet.c | 11 +++++++++++ include/linux/usb/usbnet.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-)