rndis_host: Add link_change function pointer to 'struct rndis_data'.
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>
Fri, 25 Jan 2008 22:51:34 +0000 (00:51 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Feb 2008 03:26:59 +0000 (19:26 -0800)
Callback to signal link state changes from minidriver to
'subminidrivers'.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/rndis_host.c
drivers/net/usb/usbnet.h

index 08139030954f39a5d00d226e390be2862b16ec01..800c9d02c3f42a0a508e294ca56944d676264565 100644 (file)
@@ -148,10 +148,26 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf)
                                        request_id, xid);
                                /* then likely retry */
                        } else switch (buf->msg_type) {
-                       case RNDIS_MSG_INDICATE: {      /* fault */
-                               // struct rndis_indicate *msg = (void *)buf;
-                               dev_info(&info->control->dev,
-                                       "rndis fault indication\n");
+                       case RNDIS_MSG_INDICATE: {      /* fault/event */
+                               struct rndis_indicate *msg = (void *)buf;
+                               int state = 0;
+
+                               switch (msg->status) {
+                               case RNDIS_STATUS_MEDIA_CONNECT:
+                                       state = 1;
+                               case RNDIS_STATUS_MEDIA_DISCONNECT:
+                                       dev_info(&info->control->dev,
+                                               "rndis media %sconnect\n",
+                                               !state?"dis":"");
+                                       if (dev->driver_info->link_change)
+                                               dev->driver_info->link_change(
+                                                       dev, state);
+                                       break;
+                               default:
+                                       dev_info(&info->control->dev,
+                                               "rndis indication: 0x%08x\n",
+                                               le32_to_cpu(msg->status));
+                               }
                                }
                                break;
                        case RNDIS_MSG_KEEPALIVE: {     /* ping */
index 25b63d3339dc7a3623c1530ce0a238823e252f46..e0501da3dd115024b9b31b8d1f0d0bd139b3f19d 100644 (file)
@@ -121,6 +121,10 @@ struct driver_info {
         * right after minidriver have initialized hardware. */
        int     (*early_init)(struct usbnet *dev);
 
+       /* called by minidriver when link state changes, state: 0=disconnect,
+        * 1=connect */
+       void    (*link_change)(struct usbnet *dev, int state);
+
        /* for new devices, use the descriptor-reading code instead */
        int             in;             /* rx endpoint */
        int             out;            /* tx endpoint */