Merge with kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/
authorLinus Torvalds <torvalds@ppc970.osdl.org.(none)>
Tue, 19 Apr 2005 20:14:28 +0000 (13:14 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org.(none)>
Tue, 19 Apr 2005 20:14:28 +0000 (13:14 -0700)
for 13 driver core, sysfs, and debugfs fixes.

75 files changed:
Documentation/aoe/mkdevs.sh
Documentation/aoe/mkshelf.sh
Documentation/aoe/todo.txt [new file with mode: 0644]
Documentation/aoe/udev-install.sh
drivers/block/aoe/aoe.h
drivers/block/aoe/aoeblk.c
drivers/block/aoe/aoecmd.c
drivers/block/aoe/aoedev.c
drivers/block/aoe/aoenet.c
drivers/i2c/chips/it87.c
drivers/i2c/chips/via686a.c
drivers/net/irda/stir4200.c
drivers/usb/class/audio.c
drivers/usb/class/bluetty.c
drivers/usb/core/config.c
drivers/usb/core/devices.c
drivers/usb/core/devio.c
drivers/usb/core/file.c
drivers/usb/core/hcd-pci.c
drivers/usb/core/hcd.h
drivers/usb/core/hub.c
drivers/usb/core/inode.c
drivers/usb/core/message.c
drivers/usb/core/urb.c
drivers/usb/core/usb.c
drivers/usb/core/usb.h
drivers/usb/gadget/ether.c
drivers/usb/gadget/omap_udc.c
drivers/usb/gadget/rndis.c
drivers/usb/gadget/rndis.h
drivers/usb/gadget/serial.c
drivers/usb/host/ehci-dbg.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-mem.c
drivers/usb/host/ehci-sched.c
drivers/usb/host/ehci.h
drivers/usb/host/ohci-omap.c
drivers/usb/host/ohci-pci.c
drivers/usb/host/ohci-pxa27x.c
drivers/usb/host/ohci-q.c
drivers/usb/host/ohci.h
drivers/usb/host/uhci-hcd.c
drivers/usb/input/aiptek.c
drivers/usb/input/hid-core.c
drivers/usb/media/dabusb.c
drivers/usb/media/ov511.c
drivers/usb/media/se401.c
drivers/usb/media/usbvideo.c
drivers/usb/media/w9968cf.c
drivers/usb/misc/auerswald.c
drivers/usb/misc/sisusbvga/sisusb.c
drivers/usb/net/pegasus.c
drivers/usb/net/usbnet.c
drivers/usb/net/zd1201.c
drivers/usb/serial/belkin_sa.c
drivers/usb/serial/cypress_m8.c
drivers/usb/serial/digi_acceleport.c
drivers/usb/serial/empeg.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_ti.c
drivers/usb/serial/kl5kusb105.c
drivers/usb/serial/omninet.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/pl2303.h
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/visor.c
drivers/usb/serial/visor.h
drivers/usb/storage/sddr55.c
drivers/usb/storage/transport.c
drivers/usb/storage/unusual_devs.h
drivers/w1/w1.c
drivers/w1/w1_smem.c
include/linux/usb.h
include/linux/usb_cdc.h

index 6ce70703eb47f6d9242a0b91b9dc1029c76ecca3..ec5a6de1cd7b7af23dba7f12d1f3b8831a2631f5 100644 (file)
@@ -5,6 +5,7 @@ n_partitions=${n_partitions:-16}
 
 if test "$#" != "1"; then
        echo "Usage: sh `basename $0` {dir}" 1>&2
+       echo "       n_partitions=16 sh `basename $0` {dir}" 1>&2
        exit 1
 fi
 dir=$1
index 40932836bb800f5ef83ac6ddfea1f3086728f938..8bacf9f2c7cc971ef25aefb445f550815bb4fdf3 100644 (file)
@@ -2,6 +2,7 @@
 
 if test "$#" != "2"; then
        echo "Usage: sh `basename $0` {dir} {shelfaddress}" 1>&2
+       echo "       n_partitions=16 sh `basename $0` {dir} {shelfaddress}" 1>&2
        exit 1
 fi
 n_partitions=${n_partitions:-16}
diff --git a/Documentation/aoe/todo.txt b/Documentation/aoe/todo.txt
new file mode 100644 (file)
index 0000000..7fee1e1
--- /dev/null
@@ -0,0 +1,14 @@
+There is a potential for deadlock when allocating a struct sk_buff for
+data that needs to be written out to aoe storage.  If the data is
+being written from a dirty page in order to free that page, and if
+there are no other pages available, then deadlock may occur when a
+free page is needed for the sk_buff allocation.  This situation has
+not been observed, but it would be nice to eliminate any potential for
+deadlock under memory pressure.
+
+Because ATA over Ethernet is not fragmented by the kernel's IP code,
+the destructore member of the struct sk_buff is available to the aoe
+driver.  By using a mempool for allocating all but the first few
+sk_buffs, and by registering a destructor, we should be able to
+efficiently allocate sk_buffs without introducing any potential for
+deadlock.
index 861a27f98771d152be6344c014a57d0a657aad20..6449911c6a717d1b9ab8117c078e4f5f833b8557 100644 (file)
@@ -23,4 +23,8 @@ fi
 # /etc/udev/rules.d
 #
 rules_d="`sed -n '/^udev_rules=/{ s!udev_rules=!!; s!\"!!g; p; }' $conf`"
-test "$rules_d" && sh -xc "cp `dirname $0`/udev.txt $rules_d/60-aoe.rules"
+if test -z "$rules_d" || test ! -d "$rules_d"; then
+       echo "$me Error: cannot find udev rules directory" 1>&2
+       exit 1
+fi
+sh -xc "cp `dirname $0`/udev.txt $rules_d/60-aoe.rules"
index db78f826d40c5beb3ce3254954d0e938f3f774c4..aa8b547ffafa669f7cd3d547e4ac025203d799af 100644 (file)
@@ -1,10 +1,15 @@
 /* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
-#define VERSION "5"
+#define VERSION "6"
 #define AOE_MAJOR 152
 #define DEVICE_NAME "aoe"
+
+/* set AOE_PARTITIONS to 1 to use whole-disks only
+ * default is 16, which is 15 partitions plus the whole disk
+ */
 #ifndef AOE_PARTITIONS
 #define AOE_PARTITIONS 16
 #endif
+
 #define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * 10 + (aoeminor))
 #define AOEMAJOR(sysminor) ((sysminor) / 10)
 #define AOEMINOR(sysminor) ((sysminor) % 10)
@@ -34,13 +39,13 @@ enum {
 struct aoe_hdr {
        unsigned char dst[6];
        unsigned char src[6];
-       unsigned char type[2];
+       __be16 type;
        unsigned char verfl;
        unsigned char err;
-       unsigned char major[2];
+       __be16 major;
        unsigned char minor;
        unsigned char cmd;
-       unsigned char tag[4];
+       __be32 tag;
 };
 
 struct aoe_atahdr {
@@ -58,8 +63,8 @@ struct aoe_atahdr {
 };
 
 struct aoe_cfghdr {
-       unsigned char bufcnt[2];
-       unsigned char fwver[2];
+       __be16 bufcnt;
+       __be16 fwver;
        unsigned char res;
        unsigned char aoeccmd;
        unsigned char cslen[2];
@@ -85,6 +90,7 @@ enum {
 
 struct buf {
        struct list_head bufs;
+       ulong start_time;       /* for disk stats */
        ulong flags;
        ulong nframesout;
        char *bufaddr;
@@ -125,7 +131,8 @@ struct aoedev {
        struct timer_list timer;
        spinlock_t lock;
        struct net_device *ifp; /* interface ed is attached to */
-       struct sk_buff *skblist;/* packets needing to be sent */
+       struct sk_buff *sendq_hd; /* packets needing to be sent, list head */
+       struct sk_buff *sendq_tl;
        mempool_t *bufpool;     /* for deadlock-free Buf allocation */
        struct list_head bufq;  /* queue of bios to work on */
        struct buf *inprocess;  /* the one we're currently working on */
@@ -151,7 +158,7 @@ void aoecmd_cfg_rsp(struct sk_buff *);
 
 int aoedev_init(void);
 void aoedev_exit(void);
-struct aoedev *aoedev_bymac(unsigned char *);
+struct aoedev *aoedev_by_aoeaddr(int maj, int min);
 void aoedev_downdev(struct aoedev *d);
 struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong);
 int aoedev_busy(void);
index 63561b280bc5e7149b944b4daba1c6a8acbf303d..4780f7926d4292bc8150e2712ea18d8a11204ec2 100644 (file)
@@ -125,6 +125,7 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio)
        }
        memset(buf, 0, sizeof(*buf));
        INIT_LIST_HEAD(&buf->bufs);
+       buf->start_time = jiffies;
        buf->bio = bio;
        buf->resid = bio->bi_size;
        buf->sector = bio->bi_sector;
@@ -146,8 +147,8 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio)
        list_add_tail(&buf->bufs, &d->bufq);
        aoecmd_work(d);
 
-       sl = d->skblist;
-       d->skblist = NULL;
+       sl = d->sendq_hd;
+       d->sendq_hd = d->sendq_tl = NULL;
 
        spin_unlock_irqrestore(&d->lock, flags);
 
index fb6d942a456561d18ba971cf883dedec4942dc12..b5be4b7d7b5b3acaab207e9175de16fc0dcbc895 100644 (file)
@@ -90,19 +90,16 @@ newtag(struct aoedev *d)
 static int
 aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h)
 {
-       u16 type = __constant_cpu_to_be16(ETH_P_AOE);
-       u16 aoemajor = __cpu_to_be16(d->aoemajor);
        u32 host_tag = newtag(d);
-       u32 tag = __cpu_to_be32(host_tag);
 
        memcpy(h->src, d->ifp->dev_addr, sizeof h->src);
        memcpy(h->dst, d->addr, sizeof h->dst);
-       memcpy(h->type, &type, sizeof type);
+       h->type = __constant_cpu_to_be16(ETH_P_AOE);
        h->verfl = AOE_HVER;
-       memcpy(h->major, &aoemajor, sizeof aoemajor);
+       h->major = cpu_to_be16(d->aoemajor);
        h->minor = d->aoeminor;
        h->cmd = AOECMD_ATA;
-       memcpy(h->tag, &tag, sizeof tag);
+       h->tag = cpu_to_be32(host_tag);
 
        return host_tag;
 }
@@ -181,8 +178,12 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
 
        skb = skb_prepare(d, f);
        if (skb) {
-               skb->next = d->skblist;
-               d->skblist = skb;
+               skb->next = NULL;
+               if (d->sendq_hd)
+                       d->sendq_tl->next = skb;
+               else
+                       d->sendq_hd = skb;
+               d->sendq_tl = skb;
        }
 }
 
@@ -215,7 +216,6 @@ rexmit(struct aoedev *d, struct frame *f)
        struct aoe_hdr *h;
        char buf[128];
        u32 n;
-       u32 net_tag;
 
        n = newtag(d);
 
@@ -227,13 +227,16 @@ rexmit(struct aoedev *d, struct frame *f)
 
        h = (struct aoe_hdr *) f->data;
        f->tag = n;
-       net_tag = __cpu_to_be32(n);
-       memcpy(h->tag, &net_tag, sizeof net_tag);
+       h->tag = cpu_to_be32(n);
 
        skb = skb_prepare(d, f);
        if (skb) {
-               skb->next = d->skblist;
-               d->skblist = skb;
+               skb->next = NULL;
+               if (d->sendq_hd)
+                       d->sendq_tl->next = skb;
+               else
+                       d->sendq_hd = skb;
+               d->sendq_tl = skb;
        }
 }
 
@@ -285,8 +288,8 @@ tdie:               spin_unlock_irqrestore(&d->lock, flags);
                }
        }
 
-       sl = d->skblist;
-       d->skblist = NULL;
+       sl = d->sendq_hd;
+       d->sendq_hd = d->sendq_tl = NULL;
        if (sl) {
                n = d->rttavg <<= 1;
                if (n > MAXTIMER)
@@ -308,16 +311,16 @@ ataid_complete(struct aoedev *d, unsigned char *id)
        u16 n;
 
        /* word 83: command set supported */
-       n = __le16_to_cpu(*((u16 *) &id[83<<1]));
+       n = le16_to_cpup((__le16 *) &id[83<<1]);
 
        /* word 86: command set/feature enabled */
-       n |= __le16_to_cpu(*((u16 *) &id[86<<1]));
+       n |= le16_to_cpup((__le16 *) &id[86<<1]);
 
        if (n & (1<<10)) {      /* bit 10: LBA 48 */
                d->flags |= DEVFL_EXT;
 
                /* word 100: number lba48 sectors */
-               ssize = __le64_to_cpu(*((u64 *) &id[100<<1]));
+               ssize = le64_to_cpup((__le64 *) &id[100<<1]);
 
                /* set as in ide-disk.c:init_idedisk_capacity */
                d->geo.cylinders = ssize;
@@ -328,12 +331,12 @@ ataid_complete(struct aoedev *d, unsigned char *id)
                d->flags &= ~DEVFL_EXT;
 
                /* number lba28 sectors */
-               ssize = __le32_to_cpu(*((u32 *) &id[60<<1]));
+               ssize = le32_to_cpup((__le32 *) &id[60<<1]);
 
                /* NOTE: obsolete in ATA 6 */
-               d->geo.cylinders = __le16_to_cpu(*((u16 *) &id[54<<1]));
-               d->geo.heads = __le16_to_cpu(*((u16 *) &id[55<<1]));
-               d->geo.sectors = __le16_to_cpu(*((u16 *) &id[56<<1]));
+               d->geo.cylinders = le16_to_cpup((__le16 *) &id[54<<1]);
+               d->geo.heads = le16_to_cpup((__le16 *) &id[55<<1]);
+               d->geo.sectors = le16_to_cpup((__le16 *) &id[56<<1]);
        }
        d->ssize = ssize;
        d->geo.start = 0;
@@ -380,29 +383,30 @@ aoecmd_ata_rsp(struct sk_buff *skb)
        register long n;
        ulong flags;
        char ebuf[128];
-       
+       u16 aoemajor;
+
        hin = (struct aoe_hdr *) skb->mac.raw;
-       d = aoedev_bymac(hin->src);
+       aoemajor = be16_to_cpu(hin->major);
+       d = aoedev_by_aoeaddr(aoemajor, hin->minor);
        if (d == NULL) {
                snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
                        "for unknown device %d.%d\n",
-                        __be16_to_cpu(*((u16 *) hin->major)),
-                       hin->minor);
+                        aoemajor, hin->minor);
                aoechr_error(ebuf);
                return;
        }
 
        spin_lock_irqsave(&d->lock, flags);
 
-       f = getframe(d, __be32_to_cpu(*((u32 *) hin->tag)));
+       f = getframe(d, be32_to_cpu(hin->tag));
        if (f == NULL) {
                spin_unlock_irqrestore(&d->lock, flags);
                snprintf(ebuf, sizeof ebuf,
                        "%15s e%d.%d    tag=%08x@%08lx\n",
                        "unexpected rsp",
-                       __be16_to_cpu(*((u16 *) hin->major)),
+                       be16_to_cpu(hin->major),
                        hin->minor,
-                       __be32_to_cpu(*((u32 *) hin->tag)),
+                       be32_to_cpu(hin->tag),
                        jiffies);
                aoechr_error(ebuf);
                return;
@@ -452,7 +456,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
                        printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized "
                               "outbound ata command %2.2Xh for %d.%d\n", 
                               ahout->cmdstat,
-                              __be16_to_cpu(*((u16 *) hin->major)),
+                              be16_to_cpu(hin->major),
                               hin->minor);
                }
        }
@@ -460,6 +464,20 @@ aoecmd_ata_rsp(struct sk_buff *skb)
        if (buf) {
                buf->nframesout -= 1;
                if (buf->nframesout == 0 && buf->resid == 0) {
+                       unsigned long duration = jiffies - buf->start_time;
+                       unsigned long n_sect = buf->bio->bi_size >> 9;
+                       struct gendisk *disk = d->gd;
+
+                       if (bio_data_dir(buf->bio) == WRITE) {
+                               disk_stat_inc(disk, writes);
+                               disk_stat_add(disk, write_ticks, duration);
+                               disk_stat_add(disk, write_sectors, n_sect);
+                       } else {
+                               disk_stat_inc(disk, reads);
+                               disk_stat_add(disk, read_ticks, duration);
+                               disk_stat_add(disk, read_sectors, n_sect);
+                       }
+                       disk_stat_add(disk, io_ticks, duration);
                        n = (buf->flags & BUFFL_FAIL) ? -EIO : 0;
                        bio_endio(buf->bio, buf->bio->bi_size, n);
                        mempool_free(buf, d->bufpool);
@@ -471,8 +489,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 
        aoecmd_work(d);
 
-       sl = d->skblist;
-       d->skblist = NULL;
+       sl = d->sendq_hd;
+       d->sendq_hd = d->sendq_tl = NULL;
 
        spin_unlock_irqrestore(&d->lock, flags);
 
@@ -486,8 +504,6 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
        struct aoe_cfghdr *ch;
        struct sk_buff *skb, *sl;
        struct net_device *ifp;
-       u16 aoe_type = __constant_cpu_to_be16(ETH_P_AOE);
-       u16 net_aoemajor = __cpu_to_be16(aoemajor);
 
        sl = NULL;
 
@@ -507,9 +523,9 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
 
                memset(h->dst, 0xff, sizeof h->dst);
                memcpy(h->src, ifp->dev_addr, sizeof h->src);
-               memcpy(h->type, &aoe_type, sizeof aoe_type);
+               h->type = __constant_cpu_to_be16(ETH_P_AOE);
                h->verfl = AOE_HVER;
-               memcpy(h->major, &net_aoemajor, sizeof net_aoemajor);
+               h->major = cpu_to_be16(aoemajor);
                h->minor = aoeminor;
                h->cmd = AOECMD_CFG;
 
@@ -523,7 +539,7 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
  
 /*
  * Since we only call this in one place (and it only prepares one frame)
- * we just return the skb.  Usually we'd chain it up to the d->skblist.
+ * we just return the skb.  Usually we'd chain it up to the aoedev sendq.
  */
 static struct sk_buff *
 aoecmd_ata_id(struct aoedev *d)
@@ -575,9 +591,10 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
        struct aoedev *d;
        struct aoe_hdr *h;
        struct aoe_cfghdr *ch;
-       ulong flags, bufcnt, sysminor, aoemajor;
+       ulong flags, sysminor, aoemajor;
+       u16 bufcnt;
        struct sk_buff *sl;
-       enum { MAXFRAMES = 8, MAXSYSMINOR = 255 };
+       enum { MAXFRAMES = 8 };
 
        h = (struct aoe_hdr *) skb->mac.raw;
        ch = (struct aoe_cfghdr *) (h+1);
@@ -586,7 +603,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
         * Enough people have their dip switches set backwards to
         * warrant a loud message for this special case.
         */
-       aoemajor = __be16_to_cpu(*((u16 *) h->major));
+       aoemajor = be16_to_cpu(h->major);
        if (aoemajor == 0xfff) {
                printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf "
                        "address is all ones.  Check shelf dip switches\n");
@@ -594,13 +611,14 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
        }
 
        sysminor = SYSMINOR(aoemajor, h->minor);
-       if (sysminor > MAXSYSMINOR) {
-               printk(KERN_INFO "aoe: aoecmd_cfg_rsp: sysminor %ld too "
-                       "large\n", sysminor);
+       if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) {
+               printk(KERN_INFO
+                       "aoe: e%ld.%d: minor number too large\n", 
+                       aoemajor, (int) h->minor);
                return;
        }
 
-       bufcnt = __be16_to_cpu(*((u16 *) ch->bufcnt));
+       bufcnt = be16_to_cpu(ch->bufcnt);
        if (bufcnt > MAXFRAMES) /* keep it reasonable */
                bufcnt = MAXFRAMES;
 
@@ -617,7 +635,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
                return;
        }
 
-       d->fw_ver = __be16_to_cpu(*((u16 *) ch->fwver));
+       d->fw_ver = be16_to_cpu(ch->fwver);
 
        /* we get here only if the device is new */
        sl = aoecmd_ata_id(d);
index 240abaec159b708d90065f7643bb6b8fb2697fac..ec16c64dd114c37b30f2f97bb5e8f895c0a6e9bb 100644 (file)
@@ -13,7 +13,7 @@ static struct aoedev *devlist;
 static spinlock_t devlist_lock;
 
 struct aoedev *
-aoedev_bymac(unsigned char *macaddr)
+aoedev_by_aoeaddr(int maj, int min)
 {
        struct aoedev *d;
        ulong flags;
@@ -21,7 +21,7 @@ aoedev_bymac(unsigned char *macaddr)
        spin_lock_irqsave(&devlist_lock, flags);
 
        for (d=devlist; d; d=d->next)
-               if (!memcmp(d->addr, macaddr, 6))
+               if (d->aoemajor == maj && d->aoeminor == min)
                        break;
 
        spin_unlock_irqrestore(&devlist_lock, flags);
@@ -125,7 +125,6 @@ aoedev_set(ulong sysminor, unsigned char *addr, struct net_device *ifp, ulong bu
        d->ifp = ifp;
 
        if (d->sysminor != sysminor
-       || memcmp(d->addr, addr, sizeof d->addr)
        || (d->flags & DEVFL_UP) == 0) {
                aoedev_downdev(d); /* flushes outstanding frames */
                memcpy(d->addr, addr, sizeof d->addr);
@@ -147,7 +146,8 @@ aoedev_freedev(struct aoedev *d)
                put_disk(d->gd);
        }
        kfree(d->frames);
-       mempool_destroy(d->bufpool);
+       if (d->bufpool)
+               mempool_destroy(d->bufpool);
        kfree(d);
 }
 
index cc1945b8d52bdaeb754363ed334f2ca8449cd342..bc92aacb6dadad9f2bff4145d237acd35856526d 100644 (file)
@@ -69,7 +69,7 @@ set_aoe_iflist(const char __user *user_str, size_t size)
 u64
 mac_addr(char addr[6])
 {
-       u64 n = 0;
+       __be64 n = 0;
        char *p = (char *) &n;
 
        memcpy(p + 2, addr, 6); /* (sizeof addr != 6) */
@@ -108,7 +108,7 @@ static int
 aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt)
 {
        struct aoe_hdr *h;
-       ulong n;
+       u32 n;
 
        skb = skb_check(skb);
        if (!skb)
@@ -121,7 +121,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt)
        skb_push(skb, ETH_HLEN);        /* (1) */
 
        h = (struct aoe_hdr *) skb->mac.raw;
-       n = __be32_to_cpu(*((u32 *) h->tag));
+       n = be32_to_cpu(h->tag);
        if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31))
                goto exit;
 
@@ -132,7 +132,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt)
                if (net_ratelimit())
                        printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; "
                               "ecode=%d '%s'\n",
-                              __be16_to_cpu(*((u16 *) h->major)), h->minor, 
+                              be16_to_cpu(h->major), h->minor, 
                               h->err, aoe_errlist[n]);
                goto exit;
        }
index 3d484a7aff127b9adc3120011efd7573f6eb0bf0..cf7e6898754f6dffe9a0bad6b77230f2922a37c9 100644 (file)
@@ -668,7 +668,7 @@ static ssize_t show_alarms(struct device *dev, char *buf)
        struct it87_data *data = it87_update_device(dev);
        return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms));
 }
-static DEVICE_ATTR(alarms, S_IRUGO | S_IWUSR, show_alarms, NULL);
+static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
 
 static ssize_t
 show_vrm_reg(struct device *dev, char *buf)
index 9b948f4531f5ade8899ca3efee959c7c3d33da04..6614a59cecd4a85e527ff5c172cf76cdcc0178d0 100644 (file)
@@ -574,7 +574,7 @@ static ssize_t show_alarms(struct device *dev, char *buf) {
        struct via686a_data *data = via686a_update_device(dev);
        return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms));
 }
-static DEVICE_ATTR(alarms, S_IRUGO | S_IWUSR, show_alarms, NULL);
+static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
 
 /* The driver. I choose to use type i2c_driver, as at is identical to both
    smbus_driver and isa_driver, and clients could be of either kind */
@@ -651,10 +651,9 @@ static int via686a_detect(struct i2c_adapter *adapter, int address, int kind)
        new_client->adapter = adapter;
        new_client->driver = &via686a_driver;
        new_client->flags = 0;
-       new_client->dev.parent = &adapter->dev;
 
        /* Fill in the remaining client fields and put into the global list */
-       snprintf(new_client->name, I2C_NAME_SIZE, client_name);
+       strlcpy(new_client->name, client_name, I2C_NAME_SIZE);
 
        data->valid = 0;
        init_MUTEX(&data->update_lock);
index 83c605e8824c89e714dabac99d4c40287cccf1c5..66f488c13717415b151c1bb1ad5442c09e4486e5 100644 (file)
@@ -1128,8 +1128,8 @@ static void stir_disconnect(struct usb_interface *intf)
 }
 
 #ifdef CONFIG_PM
-/* Power management suspend, so power off the transmitter/receiver */
-static int stir_suspend(struct usb_interface *intf, u32 state)
+/* USB suspend, so power off the transmitter/receiver */
+static int stir_suspend(struct usb_interface *intf, pm_message_t message)
 {
        struct stir_cb *stir = usb_get_intfdata(intf);
 
index f432b7d5b2357f45be0790f16a34f922d396b26f..f8f21567cc22489c505d104851c80ab03fe8e47f 100644 (file)
@@ -649,14 +649,10 @@ static void usbin_stop(struct usb_audiodev *as)
                }
        }
        set_current_state(TASK_RUNNING);
-       if (u->durb[0].urb->transfer_buffer)
-               kfree(u->durb[0].urb->transfer_buffer);
-       if (u->durb[1].urb->transfer_buffer)
-               kfree(u->durb[1].urb->transfer_buffer);
-       if (u->surb[0].urb->transfer_buffer)
-               kfree(u->surb[0].urb->transfer_buffer);
-       if (u->surb[1].urb->transfer_buffer)
-               kfree(u->surb[1].urb->transfer_buffer);
+       kfree(u->durb[0].urb->transfer_buffer);
+       kfree(u->durb[1].urb->transfer_buffer);
+       kfree(u->surb[0].urb->transfer_buffer);
+       kfree(u->surb[1].urb->transfer_buffer);
        u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = 
                u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL;
 }
@@ -1009,21 +1005,17 @@ static int usbin_start(struct usb_audiodev *as)
                u->phase = 0;
                maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format));
                bufsz = DESCFRAMES * maxsze;
-               if (u->durb[0].urb->transfer_buffer)
-                       kfree(u->durb[0].urb->transfer_buffer);
+               kfree(u->durb[0].urb->transfer_buffer);
                u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
                u->durb[0].urb->transfer_buffer_length = bufsz;
-               if (u->durb[1].urb->transfer_buffer)
-                       kfree(u->durb[1].urb->transfer_buffer);
+               kfree(u->durb[1].urb->transfer_buffer);
                u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
                u->durb[1].urb->transfer_buffer_length = bufsz;
                if (u->syncpipe) {
-                       if (u->surb[0].urb->transfer_buffer)
-                               kfree(u->surb[0].urb->transfer_buffer);
+                       kfree(u->surb[0].urb->transfer_buffer);
                        u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
                        u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES;
-                       if (u->surb[1].urb->transfer_buffer)
-                               kfree(u->surb[1].urb->transfer_buffer);
+                       kfree(u->surb[1].urb->transfer_buffer);
                        u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
                        u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES;
                }
@@ -1128,14 +1120,10 @@ static void usbout_stop(struct usb_audiodev *as)
                }
        }
        set_current_state(TASK_RUNNING);
-       if (u->durb[0].urb->transfer_buffer)
-               kfree(u->durb[0].urb->transfer_buffer);
-       if (u->durb[1].urb->transfer_buffer)
-               kfree(u->durb[1].urb->transfer_buffer);
-       if (u->surb[0].urb->transfer_buffer)
-               kfree(u->surb[0].urb->transfer_buffer);
-       if (u->surb[1].urb->transfer_buffer)
-               kfree(u->surb[1].urb->transfer_buffer);
+       kfree(u->durb[0].urb->transfer_buffer);
+       kfree(u->durb[1].urb->transfer_buffer);
+       kfree(u->surb[0].urb->transfer_buffer);
+       kfree(u->surb[1].urb->transfer_buffer);
        u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = 
                u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL;
 }
@@ -1376,21 +1364,17 @@ static int usbout_start(struct usb_audiodev *as)
                u->phase = 0;
                maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format));
                bufsz = DESCFRAMES * maxsze;
-               if (u->durb[0].urb->transfer_buffer)
-                       kfree(u->durb[0].urb->transfer_buffer);
+               kfree(u->durb[0].urb->transfer_buffer);
                u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
                u->durb[0].urb->transfer_buffer_length = bufsz;
-               if (u->durb[1].urb->transfer_buffer)
-                       kfree(u->durb[1].urb->transfer_buffer);
+               kfree(u->durb[1].urb->transfer_buffer);
                u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
                u->durb[1].urb->transfer_buffer_length = bufsz;
                if (u->syncpipe) {
-                       if (u->surb[0].urb->transfer_buffer)
-                               kfree(u->surb[0].urb->transfer_buffer);
+                       kfree(u->surb[0].urb->transfer_buffer);
                        u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
                        u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES;
-                       if (u->surb[1].urb->transfer_buffer)
-                               kfree(u->surb[1].urb->transfer_buffer);
+                       kfree(u->surb[1].urb->transfer_buffer);
                        u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
                        u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES;
                }
index 6bac65e0ade74e2877f2d5c9f62315e07bd08493..524023327c4900a18493c6691015a4fbf143af2b 100644 (file)
@@ -309,7 +309,7 @@ static int bluetooth_ctrl_msg (struct usb_bluetooth *bluetooth, int request, int
                }
        }
        if (urb->transfer_buffer_length < len) {
-               kfree (urb->transfer_buffer);
+               kfree(urb->transfer_buffer);
                urb->transfer_buffer = kmalloc (len, GFP_KERNEL);
                if (urb->transfer_buffer == NULL) {
                        err ("%s - out of memory", __FUNCTION__);
@@ -535,7 +535,7 @@ static int bluetooth_write (struct tty_struct * tty, const unsigned char *buf, i
        }
 
 exit:
-       kfree (temp_buffer);
+       kfree(temp_buffer);
 
        return retval;
 } 
index 0b092bdf98f39189e389fbee5e104a893b15f7c6..99595e07b65389f697624204c6d54105780c6e82 100644 (file)
@@ -10,7 +10,8 @@
 #include <linux/slab.h>
 #include <linux/device.h>
 #include <asm/byteorder.h>
-
+#include "usb.h"
+#include "hcd.h"
 
 #define USB_MAXALTSETTING              128     /* Hard limit */
 #define USB_MAXENDPOINTS               30      /* Hard limit */
index 8b61bcd742caca3aae0675d11d84fc78795e2453..ef0b35731ff078789d4129ca32bbfe4e4f542a19 100644 (file)
@@ -59,6 +59,7 @@
 #include <linux/usbdevice_fs.h>
 #include <asm/uaccess.h>
 
+#include "usb.h"
 #include "hcd.h"
 
 #define MAX_TOPO_LEVEL         6
@@ -636,11 +637,8 @@ static int usb_device_open(struct inode *inode, struct file *file)
 
 static int usb_device_release(struct inode *inode, struct file *file)
 {
-       if (file->private_data) {
-               kfree(file->private_data);
-               file->private_data = NULL;
-       }
-
+       kfree(file->private_data);
+       file->private_data = NULL;
         return 0;
 }
 
index a047bc392983eb3bc36d3b887d2187a7bcdb95fe..6bfab4bcaa9e945a5f919a93ce1cb0f75da08775 100644 (file)
@@ -213,12 +213,10 @@ static struct async *alloc_async(unsigned int numisoframes)
 
 static void free_async(struct async *as)
 {
-        if (as->urb->transfer_buffer)
-                kfree(as->urb->transfer_buffer);
-        if (as->urb->setup_packet)
-                kfree(as->urb->setup_packet);
+       kfree(as->urb->transfer_buffer);
+       kfree(as->urb->setup_packet);
        usb_free_urb(as->urb);
-        kfree(as);
+       kfree(as);
 }
 
 static inline void async_newpending(struct async *as)
@@ -938,17 +936,13 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
                return -EINVAL;
        }
        if (!(as = alloc_async(uurb->number_of_packets))) {
-               if (isopkt)
-                       kfree(isopkt);
-               if (dr)
-                       kfree(dr);
+               kfree(isopkt);
+               kfree(dr);
                return -ENOMEM;
        }
        if (!(as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL))) {
-               if (isopkt)
-                       kfree(isopkt);
-               if (dr)
-                       kfree(dr);
+               kfree(isopkt);
+               kfree(dr);
                free_async(as);
                return -ENOMEM;
        }
@@ -967,8 +961,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
                as->urb->iso_frame_desc[u].length = isopkt[u].length;
                totlen += isopkt[u].length;
        }
-       if (isopkt)
-               kfree(isopkt);
+       kfree(isopkt);
        as->ps = ps;
         as->userurb = arg;
        if (uurb->endpoint & USB_DIR_IN)
@@ -1032,15 +1025,15 @@ static int processcompl(struct async *as, void __user * __user *arg)
        if (put_user(urb->error_count, &userurb->error_count))
                return -EFAULT;
 
-       if (!(usb_pipeisoc(urb->pipe)))
-               return 0;
-       for (i = 0; i < urb->number_of_packets; i++) {
-               if (put_user(urb->iso_frame_desc[i].actual_length,
-                            &userurb->iso_frame_desc[i].actual_length))
-                       return -EFAULT;
-               if (put_user(urb->iso_frame_desc[i].status,
-                            &userurb->iso_frame_desc[i].status))
-                       return -EFAULT;
+       if (usb_pipeisoc(urb->pipe)) {
+               for (i = 0; i < urb->number_of_packets; i++) {
+                       if (put_user(urb->iso_frame_desc[i].actual_length,
+                                    &userurb->iso_frame_desc[i].actual_length))
+                               return -EFAULT;
+                       if (put_user(urb->iso_frame_desc[i].status,
+                                    &userurb->iso_frame_desc[i].status))
+                               return -EFAULT;
+               }
        }
 
        free_async(as);
@@ -1126,7 +1119,7 @@ static int proc_submiturb_compat(struct dev_state *ps, void __user *arg)
        if (get_urb32(&uurb,(struct usbdevfs_urb32 *)arg))
                return -EFAULT;
 
-       return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb __user *)arg)->iso_frame_desc, arg);
+       return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb32 __user *)arg)->iso_frame_desc, arg);
 }
 
 static int processcompl_compat(struct async *as, void __user * __user *arg)
@@ -1146,15 +1139,15 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
        if (put_user(urb->error_count, &userurb->error_count))
                return -EFAULT;
 
-       if (!(usb_pipeisoc(urb->pipe)))
-               return 0;
-       for (i = 0; i < urb->number_of_packets; i++) {
-               if (put_user(urb->iso_frame_desc[i].actual_length,
-                            &userurb->iso_frame_desc[i].actual_length))
-                       return -EFAULT;
-               if (put_user(urb->iso_frame_desc[i].status,
-                            &userurb->iso_frame_desc[i].status))
-                       return -EFAULT;
+       if (usb_pipeisoc(urb->pipe)) {
+               for (i = 0; i < urb->number_of_packets; i++) {
+                       if (put_user(urb->iso_frame_desc[i].actual_length,
+                                    &userurb->iso_frame_desc[i].actual_length))
+                               return -EFAULT;
+                       if (put_user(urb->iso_frame_desc[i].status,
+                                    &userurb->iso_frame_desc[i].status))
+                               return -EFAULT;
+               }
        }
 
        free_async(as);
@@ -1177,10 +1170,8 @@ static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg)
 {
        struct async *as;
 
-       printk("reapurbnblock\n");
        if (!(as = async_getcompleted(ps)))
                return -EAGAIN;
-       printk("reap got as %p\n", as);
        return processcompl_compat(as, (void __user * __user *)arg);
 }
 
@@ -1239,7 +1230,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
                        return -ENOMEM;
                if ((_IOC_DIR(ctrl.ioctl_code) & _IOC_WRITE)) {
                        if (copy_from_user (buf, ctrl.data, size)) {
-                               kfree (buf);
+                               kfree(buf);
                                return -EFAULT;
                        }
                } else {
@@ -1248,8 +1239,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
        }
 
        if (!connected(ps->dev)) {
-               if (buf)
-                       kfree(buf);
+               kfree(buf);
                return -ENODEV;
        }
 
@@ -1311,8 +1301,8 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
                        && size > 0
                        && copy_to_user (ctrl.data, buf, size) != 0)
                retval = -EFAULT;
-       if (buf != NULL)
-               kfree (buf);
+
+       kfree(buf);
        return retval;
 }
 
index 80ce9644d0eea027546f55cba42d921fb7e57aeb..38ed2220c9fcc31bee849c2410e45a22f3a8098e 100644 (file)
@@ -28,6 +28,8 @@
 #endif
 #include <linux/usb.h>
 
+#include "usb.h"
+
 #define MAX_USB_MINORS 256
 static struct file_operations *usb_minors[MAX_USB_MINORS];
 static DEFINE_SPINLOCK(minor_lock);
index b9a3dae070363b14325487dd68248e5e05f692cc..71b4a8d663189d3dce1edf3153990146b71350ee 100644 (file)
@@ -33,7 +33,7 @@
 #include "hcd.h"
 
 
-/* PCI-based HCs are normal, but custom bus glue should be ok */
+/* PCI-based HCs are common, but plenty of non-PCI HCs are used too */
 
 
 /*-------------------------------------------------------------------------*/
@@ -67,8 +67,8 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
 
        if (pci_enable_device (dev) < 0)
                return -ENODEV;
-       dev->current_state = 0;
-       dev->dev.power.power_state = 0;
+       dev->current_state = PCI_D0;
+       dev->dev.power.power_state = PMSG_ON;
        
         if (!dev->irq) {
                dev_err (&dev->dev,
@@ -186,26 +186,14 @@ EXPORT_SYMBOL (usb_hcd_pci_remove);
 
 #ifdef CONFIG_PM
 
-static char __attribute_used__ *pci_state(u32 state)
-{
-       switch (state) {
-       case 0:         return "D0";
-       case 1:         return "D1";
-       case 2:         return "D2";
-       case 3:         return "D3hot";
-       case 4:         return "D3cold";
-       }
-       return NULL;
-}
-
 /**
  * usb_hcd_pci_suspend - power management suspend of a PCI-based HCD
  * @dev: USB Host Controller being suspended
- * @state: state that the controller is going into
+ * @message: semantics in flux
  *
  * Store this function in the HCD's struct pci_driver as suspend().
  */
-int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
+int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
 {
        struct usb_hcd          *hcd;
        int                     retval = 0;
@@ -213,13 +201,23 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
 
        hcd = pci_get_drvdata(dev);
 
+       /* FIXME until the generic PM interfaces change a lot more, this
+        * can't use PCI D1 and D2 states.  For example, the confusion
+        * between messages and states will need to vanish, and messages
+        * will need to provide a target system state again.
+        *
+        * It'll be important to learn characteristics of the target state,
+        * especially on embedded hardware where the HCD will often be in
+        * charge of an external VBUS power supply and one or more clocks.
+        * Some target system states will leave them active; others won't.
+        * (With PCI, that's often handled by platform BIOS code.)
+        */
+
        /* even when the PCI layer rejects some of the PCI calls
         * below, HCs can try global suspend and reduce DMA traffic.
         * PM-sensitive HCDs may already have done this.
         */
        has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
-       if (state > 4)
-               state = 4;
 
        switch (hcd->state) {
 
@@ -228,7 +226,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
         */
        case HC_STATE_RUNNING:
                hcd->state = HC_STATE_QUIESCING;
-               retval = hcd->driver->suspend (hcd, state);
+               retval = hcd->driver->suspend (hcd, message);
                if (retval) {
                        dev_dbg (hcd->self.controller, 
                                        "suspend fail, retval %d\n",
@@ -246,14 +244,11 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
         * have been called, otherwise root hub timers still run ...
         */
        case HC_STATE_SUSPENDED:
-               if (state <= dev->current_state)
-                       break;
-
-               /* no DMA or IRQs except in D0 */
-               if (!dev->current_state) {
+               /* no DMA or IRQs except when HC is active */
+               if (dev->current_state == PCI_D0) {
+                       free_irq (hcd->irq, hcd);
                        pci_save_state (dev);
                        pci_disable_device (dev);
-                       free_irq (hcd->irq, hcd);
                }
 
                if (!has_pci_pm) {
@@ -261,25 +256,19 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
                        break;
                }
 
-               /* POLICY: ignore D1/D2/D3hot differences;
-                * we know D3hot will always work.
+               /* NOTE:  dev->current_state becomes nonzero only here, and
+                * only for devices that support PCI PM.  Also, exiting
+                * PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset
+                * some device state (e.g. as part of clock reinit).
                 */
-               retval = pci_set_power_state (dev, state);
-               if (retval < 0 && state < 3) {
-                       retval = pci_set_power_state (dev, 3);
-                       if (retval == 0)
-                               state = 3;
-               }
+               retval = pci_set_power_state (dev, PCI_D3hot);
                if (retval == 0) {
-                       dev_dbg (hcd->self.controller, "--> PCI %s\n",
-                                       pci_state(dev->current_state));
-#ifdef CONFIG_USB_SUSPEND
-                       pci_enable_wake (dev, state, hcd->remote_wakeup);
-                       pci_enable_wake (dev, 4, hcd->remote_wakeup);
-#endif
+                       dev_dbg (hcd->self.controller, "--> PCI D3\n");
+                       pci_enable_wake (dev, PCI_D3hot, hcd->remote_wakeup);
+                       pci_enable_wake (dev, PCI_D3cold, hcd->remote_wakeup);
                } else if (retval < 0) {
-                       dev_dbg (&dev->dev, "PCI %s suspend fail, %d\n",
-                                       pci_state(state), retval);
+                       dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n",
+                                       retval);
                        (void) usb_hcd_pci_resume (dev);
                        break;
                }
@@ -287,13 +276,14 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
        default:
                dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n",
                        hcd->state);
+               WARN_ON(1);
                retval = -EINVAL;
                break;
        }
 
        /* update power_state **ONLY** to make sysfs happier */
        if (retval == 0)
-               dev->dev.power.power_state = state;
+               dev->dev.power.power_state = message;
        return retval;
 }
 EXPORT_SYMBOL (usb_hcd_pci_suspend);
@@ -308,7 +298,6 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
 {
        struct usb_hcd          *hcd;
        int                     retval;
-       int                     has_pci_pm;
 
        hcd = pci_get_drvdata(dev);
        if (hcd->state != HC_STATE_SUSPENDED) {
@@ -316,31 +305,73 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
                                "can't resume, not suspended!\n");
                return 0;
        }
-       has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
 
-       /* D3cold resume isn't usually reported this way... */
-       dev_dbg(hcd->self.controller, "resume from PCI %s%s\n",
-                       pci_state(dev->current_state),
-                       has_pci_pm ? "" : " (legacy)");
+       /* NOTE:  chip docs cover clean "real suspend" cases (what Linux
+        * calls "standby", "suspend to RAM", and so on).  There are also
+        * dirty cases when swsusp fakes a suspend in "shutdown" mode.
+        */
+       if (dev->current_state != PCI_D0) {
+#ifdef DEBUG
+               int     pci_pm;
+               u16     pmcr;
+
+               pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
+               pci_read_config_word(dev, pci_pm + PCI_PM_CTRL, &pmcr);
+               pmcr &= PCI_PM_CTRL_STATE_MASK;
+               if (pmcr) {
+                       /* Clean case:  power to USB and to HC registers was
+                        * maintained; remote wakeup is easy.
+                        */
+                       dev_dbg(hcd->self.controller, "resume from PCI D%d\n",
+                                       pmcr);
+               } else {
+                       /* Clean:  HC lost Vcc power, D0 uninitialized
+                        *   + Vaux may have preserved port and transceiver
+                        *     state ... for remote wakeup from D3cold
+                        *   + or not; HCD must reinit + re-enumerate
+                        *
+                        * Dirty: D0 semi-initialized cases with swsusp
+                        *   + after BIOS init
+                        *   + after Linux init (HCD statically linked)
+                        */
+                       dev_dbg(hcd->self.controller,
+                               "PCI D0, from previous PCI D%d\n",
+                               dev->current_state);
+               }
+#endif
+               pci_enable_wake (dev, dev->current_state, 0);
+               pci_enable_wake (dev, PCI_D3cold, 0);
+       } else {
+               /* Same basic cases: clean (powered/not), dirty */
+               dev_dbg(hcd->self.controller, "PCI legacy resume\n");
+       }
+
+       /* NOTE:  the PCI API itself is asymmetric here.  We don't need to
+        * pci_set_power_state(PCI_D0) since that's part of re-enabling;
+        * but that won't re-enable bus mastering.  Yet pci_disable_device()
+        * explicitly disables bus mastering...
+        */
+       retval = pci_enable_device (dev);
+       if (retval < 0) {
+               dev_err (hcd->self.controller,
+                       "can't re-enable after resume, %d!\n", retval);
+               return retval;
+       }
+       pci_set_master (dev);
+       pci_restore_state (dev);
+
+       dev->dev.power.power_state = PMSG_ON;
 
        hcd->state = HC_STATE_RESUMING;
-
-       if (has_pci_pm)
-               pci_set_power_state (dev, 0);
-       dev->dev.power.power_state = 0;
+       hcd->saw_irq = 0;
        retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,
-                               hcd->driver->description, hcd);
+                               hcd->irq_descr, hcd);
        if (retval < 0) {
                dev_err (hcd->self.controller,
                        "can't restore IRQ after resume!\n");
+               usb_hc_died (hcd);
                return retval;
        }
-       hcd->saw_irq = 0;
-       pci_restore_state (dev);
-#ifdef CONFIG_USB_SUSPEND
-       pci_enable_wake (dev, dev->current_state, 0);
-       pci_enable_wake (dev, 4, 0);
-#endif
 
        retval = hcd->driver->resume (hcd);
        if (!HC_IS_RUNNING (hcd->state)) {
index 6c625b35fa0c9e5df3a27578e98d1ca854d43781..f67cf1e634fc51f75227ad2e0c24e512a3da2377 100644 (file)
@@ -177,7 +177,7 @@ struct hc_driver {
         * a whole, not just the root hub; they're for bus glue.
         */
        /* called after all devices were suspended */
-       int     (*suspend) (struct usb_hcd *hcd, u32 state);
+       int     (*suspend) (struct usb_hcd *hcd, pm_message_t message);
 
        /* called before any devices get resumed */
        int     (*resume) (struct usb_hcd *hcd);
@@ -226,7 +226,7 @@ extern int usb_hcd_pci_probe (struct pci_dev *dev,
 extern void usb_hcd_pci_remove (struct pci_dev *dev);
 
 #ifdef CONFIG_PM
-extern int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state);
+extern int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t state);
 extern int usb_hcd_pci_resume (struct pci_dev *dev);
 #endif /* CONFIG_PM */
 
index fa0dc4f6de47380da80935de2a2d750affb46e63..d2d648ee864009cc028d2ce539ffede88f9bf17f 100644 (file)
@@ -381,7 +381,7 @@ static void hub_tt_kevent (void *arg)
                        dev_err (&hdev->dev,
                                "clear tt %d (%04x) error %d\n",
                                clear->tt, clear->devinfo, status);
-               kfree (clear);
+               kfree(clear);
        }
        spin_unlock_irqrestore (&hub->tt.lock, flags);
 }
@@ -728,15 +728,11 @@ static void hub_disconnect(struct usb_interface *intf)
        list_del_init(&hub->event_list);
        spin_unlock_irq(&hub_event_lock);
 
-       if (hub->descriptor) {
-               kfree(hub->descriptor);
-               hub->descriptor = NULL;
-       }
+       kfree(hub->descriptor);
+       hub->descriptor = NULL;
 
-       if (hub->status) {
-               kfree(hub->status);
-               hub->status = NULL;
-       }
+       kfree(hub->status);
+       hub->status = NULL;
 
        if (hub->buffer) {
                usb_buffer_free(hdev, sizeof(*hub->buffer), hub->buffer,
@@ -1456,7 +1452,7 @@ static void hub_port_logical_disconnect(struct usb_hub *hub, int port1)
        /* FIXME let caller ask to power down the port:
         *  - some devices won't enumerate without a VBUS power cycle
         *  - SRP saves power that way
-        *  - usb_suspend_device(dev,PM_SUSPEND_DISK)
+        *  - usb_suspend_device(dev, PMSG_SUSPEND)
         * That's easy if this hub can switch power per-port, and
         * khubd reactivates the port later (timer, SRP, etc).
         * Powerdown must be optional, because of reset/DFU.
@@ -1531,7 +1527,7 @@ static int hub_port_suspend(struct usb_hub *hub, int port1,
 
 /*
  * Devices on USB hub ports have only one "suspend" state, corresponding
- * to ACPI D2 (PM_SUSPEND_MEM), "may cause the device to lose some context".
+ * to ACPI D2, "may cause the device to lose some context".
  * State transitions include:
  *
  *   - suspend, resume ... when the VBUS power link stays live
@@ -1731,7 +1727,7 @@ static int finish_port_resume(struct usb_device *udev)
                        struct usb_driver       *driver;
 
                        intf = udev->actconfig->interface[i];
-                       if (intf->dev.power.power_state == PM_SUSPEND_ON)
+                       if (intf->dev.power.power_state == PMSG_SUSPEND)
                                continue;
                        if (!intf->dev.driver) {
                                /* FIXME maybe force to alt 0 */
@@ -1745,7 +1741,7 @@ static int finish_port_resume(struct usb_device *udev)
 
                        /* can we do better than just logging errors? */
                        status = driver->resume(intf);
-                       if (intf->dev.power.power_state != PM_SUSPEND_ON
+                       if (intf->dev.power.power_state != PMSG_ON
                                        || status)
                                dev_dbg(&intf->dev,
                                        "resume fail, state %d code %d\n",
@@ -2354,7 +2350,7 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
                        schedule_work (&hub->leds);
                }
        }
-       kfree (qual);
+       kfree(qual);
 }
 
 static unsigned
index d913407bcdc1e3e453d6811b9a1547234386badb..f9f9561c6bad3fa611e410af62aaffae92771335 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/parser.h>
 #include <asm/byteorder.h>
 #include "usb.h"
+#include "hcd.h"
 
 static struct super_operations usbfs_ops;
 static struct file_operations default_file_operations;
index 40bdb38e7bcbade82a4a176344604947f5f2760a..e12c5be1e0a345f12f430b17c17669ba32ba57f6 100644 (file)
@@ -1133,29 +1133,10 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
        /* prevent submissions using previous endpoint settings */
        usb_disable_interface(dev, iface);
 
-       /* 9.1.1.5 says:
-        *
-        *      Configuring a device or changing an alternate setting
-        *      causes all of the status and configuration values
-        *      associated with endpoints in the affected interfaces to
-        *      be set to their default values. This includes setting
-        *      the data toggle of any endpoint using data toggles to
-        *      the value DATA0.
-        *
-        * Some devices take this too literally and don't reset the data
-        * toggles if the new altsetting is the same as the old one (the
-        * command isn't "changing" an alternate setting).  We will manually
-        * reset the toggles when the new and old altsettings are the same.
-        * Most devices won't need this, but fortunately it doesn't happen
-        * often.
-        */
-       if (iface->cur_altsetting == alt)
-               manual = 1;
        iface->cur_altsetting = alt;
 
        /* If the interface only has one altsetting and the device didn't
-        * accept the request (or whenever the old altsetting is the same
-        * as the new one), we attempt to carry out the equivalent action
+        * accept the request, we attempt to carry out the equivalent action
         * by manually clearing the HALT feature for each endpoint in the
         * new altsetting.
         */
@@ -1202,7 +1183,9 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
  *
  * Because this affects multiple interfaces, avoid using this with composite
  * (multi-interface) devices.  Instead, the driver for each interface may
- * use usb_set_interface() on the interfaces it claims.  Resetting the whole
+ * use usb_set_interface() on the interfaces it claims.  Be careful though;
+ * some devices don't support the SET_INTERFACE request, and others won't
+ * reset all the interface state (notably data toggles).  Resetting the whole
  * configuration would affect other drivers' interfaces.
  *
  * The caller must own the device lock.
index dc838f81742cb1c848ea084e07266d1cd7477c52..16972159a57ad855485f61e1e1a9421e88a95b0f 100644 (file)
@@ -420,12 +420,16 @@ int usb_submit_urb(struct urb *urb, int mem_flags)
  *
  * Host Controller Drivers (HCDs) place all the URBs for a particular
  * endpoint in a queue.  Normally the queue advances as the controller
- * hardware processes each request.  But when an URB terminates with any
- * fault (such as an error, or being unlinked) its queue stops, at least
- * until that URB's completion routine returns.  It is guaranteed that
- * the queue will not restart until all its unlinked URBs have been fully
- * retired, with their completion routines run, even if that's not until
- * some time after the original completion handler returns.
+ * hardware processes each request.  But when an URB terminates with an
+ * error its queue stops, at least until that URB's completion routine
+ * returns.  It is guaranteed that the queue will not restart until all
+ * its unlinked URBs have been fully retired, with their completion
+ * routines run, even if that's not until some time after the original
+ * completion handler returns.  Normally the same behavior and guarantees
+ * apply when an URB terminates because it was unlinked; however if an
+ * URB is unlinked before the hardware has started to execute it, then
+ * its queue is not guaranteed to stop until all the preceding URBs have
+ * completed.
  *
  * This means that USB device drivers can safely build deep queues for
  * large or complex transfers, and clean them up reliably after any sort
index f0534ee064901d0108eb7b2b1fcb59a98bb53c2b..c231b4bef314284a168fedb6c5f6c47aec5084fc 100644 (file)
 #include "hcd.h"
 #include "usb.h"
 
-extern int  usb_hub_init(void);
-extern void usb_hub_cleanup(void);
-extern int usb_major_init(void);
-extern void usb_major_cleanup(void);
-extern int usb_host_init(void);
-extern void usb_host_cleanup(void);
-
 
 const char *usbcore_name = "usbcore";
 
@@ -1382,13 +1375,13 @@ void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
                        usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
 }
 
-static int usb_generic_suspend(struct device *dev, u32 state)
+static int usb_generic_suspend(struct device *dev, pm_message_t message)
 {
        struct usb_interface *intf;
        struct usb_driver *driver;
 
        if (dev->driver == &usb_generic_driver)
-               return usb_suspend_device (to_usb_device(dev), state);
+               return usb_suspend_device (to_usb_device(dev), message);
 
        if ((dev->driver == NULL) ||
            (dev->driver_data == &usb_generic_driver_data))
@@ -1402,7 +1395,7 @@ static int usb_generic_suspend(struct device *dev, u32 state)
                return 0;
 
        if (driver->suspend)
-               return driver->suspend(intf, state);
+               return driver->suspend(intf, message);
        return 0;
 }
 
index 4c33eee520011bc7eba449f9c379d4e4007f067c..2c690f6d4c18b84dd83832f7aca4746dbd36d731 100644 (file)
@@ -21,6 +21,13 @@ extern void usb_unlock_all_devices(void);
 extern void usb_kick_khubd(struct usb_device *dev);
 extern void usb_resume_root_hub(struct usb_device *dev);
 
+extern int  usb_hub_init(void);
+extern void usb_hub_cleanup(void);
+extern int usb_major_init(void);
+extern void usb_major_cleanup(void);
+extern int usb_host_init(void);
+extern void usb_host_cleanup(void);
+
 /* for labeling diagnostics */
 extern const char *usbcore_name;
 
@@ -30,6 +37,7 @@ extern struct file_operations usbfs_devices_fops;
 extern struct file_operations usbfs_device_file_operations;
 extern void usbfs_conn_disc_event(void);
 
+
 struct dev_state {
        struct list_head list;      /* state list */
        struct usb_device *dev;
index cff9fb0b73cc09724c59483759906f08202b261c..3993156c2e826ce8d95a8717338d151e805a8104 100644 (file)
@@ -100,6 +100,8 @@ static const char driver_desc [] = DRIVER_DESC;
 
 /* CDC and RNDIS support the same host-chosen outgoing packet filters. */
 #define        DEFAULT_FILTER  (USB_CDC_PACKET_TYPE_BROADCAST \
+                       |USB_CDC_PACKET_TYPE_ALL_MULTICAST \
+                       |USB_CDC_PACKET_TYPE_PROMISCUOUS \
                        |USB_CDC_PACKET_TYPE_DIRECTED)
 
 
@@ -322,12 +324,18 @@ module_param (qmult, uint, S_IRUGO|S_IWUSR);
 /* also defer IRQs on highspeed TX */
 #define TX_DELAY       qmult
 
-#define        BITRATE(g)      (((g)->speed == USB_SPEED_HIGH) ? HS_BPS : FS_BPS)
+static inline int BITRATE(struct usb_gadget *g)
+{
+       return (g->speed == USB_SPEED_HIGH) ? HS_BPS : FS_BPS;
+}
 
 #else  /* full speed (low speed doesn't do bulk) */
 #define qlen(gadget) DEFAULT_QLEN
 
-#define        BITRATE(g)      FS_BPS
+static inline int BITRATE(struct usb_gadget *g)
+{
+       return FS_BPS;
+}
 #endif
 
 
@@ -1167,7 +1175,7 @@ eth_set_config (struct eth_dev *dev, unsigned number, int gfp_flags)
        eth_reset_config (dev);
 
        /* default:  pass all packets, no multicast filtering */
-       dev->cdc_filter = 0x000f;
+       dev->cdc_filter = DEFAULT_FILTER;
 
        switch (number) {
        case DEV_CONFIG_VALUE:
@@ -1343,9 +1351,9 @@ eth_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
        struct eth_dev          *dev = get_gadget_data (gadget);
        struct usb_request      *req = dev->req;
        int                     value = -EOPNOTSUPP;
-       u16                     wIndex = ctrl->wIndex;
-       u16                     wValue = ctrl->wValue;
-       u16                     wLength = ctrl->wLength;
+       u16                     wIndex = (__force u16) ctrl->wIndex;
+       u16                     wValue = (__force u16) ctrl->wValue;
+       u16                     wLength = (__force u16) ctrl->wLength;
 
        /* descriptors just go into the pre-allocated ep0 buffer,
         * while config change events may enable network traffic.
@@ -1693,7 +1701,7 @@ rx_submit (struct eth_dev *dev, struct usb_request *req, int gfp_flags)
        
        /* Some platforms perform better when IP packets are aligned,
         * but on at least one, checksumming fails otherwise.  Note:
-        * this doesn't account for variable-sized RNDIS headers.
+        * RNDIS headers involve variable numbers of LE32 values.
         */
        skb_reserve(skb, NET_IP_ALIGN);
 
@@ -1730,9 +1738,11 @@ static void rx_complete (struct usb_ep *ep, struct usb_request *req)
 #ifdef CONFIG_USB_ETH_RNDIS
                /* we know MaxPacketsPerTransfer == 1 here */
                if (dev->rndis)
-                       rndis_rm_hdr (req->buf, &(skb->len));
+                       status = rndis_rm_hdr (skb);
 #endif
-               if (ETH_HLEN > skb->len || skb->len > ETH_FRAME_LEN) {
+               if (status < 0
+                               || ETH_HLEN > skb->len
+                               || skb->len > ETH_FRAME_LEN) {
                        dev->stats.rx_errors++;
                        dev->stats.rx_length_errors++;
                        DEBUG (dev, "rx length %d\n", skb->len);
@@ -2047,38 +2057,20 @@ rndis_control_ack_complete (struct usb_ep *ep, struct usb_request *req)
                DEBUG ((struct eth_dev *) ep->driver_data,
                        "rndis control ack complete --> %d, %d/%d\n",
                        req->status, req->actual, req->length);
-
-       usb_ep_free_buffer(ep, req->buf, req->dma, 8);
-       usb_ep_free_request(ep, req);
 }
 
 static int rndis_control_ack (struct net_device *net)
 {
        struct eth_dev          *dev = netdev_priv(net);
        u32                     length;
-       struct usb_request      *resp;
+       struct usb_request      *resp = dev->stat_req;
        
        /* in case RNDIS calls this after disconnect */
-       if (!dev->status_ep) {
+       if (!dev->status) {
                DEBUG (dev, "status ENODEV\n");
                return -ENODEV;
        }
 
-       /* Allocate memory for notification ie. ACK */
-       resp = usb_ep_alloc_request (dev->status_ep, GFP_ATOMIC);
-       if (!resp) {
-               DEBUG (dev, "status ENOMEM\n");
-               return -ENOMEM;
-       }
-       
-       resp->buf = usb_ep_alloc_buffer (dev->status_ep, 8,
-                                        &resp->dma, GFP_ATOMIC);
-       if (!resp->buf) {
-               DEBUG (dev, "status buf ENOMEM\n");
-               usb_ep_free_request (dev->status_ep, resp);
-               return -ENOMEM;
-       }
-       
        /* Send RNDIS RESPONSE_AVAILABLE notification;
         * USB_CDC_NOTIFY_RESPONSE_AVAILABLE should work too
         */
@@ -2113,7 +2105,7 @@ static void eth_start (struct eth_dev *dev, int gfp_flags)
        if (dev->rndis) {
                rndis_set_param_medium (dev->rndis_config,
                                        NDIS_MEDIUM_802_3,
-                                       BITRATE(dev->gadget));
+                                       BITRATE(dev->gadget)/100);
                rndis_send_media_state (dev, 1);
        }
 #endif 
@@ -2307,8 +2299,8 @@ eth_bind (struct usb_gadget *gadget)
                device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210);
        } else if (gadget_is_pxa27x(gadget)) {
                device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211);
-       } else if (gadget_is_s3c2410(gadget)) {
-               device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);
+       } else if (gadget_is_s3c2410(gadget)) {
+               device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);
        } else if (gadget_is_at91(gadget)) {
                device_desc.bcdDevice = __constant_cpu_to_le16 (0x0213);
        } else {
index b66ea5a6ed791d6f0e8d2a05de7977da0aabe661..98cbcbc16cc19da3429aca42ef966612bf667723 100644 (file)
@@ -2809,17 +2809,15 @@ static int __exit omap_udc_remove(struct device *dev)
        return 0;
 }
 
-/* suspend/resume/wakeup from sysfs (echo > power/state) */
-
-static int omap_udc_suspend(struct device *dev, u32 state, u32 level)
+static int omap_udc_suspend(struct device *dev, pm_message_t state, u32 level)
 {
        if (level != 0)
                return 0;
 
        DBG("suspend, state %d\n", state);
        omap_pullup(&udc->gadget, 0);
-       udc->gadget.dev.power.power_state = 3;
-       udc->gadget.dev.parent->power.power_state = 3;
+       udc->gadget.dev.power.power_state = PMSG_SUSPEND;
+       udc->gadget.dev.parent->power.power_state = PMSG_SUSPEND;
        return 0;
 }
 
@@ -2829,8 +2827,8 @@ static int omap_udc_resume(struct device *dev, u32 level)
                return 0;
 
        DBG("resume + wakeup/SRP\n");
-       udc->gadget.dev.parent->power.power_state = 0;
-       udc->gadget.dev.power.power_state = 0;
+       udc->gadget.dev.parent->power.power_state = PMSG_ON;
+       udc->gadget.dev.power.power_state = PMSG_ON;
        omap_pullup(&udc->gadget, 1);
 
        /* maybe the host would enumerate us if we nudged it */
index 6c5197850edc1f7b14942e211fefb14a91f1242f..7457268d5f282b9e9d1d6217857db70e0ecaefc9 100644 (file)
@@ -37,6 +37,7 @@
 #include <asm/io.h>
 #include <asm/byteorder.h>
 #include <asm/system.h>
+#include <asm/unaligned.h>
 
 
 #undef RNDIS_PM
@@ -165,7 +166,7 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r)
                
        /* mandatory */
        case OID_GEN_LINK_SPEED:
-               DEBUG("%s: OID_GEN_LINK_SPEED\n", __FUNCTION__);
+//             DEBUG("%s: OID_GEN_LINK_SPEED\n", __FUNCTION__);
                length = 4;
                if (rndis_per_dev_params [configNr].media_state
                        == NDIS_MEDIA_STATE_DISCONNECTED)
@@ -729,7 +730,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
                retval = 0;
 
                /* FIXME use these NDIS_PACKET_TYPE_* bitflags to
-                * filter packets in hard_start_xmit()
+                * set the cdc_filter; it's not RNDIS-specific
                 * NDIS_PACKET_TYPE_x == USB_CDC_PACKET_TYPE_x for x in:
                 *      PROMISCUOUS, DIRECTED,
                 *      MULTICAST, ALL_MULTICAST, BROADCAST
@@ -1194,10 +1195,10 @@ void rndis_add_hdr (struct sk_buff *skb)
                return;
        header = (void *) skb_push (skb, sizeof *header);
        memset (header, 0, sizeof *header);
-       header->MessageType = __constant_cpu_to_le32 (1);
+       header->MessageType = __constant_cpu_to_le32(REMOTE_NDIS_PACKET_MSG);
        header->MessageLength = cpu_to_le32(skb->len);
        header->DataOffset = __constant_cpu_to_le32 (36);
-       header->OOBDataOffset = cpu_to_le32(skb->len - 44);
+       header->DataLength = cpu_to_le32(skb->len - sizeof *header);
 }
 
 void rndis_free_response (int configNr, u8 *buf)
@@ -1253,26 +1254,23 @@ static rndis_resp_t *rndis_add_response (int configNr, u32 length)
        return r;
 }
 
-int rndis_rm_hdr (u8 *buf, u32 *length)
+int rndis_rm_hdr(struct sk_buff *skb)
 {
-       u32 i, messageLen, dataOffset;
-       __le32 *tmp;
-       
-       tmp = (__le32 *) buf; 
+       /* tmp points to a struct rndis_packet_msg_type */
+       __le32          *tmp = (void *) skb->data;
 
-       if (!buf || !length) return -1;
-       if (le32_to_cpup(tmp++) != 1) return -1;
-       
-       messageLen = le32_to_cpup(tmp++);
-       dataOffset = le32_to_cpup(tmp++) + 8;
+       /* MessageType, MessageLength */
+       if (__constant_cpu_to_le32(REMOTE_NDIS_PACKET_MSG)
+                       != get_unaligned(tmp++))
+               return -EINVAL;
+       tmp++;
+
+       /* DataOffset, DataLength */
+       if (!skb_pull(skb, le32_to_cpu(get_unaligned(tmp++))
+                       + 8 /* offset of DataOffset */))
+               return -EOVERFLOW;
+       skb_trim(skb, le32_to_cpu(get_unaligned(tmp++)));
 
-       if (messageLen < dataOffset || messageLen > *length) return -1;
-       
-       for (i = dataOffset; i < messageLen; i++)
-               buf [i - dataOffset] = buf [i];
-               
-       *length = messageLen - dataOffset;
-       
        return 0;
 }
 
index 822501852c50ba9776d8f4bfca1f8c4774ff3ce1..2b5b55df3cfd3042bfc189c12e6cbbc8fea54a4b 100644 (file)
@@ -38,6 +38,7 @@
  */
 
 /* Message Set for Connectionless (802.3) Devices */
+#define REMOTE_NDIS_PACKET_MSG         0x00000001U
 #define REMOTE_NDIS_INITIALIZE_MSG     0x00000002U     /* Initialize device */
 #define REMOTE_NDIS_HALT_MSG           0x00000003U
 #define REMOTE_NDIS_QUERY_MSG          0x00000004U
@@ -333,7 +334,7 @@ int  rndis_set_param_vendor (u8 configNr, u32 vendorID,
                            const char *vendorDescr);
 int  rndis_set_param_medium (u8 configNr, u32 medium, u32 speed);
 void rndis_add_hdr (struct sk_buff *skb);
-int  rndis_rm_hdr (u8 *buf, u32 *length);
+int rndis_rm_hdr (struct sk_buff *skb);
 u8   *rndis_get_next_response (int configNr, u32 *length);
 void rndis_free_response (int configNr, u8 *buf);
 
index 2af3f785d5a11c92926b7891c486f7fb762501a3..f1762ed6db6394aefd5340ddabc8692f56d89fbc 100644 (file)
@@ -2312,9 +2312,8 @@ static struct gs_buf *gs_buf_alloc(unsigned int size, int kmalloc_flags)
  */
 void gs_buf_free(struct gs_buf *gb)
 {
-       if (gb != NULL) {
-               if (gb->buf_buf != NULL)
-                       kfree(gb->buf_buf);
+       if (gb) {
+               kfree(gb->buf_buf);
                kfree(gb);
        }
 }
index 495e2a3ef6f1f96582e51faa3b04eb3ea4e399d8..9b347d765383ab947b4cee47ffbaf3bfd51078ff 100644 (file)
@@ -394,7 +394,7 @@ static void qh_lines (
                mark = ' ';
                if (hw_curr == td->qtd_dma)
                        mark = '*';
-               else if (qh->hw_qtd_next == td->qtd_dma)
+               else if (qh->hw_qtd_next == cpu_to_le32(td->qtd_dma))
                        mark = '+';
                else if (QTD_LENGTH (scratch)) {
                        if (td->hw_alt_next == ehci->async->hw_alt_next)
index a63bb792e2c7e0b6d251c7e3384b82bff48362fb..84d2b93aca37d51a7e13f9db9072ce76b8105372 100644 (file)
@@ -721,7 +721,7 @@ static int ehci_get_frame (struct usb_hcd *hcd)
  * the right sort of wakeup.  
  */
 
-static int ehci_suspend (struct usb_hcd *hcd, u32 state)
+static int ehci_suspend (struct usb_hcd *hcd, pm_message_t message)
 {
        struct ehci_hcd         *ehci = hcd_to_ehci (hcd);
 
@@ -729,7 +729,7 @@ static int ehci_suspend (struct usb_hcd *hcd, u32 state)
                msleep (100);
 
 #ifdef CONFIG_USB_SUSPEND
-       (void) usb_suspend_device (hcd->self.root_hub, state);
+       (void) usb_suspend_device (hcd->self.root_hub, message);
 #else
        usb_lock_device (hcd->self.root_hub);
        (void) ehci_hub_suspend (hcd);
index 9938697ff361372e62814f45f48d4393566147ac..5c38ad869485e8870f20d1834f78eb264cbe8104 100644 (file)
@@ -156,8 +156,7 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
        ehci->periodic = NULL;
 
        /* shadow periodic table */
-       if (ehci->pshadow)
-               kfree (ehci->pshadow);
+       kfree(ehci->pshadow);
        ehci->pshadow = NULL;
 }
 
index f6c86354e30497b62744af46b00843b9511eb0d9..2fa1ffee5ff3bfea6428d4fb488dff8e1ab32fec 100644 (file)
@@ -310,9 +310,9 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
 
        for (i = qh->start; i < ehci->periodic_size; i += period) {
                union ehci_shadow       *prev = &ehci->pshadow [i];
-               u32                     *hw_p = &ehci->periodic [i];
+               __le32                  *hw_p = &ehci->periodic [i];
                union ehci_shadow       here = *prev;
-               u32                     type = 0;
+               __le32                  type = 0;
 
                /* skip the iso nodes at list head */
                while (here.ptr) {
index 67988dba9eb73dc0345186d7148d3d0b7eb2a14c..e763a8399a7522ee627db7c37779c4cb4c4d1c5f 100644 (file)
@@ -364,7 +364,7 @@ union ehci_shadow {
        struct ehci_itd         *itd;           /* Q_TYPE_ITD */
        struct ehci_sitd        *sitd;          /* Q_TYPE_SITD */
        struct ehci_fstn        *fstn;          /* Q_TYPE_FSTN */
-       u32                     *hw_next;       /* (all types) */
+       __le32                  *hw_next;       /* (all types) */
        void                    *ptr;
 };
 
index 90285f180f87a1775280ffb2176adc81e343d7ae..8aab5907afe9ad442012ec4c00aecd46dd88c50b 100644 (file)
@@ -458,9 +458,11 @@ static int ohci_hcd_omap_drv_remove(struct device *dev)
 
 /* states match PCI usage, always suspending the root hub except that
  * 4 ~= D3cold (ACPI D3) with clock off (resume sees reset).
+ *
+ * FIXME: above comment is not right, and code is wrong, too :-(.
  */
 
-static int ohci_omap_suspend(struct device *dev, u32 state, u32 level)
+static int ohci_omap_suspend(struct device *dev, pm_message_t state, u32 level)
 {
        struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
        int             status = -EINVAL;
index b611582e6bcfb98725ae5c23213757c1844c841d..57fd07d005493bb49525806d5fb61928021262c1 100644 (file)
@@ -54,7 +54,7 @@ ohci_pci_start (struct usb_hcd *hcd)
                if (pdev->vendor == PCI_VENDOR_ID_AMD
                                && pdev->device == 0x740c) {
                        ohci->flags = OHCI_QUIRK_AMD756;
-                       ohci_info (ohci, "AMD756 erratum 4 workaround\n");
+                       ohci_dbg (ohci, "AMD756 erratum 4 workaround\n");
                        // also somewhat erratum 10 (suspend/resume issues)
                }
 
@@ -68,7 +68,7 @@ ohci_pci_start (struct usb_hcd *hcd)
                 */
                else if (pdev->vendor == PCI_VENDOR_ID_OPTI
                                && pdev->device == 0xc861) {
-                       ohci_info (ohci,
+                       ohci_dbg (ohci,
                                "WARNING: OPTi workarounds unavailable\n");
                }
 
@@ -84,9 +84,20 @@ ohci_pci_start (struct usb_hcd *hcd)
                        if (b && b->device == PCI_DEVICE_ID_NS_87560_LIO
                                        && b->vendor == PCI_VENDOR_ID_NS) {
                                ohci->flags |= OHCI_QUIRK_SUPERIO;
-                               ohci_info (ohci, "Using NSC SuperIO setup\n");
+                               ohci_dbg (ohci, "Using NSC SuperIO setup\n");
                        }
                }
+
+               /* Check for Compaq's ZFMicro chipset, which needs short 
+                * delays before control or bulk queues get re-activated
+                * in finish_unlinks()
+                */
+               else if (pdev->vendor == PCI_VENDOR_ID_COMPAQ
+                               && pdev->device  == 0xa0f8) {
+                       ohci->flags |= OHCI_QUIRK_ZFMICRO;
+                       ohci_dbg (ohci,
+                               "enabled Compaq ZFMicro chipset quirk\n");
+               }
        }
 
        /* NOTE: there may have already been a first reset, to
@@ -102,7 +113,7 @@ ohci_pci_start (struct usb_hcd *hcd)
 
 #ifdef CONFIG_PM
 
-static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
+static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
 {
        struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
 
@@ -111,7 +122,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
                msleep (100);
 
 #ifdef CONFIG_USB_SUSPEND
-       (void) usb_suspend_device (hcd->self.root_hub, state);
+       (void) usb_suspend_device (hcd->self.root_hub, message);
 #else
        usb_lock_device (hcd->self.root_hub);
        (void) ohci_hub_suspend (hcd);
index 6f3464a957798e5390d27988c4a4c2b569d414e4..e5bc1789d18a6532b13cdaf1e367e8002c9d9b49 100644 (file)
@@ -337,7 +337,7 @@ static int ohci_hcd_pxa27x_drv_remove(struct device *dev)
        return 0;
 }
 
-static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, u32 state, u32 level)
+static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state, u32 level)
 {
 //     struct platform_device *pdev = to_platform_device(dev);
 //     struct usb_hcd *hcd = dev_get_drvdata(dev);
@@ -346,7 +346,7 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, u32 state, u32 level)
        return 0;
 }
 
-static int ohci_hcd_pxa27x_drv_resume(struct device *dev, u32 state)
+static int ohci_hcd_pxa27x_drv_resume(struct device *dev, u32 level)
 {
 //     struct platform_device *pdev = to_platform_device(dev);
 //     struct usb_hcd *hcd = dev_get_drvdata(dev);
index c90114a772776b435ede30408b865ed6b086930e..e372306ed0daa1dd4bfb9231e0d5eb841a2864bb 100644 (file)
@@ -1021,6 +1021,8 @@ rescan_this:
 
                if (ohci->ed_controltail) {
                        command |= OHCI_CLF;
+                       if (ohci->flags & OHCI_QUIRK_ZFMICRO)
+                               mdelay(1);
                        if (!(ohci->hc_control & OHCI_CTRL_CLE)) {
                                control |= OHCI_CTRL_CLE;
                                ohci_writel (ohci, 0,
@@ -1029,6 +1031,8 @@ rescan_this:
                }
                if (ohci->ed_bulktail) {
                        command |= OHCI_BLF;
+                       if (ohci->flags & OHCI_QUIRK_ZFMICRO)
+                               mdelay(1);
                        if (!(ohci->hc_control & OHCI_CTRL_BLE)) {
                                control |= OHCI_CTRL_BLE;
                                ohci_writel (ohci, 0,
@@ -1039,12 +1043,17 @@ rescan_this:
                /* CLE/BLE to enable, CLF/BLF to (maybe) kickstart */
                if (control) {
                        ohci->hc_control |= control;
+                       if (ohci->flags & OHCI_QUIRK_ZFMICRO)
+                               mdelay(1);
                        ohci_writel (ohci, ohci->hc_control,
                                        &ohci->regs->control);   
                }
-               if (command)
+               if (command) {
+                       if (ohci->flags & OHCI_QUIRK_ZFMICRO)
+                               mdelay(1);
                        ohci_writel (ohci, command, &ohci->regs->cmdstatus);   
-       }
+               }
+       }
 }
 
 
index 2ba6e2b0210c99a0cedd8ee77866d980d1d4d8d4..22e1ac138ac0686bc4e72baba0d412d5f9c4022e 100644 (file)
@@ -396,6 +396,7 @@ struct ohci_hcd {
 #define        OHCI_QUIRK_SUPERIO      0x02                    /* natsemi */
 #define        OHCI_QUIRK_INITRESET    0x04                    /* SiS, OPTi, ... */
 #define        OHCI_BIG_ENDIAN         0x08                    /* big endian HC */
+#define        OHCI_QUIRK_ZFMICRO      0x10                    /* Compaq ZFMicro chipset*/
        // there are also chip quirks/bugs in init logic
 
 };
index 324a1a9bbdb2d436207260baa99c851489687de1..49bd83ee0c75bd77eded16e1fa3d02484f2d784a 100644 (file)
@@ -716,7 +716,7 @@ static void uhci_stop(struct usb_hcd *hcd)
 }
 
 #ifdef CONFIG_PM
-static int uhci_suspend(struct usb_hcd *hcd, u32 state)
+static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message)
 {
        struct uhci_hcd *uhci = hcd_to_uhci(hcd);
 
@@ -890,8 +890,7 @@ up_failed:
        debugfs_remove(uhci_debugfs_root);
 
 debug_failed:
-       if (errbuf)
-               kfree(errbuf);
+       kfree(errbuf);
 
 errbuf_failed:
 
@@ -906,9 +905,7 @@ static void __exit uhci_hcd_cleanup(void)
                warn("not all urb_priv's were freed!");
 
        debugfs_remove(uhci_debugfs_root);
-
-       if (errbuf)
-               kfree(errbuf);
+       kfree(errbuf);
 }
 
 module_init(uhci_hcd_init);
index d7fea9ea301b8931055a035b9286691860174eb3..2d76be62f4e0f2e040c89c11047e423246d2d9fd 100644 (file)
@@ -2138,6 +2138,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
        aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor);
        aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct);
        aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice);
+       aiptek->inputdev.dev = &intf->dev;
 
        aiptek->usbdev = usbdev;
        aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber;
index 7662cf4e262152de1958c315959ce8b0555633a0..869ff73690acebf04655691c4edc01a017a6abe4 100644 (file)
@@ -558,8 +558,7 @@ static void hid_free_device(struct hid_device *device)
                }
        }
 
-       if (device->rdesc)
-               kfree(device->rdesc);
+       kfree(device->rdesc);
        kfree(device);
 }
 
@@ -1790,12 +1789,12 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
        return 0;
 }
 
-static int hid_suspend(struct usb_interface *intf, u32 state)
+static int hid_suspend(struct usb_interface *intf, pm_message_t message)
 {
        struct hid_device *hid = usb_get_intfdata (intf);
 
        usb_kill_urb(hid->urbin);
-       intf->dev.power.power_state = state;
+       intf->dev.power.power_state = PMSG_SUSPEND;
        dev_dbg(&intf->dev, "suspend\n");
        return 0;
 }
@@ -1805,7 +1804,7 @@ static int hid_resume(struct usb_interface *intf)
        struct hid_device *hid = usb_get_intfdata (intf);
        int status;
 
-       intf->dev.power.power_state = PM_SUSPEND_ON;
+       intf->dev.power.power_state = PMSG_ON;
        if (hid->open)
                status = usb_submit_urb(hid->urbin, GFP_NOIO);
        else
index 8823297d219165b4e899f62b1a51cc8ade8728e6..6ca2fae99d2d75026bec3d29007378171fd14274 100644 (file)
@@ -138,8 +138,7 @@ static int dabusb_free_queue (struct list_head *q)
 #ifdef DEBUG 
                dump_urb(b->purb);
 #endif
-               if (b->purb->transfer_buffer)
-                       kfree (b->purb->transfer_buffer);
+               kfree(b->purb->transfer_buffer);
                usb_free_urb(b->purb);
                tmp = p->next;
                list_del (p);
index 0fd7ffed3a980155c3514cd1da68246995e298fd..d6051822416e0a4601828e41545125fe25f9819b 100644 (file)
@@ -3915,10 +3915,8 @@ ov51x_do_dealloc(struct usb_ov511 *ov)
        ov->tempfbuf = NULL;
 
        for (i = 0; i < OV511_NUMSBUF; i++) {
-               if (ov->sbuf[i].data) {
-                       kfree(ov->sbuf[i].data);
-                       ov->sbuf[i].data = NULL;
-               }
+               kfree(ov->sbuf[i].data);
+               ov->sbuf[i].data = NULL;
        }
 
        for (i = 0; i < OV511_NUMFRAMES; i++) {
@@ -5954,10 +5952,8 @@ error:
                up(&ov->cbuf_lock);
        }
 
-       if (ov) {
-               kfree(ov);
-               ov = NULL;
-       }
+       kfree(ov);
+       ov = NULL;
 
 error_out:
        err("Camera initialization failed");
index 685bdae5cb626f4d3263156097938885352072fd..f69e443cd1bcda63b6c4e4eb6396676f85a3124e 100644 (file)
@@ -868,13 +868,14 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401)
 
         se401->dev = NULL;
 
-       for (i=0; i<SE401_NUMSBUF; i++) if (se401->urb[i]) {
-               usb_kill_urb(se401->urb[i]);
-               usb_free_urb(se401->urb[i]);
-               se401->urb[i] = NULL;
-               kfree(se401->sbuf[i].data);
-       }
-       for (i=0; i<SE401_NUMSCRATCH; i++) if (se401->scratch[i].data) {
+       for (i=0; i<SE401_NUMSBUF; i++)
+               if (se401->urb[i]) {
+                       usb_kill_urb(se401->urb[i]);
+                       usb_free_urb(se401->urb[i]);
+                       se401->urb[i] = NULL;
+                       kfree(se401->sbuf[i].data);
+               }
+       for (i=0; i<SE401_NUMSCRATCH; i++) {
                kfree(se401->scratch[i].data);
        }
        if (se401->inturb) {
index 298484aa27d2432999f740ca102239ed5365652d..24efb21969c6ce34d15490bb70c576b5879ce7a2 100644 (file)
@@ -1169,10 +1169,8 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
                        }
                        RingQueue_Free(&uvd->dp);
                        for (i=0; i < USBVIDEO_NUMSBUF; i++) {
-                               if (uvd->sbuf[i].data != NULL) {
-                                       kfree (uvd->sbuf[i].data);
-                                       uvd->sbuf[i].data = NULL;
-                               }
+                               kfree(uvd->sbuf[i].data);
+                               uvd->sbuf[i].data = NULL;
                        }
                }
        }
index 689e79e4bcee8ba61bde2f858ee6792506e04a20..ca9f3a30634fef6eb3f9fb2aed8d319b33aa660b 100644 (file)
@@ -3624,10 +3624,8 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
        return 0;
 
 fail: /* Free unused memory */
-       if (cam->control_buffer)
-               kfree(cam->control_buffer);
-       if (cam->data_buffer)
-               kfree(cam->data_buffer);
+       kfree(cam->control_buffer);
+       kfree(cam->data_buffer);
        if (cam->v4ldev)
                video_device_release(cam->v4ldev);
        up(&cam->dev_sem);
index a530bb976e437d941e25b65df302d186d8797df3..6f7994f5a714b19e1552aa485ebb6240cac93e67 100644 (file)
@@ -705,16 +705,12 @@ static int auerchain_control_msg (pauerchain_t acp, struct usb_device *dev, unsi
 /* free a single auerbuf */
 static void auerbuf_free (pauerbuf_t bp)
 {
-       if (bp->bufp) {
-               kfree (bp->bufp);
-       }
-       if (bp->dr) {
-               kfree (bp->dr);
-       }
+       kfree(bp->bufp);
+       kfree(bp->dr);
        if (bp->urbp) {
-               usb_free_urb (bp->urbp);
+               usb_free_urb(bp->urbp);
        }
-       kfree (bp);
+       kfree(bp);
 }
 
 /* free the buffers from an auerbuf list */
@@ -1093,14 +1089,12 @@ exit:
 */
 static void auerswald_int_free (pauerswald_t cp)
 {
-        if (cp->inturbp) {
-                usb_free_urb (cp->inturbp);
-                cp->inturbp = NULL;
-        }
-        if (cp->intbufp) {
-                kfree (cp->intbufp);
-                cp->intbufp = NULL;
-        }
+       if (cp->inturbp) {
+               usb_free_urb(cp->inturbp);
+               cp->inturbp = NULL;
+       }
+       kfree(cp->intbufp);
+       cp->intbufp = NULL;
 }
 
 /* This function is called to activate the interrupt
index be163b33016742b95731b5b1e5e79b3167f0b1d5..57b82d53a9401ec1a990997e9f28ec349699b765 100644 (file)
@@ -3104,6 +3104,7 @@ static void sisusb_disconnect(struct usb_interface *intf)
 
 static struct usb_device_id sisusb_table [] = {
        { USB_DEVICE(0x0711, 0x0900) },
+       { USB_DEVICE(0x182d, 0x021c) },
        { }
 };
 
@@ -3114,7 +3115,7 @@ static struct usb_driver sisusb_driver = {
        .name =         "sisusb",
        .probe =        sisusb_probe,
        .disconnect =   sisusb_disconnect,
-       .id_table =     sisusb_table
+       .id_table =     sisusb_table,
 };
 
 static int __init usb_sisusb_init(void)
index f6c19d73b7da9b1591ae25a6f1ab1d8e6d31af35..a02be795d63e7ab898aab82fe985c3969b86aaf4 100644 (file)
@@ -1364,11 +1364,18 @@ static void pegasus_disconnect(struct usb_interface *intf)
        free_netdev(pegasus->net);
 }
 
-static int pegasus_suspend (struct usb_interface *intf, pm_message_t state)
+static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
 {
        struct pegasus *pegasus = usb_get_intfdata(intf);
        
        netif_device_detach (pegasus->net);
+       if (netif_running(pegasus->net)) {
+               cancel_delayed_work(&pegasus->carrier_check);
+
+               usb_kill_urb(pegasus->rx_urb);
+               usb_kill_urb(pegasus->intr_urb);
+       }
+       intf->dev.power.power_state = PMSG_SUSPEND;
        return 0;
 }
 
@@ -1376,7 +1383,20 @@ static int pegasus_resume (struct usb_interface *intf)
 {
        struct pegasus *pegasus = usb_get_intfdata(intf);
 
+       intf->dev.power.power_state = PMSG_ON;
        netif_device_attach (pegasus->net);
+       if (netif_running(pegasus->net)) {
+               pegasus->rx_urb->status = 0;
+               pegasus->rx_urb->actual_length = 0;
+               read_bulk_callback(pegasus->rx_urb, 0);
+
+               pegasus->intr_urb->status = 0;
+               pegasus->intr_urb->actual_length = 0;
+               intr_callback(pegasus->intr_urb, 0);
+
+               queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
+                                       CARRIER_CHECK_DELAY);
+       }
        return 0;
 }
 
index dd8b4456ea35e2fb4882f76b173c250f4114eaf1..bbaef047d53255e9fdeba80a9136e5057e39b50d 100644 (file)
@@ -426,7 +426,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 %d, type 0x%x",
+               devdbg (dev, "< rx, len %zd, type 0x%x",
                        skb->len + sizeof (struct ethhdr), skb->protocol);
        memset (skb->cb, 0, sizeof (struct skb_data));
        status = netif_rx (skb);
@@ -3732,11 +3732,17 @@ out:
 
 #ifdef CONFIG_PM
 
-static int usbnet_suspend (struct usb_interface *intf, u32 state)
+static int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
 {
        struct usbnet           *dev = usb_get_intfdata(intf);
        
+       /* accelerate emptying of the rx and queues, to avoid
+        * having everything error out.
+        */
        netif_device_detach (dev->net);
+       (void) unlink_urbs (dev, &dev->rxq);
+       (void) unlink_urbs (dev, &dev->txq);
+       intf->dev.power.power_state = PMSG_SUSPEND;
        return 0;
 }
 
@@ -3744,7 +3750,9 @@ static int usbnet_resume (struct usb_interface *intf)
 {
        struct usbnet           *dev = usb_get_intfdata(intf);
 
+       intf->dev.power.power_state = PMSG_ON;
        netif_device_attach (dev->net);
+       tasklet_schedule (&dev->bh);
        return 0;
 }
 
@@ -4009,10 +4017,23 @@ static const struct usb_device_id       products [] = {
        .idProduct              = 0x9050,       /* C-860 */
        ZAURUS_MASTER_INTERFACE,
        .driver_info = ZAURUS_PXA_INFO,
+},
+
 #ifdef CONFIG_USB_ZAURUS
-       /* at least some (reports vary) C-860 units have very different
-        * lies about their standards support.
+       /* at least some (reports vary) PXA units have very different
+        * lies about their standards support:  they claim to be cell
+        * phones giving direct radio access (which they aren't).
         */
+{
+       .match_flags    =   USB_DEVICE_ID_MATCH_INT_INFO
+                | USB_DEVICE_ID_MATCH_DEVICE,
+       .idVendor               = 0x04DD,
+       /* Sharp ROM v1.32 */
+       .idProduct              = 0x8006,       /* SL-5600 */
+       .bInterfaceClass        = USB_CLASS_COMM,
+       .bInterfaceSubClass     = USB_CDC_SUBCLASS_MDLM,
+       .bInterfaceProtocol     = USB_CDC_PROTO_NONE,
+       .driver_info            = (unsigned long) &zaurus_pxa_mdlm_info,
 }, {
        .match_flags    =   USB_DEVICE_ID_MATCH_INT_INFO
                 | USB_DEVICE_ID_MATCH_DEVICE,
@@ -4023,8 +4044,8 @@ static const struct usb_device_id products [] = {
        .bInterfaceSubClass     = USB_CDC_SUBCLASS_MDLM,
        .bInterfaceProtocol     = USB_CDC_PROTO_NONE,
        .driver_info            = (unsigned long) &zaurus_pxa_mdlm_info,
-#endif
 },
+#endif
 
 /* Olympus has some models with a Zaurus-compatible option.
  * R-1000 uses a FreeScale i.MXL cpu (ARMv4T)
index 938025e2c6469a0aeefd3987a2cde9ee54b1634b..c81cd0a619bfcf1841b611f79b946956fbc82591 100644 (file)
@@ -106,8 +106,7 @@ int zd1201_fw_upload(struct usb_device *dev, int apfw)
 
        err = 0;
 exit:
-       if (buf)
-               kfree(buf);
+       kfree(buf);
        release_firmware(fw_entry);
        return err;
 }
index 86994d117c44aa249d057b94d9f42d0aa4ede6f2..abb1b2c543bbe11a7509857599024c8c7fdc3b6a 100644 (file)
@@ -202,8 +202,7 @@ static void belkin_sa_shutdown (struct usb_serial *serial)
        for (i=0; i < serial->num_ports; ++i) {
                /* My special items, the standard routines free my urbs */
                priv = usb_get_serial_port_data(serial->port[i]);
-               if (priv)
-                       kfree(priv);
+               kfree(priv);
        }
 }
 
index db8f472d9e3f279ef72ab8dba68296cf8a841b07..d165f42d560d6282751c6f81075eced95994341c 100644 (file)
@@ -1340,9 +1340,8 @@ static struct cypress_buf *cypress_buf_alloc(unsigned int size)
 
 static void cypress_buf_free(struct cypress_buf *cb)
 {
-       if (cb != NULL) {
-               if (cb->buf_buf != NULL)
-                       kfree(cb->buf_buf);
+       if (cb) {
+               kfree(cb->buf_buf);
                kfree(cb);
        }
 }
index 25f92788a6d4254284e1e71111b80b84fb5ca1aa..a19a47f6cf12a1acee1224218b0eb6d6bc17090b 100644 (file)
@@ -568,6 +568,9 @@ static struct usb_serial_device_type digi_acceleport_4_device = {
 *  and the sleep.  In other words, spin_unlock_irqrestore and
 *  interruptible_sleep_on_timeout are "atomic" with respect to
 *  wake ups.  This is used to implement condition variables.
+*
+*  interruptible_sleep_on_timeout is deprecated and has been replaced
+*  with the equivalent code.
 */
 
 static inline long cond_wait_interruptible_timeout_irqrestore(
@@ -576,13 +579,12 @@ static inline long cond_wait_interruptible_timeout_irqrestore(
 {
        DEFINE_WAIT(wait);
 
-       prepare_to_wait(q, &wait, TASK_UNINTERRUPTIBLE);
+       prepare_to_wait(q, &wait, TASK_INTERRUPTIBLE);
        spin_unlock_irqrestore(lock, flags);
        timeout = schedule_timeout(timeout);
        finish_wait(q, &wait);
 
        return timeout;
-
 }
 
 
@@ -1596,7 +1598,7 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co
                        dbg( "digi_close: write oob failed, ret=%d", ret );
 
                /* wait for final commands on oob port to complete */
-               prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_UNINTERRUPTIBLE);
+               prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE);
                schedule_timeout(DIGI_CLOSE_TIMEOUT);
                finish_wait(&priv->dp_flush_wait, &wait);
 
@@ -1995,7 +1997,7 @@ opcode, line, status, val );
 
                } else if( opcode == DIGI_CMD_IFLUSH_FIFO ) {
 
-                       wake_up( &priv->dp_flush_wait );
+                       wake_up_interruptible( &priv->dp_flush_wait );
 
                }
 
index 4d46394f351b184bd778bc5aa3d4c5a9c6405ce4..8d562ab454a8589335d1d6350b80bfe6b32b0c80 100644 (file)
@@ -550,8 +550,7 @@ failed_usb_register:
 failed_usb_serial_register:
        for (i = 0; i < NUM_URBS; ++i) {
                if (write_urb_pool[i]) {
-                       if (write_urb_pool[i]->transfer_buffer)
-                               kfree(write_urb_pool[i]->transfer_buffer);
+                       kfree(write_urb_pool[i]->transfer_buffer);
                        usb_free_urb(write_urb_pool[i]);
                }
        }
@@ -575,8 +574,7 @@ static void __exit empeg_exit (void)
                         * the host controllers get fixed to set urb->dev = NULL after
                         * the urb is finished.  Otherwise this call oopses. */
                        /* usb_kill_urb(write_urb_pool[i]); */
-                       if (write_urb_pool[i]->transfer_buffer)
-                               kfree(write_urb_pool[i]->transfer_buffer);
+                       kfree(write_urb_pool[i]->transfer_buffer);
                        usb_free_urb (write_urb_pool[i]);
                }
        }
index 4afd905fe2fe429ffcb766678a68e212c925dc5a..4c788c767a97f890df4f24741f4d47518bc1a6ee 100644 (file)
@@ -1347,9 +1347,7 @@ static int ftdi_common_startup (struct usb_serial *serial)
        priv->flags = ASYNC_LOW_LATENCY;
 
        /* Increase the size of read buffers */
-       if (port->bulk_in_buffer) {
-               kfree (port->bulk_in_buffer);
-       }
+       kfree(port->bulk_in_buffer);
        port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL);
        if (!port->bulk_in_buffer) {
                kfree (priv);
@@ -1365,10 +1363,8 @@ static int ftdi_common_startup (struct usb_serial *serial)
                usb_free_urb (port->write_urb);
                port->write_urb = NULL;
        }
-       if (port->bulk_out_buffer) {
-               kfree (port->bulk_out_buffer);
-               port->bulk_out_buffer = NULL;
-       }
+       kfree(port->bulk_out_buffer);
+       port->bulk_out_buffer = NULL;
 
        usb_set_serial_port_data(serial->port[0], priv);
        
index e35b5adcd5fe71821b8a5f0ff03ed0ebb782d4ba..04bfe279d763bd15e2bf48eefb71a84b2bff07c8 100644 (file)
@@ -951,9 +951,7 @@ static void edge_bulk_out_cmd_callback (struct urb *urb, struct pt_regs *regs)
 
 
        /* clean up the transfer buffer */
-       if (urb->transfer_buffer != NULL) {
-               kfree(urb->transfer_buffer);
-       }
+       kfree(urb->transfer_buffer);
 
        /* Free the command urb */
        usb_free_urb (urb);
@@ -1266,16 +1264,12 @@ static void edge_close (struct usb_serial_port *port, struct file * filp)
 
        if (edge_port->write_urb) {
                /* if this urb had a transfer buffer already (old transfer) free it */
-               if (edge_port->write_urb->transfer_buffer != NULL) {
-                       kfree(edge_port->write_urb->transfer_buffer);
-               }
-               usb_free_urb   (edge_port->write_urb);
+               kfree(edge_port->write_urb->transfer_buffer);
+               usb_free_urb(edge_port->write_urb);
                edge_port->write_urb = NULL;
        }
-       if (edge_port->txfifo.fifo) {
-               kfree(edge_port->txfifo.fifo);
-               edge_port->txfifo.fifo = NULL;
-       }
+       kfree(edge_port->txfifo.fifo);
+       edge_port->txfifo.fifo = NULL;
 
        dbg("%s exited", __FUNCTION__);
 }   
@@ -1419,11 +1413,9 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge
        // get a pointer to the write_urb
        urb = edge_port->write_urb;
 
-       /* if this urb had a transfer buffer already (old transfer) free it */
-       if (urb->transfer_buffer != NULL) {
-               kfree(urb->transfer_buffer);
-               urb->transfer_buffer = NULL;
-       }
+       /* make sure transfer buffer is freed */
+       kfree(urb->transfer_buffer);
+       urb->transfer_buffer = NULL;
 
        /* build the data header for the buffer and port that we are about to send out */
        count = fifo->count;
index 6c96fdaec36e3a4de5007494073904b5116f7ff5..ebf9967f7c86f3e76998e3fb8a3b348a0eeef2c1 100644 (file)
@@ -2845,9 +2845,8 @@ static struct edge_buf *edge_buf_alloc(unsigned int size)
 
 void edge_buf_free(struct edge_buf *eb)
 {
-       if (eb != NULL) {
-               if (eb->buf_buf != NULL)
-                       kfree(eb->buf_buf);
+       if (eb) {
+               kfree(eb->buf_buf);
                kfree(eb);
        }
 }
index 49c602a0b4dfc1399b9f062474bb4457b2a4ad05..a11e829e38c8a04e8c90b1d3fa8f262176a4b41e 100644 (file)
@@ -341,8 +341,7 @@ static void klsi_105_shutdown (struct usb_serial *serial)
                                         * finished.  Otherwise this call
                                         * oopses. */
                                        /* usb_kill_urb(write_urbs[j]); */
-                                       if (write_urbs[j]->transfer_buffer)
-                                                   kfree(write_urbs[j]->transfer_buffer);
+                                       kfree(write_urbs[j]->transfer_buffer);
                                        usb_free_urb (write_urbs[j]);
                                }
                        }
index a1cba4b5fa2352243b48c363afb485d07db275d9..b5f2c06d4f3e6a69e713dc4250cd6519ac00ec75 100644 (file)
@@ -178,7 +178,6 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
 {
        struct usb_serial       *serial = port->serial;
        struct usb_serial_port  *wport;
-       struct omninet_data     *od;
 
        dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -186,9 +185,7 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
        usb_kill_urb(wport->write_urb);
        usb_kill_urb(port->read_urb);
 
-       od = usb_get_serial_port_data(port);
-       if (od)
-               kfree(od);
+       kfree(usb_get_serial_port_data(port));
 }
 
 
index 3368d2b0412d2ef74cdc4b9784b4f877f741522d..7eab5d4cf3a8c674a84ebafd73c8e4aaa4e2da27 100644 (file)
@@ -94,6 +94,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) },
        { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) },
        { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) },
+       { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) },
        { }                                     /* Terminating entry */
 };
 
@@ -677,6 +678,9 @@ static int pl2303_tiocmset (struct usb_serial_port *port, struct file *file,
        unsigned long flags;
        u8 control;
 
+       if (!usb_get_intfdata(port->serial->interface))
+               return -ENODEV;
+
        spin_lock_irqsave (&priv->lock, flags);
        if (set & TIOCM_RTS)
                priv->line_control |= CONTROL_RTS;
@@ -702,6 +706,9 @@ static int pl2303_tiocmget (struct usb_serial_port *port, struct file *file)
 
        dbg("%s (%d)", __FUNCTION__, port->number);
 
+       if (!usb_get_intfdata(port->serial->interface))
+               return -ENODEV;
+
        spin_lock_irqsave (&priv->lock, flags);
        mcr = priv->line_control;
        status = priv->line_status;
@@ -811,15 +818,40 @@ static void pl2303_shutdown (struct usb_serial *serial)
        }               
 }
 
+static void pl2303_update_line_status(struct usb_serial_port *port,
+                                     unsigned char *data,
+                                     unsigned int actual_length)
+{
+
+       struct pl2303_private *priv = usb_get_serial_port_data(port);
+       unsigned long flags;
+       u8 status_idx = UART_STATE;
+       u8 length = UART_STATE;
+
+       if ((le16_to_cpu(port->serial->dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) &&
+           (le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65)) {
+               length = 1;
+               status_idx = 0;
+       }
+
+       if (actual_length < length)
+               goto exit;
+
+        /* Save off the uart status for others to look at */
+       spin_lock_irqsave(&priv->lock, flags);
+       priv->line_status = data[status_idx];
+       spin_unlock_irqrestore(&priv->lock, flags);
+
+exit:
+       return;
+}
 
 static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs)
 {
        struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
-       struct pl2303_private *priv = usb_get_serial_port_data(port);
        unsigned char *data = urb->transfer_buffer;
-       unsigned long flags;
+       unsigned int actual_length = urb->actual_length;
        int status;
-       u8 uart_state;
 
        dbg("%s (%d)", __FUNCTION__, port->number);
 
@@ -838,19 +870,9 @@ static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs)
                goto exit;
        }
 
-
        usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
+       pl2303_update_line_status(port, data, actual_length);
 
-       if (urb->actual_length < UART_STATE)
-               goto exit;
-
-       /* Save off the uart status for others to look at */
-       uart_state = data[UART_STATE];
-       spin_lock_irqsave(&priv->lock, flags);
-       uart_state |= (priv->line_status & UART_STATE_TRANSIENT_MASK);
-       priv->line_status = uart_state;
-       spin_unlock_irqrestore(&priv->lock, flags);
-               
 exit:
        status = usb_submit_urb (urb, GFP_ATOMIC);
        if (status)
@@ -1022,9 +1044,8 @@ static struct pl2303_buf *pl2303_buf_alloc(unsigned int size)
 
 static void pl2303_buf_free(struct pl2303_buf *pb)
 {
-       if (pb != NULL) {
-               if (pb->buf_buf != NULL)
-                       kfree(pb->buf_buf);
+       if (pb) {
+               kfree(pb->buf_buf);
                kfree(pb);
        }
 }
index 6c1b4712dc2f3ae48d6c2275ed5c42c2ad203bb4..b734c4003c5af6cf725d009f979e408641a6f8cf 100644 (file)
@@ -55,3 +55,6 @@
 
 #define SIEMENS_VENDOR_ID      0x11f5
 #define SIEMENS_PRODUCT_ID_X65 0x0003
+
+#define SYNTECH_VENDOR_ID      0x0745
+#define SYNTECH_PRODUCT_ID     0x0001
index 98054876cca25f8c9fea8d9201e2e1d921dbd5e8..59c88de3e7ae337459ea7cea7262639fe28d5e5e 100644 (file)
@@ -517,8 +517,7 @@ static void ti_shutdown(struct usb_serial *serial)
                }
        }
 
-       if (tdev)
-               kfree(tdev);
+       kfree(tdev);
        usb_set_serial_data(serial, NULL);
 }
 
index 69d313e98fadbf30838800beff1a5c77dac880b9..31c57adcb623c5cbd682216a7cc3b8ea748c28c8 100644 (file)
@@ -215,6 +215,8 @@ static struct usb_device_id id_table [] = {
                .driver_info = (kernel_ulong_t)&palm_os_4_probe },
        { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID),
                .driver_info = (kernel_ulong_t)&palm_os_4_probe },
+       { USB_DEVICE(PALM_VENDOR_ID, PALM_TREO_650),
+               .driver_info = (kernel_ulong_t)&palm_os_4_probe },
        { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID),
                .driver_info = (kernel_ulong_t)&palm_os_4_probe },
        { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID),
@@ -237,6 +239,8 @@ static struct usb_device_id id_table [] = {
                .driver_info = (kernel_ulong_t)&palm_os_4_probe },
        { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), 
                .driver_info = (kernel_ulong_t)&palm_os_4_probe },
+       { USB_DEVICE(TAPWAVE_VENDOR_ID, TAPWAVE_ZODIAC_ID),
+               .driver_info = (kernel_ulong_t)&palm_os_4_probe },
        { USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID), 
                .driver_info = (kernel_ulong_t)&palm_os_4_probe },
        { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID),
@@ -273,6 +277,7 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID) },
        { USB_DEVICE(PALM_VENDOR_ID, PALM_M130_ID) },
        { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID) },
+       { USB_DEVICE(PALM_VENDOR_ID, PALM_TREO_650) },
        { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID) },
        { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID) },
        { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID) },
@@ -286,6 +291,7 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_TJ25_ID) },
        { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID) },
        { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID) },
+       { USB_DEVICE(TAPWAVE_VENDOR_ID, TAPWAVE_ZODIAC_ID) },
        { USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID) },
        { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) },
        { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) },
index a2fa2c61a009fe880b09a48c5e28ed4c333446ad..b84d1cb4c69393b40ede2929d9fd83746f533565 100644 (file)
@@ -30,6 +30,7 @@
 #define PALM_M125_ID                   0x0040
 #define PALM_M130_ID                   0x0050
 #define PALM_TUNGSTEN_T_ID             0x0060
+#define PALM_TREO_650                  0x0061
 #define PALM_TUNGSTEN_Z_ID             0x0031
 #define PALM_ZIRE31_ID                 0x0061
 #define PALM_ZIRE_ID                   0x0070
@@ -49,6 +50,9 @@
 #define SAMSUNG_SCH_I330_ID            0x8001
 #define SAMSUNG_SPH_I500_ID            0x6601
 
+#define TAPWAVE_VENDOR_ID              0x12EF
+#define TAPWAVE_ZODIAC_ID              0x0100
+
 #define GARMIN_VENDOR_ID               0x091E
 #define GARMIN_IQUE_3600_ID            0x0004
 
index 229ca181716b507934db9daeca07990a7774c0c6..8451779f4269836f41a56cb06a38dfa479b2e7c1 100644 (file)
@@ -119,10 +119,8 @@ static int sddr55_status(struct us_data *us)
        /* expect to get short transfer if no card fitted */
        if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) {
                /* had a short transfer, no card inserted, free map memory */
-               if (info->lba_to_pba)
-                       kfree(info->lba_to_pba);
-               if (info->pba_to_lba)
-                       kfree(info->pba_to_lba);
+               kfree(info->lba_to_pba);
+               kfree(info->pba_to_lba);
                info->lba_to_pba = NULL;
                info->pba_to_lba = NULL;
 
@@ -649,18 +647,14 @@ static int sddr55_read_map(struct us_data *us) {
                return -1;
        }
 
-       if (info->lba_to_pba)
-               kfree(info->lba_to_pba);
-       if (info->pba_to_lba)
-               kfree(info->pba_to_lba);
+       kfree(info->lba_to_pba);
+       kfree(info->pba_to_lba);
        info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
        info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
 
        if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) {
-               if (info->lba_to_pba != NULL)
-                       kfree(info->lba_to_pba);
-               if (info->pba_to_lba != NULL)
-                       kfree(info->pba_to_lba);
+               kfree(info->lba_to_pba);
+               kfree(info->pba_to_lba);
                info->lba_to_pba = NULL;
                info->pba_to_lba = NULL;
                kfree(buffer);
@@ -728,10 +722,8 @@ static void sddr55_card_info_destructor(void *extra) {
        if (!extra)
                return;
 
-       if (info->lba_to_pba)
-               kfree(info->lba_to_pba);
-       if (info->pba_to_lba)
-               kfree(info->pba_to_lba);
+       kfree(info->lba_to_pba);
+       kfree(info->pba_to_lba);
 }
 
 
index d2c3d2fa082e927419076bc28943b004a8e9917a..9743e289cd3b1d68b49aba1298ad79fb2cfe5c3c 100644 (file)
@@ -996,7 +996,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
         * command phase and the data phase.  Some devices need a little
         * more than that, probably because of clock rate inaccuracies. */
        if (unlikely(us->flags & US_FL_GO_SLOW))
-               udelay(110);
+               udelay(125);
 
        if (transfer_length) {
                unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ? 
index d53f777c4f50f5df62276508c909b744145d5ffb..fa68dea6bc6fe72f84d96f1153c75aa9acb34735 100644 (file)
@@ -763,6 +763,19 @@ UNUSUAL_DEV(  0x07c4, 0xa109, 0x0000, 0xffff,
                US_FL_SINGLE_LUN ),
 #endif
 
+#ifdef CONFIG_USB_STORAGE_DATAFAB
+/* Reported by Felix Moeller <felix@derklecks.de>
+ * in Germany this is sold by Hama with the productnumber 46952
+ * as "DualSlot CompactFlash(TM) & MStick Drive USB"
+ */
+UNUSUAL_DEV(  0x07c4, 0xa10b, 0x0000, 0xffff,
+                "DataFab Systems Inc.",
+                "USB CF+MS",
+                US_SC_SCSI, US_PR_DATAFAB, NULL,
+                0 ),
+
+#endif
+
 /* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100
  * Only revision 1.13 tested (same for all of the above devices,
  * based on the Datafab DF-UG-07 chip).  Needed for US_FL_FIX_INQUIRY.
index fd630cec0e7915bcdbc620d49b098002b18bbc0c..8d7821899cc10440137299c7254ee4750c416d8d 100644 (file)
@@ -522,10 +522,11 @@ void w1_slave_found(unsigned long data, u64 rn)
                slave_count++;
        }
 
-               if (slave_count == dev->slave_count && rn ) {
-                       tmp = cpu_to_le64(rn);
-                       if(((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&tmp, 7))
-                               w1_attach_slave_device(dev, (struct w1_reg_num *) &rn);
+       rn = cpu_to_le64(rn);
+
+       if (slave_count == dev->slave_count &&
+               rn && ((le64_to_cpu(rn) >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) {
+               w1_attach_slave_device(dev, tmp);
        }
                        
        atomic_dec(&dev->refcnt);
index ab82eb7ed74f73061cdb630eda275d3aea0fe208..a54e425217a06736cdf873e8a914b434eb30a6ce 100644 (file)
@@ -60,7 +60,7 @@ static ssize_t w1_smem_read_val(struct device *dev, char *buf)
        int i;
        ssize_t count = 0;
        
-       for (i = 0; i < 9; ++i)
+       for (i = 0; i < 8; ++i)
                count += sprintf(buf + count, "%02x ", ((u8 *)&sl->reg_num)[i]);
        count += sprintf(buf + count, "\n");
 
@@ -87,7 +87,7 @@ static ssize_t w1_smem_read_bin(struct kobject *kobj, char *buf, loff_t off, siz
                count = 0;
                goto out;
        }
-       for (i = 0; i < 9; ++i)
+       for (i = 0; i < 8; ++i)
                count += sprintf(buf + count, "%02x ", ((u8 *)&sl->reg_num)[i]);
        count += sprintf(buf + count, "\n");
        
index c96728435935b1e90e709c70a030736d35fc2c62..41d1a644c9d43aa8206cf2b6e708c4a8173b7fd2 100644 (file)
@@ -558,7 +558,7 @@ struct usb_driver {
 
        int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf);
 
-       int (*suspend) (struct usb_interface *intf, u32 state);
+       int (*suspend) (struct usb_interface *intf, pm_message_t message);
        int (*resume) (struct usb_interface *intf);
 
        const struct usb_device_id *id_table;
@@ -977,7 +977,7 @@ extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
        int timeout);
 
 /* selective suspend/resume */
-extern int usb_suspend_device(struct usb_device *dev, u32 state);
+extern int usb_suspend_device(struct usb_device *dev, pm_message_t message);
 extern int usb_resume_device(struct usb_device *dev);
 
 
index 1b68c122279a82826aea36f02c80edb2fed384b6..f22d6beecc73172309bdf22b6ddbb4be2f1b51c8 100644 (file)
@@ -114,7 +114,7 @@ struct usb_cdc_mdlm_detail_desc {
 
        /* type is associated with mdlm_desc.bGUID */
        __u8    bGuidDescriptorType;
-       __u8    bDetailData[];
+       __u8    bDetailData[0];
 } __attribute__ ((packed));
 
 /*-------------------------------------------------------------------------*/