Skip to contentSkip to conversation

Add rndis_early_init function pointer to 'struct rndis_data'.

PATCH In review Jussi Kivilinna 3 participants 3 messages Jan 20, 2008 – Jan 25, 2008 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 10/14 Add rndis_early_init function pointer to 'struct rndis_data'.

Function pointer is for rndis minidrivers that need to do work on device right after RNDIS_INIT. For example setting device specific configuration parameters with OID_GEN_RNDIS_CONFIG_PARAMETER.

---

 drivers/net/usb/rndis_host.c |    6 ++++++
 drivers/net/usb/usbnet.h     |    3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)
drivers/net/usb/rndis_host.c +6 -0
index 1d6bf0a..22e5ca1 100644
@@ -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->rndis_early_init &&
+			dev->driver_info->rndis_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,
drivers/net/usb/usbnet.h +3 -0
index 0b4bf09..2bc5f76 100644
@@ -116,6 +116,9 @@ struct driver_info {
 	struct sk_buff	*(*tx_fixup)(struct usbnet *dev,
 				struct sk_buff *skb, gfp_t flags);
 
+	/* rndis minidriver early initialization code, can sleep */
+	int	(*rndis_early_init)(struct usbnet *dev);
+
 	/* for new devices, use the descriptor-reading code instead */
 	int		in;		/* rx endpoint */
 	int		out;		/* tx endpoint */

A message that is not in the archive (sent off-list or not yet received): 20080120001438.25718.96722.stgit-q/[email protected]

#2 lore raw
Quoted 5 lines · Jussi Kivilinna

Function pointer is for rndis minidrivers that need to do work on device right after RNDIS_INIT. For example setting device specific configuration parameters with OID_GEN_RNDIS_CONFIG_PARAMETER.

Could this -- and #11/14 -- instead be generalized a bit, so they're not RNDIS-specific? At least in name; the only user for now would be the rndis_host code.

The generalization would presumably be "early_init" and "link_change", paired with doc comments reflecting that they're usable by any driver stack built over the usbnet framework core.

There's no point IMO to having generalizable hooks be restricted this way.

- Dave

Quoted 38 lines

---

 drivers/net/usb/rndis_host.c |    6 ++++++
 drivers/net/usb/usbnet.h     |    3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)
drivers/net/usb/rndis_host.c +6 -0
index 1d6bf0a..22e5ca1 100644
@@ -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->rndis_early_init &&
+			dev->driver_info->rndis_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,
drivers/net/usb/usbnet.h +3 -0
index 0b4bf09..2bc5f76 100644
@@ -116,6 +116,9 @@ struct driver_info {
 	struct sk_buff	*(*tx_fixup)(struct usbnet *dev,
 				struct sk_buff *skb, gfp_t flags);
 
+	/* rndis minidriver early initialization code, can sleep */
+	int	(*rndis_early_init)(struct usbnet *dev);
+
 	/* for new devices, use the descriptor-reading code instead */
 	int		in;		/* rx endpoint */
 	int		out;		/* tx endpoint */

A message that is not in the archive (sent off-list or not yet received): 200801241710.35528.david-b-yBeKhBN/[email protected]

#4 lore raw
Quoted 11 lines · David Brownell

Could this -- and #11/14 -- instead be generalized a bit, so they're not RNDIS-specific? At least in name; the only user for now would be the rndis_host code.

The generalization would presumably be "early_init" and "link_change", paired with doc comments reflecting that they're usable by any driver stack built over the usbnet framework core.

There's no point IMO to having generalizable hooks be restricted this way.

Sure.