usbnet: add usbnet_event_names[] for kevent
authorYajun Deng <yajun.deng@linux.dev>
Thu, 24 Jun 2021 07:35:08 +0000 (15:35 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Jun 2021 19:34:45 +0000 (12:34 -0700)
Modify the netdev_dbg content from int to char * in usbnet_defer_kevent(),
this looks more readable.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/usbnet.c

index 57a5a025255c1a7aa6f4c90089cfa7ebc6c5cb72..470e1c1e6353532a1f653c2b3cc25b83d534d78e 100644 (file)
@@ -74,6 +74,23 @@ MODULE_PARM_DESC (msg_level, "Override default message level");
 
 /*-------------------------------------------------------------------------*/
 
+static const char * const usbnet_event_names[] = {
+       [EVENT_TX_HALT]            = "EVENT_TX_HALT",
+       [EVENT_RX_HALT]            = "EVENT_RX_HALT",
+       [EVENT_RX_MEMORY]          = "EVENT_RX_MEMORY",
+       [EVENT_STS_SPLIT]          = "EVENT_STS_SPLIT",
+       [EVENT_LINK_RESET]         = "EVENT_LINK_RESET",
+       [EVENT_RX_PAUSED]          = "EVENT_RX_PAUSED",
+       [EVENT_DEV_ASLEEP]         = "EVENT_DEV_ASLEEP",
+       [EVENT_DEV_OPEN]           = "EVENT_DEV_OPEN",
+       [EVENT_DEVICE_REPORT_IDLE] = "EVENT_DEVICE_REPORT_IDLE",
+       [EVENT_NO_RUNTIME_PM]      = "EVENT_NO_RUNTIME_PM",
+       [EVENT_RX_KILL]            = "EVENT_RX_KILL",
+       [EVENT_LINK_CHANGE]        = "EVENT_LINK_CHANGE",
+       [EVENT_SET_RX_MODE]        = "EVENT_SET_RX_MODE",
+       [EVENT_NO_IP_ALIGN]        = "EVENT_NO_IP_ALIGN",
+};
+
 /* handles CDC Ethernet and many other network "bulk data" interfaces */
 int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
 {
@@ -452,9 +469,9 @@ void usbnet_defer_kevent (struct usbnet *dev, int work)
 {
        set_bit (work, &dev->flags);
        if (!schedule_work (&dev->kevent))
-               netdev_dbg(dev->net, "kevent %d may have been dropped\n", work);
+               netdev_dbg(dev->net, "kevent %s may have been dropped\n", usbnet_event_names[work]);
        else
-               netdev_dbg(dev->net, "kevent %d scheduled\n", work);
+               netdev_dbg(dev->net, "kevent %s scheduled\n", usbnet_event_names[work]);
 }
 EXPORT_SYMBOL_GPL(usbnet_defer_kevent);