]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/usb/net/usbnet.c
Merge with /shiny/git/linux-2.6/.git
[karo-tx-linux.git] / drivers / usb / net / usbnet.c
index 1748159e462e7b86c5f1827abc96263d95b854de..576f3b852fce39ccfff151704c1447b883e1703f 100644 (file)
@@ -431,7 +431,7 @@ static void skb_return (struct usbnet *dev, struct sk_buff *skb)
        dev->stats.rx_bytes += skb->len;
 
        if (netif_msg_rx_status (dev))
-               devdbg (dev, "< rx, len %zd, type 0x%x",
+               devdbg (dev, "< rx, len %zu, type 0x%x",
                        skb->len + sizeof (struct ethhdr), skb->protocol);
        memset (skb->cb, 0, sizeof (struct skb_data));
        status = netif_rx (skb);
@@ -1429,7 +1429,7 @@ static int generic_cdc_bind (struct usbnet *dev, struct usb_interface *intf)
                        info->ether = (void *) buf;
                        if (info->ether->bLength != sizeof *info->ether) {
                                dev_dbg (&intf->dev, "CDC ether len %u\n",
-                                       info->u->bLength);
+                                       info->ether->bLength);
                                goto bad_desc;
                        }
                        dev->net->mtu = le16_to_cpup (
@@ -1517,6 +1517,26 @@ static void cdc_unbind (struct usbnet *dev, struct usb_interface *intf)
        }
 }
 
+#endif /* NEED_GENERIC_CDC */
+
+\f
+#ifdef CONFIG_USB_CDCETHER
+#define        HAVE_HARDWARE
+
+/*-------------------------------------------------------------------------
+ *
+ * Communications Device Class, Ethernet Control model
+ *
+ * Takes two interfaces.  The DATA interface is inactive till an altsetting
+ * is selected.  Configuration data includes class descriptors.
+ *
+ * This should interop with whatever the 2.4 "CDCEther.c" driver
+ * (by Brad Hards) talked with.
+ *
+ *-------------------------------------------------------------------------*/
+
+#include <linux/ctype.h>
+
 
 static void dumpspeed (struct usbnet *dev, __le32 *speeds)
 {
@@ -1567,26 +1587,6 @@ static void cdc_status (struct usbnet *dev, struct urb *urb)
        }
 }
 
-#endif /* NEED_GENERIC_CDC */
-
-\f
-#ifdef CONFIG_USB_CDCETHER
-#define        HAVE_HARDWARE
-
-/*-------------------------------------------------------------------------
- *
- * Communications Device Class, Ethernet Control model
- * 
- * Takes two interfaces.  The DATA interface is inactive till an altsetting
- * is selected.  Configuration data includes class descriptors.
- *
- * This should interop with whatever the 2.4 "CDCEther.c" driver
- * (by Brad Hards) talked with.
- *
- *-------------------------------------------------------------------------*/
-
-#include <linux/ctype.h>
-
 static u8 nibble (unsigned char c)
 {
        if (likely (isdigit (c)))
@@ -2765,7 +2765,7 @@ static int blan_mdlm_bind (struct usbnet *dev, struct usb_interface *intf)
                        }
                        /* expect bcdVersion 1.0, ignore */
                        if (memcmp(&desc->bGUID, blan_guid, 16)
-                                   || memcmp(&desc->bGUID, blan_guid, 16) ) {
+                                   && memcmp(&desc->bGUID, safe_guid, 16) ) {
                                /* hey, this one might _really_ be MDLM! */
                                dev_dbg (&intf->dev, "MDLM guid\n");
                                goto bad_desc;
@@ -2797,11 +2797,13 @@ static int blan_mdlm_bind (struct usbnet *dev, struct usb_interface *intf)
                         *  - bPad (ignored, for PADAFTER -- BLAN-only)
                         * bits are:
                         *  - 0x01 -- Zaurus framing (add CRC)
-                        *  - 0x02 -- PADBEFORE
-                        *  - 0x04 -- PADAFTER
+                        *  - 0x02 -- PADBEFORE (CRC includes some padding)
+                        *  - 0x04 -- PADAFTER (some padding after CRC)
                         *  - 0x08 -- "fermat" packet mangling (for hw bugs)
+                        * the PADBEFORE appears not to matter; we interop
+                        * with devices that use it and those that don't.
                         */
-                       if (detail->bDetailData[1] != 0x01) {
+                       if ((detail->bDetailData[1] & ~02) != 0x01) {
                                /* bmDataCapabilites == 0 would be fine too,
                                 * but framing is minidriver-coupled for now.
                                 */
@@ -3225,9 +3227,9 @@ static int usbnet_stop (struct net_device *net)
        temp = unlink_urbs (dev, &dev->txq) + unlink_urbs (dev, &dev->rxq);
 
        // maybe wait for deletions to finish.
-       while (skb_queue_len (&dev->rxq)
-                       && skb_queue_len (&dev->txq)
-                       && skb_queue_len (&dev->done)) {
+       while (!skb_queue_empty(&dev->rxq) &&
+              !skb_queue_empty(&dev->txq) &&
+              !skb_queue_empty(&dev->done)) {
                msleep(UNLINK_TIMEOUT_MS);
                if (netif_msg_ifdown (dev))
                        devdbg (dev, "waited for %d urb completions", temp);