rndis_host: Add early_init function pointer to 'struct rndis_data'.
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>
Fri, 25 Jan 2008 22:51:28 +0000 (00:51 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Feb 2008 03:26:58 +0000 (19:26 -0800)
Function pointer is for 'subminidrivers' that need to do work on device
right after minidriver has initialized hardware.

For example, rndis_wlan setting device specific configuration parameters
with OID_GEN_RNDIS_CONFIG_PARAMETER right after rndis_host has
initialized hardware with RNDIS_INIT.

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 1d6bf0a28cecf312cc32ee448722315f89d82aa0..08139030954f39a5d00d226e390be2862b16ec01 100644 (file)
@@ -336,6 +336,12 @@ int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf)
                dev->hard_mtu, tmp, dev->rx_urb_size,
                1 << le32_to_cpu(u.init_c->packet_alignment));
 
+       /* module has some device initialization code needs to be done right
+        * after RNDIS_INIT */
+       if (dev->driver_info->early_init &&
+                       dev->driver_info->early_init(dev) != 0)
+               goto halt_fail_and_release;
+
        /* Get designated host ethernet address */
        reply_len = ETH_ALEN;
        retval = rndis_query(dev, intf, u.buf, OID_802_3_PERMANENT_ADDRESS,
index 0b4bf09fc8b150b19d3f88ea70fc619c9959beb6..25b63d3339dc7a3623c1530ce0a238823e252f46 100644 (file)
@@ -116,6 +116,11 @@ struct driver_info {
        struct sk_buff  *(*tx_fixup)(struct usbnet *dev,
                                struct sk_buff *skb, gfp_t flags);
 
+       /* early initialization code, can sleep. This is for minidrivers
+        * having 'subminidrivers' that need to do extra initialization
+        * right after minidriver have initialized hardware. */
+       int     (*early_init)(struct usbnet *dev);
+
        /* for new devices, use the descriptor-reading code instead */
        int             in;             /* rx endpoint */
        int             out;            /* tx endpoint */