From b9a60139fce263beac4571d44e0b322fb1ee2d9d Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Fri, 8 Jun 2007 03:16:24 -0400 Subject: [PATCH] Don't keep priv->interface, use USB interface provided in at76_probe() This reduces driver's dependency on USB internals. Signed-off-by: Pavel Roskin --- at76_usb.c | 16 +++++++--------- at76_usb.h | 1 - 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/at76_usb.c b/at76_usb.c index ddd890b..6ad97c8 100644 --- a/at76_usb.c +++ b/at76_usb.c @@ -2293,9 +2293,9 @@ static void at76_delete_device(struct at76_priv *priv) } -static int at76_alloc_urbs(struct at76_priv *priv) +static int at76_alloc_urbs(struct at76_priv *priv, + struct usb_interface *interface) { - struct usb_interface *interface = priv->interface; struct usb_endpoint_descriptor *endpoint; struct usb_device *udev = priv->udev; int i, buffer_size; @@ -4039,7 +4039,8 @@ static struct ethtool_ops at76_ethtool_ops = { * because hotplug may try to configure the netdev _before_ (or parallel to) * the download of firmware */ -static int at76_init_new_device(struct at76_priv *priv) +static int at76_init_new_device(struct at76_priv *priv, + struct usb_interface *interface) { struct net_device *netdev = priv->netdev; int ret; @@ -4048,12 +4049,10 @@ static int at76_init_new_device(struct at76_priv *priv) /* set up the endpoint information */ /* check out the endpoints */ - priv->interface = priv->udev->actconfig->interface[0]; - at76_dbg(DBG_DEVSTART, "USB interface: %d endpoints", - priv->interface->cur_altsetting->desc.bNumEndpoints); + interface->cur_altsetting->desc.bNumEndpoints); - if ((ret = at76_alloc_urbs(priv)) < 0) + if ((ret = at76_alloc_urbs(priv, interface)) < 0) goto error; /* get firmware version */ @@ -6196,10 +6195,9 @@ static int at76_probe(struct usb_interface *interface, } usb_set_intfdata(interface, priv); - priv->interface = interface; priv->fwe = fwe; - ret = at76_init_new_device(priv); + ret = at76_init_new_device(priv, interface); if (ret < 0) at76_delete_device(priv); diff --git a/at76_usb.h b/at76_usb.h index de5f035..204fb12 100644 --- a/at76_usb.h +++ b/at76_usb.h @@ -463,7 +463,6 @@ struct at76_priv { struct net_device *netdev; /* net device pointer */ struct net_device_stats stats; struct iw_statistics wstats; - struct usb_interface *interface; /* the interface for this device */ struct sk_buff *rx_skb; /* skbuff for receiving packets */ __u8 bulk_in_endpointAddr; /* the address of the bulk in endpoint */ -- cgit v1.2.3