On Tue, Mar 05, 2002 at 10:40:59AM -0800, Greg KH wrote:
> 
> Ah, that's it.  include/net/irda/irda-usb.h was missed in the big "no
> more static urb allocations" fixup.  Give me a few minutes to change
> this.

Jean, does the patch below fix your problem?

thanks,

greg k-h


diff -Nru a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
--- a/drivers/net/irda/irda-usb.c       Tue Mar  5 10:58:16 2002
+++ b/drivers/net/irda/irda-usb.c       Tue Mar  5 10:58:16 2002
@@ -255,7 +255,7 @@
                   self->new_speed, self->new_xbofs);
 
        /* Grab the speed URB */
-       urb = &self->speed_urb;
+       urb = self->speed_urb;
        if (urb->status != 0) {
                WARNING(__FUNCTION__ "(), URB still in use!\n");
                return;
@@ -317,7 +317,7 @@
        urb->status = 0;
 
        /* If it was the speed URB, allow the stack to send more packets */
-       if(urb == &self->speed_urb) {
+       if(urb == self->speed_urb) {
                netif_wake_queue(self->netdev);
        }
 }
@@ -329,7 +329,7 @@
 static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
        struct irda_usb_cb *self = netdev->priv;
-       struct urb *urb = &self->tx_urb;
+       struct urb *urb = self->tx_urb;
        unsigned long flags;
        s32 speed;
        s16 xbofs;
@@ -546,7 +546,7 @@
        }
 
        /* Check speed URB */
-       urb = &(self->speed_urb);
+       urb = self->speed_urb;
        if (urb->status != 0) {
                IRDA_DEBUG(0, "%s: Speed change timed out, urb->status=%d, 
urb->transfer_flags=0x%04X\n", netdev->name, urb->status, urb->transfer_flags);
 
@@ -571,7 +571,7 @@
        }
 
        /* Check Tx URB */
-       urb = &(self->tx_urb);
+       urb = self->tx_urb;
        if (urb->status != 0) {
                struct sk_buff *skb = urb->context;
 
@@ -955,9 +955,9 @@
        /* Now that we can pass data to IrLAP, allow the USB layer
         * to send us some data... */
        for (i = 0; i < IU_MAX_ACTIVE_RX_URBS; i++)
-               irda_usb_submit(self, NULL, &(self->rx_urb[i]));
+               irda_usb_submit(self, NULL, self->rx_urb[i]);
        /* Note : we submit all the Rx URB except for one - Jean II */
-       self->idle_rx_urb = &(self->rx_urb[IU_MAX_ACTIVE_RX_URBS]);
+       self->idle_rx_urb = self->rx_urb[IU_MAX_ACTIVE_RX_URBS];
        self->idle_rx_urb->context = NULL;
 
        /* Ready to play !!! */
@@ -992,7 +992,7 @@
 
        /* Deallocate all the Rx path buffers (URBs and skb) */
        for (i = 0; i < IU_MAX_RX_URBS; i++) {
-               struct urb *urb = &(self->rx_urb[i]);
+               struct urb *urb = self->rx_urb[i];
                struct sk_buff *skb = (struct sk_buff *) urb->context;
                /* Cancel the receive command */
                usb_unlink_urb(urb);
@@ -1003,8 +1003,8 @@
                }
        }
        /* Cancel Tx and speed URB */
-       usb_unlink_urb(&(self->tx_urb));
-       usb_unlink_urb(&(self->speed_urb));
+       usb_unlink_urb(self->tx_urb);
+       usb_unlink_urb(self->speed_urb);
 
        /* Stop and remove instance of IrLAP */
        if (self->irlap)
@@ -1429,7 +1429,31 @@
        self->present = 0;
        self->netopen = 0;
 
-       /* Is this really necessary? */
+       /* Create all of the needed urbs */
+       for (i = 0; i < IU_MAX_RX_URBS; i++) {
+               self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
+               if (!self->rx_urb[i]) {
+                       int j;
+                       for (j = 0; j < i; j++)
+                               usb_free_urb(self->rx_urb[j]);
+                       return NULL;
+               }
+       }
+       self->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
+       if (!self->tx_urb) {
+               for (i = 0; i < IU_MAX_RX_URBS; i++)
+                       usb_free_urb(self->rx_urb[i]);
+               return NULL;
+       }
+       self->speed_urb = usb_alloc_urb(0, GFP_KERNEL);
+       if (!self->speed_urb) {
+               for (i = 0; i < IU_MAX_RX_URBS; i++)
+                       usb_free_urb(self->rx_urb[i]);
+               usb_free_urb(self->tx_urb);
+               return NULL;
+       }
+
+       /* Is this really necessary? */
        if (usb_set_configuration (dev, dev->config[0].bConfigurationValue) < 0) {
                err("set_configuration failed");
                return NULL;
@@ -1501,10 +1525,10 @@
                netif_stop_queue(self->netdev);
                /* Stop all the receive URBs */
                for (i = 0; i < IU_MAX_RX_URBS; i++)
-                       usb_unlink_urb(&(self->rx_urb[i]));
+                       usb_unlink_urb(self->rx_urb[i]);
                /* Cancel Tx and speed URB */
-               usb_unlink_urb(&(self->tx_urb));
-               usb_unlink_urb(&(self->speed_urb));
+               usb_unlink_urb(self->tx_urb);
+               usb_unlink_urb(self->speed_urb);
 
                IRDA_DEBUG(0, __FUNCTION__ "(), postponing disconnect, network is 
still active...\n");
                /* better not do anything just yet, usb_irda_cleanup()
@@ -1516,6 +1540,14 @@
        irda_usb_close(self);
        /* No longer attached to USB bus */
        self->usbdev = NULL;
+
+       /* Clean up our urbs */
+       for (i = 0; i < IU_MAX_RX_URBS; i++)
+               usb_free_urb(self->rx_urb[i]);
+       /* Cancel Tx and speed URB */
+       usb_free_urb(self->tx_urb);
+       usb_free_urb(self->speed_urb);
+
        IRDA_DEBUG(0, __FUNCTION__ "(), USB IrDA Disconnected\n");
 }
 
diff -Nru a/include/net/irda/irda-usb.h b/include/net/irda/irda-usb.h
--- a/include/net/irda/irda-usb.h       Tue Mar  5 10:58:16 2002
+++ b/include/net/irda/irda-usb.h       Tue Mar  5 10:58:16 2002
@@ -139,10 +139,10 @@
 
        wait_queue_head_t wait_q;       /* for timeouts */
 
-       struct urb rx_urb[IU_MAX_RX_URBS];      /* URBs used to receive data frames */
+       struct urb *rx_urb[IU_MAX_RX_URBS];     /* URBs used to receive data frames */
        struct urb *idle_rx_urb;        /* Pointer to idle URB in Rx path */
-       struct urb tx_urb;              /* URB used to send data frames */
-       struct urb speed_urb;           /* URB used to send speed commands */
+       struct urb *tx_urb;             /* URB used to send data frames */
+       struct urb *speed_urb;          /* URB used to send speed commands */
        
        struct net_device *netdev;      /* Yes! we are some kind of netdev. */
        struct net_device_stats stats;

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to