diff options
Diffstat (limited to 'drivers')
46 files changed, 659 insertions, 342 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 7d893a60f994..b4a8d6030e48 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -8,7 +8,6 @@ menuconfig ATA depends on BLOCK depends on !(M32R || M68K) || BROKEN depends on !SUN4 || BROKEN - depends on !(SPARC64 && !PCI) select SCSI ---help--- If you want to use a ATA hard disk, ATA tape drive, ATA CD-ROM or diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 2b924a69b365..6dc0b011a6b7 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c @@ -784,9 +784,12 @@ static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc) if (qc->dev->flags & ATA_DFLAG_CDB_INTR) break; /*FALLTHROUGH*/ + case ATA_PROT_NODATA: + if (qc->tf.flags & ATA_TFLAG_POLLING) + break; + /*FALLTHROUGH*/ case ATA_PROT_ATAPI_DMA: case ATA_PROT_DMA: - case ATA_PROT_NODATA: pdc_packet_start(qc); return 0; @@ -800,7 +803,7 @@ static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc) static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) { WARN_ON (tf->protocol == ATA_PROT_DMA || - tf->protocol == ATA_PROT_NODATA); + tf->protocol == ATA_PROT_ATAPI_DMA); ata_tf_load(ap, tf); } @@ -808,7 +811,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) { WARN_ON (tf->protocol == ATA_PROT_DMA || - tf->protocol == ATA_PROT_NODATA); + tf->protocol == ATA_PROT_ATAPI_DMA); ata_exec_command(ap, tf); } diff --git a/drivers/base/class.c b/drivers/base/class.c index 20c4ea6eb50d..8c506dbe3913 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -369,36 +369,6 @@ char *make_class_name(const char *name, struct kobject *kobj) return class_name; } -static int deprecated_class_uevent(char **envp, int num_envp, int *cur_index, - char *buffer, int buffer_size, - int *cur_len, - struct class_device *class_dev) -{ - struct device *dev = class_dev->dev; - char *path; - - if (!dev) - return 0; - - /* add device, backing this class device (deprecated) */ - path = kobject_get_path(&dev->kobj, GFP_KERNEL); - - add_uevent_var(envp, num_envp, cur_index, buffer, buffer_size, - cur_len, "PHYSDEVPATH=%s", path); - kfree(path); - - if (dev->bus) - add_uevent_var(envp, num_envp, cur_index, - buffer, buffer_size, cur_len, - "PHYSDEVBUS=%s", dev->bus->name); - - if (dev->driver) - add_uevent_var(envp, num_envp, cur_index, - buffer, buffer_size, cur_len, - "PHYSDEVDRIVER=%s", dev->driver->name); - return 0; -} - static int make_deprecated_class_device_links(struct class_device *class_dev) { char *class_name; @@ -430,11 +400,6 @@ static void remove_deprecated_class_device_links(struct class_device *class_dev) kfree(class_name); } #else -static inline int deprecated_class_uevent(char **envp, int num_envp, - int *cur_index, char *buffer, - int buffer_size, int *cur_len, - struct class_device *class_dev) -{ return 0; } static inline int make_deprecated_class_device_links(struct class_device *cd) { return 0; } static void remove_deprecated_class_device_links(struct class_device *cd) @@ -445,15 +410,13 @@ static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp, int num_envp, char *buffer, int buffer_size) { struct class_device *class_dev = to_class_dev(kobj); + struct device *dev = class_dev->dev; int i = 0; int length = 0; int retval = 0; pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id); - deprecated_class_uevent(envp, num_envp, &i, buffer, buffer_size, - &length, class_dev); - if (MAJOR(class_dev->devt)) { add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, @@ -464,6 +427,26 @@ static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp, "MINOR=%u", MINOR(class_dev->devt)); } + if (dev) { + const char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); + if (path) { + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVPATH=%s", path); + kfree(path); + } + + if (dev->bus) + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVBUS=%s", dev->bus->name); + + if (dev->driver) + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVDRIVER=%s", dev->driver->name); + } + /* terminate, set to next free slot, shrink available space */ envp[i] = NULL; envp = &envp[i]; diff --git a/drivers/base/core.c b/drivers/base/core.c index b78fc1e68264..dd40d78a023d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -180,10 +180,12 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, char **envp, const char *path; path = kobject_get_path(&parent->kobj, GFP_KERNEL); - add_uevent_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PHYSDEVPATH=%s", path); - kfree(path); + if (path) { + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVPATH=%s", path); + kfree(path); + } add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 92428e55b0c2..b0088b0efecd 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -207,19 +207,6 @@ static int __device_attach(struct device_driver * drv, void * data) return driver_probe_device(drv, dev); } -static int device_probe_drivers(void *data) -{ - struct device *dev = data; - int ret = 0; - - if (dev->bus) { - down(&dev->sem); - ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); - up(&dev->sem); - } - return ret; -} - /** * device_attach - try to attach device to a driver. * @dev: device. diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 97ab5bd1c4d6..89a5f4a54913 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -1,7 +1,7 @@ /* * firmware_class.c - Multi purpose firmware loading support * - * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org> + * Copyright (c) 2003 Manuel Estrada Sainz * * Please see Documentation/firmware_class/ for more information. * @@ -23,7 +23,7 @@ #define to_dev(obj) container_of(obj, struct device, kobj) -MODULE_AUTHOR("Manuel Estrada Sainz <ranty@debian.org>"); +MODULE_AUTHOR("Manuel Estrada Sainz"); MODULE_DESCRIPTION("Multi purpose firmware loading support"); MODULE_LICENSE("GPL"); diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 5526eadb6592..0ed5470d2533 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1354,7 +1354,7 @@ static struct block_device_operations lo_fops = { */ static int max_loop; module_param(max_loop, int, 0); -MODULE_PARM_DESC(max_loop, "obsolete, loop device is created on-demand"); +MODULE_PARM_DESC(max_loop, "Maximum number of loop devices"); MODULE_LICENSE("GPL"); MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); @@ -1394,16 +1394,11 @@ int loop_unregister_transfer(int number) EXPORT_SYMBOL(loop_register_transfer); EXPORT_SYMBOL(loop_unregister_transfer); -static struct loop_device *loop_init_one(int i) +static struct loop_device *loop_alloc(int i) { struct loop_device *lo; struct gendisk *disk; - list_for_each_entry(lo, &loop_devices, lo_list) { - if (lo->lo_number == i) - return lo; - } - lo = kzalloc(sizeof(*lo), GFP_KERNEL); if (!lo) goto out; @@ -1427,8 +1422,6 @@ static struct loop_device *loop_init_one(int i) disk->private_data = lo; disk->queue = lo->lo_queue; sprintf(disk->disk_name, "loop%d", i); - add_disk(disk); - list_add_tail(&lo->lo_list, &loop_devices); return lo; out_free_queue: @@ -1439,15 +1432,37 @@ out: return NULL; } -static void loop_del_one(struct loop_device *lo) +static void loop_free(struct loop_device *lo) { - del_gendisk(lo->lo_disk); blk_cleanup_queue(lo->lo_queue); put_disk(lo->lo_disk); list_del(&lo->lo_list); kfree(lo); } +static struct loop_device *loop_init_one(int i) +{ + struct loop_device *lo; + + list_for_each_entry(lo, &loop_devices, lo_list) { + if (lo->lo_number == i) + return lo; + } + + lo = loop_alloc(i); + if (lo) { + add_disk(lo->lo_disk); + list_add_tail(&lo->lo_list, &loop_devices); + } + return lo; +} + +static void loop_del_one(struct loop_device *lo) +{ + del_gendisk(lo->lo_disk); + loop_free(lo); +} + static struct kobject *loop_probe(dev_t dev, int *part, void *data) { struct loop_device *lo; @@ -1464,28 +1479,77 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data) static int __init loop_init(void) { - if (register_blkdev(LOOP_MAJOR, "loop")) - return -EIO; - blk_register_region(MKDEV(LOOP_MAJOR, 0), 1UL << MINORBITS, - THIS_MODULE, loop_probe, NULL, NULL); + int i, nr; + unsigned long range; + struct loop_device *lo, *next; + + /* + * loop module now has a feature to instantiate underlying device + * structure on-demand, provided that there is an access dev node. + * However, this will not work well with user space tool that doesn't + * know about such "feature". In order to not break any existing + * tool, we do the following: + * + * (1) if max_loop is specified, create that many upfront, and this + * also becomes a hard limit. + * (2) if max_loop is not specified, create 8 loop device on module + * load, user can further extend loop device by create dev node + * themselves and have kernel automatically instantiate actual + * device on-demand. + */ + if (max_loop > 1UL << MINORBITS) + return -EINVAL; if (max_loop) { - printk(KERN_INFO "loop: the max_loop option is obsolete " - "and will be removed in March 2008\n"); + nr = max_loop; + range = max_loop; + } else { + nr = 8; + range = 1UL << MINORBITS; + } + + if (register_blkdev(LOOP_MAJOR, "loop")) + return -EIO; + for (i = 0; i < nr; i++) { + lo = loop_alloc(i); + if (!lo) + goto Enomem; + list_add_tail(&lo->lo_list, &loop_devices); } + + /* point of no return */ + + list_for_each_entry(lo, &loop_devices, lo_list) + add_disk(lo->lo_disk); + + blk_register_region(MKDEV(LOOP_MAJOR, 0), range, + THIS_MODULE, loop_probe, NULL, NULL); + printk(KERN_INFO "loop: module loaded\n"); return 0; + +Enomem: + printk(KERN_INFO "loop: out of memory\n"); + + list_for_each_entry_safe(lo, next, &loop_devices, lo_list) + loop_free(lo); + + unregister_blkdev(LOOP_MAJOR, "loop"); + return -ENOMEM; } static void __exit loop_exit(void) { + unsigned long range; struct loop_device *lo, *next; + range = max_loop ? max_loop : 1UL << MINORBITS; + list_for_each_entry_safe(lo, next, &loop_devices, lo_list) loop_del_one(lo); - blk_unregister_region(MKDEV(LOOP_MAJOR, 0), 1UL << MINORBITS); + blk_unregister_region(MKDEV(LOOP_MAJOR, 0), range); if (unregister_blkdev(LOOP_MAJOR, "loop")) printk(KERN_WARNING "loop: cannot unregister blkdev\n"); } diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c index f574962f4288..4310cc84dfed 100644 --- a/drivers/cdrom/mcdx.c +++ b/drivers/cdrom/mcdx.c @@ -1053,11 +1053,11 @@ static void __exit mcdx_exit(void) if (unregister_blkdev(MAJOR_NR, "mcdx") != 0) { xwarn("cleanup() unregister_blkdev() failed\n"); } - blk_cleanup_queue(mcdx_queue); #if !MCDX_QUIET else xinfo("cleanup() succeeded\n"); #endif + blk_cleanup_queue(mcdx_queue); } #ifdef MODULE diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index e45113a7a472..45bf2a262a85 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -2172,11 +2172,12 @@ static int __devinit stl_initech(struct stlbrd *brdp) } status = inb(ioaddr + ECH_PNLSTATUS); if ((status & ECH_PNLIDMASK) != nxtid) - goto err_fr; + break; panelp = kzalloc(sizeof(struct stlpanel), GFP_KERNEL); if (!panelp) { printk("STALLION: failed to allocate memory " "(size=%Zd)\n", sizeof(struct stlpanel)); + retval = -ENOMEM; goto err_fr; } panelp->magic = STL_PANELMAGIC; @@ -2223,8 +2224,10 @@ static int __devinit stl_initech(struct stlbrd *brdp) brdp->nrports += panelp->nrports; brdp->panels[panelnr++] = panelp; if ((brdp->brdtype != BRD_ECHPCI) && - (ioaddr >= (brdp->ioaddr2 + brdp->iosize2))) + (ioaddr >= (brdp->ioaddr2 + brdp->iosize2))) { + retval = -EINVAL; goto err_fr; + } } brdp->nrpanels = panelnr; @@ -2371,6 +2374,7 @@ static int __devinit stl_pciprobe(struct pci_dev *pdev, dev_err(&pdev->dev, "too many boards found, " "maximum supported %d\n", STL_MAXBRDS); mutex_unlock(&stl_brdslock); + retval = -ENODEV; goto err_fr; } brdp->brdnr = (unsigned int)brdnr; @@ -4710,6 +4714,29 @@ static int __init stallion_module_init(void) spin_lock_init(&stallion_lock); spin_lock_init(&brd_lock); + stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); + if (!stl_serial) { + retval = -ENOMEM; + goto err; + } + + stl_serial->owner = THIS_MODULE; + stl_serial->driver_name = stl_drvname; + stl_serial->name = "ttyE"; + stl_serial->major = STL_SERIALMAJOR; + stl_serial->minor_start = 0; + stl_serial->type = TTY_DRIVER_TYPE_SERIAL; + stl_serial->subtype = SERIAL_TYPE_NORMAL; + stl_serial->init_termios = stl_deftermios; + stl_serial->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; + tty_set_operations(stl_serial, &stl_ops); + + retval = tty_register_driver(stl_serial); + if (retval) { + printk("STALLION: failed to register serial driver\n"); + goto err_frtty; + } + /* * Find any dynamically supported boards. That is via module load * line options. @@ -4739,13 +4766,9 @@ static int __init stallion_module_init(void) /* this has to be _after_ isa finding because of locking */ retval = pci_register_driver(&stl_pcidriver); - if (retval && stl_nrbrds == 0) - goto err; - - stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); - if (!stl_serial) { - retval = -ENOMEM; - goto err_pcidr; + if (retval && stl_nrbrds == 0) { + printk(KERN_ERR "STALLION: can't register pci driver\n"); + goto err_unrtty; } /* @@ -4756,43 +4779,18 @@ static int __init stallion_module_init(void) printk("STALLION: failed to register serial board device\n"); stallion_class = class_create(THIS_MODULE, "staliomem"); - if (IS_ERR(stallion_class)) { - retval = PTR_ERR(stallion_class); - goto err_reg; - } + if (IS_ERR(stallion_class)) + printk("STALLION: failed to create class\n"); for (i = 0; i < 4; i++) class_device_create(stallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i), NULL, "staliomem%d", i); - stl_serial->owner = THIS_MODULE; - stl_serial->driver_name = stl_drvname; - stl_serial->name = "ttyE"; - stl_serial->major = STL_SERIALMAJOR; - stl_serial->minor_start = 0; - stl_serial->type = TTY_DRIVER_TYPE_SERIAL; - stl_serial->subtype = SERIAL_TYPE_NORMAL; - stl_serial->init_termios = stl_deftermios; - stl_serial->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; - tty_set_operations(stl_serial, &stl_ops); - - retval = tty_register_driver(stl_serial); - if (retval) { - printk("STALLION: failed to register serial driver\n"); - goto err_clsdev; - } - return 0; -err_clsdev: - for (i = 0; i < 4; i++) - class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); - class_destroy(stallion_class); -err_reg: - unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"); +err_unrtty: + tty_unregister_driver(stl_serial); +err_frtty: put_tty_driver(stl_serial); -err_pcidr: - pci_unregister_driver(&stl_pcidriver); - stl_free_isabrds(); err: return retval; } @@ -4821,8 +4819,6 @@ static void __exit stallion_module_exit(void) tty_unregister_device(stl_serial, brdp->brdnr * STL_MAXPORTS + j); } - tty_unregister_driver(stl_serial); - put_tty_driver(stl_serial); for (i = 0; i < 4; i++) class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); @@ -4834,6 +4830,9 @@ static void __exit stallion_module_exit(void) pci_unregister_driver(&stl_pcidriver); stl_free_isabrds(); + + tty_unregister_driver(stl_serial); + put_tty_driver(stl_serial); } module_init(stallion_module_init); diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c index 58bc272bd407..0aecea67f3e6 100644 --- a/drivers/infiniband/hw/amso1100/c2.c +++ b/drivers/infiniband/hw/amso1100/c2.c @@ -672,7 +672,7 @@ static int c2_up(struct net_device *netdev) * rdma interface. */ in_dev = in_dev_get(netdev); - in_dev->cnf.arp_ignore = 1; + IN_DEV_CONF_SET(in_dev, ARP_IGNORE, 1); in_dev_put(in_dev); return 0; diff --git a/drivers/input/keyboard/pxa27x_keyboard.c b/drivers/input/keyboard/pxa27x_keyboard.c index 06eaf766d9d2..f9e82c9ca421 100644 --- a/drivers/input/keyboard/pxa27x_keyboard.c +++ b/drivers/input/keyboard/pxa27x_keyboard.c @@ -104,7 +104,7 @@ static int pxakbd_open(struct input_dev *dev) KPREC = 0x7F; /* Enable unit clock */ - pxa_set_cken(CKEN19_KEYPAD, 1); + pxa_set_cken(CKEN_KEYPAD, 1); return 0; } @@ -112,7 +112,7 @@ static int pxakbd_open(struct input_dev *dev) static void pxakbd_close(struct input_dev *dev) { /* Disable clock unit */ - pxa_set_cken(CKEN19_KEYPAD, 0); + pxa_set_cken(CKEN_KEYPAD, 0); } #ifdef CONFIG_PM @@ -185,7 +185,7 @@ static int __devinit pxakbd_probe(struct platform_device *pdev) DRIVER_NAME, pdev); if (error) { printk(KERN_ERR "Cannot request keypad IRQ\n"); - pxa_set_cken(CKEN19_KEYPAD, 0); + pxa_set_cken(CKEN_KEYPAD, 0); goto err_free_dev; } diff --git a/drivers/isdn/hardware/eicon/divasfunc.c b/drivers/isdn/hardware/eicon/divasfunc.c index 46fc21a3f8ff..d36a4c09e25d 100644 --- a/drivers/isdn/hardware/eicon/divasfunc.c +++ b/drivers/isdn/hardware/eicon/divasfunc.c @@ -195,7 +195,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void) /* * disconnect from didd */ -static void DIVA_EXIT_FUNCTION disconnect_didd(void) +static void disconnect_didd(void) { IDI_SYNC_REQ req; diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index da7c3b0c533c..ce3ed67a878e 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -54,8 +54,8 @@ #define DRV_MODULE_NAME "bnx2" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "1.5.10" -#define DRV_MODULE_RELDATE "May 1, 2007" +#define DRV_MODULE_VERSION "1.5.11" +#define DRV_MODULE_RELDATE "June 4, 2007" #define RUN_AT(x) (jiffies + (x)) @@ -1778,6 +1778,15 @@ bnx2_init_5709_context(struct bnx2 *bp) val = BNX2_CTX_COMMAND_ENABLED | BNX2_CTX_COMMAND_MEM_INIT | (1 << 12); val |= (BCM_PAGE_BITS - 8) << 16; REG_WR(bp, BNX2_CTX_COMMAND, val); + for (i = 0; i < 10; i++) { + val = REG_RD(bp, BNX2_CTX_COMMAND); + if (!(val & BNX2_CTX_COMMAND_MEM_INIT)) + break; + udelay(2); + } + if (val & BNX2_CTX_COMMAND_MEM_INIT) + return -EBUSY; + for (i = 0; i < bp->ctx_pages; i++) { int j; @@ -1811,6 +1820,7 @@ bnx2_init_context(struct bnx2 *bp) vcid = 96; while (vcid) { u32 vcid_addr, pcid_addr, offset; + int i; vcid--; @@ -1831,16 +1841,20 @@ bnx2_init_context(struct bnx2 *bp) pcid_addr = vcid_addr; } - REG_WR(bp, BNX2_CTX_VIRT_ADDR, 0x00); - REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr); + for (i = 0; i < (CTX_SIZE / PHY_CTX_SIZE); i++) { + vcid_addr += (i << PHY_CTX_SHIFT); + pcid_addr += (i << PHY_CTX_SHIFT); - /* Zero out the context. */ - for (offset = 0; offset < PHY_CTX_SIZE; offset += 4) { - CTX_WR(bp, 0x00, offset, 0); - } + REG_WR(bp, BNX2_CTX_VIRT_ADDR, 0x00); + REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr); + + /* Zero out the context. */ + for (offset = 0; offset < PHY_CTX_SIZE; offset += 4) + CTX_WR(bp, 0x00, offset, 0); - REG_WR(bp, BNX2_CTX_VIRT_ADDR, vcid_addr); - REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr); + REG_WR(bp, BNX2_CTX_VIRT_ADDR, vcid_addr); + REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr); + } } } @@ -3691,9 +3705,11 @@ bnx2_init_chip(struct bnx2 *bp) /* Initialize context mapping and zero out the quick contexts. The * context block must have already been enabled. */ - if (CHIP_NUM(bp) == CHIP_NUM_5709) - bnx2_init_5709_context(bp); - else + if (CHIP_NUM(bp) == CHIP_NUM_5709) { + rc = bnx2_init_5709_context(bp); + if (rc) + return rc; + } else bnx2_init_context(bp); if ((rc = bnx2_init_cpus(bp)) != 0) @@ -3772,7 +3788,10 @@ bnx2_init_chip(struct bnx2 *bp) REG_WR(bp, BNX2_HC_CMD_TICKS, (bp->cmd_ticks_int << 16) | bp->cmd_ticks); - REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks & 0xffff00); + if (CHIP_NUM(bp) == CHIP_NUM_5708) + REG_WR(bp, BNX2_HC_STATS_TICKS, 0); + else + REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks & 0xffff00); REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */ if (CHIP_ID(bp) == CHIP_ID_5706_A1) @@ -3799,6 +3818,11 @@ bnx2_init_chip(struct bnx2 *bp) /* Initialize the receive filter. */ bnx2_set_rx_mode(bp->dev); + if (CHIP_NUM(bp) == CHIP_NUM_5709) { + val = REG_RD(bp, BNX2_MISC_NEW_CORE_CTL); + val |= BNX2_MISC_NEW_CORE_CTL_DMA_ENABLE; + REG_WR(bp, BNX2_MISC_NEW_CORE_CTL, val); + } rc = bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT2 | BNX2_DRV_MSG_CODE_RESET, 0); @@ -4620,6 +4644,11 @@ bnx2_timer(unsigned long data) bp->stats_blk->stat_FwRxDrop = REG_RD_IND(bp, BNX2_FW_RX_DROP_COUNT); + /* workaround occasional corrupted counters */ + if (CHIP_NUM(bp) == CHIP_NUM_5708 && bp->stats_ticks) + REG_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd | + BNX2_HC_COMMAND_STATS_NOW); + if (bp->phy_flags & PHY_SERDES_FLAG) { if (CHIP_NUM(bp) == CHIP_NUM_5706) bnx2_5706_serdes_timer(bp); @@ -5417,6 +5446,10 @@ bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) 0xff; bp->stats_ticks = coal->stats_block_coalesce_usecs; + if (CHIP_NUM(bp) == CHIP_NUM_5708) { + if (bp->stats_ticks != 0 && bp->stats_ticks != USEC_PER_SEC) + bp->stats_ticks = USEC_PER_SEC; + } if (bp->stats_ticks > 0xffff00) bp->stats_ticks = 0xffff00; bp->stats_ticks &= 0xffff00; diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index bd6288d6350f..49a5de253b17 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h @@ -1373,6 +1373,7 @@ struct l2_fhdr { #define BNX2_MISC_NEW_CORE_CTL 0x000008c8 #define BNX2_MISC_NEW_CORE_CTL_LINK_HOLDOFF_SUCCESS (1L<<0) #define BNX2_MISC_NEW_CORE_CTL_LINK_HOLDOFF_REQ (1L<<1) +#define BNX2_MISC_NEW_CORE_CTL_DMA_ENABLE (1L<<16) #define BNX2_MISC_NEW_CORE_CTL_RESERVED_CMN (0x3fffL<<2) #define BNX2_MISC_NEW_CORE_CTL_RESERVED_TC (0xffffL<<16) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 61696637a21e..763810c7f33a 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -285,6 +285,12 @@ enum scb_status { rus_mask = 0x3C, }; +enum ru_state { + RU_SUSPENDED = 0, + RU_RUNNING = 1, + RU_UNINITIALIZED = -1, +}; + enum scb_stat_ack { stat_ack_not_ours = 0x00, stat_ack_sw_gen = 0x04, @@ -526,6 +532,7 @@ struct nic { struct rx *rx_to_use; struct rx *rx_to_clean; struct rfd blank_rfd; + enum ru_state ru_running; spinlock_t cb_lock ____cacheline_aligned; spinlock_t cmd_lock; @@ -947,7 +954,7 @@ static void e100_get_defaults(struct nic *nic) ((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i)); /* Template for a freshly allocated RFD */ - nic->blank_rfd.command = cpu_to_le16(cb_el & cb_s); + nic->blank_rfd.command = cpu_to_le16(cb_el); nic->blank_rfd.rbd = 0xFFFFFFFF; nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN); @@ -1742,11 +1749,19 @@ static int e100_alloc_cbs(struct nic *nic) return 0; } -static inline void e100_start_receiver(struct nic *nic) +static inline void e100_start_receiver(struct nic *nic, struct rx *rx) { - /* Start if RFA is non-NULL */ - if(nic->rx_to_clean->skb) - e100_exec_cmd(nic, ruc_start, nic->rx_to_clean->dma_addr); + if(!nic->rxs) return; + if(RU_SUSPENDED != nic->ru_running) return; + + /* handle init time starts */ + if(!rx) rx = nic->rxs; + + /* (Re)start RU if suspended or idle and RFA is non-NULL */ + if(rx->skb) { + e100_exec_cmd(nic, ruc_start, rx->dma_addr); + nic->ru_running = RU_RUNNING; + } } #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) @@ -1775,7 +1790,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) put_unaligned(cpu_to_le32(rx->dma_addr), (u32 *)&prev_rfd->link); wmb(); - prev_rfd->command &= ~cpu_to_le16(cb_el & cb_s); + prev_rfd->command &= ~cpu_to_le16(cb_el); pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr, sizeof(struct rfd), PCI_DMA_TODEVICE); } @@ -1813,6 +1828,10 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, pci_unmap_single(nic->pdev, rx->dma_addr, RFD_BUF_LEN, PCI_DMA_FROMDEVICE); + /* this allows for a fast restart without re-enabling interrupts */ + if(le16_to_cpu(rfd->command) & cb_el) + nic->ru_running = RU_SUSPENDED; + /* Pull off the RFD and put the actual data (minus eth hdr) */ skb_reserve(skb, sizeof(struct rfd)); skb_put(skb, actual_size); @@ -1843,18 +1862,45 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done, unsigned int work_to_do) { struct rx *rx; + int restart_required = 0; + struct rx *rx_to_start = NULL; + + /* are we already rnr? then pay attention!!! this ensures that + * the state machine progression never allows a start with a + * partially cleaned list, avoiding a race between hardware + * and rx_to_clean when in NAPI mode */ + if(RU_SUSPENDED == nic->ru_running) + restart_required = 1; /* Indicate newly arrived packets */ for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) { - if(e100_rx_indicate(nic, rx, work_done, work_to_do)) + int err = e100_rx_indicate(nic, rx, work_done, work_to_do); + if(-EAGAIN == err) { + /* hit quota so have more work to do, restart once + * cleanup is complete */ + restart_required = 0; + break; + } else if(-ENODATA == err) break; /* No more to clean */ } + /* save our starting point as the place we'll restart the receiver */ + if(restart_required) + rx_to_start = nic->rx_to_clean; + /* Alloc new skbs to refill list */ for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) { if(unlikely(e100_rx_alloc_skb(nic, rx))) break; /* Better luck next time (see watchdog) */ } + + if(restart_required) { + // ack the rnr? + writeb(stat_ack_rnr, &nic->csr->scb.stat_ack); + e100_start_receiver(nic, rx_to_start); + if(work_done) + (*work_done)++; + } } static void e100_rx_clean_list(struct nic *nic) @@ -1862,6 +1908,8 @@ static void e100_rx_clean_list(struct nic *nic) struct rx *rx; unsigned int i, count = nic->params.rfds.count; + nic->ru_running = RU_UNINITIALIZED; + if(nic->rxs) { for(rx = nic->rxs, i = 0; i < count; rx++, i++) { if(rx->skb) { @@ -1883,6 +1931,7 @@ static int e100_rx_alloc_list(struct nic *nic) unsigned int i, count = nic->params.rfds.count; nic->rx_to_use = nic->rx_to_clean = NULL; + nic->ru_running = RU_UNINITIALIZED; if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC))) return -ENOMEM; @@ -1897,6 +1946,7 @@ static int e100_rx_alloc_list(struct nic *nic) } nic->rx_to_use = nic->rx_to_clean = nic->rxs; + nic->ru_running = RU_SUSPENDED; return 0; } @@ -1916,6 +1966,10 @@ static irqreturn_t e100_intr(int irq, void *dev_id) /* Ack interrupt(s) */ iowrite8(stat_ack, &nic->csr->scb.stat_ack); + /* We hit Receive No Resource (RNR); restart RU after cleaning */ + if(stat_ack & stat_ack_rnr) + nic->ru_running = RU_SUSPENDED; + if(likely(netif_rx_schedule_prep(netdev))) { e100_disable_irq(nic); __netif_rx_schedule(netdev); @@ -2007,7 +2061,7 @@ static int e100_up(struct nic *nic) if((err = e100_hw_init(nic))) goto err_clean_cbs; e100_set_multicast_list(nic->netdev); - e100_start_receiver(nic); + e100_start_receiver(nic, NULL); mod_timer(&nic->watchdog, jiffies); if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, nic->netdev->name, nic->netdev))) @@ -2088,7 +2142,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode) mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, BMCR_LOOPBACK); - e100_start_receiver(nic); + e100_start_receiver(nic, NULL); if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) { err = -ENOMEM; diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index e85a933a4762..c0f81b5a30fb 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -39,7 +39,7 @@ #include <asm/io.h> #define DRV_NAME "ehea" -#define DRV_VERSION "EHEA_0061" +#define DRV_VERSION "EHEA_0064" #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 152bb2016a2c..9e13433a268a 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -451,7 +451,8 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev, processed_rq3++; } - if (cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) + if ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) + && port->vgrp) vlan_hwaccel_receive_skb(skb, port->vgrp, cqe->vlan_tag); else @@ -1910,10 +1911,7 @@ static void ehea_vlan_rx_register(struct net_device *dev, goto out; } - if (grp) - memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter)); - else - memset(cb1->vlan_filter, 0xFF, sizeof(cb1->vlan_filter)); + memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter)); hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, H_PORT_CB1, H_PORT_CB1_ALL, cb1); @@ -1947,7 +1945,7 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) } index = (vid / 64); - cb1->vlan_filter[index] |= ((u64)(1 << (vid & 0x3F))); + cb1->vlan_filter[index] |= ((u64)(0x8000000000000000 >> (vid & 0x3F))); hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, H_PORT_CB1, H_PORT_CB1_ALL, cb1); @@ -1982,7 +1980,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) } index = (vid / 64); - cb1->vlan_filter[index] &= ~((u64)(1 << (vid & 0x3F))); + cb1->vlan_filter[index] &= ~((u64)(0x8000000000000000 >> (vid & 0x3F))); hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, H_PORT_CB1, H_PORT_CB1_ALL, cb1); diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 3bec0f733f01..6ec3d500f334 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c @@ -915,17 +915,36 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu) { struct ibmveth_adapter *adapter = dev->priv; int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; - int i; + int reinit = 0; + int i, rc; if (new_mtu < IBMVETH_MAX_MTU) return -EINVAL; + for (i = 0; i < IbmVethNumBufferPools; i++) + if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) + break; + + if (i == IbmVethNumBufferPools) + return -EINVAL; + /* Look for an active buffer pool that can hold the new MTU */ for(i = 0; i<IbmVethNumBufferPools; i++) { - if (!adapter->rx_buff_pool[i].active) - continue; + if (!adapter->rx_buff_pool[i].active) { + adapter->rx_buff_pool[i].active = 1; + reinit = 1; + } + if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { - dev->mtu = new_mtu; + if (reinit && netif_running(adapter->netdev)) { + adapter->pool_config = 1; + ibmveth_close(adapter->netdev); + adapter->pool_config = 0; + dev->mtu = new_mtu; + if ((rc = ibmveth_open(adapter->netdev))) + return rc; + } else + dev->mtu = new_mtu; return 0; } } @@ -1243,16 +1262,19 @@ const char * buf, size_t count) if (attr == &veth_active_attr) { if (value && !pool->active) { - if(ibmveth_alloc_buffer_pool(pool)) { - ibmveth_error_printk("unable to alloc pool\n"); - return -ENOMEM; - } - pool->active = 1; - adapter->pool_config = 1; - ibmveth_close(netdev); - adapter->pool_config = 0; - if ((rc = ibmveth_open(netdev))) - return rc; + if (netif_running(netdev)) { + if(ibmveth_alloc_buffer_pool(pool)) { + ibmveth_error_printk("unable to alloc pool\n"); + return -ENOMEM; + } + pool->active = 1; + adapter->pool_config = 1; + ibmveth_close(netdev); + adapter->pool_config = 0; + if ((rc = ibmveth_open(netdev))) + return rc; + } else + pool->active = 1; } else if (!value && pool->active) { int mtu = netdev->mtu + IBMVETH_BUFF_OH; int i; @@ -1281,23 +1303,29 @@ const char * buf, size_t count) if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) return -EINVAL; else { - adapter->pool_config = 1; - ibmveth_close(netdev); - adapter->pool_config = 0; - pool->size = value; - if ((rc = ibmveth_open(netdev))) - return rc; + if (netif_running(netdev)) { + adapter->pool_config = 1; + ibmveth_close(netdev); + adapter->pool_config = 0; + pool->size = value; + if ((rc = ibmveth_open(netdev))) + return rc; + } else + pool->size = value; } } else if (attr == &veth_size_attr) { if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE) return -EINVAL; else { - adapter->pool_config = 1; - ibmveth_close(netdev); - adapter->pool_config = 0; - pool->buff_size = value; - if ((rc = ibmveth_open(netdev))) - return rc; + if (netif_running(netdev)) { + adapter->pool_config = 1; + ibmveth_close(netdev); + adapter->pool_config = 0; + pool->buff_size = value; + if ((rc = ibmveth_open(netdev))) + return rc; + } else + pool->buff_size = value; } } diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index b53b7ad999bc..0f9904fe3a5a 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c @@ -71,7 +71,7 @@ #include "myri10ge_mcp.h" #include "myri10ge_mcp_gen_header.h" -#define MYRI10GE_VERSION_STR "1.3.0-1.233" +#define MYRI10GE_VERSION_STR "1.3.1-1.248" MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); MODULE_AUTHOR("Maintainer: help@myri.com"); @@ -279,6 +279,8 @@ static int myri10ge_fill_thresh = 256; module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n"); +static int myri10ge_reset_recover = 1; + static int myri10ge_wcfifo = 0; module_param(myri10ge_wcfifo, int, S_IRUGO); MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n"); @@ -1154,9 +1156,11 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp) struct mcp_irq_data *stats = mgp->fw_stats; if (unlikely(stats->stats_updated)) { - if (mgp->link_state != stats->link_up) { - mgp->link_state = stats->link_up; - if (mgp->link_state) { + unsigned link_up = ntohl(stats->link_up); + if (mgp->link_state != link_up) { + mgp->link_state = link_up; + + if (mgp->link_state == MXGEFW_LINK_UP) { if (netif_msg_link(mgp)) printk(KERN_INFO "myri10ge: %s: link up\n", @@ -1166,8 +1170,11 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp) } else { if (netif_msg_link(mgp)) printk(KERN_INFO - "myri10ge: %s: link down\n", - mgp->dev->name); + "myri10ge: %s: link %s\n", + mgp->dev->name, + (link_up == MXGEFW_LINK_MYRINET ? + "mismatch (Myrinet detected)" : + "down")); netif_carrier_off(mgp->dev); mgp->link_changes++; } @@ -2730,8 +2737,14 @@ static void myri10ge_watchdog(struct work_struct *work) * For now, just report it */ reboot = myri10ge_read_reboot(mgp); printk(KERN_ERR - "myri10ge: %s: NIC rebooted (0x%x), resetting\n", - mgp->dev->name, reboot); + "myri10ge: %s: NIC rebooted (0x%x),%s resetting\n", + mgp->dev->name, reboot, + myri10ge_reset_recover ? " " : " not"); + if (myri10ge_reset_recover == 0) + return; + + myri10ge_reset_recover--; + /* * A rebooted nic will come back with config space as * it was after power was applied to PCIe bus. diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index ad6688eab265..91f25e0a638e 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h @@ -68,9 +68,10 @@ #define _NETXEN_NIC_LINUX_SUBVERSION 2 #define NETXEN_NIC_LINUX_VERSIONID "3.4.2" -#define NUM_FLASH_SECTORS (64) -#define FLASH_SECTOR_SIZE (64 * 1024) -#define FLASH_TOTAL_SIZE (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE) +#define NETXEN_NUM_FLASH_SECTORS (64) +#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) +#define NETXEN_FLASH_TOTAL_SIZE (NETXEN_NUM_FLASH_SECTORS \ + * NETXEN_FLASH_SECTOR_SIZE) #define PHAN_VENDOR_ID 0x4040 @@ -677,28 +678,28 @@ struct netxen_new_user_info { /* Flash memory map */ typedef enum { - CRBINIT_START = 0, /* Crbinit section */ - BRDCFG_START = 0x4000, /* board config */ - INITCODE_START = 0x6000, /* pegtune code */ - BOOTLD_START = 0x10000, /* bootld */ - IMAGE_START = 0x43000, /* compressed image */ - SECONDARY_START = 0x200000, /* backup images */ - PXE_START = 0x3E0000, /* user defined region */ - USER_START = 0x3E8000, /* User defined region for new boards */ - FIXED_START = 0x3F0000 /* backup of crbinit */ + NETXEN_CRBINIT_START = 0, /* Crbinit section */ + NETXEN_BRDCFG_START = 0x4000, /* board config */ + NETXEN_INITCODE_START = 0x6000, /* pegtune code */ + NETXEN_BOOTLD_START = 0x10000, /* bootld */ + NETXEN_IMAGE_START = 0x43000, /* compressed image */ + NETXEN_SECONDARY_START = 0x200000, /* backup images */ + NETXEN_PXE_START = 0x3E0000, /* user defined region */ + NETXEN_USER_START = 0x3E8000, /* User defined region for new boards */ + NETXEN_FIXED_START = 0x3F0000 /* backup of crbinit */ } netxen_flash_map_t; -#define USER_START_OLD PXE_START /* for backward compatibility */ - -#define FLASH_START (CRBINIT_START) -#define INIT_SECTOR (0) -#define PRIMARY_START (BOOTLD_START) -#define FLASH_CRBINIT_SIZE (0x4000) -#define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info)) -#define FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32)) -#define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START) -#define NUM_PRIMARY_SECTORS (0x20) -#define NUM_CONFIG_SECTORS (1) +#define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */ + +#define NETXEN_FLASH_START (NETXEN_CRBINIT_START) +#define NETXEN_INIT_SECTOR (0) +#define NETXEN_PRIMARY_START (NETXEN_BOOTLD_START) +#define NETXEN_FLASH_CRBINIT_SIZE (0x4000) +#define NETXEN_FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info)) +#define NETXEN_FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32)) +#define NETXEN_FLASH_SECONDARY_SIZE (NETXEN_USER_START-NETXEN_SECONDARY_START) +#define NETXEN_NUM_PRIMARY_SECTORS (0x20) +#define NETXEN_NUM_CONFIG_SECTORS (1) #define PFX "NetXen: " extern char netxen_nic_driver_name[]; @@ -1048,6 +1049,7 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr); int netxen_do_rom_se(struct netxen_adapter *adapter, int addr); /* Functions from netxen_nic_isr.c */ +int netxen_nic_link_ok(struct netxen_adapter *adapter); void netxen_nic_isr_other(struct netxen_adapter *adapter); void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link); void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable); diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 16fabb377488..0175f6c353f6 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c @@ -94,7 +94,7 @@ static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = { static int netxen_nic_get_eeprom_len(struct net_device *dev) { - return FLASH_TOTAL_SIZE; + return NETXEN_FLASH_TOTAL_SIZE; } static void @@ -470,7 +470,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, return 0; } - if (offset == BOOTLD_START) { + if (offset == NETXEN_BOOTLD_START) { ret = netxen_flash_erase_primary(adapter); if (ret != FLASH_SUCCESS) { printk(KERN_ERR "%s: Flash erase failed.\n", @@ -478,10 +478,10 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, return ret; } - ret = netxen_rom_se(adapter, USER_START); + ret = netxen_rom_se(adapter, NETXEN_USER_START); if (ret != FLASH_SUCCESS) return ret; - ret = netxen_rom_se(adapter, FIXED_START); + ret = netxen_rom_se(adapter, NETXEN_FIXED_START); if (ret != FLASH_SUCCESS) return ret; diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index baff17a24d63..c012764d1145 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c @@ -257,7 +257,7 @@ u64 ctx_addr_sig_regs[][3] = { #define ADDR_IN_RANGE(addr, low, high) \ (((addr) <= (high)) && ((addr) >= (low))) -#define NETXEN_FLASH_BASE (BOOTLD_START) +#define NETXEN_FLASH_BASE (NETXEN_BOOTLD_START) #define NETXEN_PHANTOM_MEM_BASE (NETXEN_FLASH_BASE) #define NETXEN_MAX_MTU 8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE #define NETXEN_MIN_MTU 64 @@ -611,7 +611,7 @@ int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]) u32 *pmac = (u32 *) & mac[0]; if (netxen_get_flash_block(adapter, - USER_START + + NETXEN_USER_START + offsetof(struct netxen_new_user_info, mac_addr), FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) { @@ -619,7 +619,7 @@ int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]) } if (*mac == ~0ULL) { if (netxen_get_flash_block(adapter, - USER_START_OLD + + NETXEN_USER_START_OLD + offsetof(struct netxen_user_old_info, mac_addr), FLASH_NUM_PORTS * sizeof(u64), @@ -942,7 +942,7 @@ netxen_nic_pci_set_window(struct netxen_adapter *adapter, int netxen_nic_erase_pxe(struct netxen_adapter *adapter) { - if (netxen_rom_fast_write(adapter, PXE_START, 0) == -1) { + if (netxen_rom_fast_write(adapter, NETXEN_PXE_START, 0) == -1) { printk(KERN_ERR "%s: erase pxe failed\n", netxen_nic_driver_name); return -1; @@ -953,7 +953,7 @@ netxen_nic_erase_pxe(struct netxen_adapter *adapter) int netxen_nic_get_board_info(struct netxen_adapter *adapter) { int rv = 0; - int addr = BRDCFG_START; + int addr = NETXEN_BRDCFG_START; struct netxen_board_info *boardinfo; int index; u32 *ptr32; @@ -1115,7 +1115,7 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter) u32 fw_build = 0; char brd_name[NETXEN_MAX_SHORT_NAME]; struct netxen_new_user_info user_info; - int i, addr = USER_START; + int i, addr = NETXEN_USER_START; __le32 *ptr32; struct netxen_board_info *board_info = &(adapter->ahw.boardcfg); diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index a36892457761..bb23f4c360db 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c @@ -585,7 +585,7 @@ int netxen_backup_crbinit(struct netxen_adapter *adapter) { int ret = FLASH_SUCCESS; int val; - char *buffer = kmalloc(FLASH_SECTOR_SIZE, GFP_KERNEL); + char *buffer = kmalloc(NETXEN_FLASH_SECTOR_SIZE, GFP_KERNEL); if (!buffer) return -ENOMEM; @@ -601,13 +601,13 @@ int netxen_backup_crbinit(struct netxen_adapter *adapter) goto out_kfree; /* copy sector 0 to sector 63 */ - ret = netxen_rom_fast_read_words(adapter, CRBINIT_START, - buffer, FLASH_SECTOR_SIZE); + ret = netxen_rom_fast_read_words(adapter, NETXEN_CRBINIT_START, + buffer, NETXEN_FLASH_SECTOR_SIZE); if (ret != FLASH_SUCCESS) goto out_kfree; - ret = netxen_rom_fast_write_words(adapter, FIXED_START, - buffer, FLASH_SECTOR_SIZE); + ret = netxen_rom_fast_write_words(adapter, NETXEN_FIXED_START, + buffer, NETXEN_FLASH_SECTOR_SIZE); if (ret != FLASH_SUCCESS) goto out_kfree; @@ -654,7 +654,8 @@ void check_erased_flash(struct netxen_adapter *adapter, int addr) int count = 0, erased_errors = 0; int range; - range = (addr == USER_START) ? FIXED_START : addr + FLASH_SECTOR_SIZE; + range = (addr == NETXEN_USER_START) ? + NETXEN_FIXED_START : addr + NETXEN_FLASH_SECTOR_SIZE; for (i = addr; i < range; i += 4) { netxen_rom_fast_read(adapter, i, &val); @@ -689,7 +690,7 @@ netxen_flash_erase_sections(struct netxen_adapter *adapter, int start, int end) int i; for (i = start; i < end; i++) { - ret = netxen_rom_se(adapter, i * FLASH_SECTOR_SIZE); + ret = netxen_rom_se(adapter, i * NETXEN_FLASH_SECTOR_SIZE); if (ret) break; ret = netxen_rom_wip_poll(adapter); @@ -706,8 +707,8 @@ netxen_flash_erase_secondary(struct netxen_adapter *adapter) int ret = FLASH_SUCCESS; int start, end; - start = SECONDARY_START / FLASH_SECTOR_SIZE; - end = USER_START / FLASH_SECTOR_SIZE; + start = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE; + end = NETXEN_USER_START / NETXEN_FLASH_SECTOR_SIZE; ret = netxen_flash_erase_sections(adapter, start, end); return ret; @@ -719,8 +720,8 @@ netxen_flash_erase_primary(struct netxen_adapter *adapter) int ret = FLASH_SUCCESS; int start, end; - start = PRIMARY_START / FLASH_SECTOR_SIZE; - end = SECONDARY_START / FLASH_SECTOR_SIZE; + start = NETXEN_PRIMARY_START / NETXEN_FLASH_SECTOR_SIZE; + end = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE; ret = netxen_flash_erase_sections(adapter, start, end); return ret; @@ -1036,18 +1037,23 @@ void netxen_watchdog_task(struct work_struct *work) if ((adapter->portnum == 0) && netxen_nic_check_temp(adapter)) return; + if (adapter->handle_phy_intr) + adapter->handle_phy_intr(adapter); + netdev = adapter->netdev; - if ((netif_running(netdev)) && !netif_carrier_ok(netdev)) { - printk(KERN_INFO "%s port %d, %s carrier is now ok\n", - netxen_nic_driver_name, adapter->portnum, netdev->name); + if ((netif_running(netdev)) && !netif_carrier_ok(netdev) && + netxen_nic_link_ok(adapter) ) { + printk(KERN_INFO "%s %s (port %d), Link is up\n", + netxen_nic_driver_name, netdev->name, adapter->portnum); netif_carrier_on(netdev); - } - - if (netif_queue_stopped(netdev)) netif_wake_queue(netdev); + } else if(!(netif_running(netdev)) && netif_carrier_ok(netdev)) { + printk(KERN_ERR "%s %s Link is Down\n", + netxen_nic_driver_name, netdev->name); + netif_carrier_off(netdev); + netif_stop_queue(netdev); + } - if (adapter->handle_phy_intr) - adapter->handle_phy_intr(adapter); mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); } diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c index b213b062eb56..b2de6b6c2a7f 100644 --- a/drivers/net/netxen/netxen_nic_isr.c +++ b/drivers/net/netxen/netxen_nic_isr.c @@ -169,6 +169,24 @@ void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter) netxen_nic_isr_other(adapter); } +int netxen_nic_link_ok(struct netxen_adapter *adapter) +{ + switch (adapter->ahw.board_type) { + case NETXEN_NIC_GBE: + return ((adapter->ahw.qg_linksup) & 1); + + case NETXEN_NIC_XGBE: + return ((adapter->ahw.xg_linkup) & 1); + + default: + printk(KERN_ERR"%s: Function: %s, Unknown board type\n", + netxen_nic_driver_name, __FUNCTION__); + break; + } + + return 0; +} + void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) { struct net_device *netdev = adapter->netdev; @@ -183,6 +201,10 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) printk(KERN_INFO "%s: %s NIC Link is down\n", netxen_nic_driver_name, netdev->name); adapter->ahw.xg_linkup = 0; + if (netif_running(netdev)) { + netif_carrier_off(netdev); + netif_stop_queue(netdev); + } /* read twice to clear sticky bits */ /* WINDOW = 0 */ netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1); @@ -196,5 +218,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) printk(KERN_INFO "%s: %s NIC Link is up\n", netxen_nic_driver_name, netdev->name); adapter->ahw.xg_linkup = 1; + netif_carrier_on(netdev); + netif_wake_queue(netdev); } } diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index c61181f23bd5..6167b58d2731 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c @@ -542,6 +542,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); /* Handshake with the card before we register the devices. */ netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); + + /* leave the hw in the same state as reboot */ + writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); + netxen_pinit_from_rom(adapter, 0); + udelay(500); + netxen_load_firmware(adapter); + netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); } /* diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index cef90a78351e..75102d30730f 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c @@ -454,16 +454,12 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) { - u32 reg; u32 portnum = physical_port[adapter->portnum]; netxen_crb_writelit_adapter(adapter, - NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5); - netxen_nic_hw_read_wx(adapter, - NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), ®, 4); - reg = (reg & ~0x2000UL); + NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447); netxen_crb_writelit_adapter(adapter, - NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), reg); + NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5); return 0; } diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 22aec5cce683..b87f8d2a888b 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -54,6 +54,12 @@ #define MII_M1111_PHY_LED_CONTROL 0x18 #define MII_M1111_PHY_LED_DIRECT 0x4100 #define MII_M1111_PHY_LED_COMBINE 0x411c +#define MII_M1111_PHY_EXT_CR 0x14 +#define MII_M1111_RX_DELAY 0x80 +#define MII_M1111_TX_DELAY 0x2 +#define MII_M1111_PHY_EXT_SR 0x1b +#define MII_M1111_HWCFG_MODE_MASK 0xf +#define MII_M1111_HWCFG_MODE_RGMII 0xb MODULE_DESCRIPTION("Marvell PHY driver"); MODULE_AUTHOR("Andy Fleming"); @@ -131,6 +137,45 @@ static int marvell_config_aneg(struct phy_device *phydev) return err; } +static int m88e1111_config_init(struct phy_device *phydev) +{ + int err; + + if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || + (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) { + int temp; + + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { + temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); + if (temp < 0) + return temp; + + temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY); + + err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp); + if (err < 0) + return err; + } + + temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); + if (temp < 0) + return temp; + + temp &= ~(MII_M1111_HWCFG_MODE_MASK); + temp |= MII_M1111_HWCFG_MODE_RGMII; + + err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); + if (err < 0) + return err; + } + + err = phy_write(phydev, MII_BMCR, BMCR_RESET); + if (err < 0) + return err; + + return 0; +} + static int m88e1145_config_init(struct phy_device *phydev) { int err; @@ -152,7 +197,7 @@ static int m88e1145_config_init(struct phy_device *phydev) if (err < 0) return err; - if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR); if (temp < 0) return temp; @@ -206,7 +251,7 @@ static struct phy_driver m88e1101_driver = { .driver = {.owner = THIS_MODULE,}, }; -static struct phy_driver m88e1111s_driver = { +static struct phy_driver m88e1111_driver = { .phy_id = 0x01410cc0, .phy_id_mask = 0xfffffff0, .name = "Marvell 88E1111", @@ -216,6 +261,7 @@ static struct phy_driver m88e1111s_driver = { .read_status = &genphy_read_status, .ack_interrupt = &marvell_ack_interrupt, .config_intr = &marvell_config_intr, + .config_init = &m88e1111_config_init, .driver = {.owner = THIS_MODULE,}, }; @@ -241,9 +287,9 @@ static int __init marvell_init(void) if (ret) return ret; - ret = phy_driver_register(&m88e1111s_driver); + ret = phy_driver_register(&m88e1111_driver); if (ret) - goto err1111s; + goto err1111; ret = phy_driver_register(&m88e1145_driver); if (ret) @@ -251,9 +297,9 @@ static int __init marvell_init(void) return 0; - err1145: - phy_driver_unregister(&m88e1111s_driver); - err1111s: +err1145: + phy_driver_unregister(&m88e1111_driver); +err1111: phy_driver_unregister(&m88e1101_driver); return ret; } @@ -261,7 +307,7 @@ static int __init marvell_init(void) static void __exit marvell_exit(void) { phy_driver_unregister(&m88e1101_driver); - phy_driver_unregister(&m88e1111s_driver); + phy_driver_unregister(&m88e1111_driver); phy_driver_unregister(&m88e1145_driver); } diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 3de564b23147..8dc09a3790cb 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig @@ -313,8 +313,8 @@ config USB_KC2190 boolean "KT Technology KC2190 based cables (InstaNet)" depends on USB_NET_CDC_SUBSET && EXPERIMENTAL help - Choose this option if you're using a host-to-host cable - with one of these chips. + Choose this option if you're using a host-to-host cable + with one of these chips. config USB_NET_ZAURUS tristate "Sharp Zaurus (stock ROMs) and compatible" diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 25b75b615188..b670b97bcfde 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c @@ -1562,7 +1562,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) if (vptr->mii_status & VELOCITY_LINK_FAIL) { VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link autonegation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index 00d1255e4c12..e88da72f8304 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c @@ -167,9 +167,9 @@ static void pl010_rx_chars(struct uart_amba_port *uap) ignore_char: status = readb(uap->port.membase + UART01x_FR); } - spin_unlock(&port->lock); + spin_unlock(&uap->port.lock); tty_flip_buffer_push(tty); - spin_lock(&port->lock); + spin_lock(&uap->port.lock); } static void pl010_tx_chars(struct uart_amba_port *uap) diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c index 3524e3fc08b9..61de78a9f6ee 100644 --- a/drivers/tc/zs.c +++ b/drivers/tc/zs.c @@ -2182,7 +2182,7 @@ struct dec_serial_hook zs_kgdbhook = { .init_info = kgdbhook_init_info, .rx_char = kgdbhook_rx_char, .cflags = B38400 | CS8 | CLOCAL, -} +}; void __init zs_kgdb_hook(int tty_num) { diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index 30b7bfbc985a..8bcf7fe1dd80 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c @@ -476,8 +476,6 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done, add_timer(&timer); wait_for_completion(done); status = urb->status; - if (status == -ECONNRESET) - status = -ETIMEDOUT; del_timer_sync(&timer); if (actual_length) @@ -629,10 +627,22 @@ static int cxacru_card_status(struct cxacru_data *instance) return 0; } +static void cxacru_remove_device_files(struct usbatm_data *usbatm_instance, + struct atm_dev *atm_dev) +{ + struct usb_interface *intf = usbatm_instance->usb_intf; + + #define CXACRU_DEVICE_REMOVE_FILE(_name) \ + device_remove_file(&intf->dev, &dev_attr_##_name); + CXACRU_ALL_FILES(REMOVE); + #undef CXACRU_DEVICE_REMOVE_FILE +} + static int cxacru_atm_start(struct usbatm_data *usbatm_instance, struct atm_dev *atm_dev) { struct cxacru_data *instance = usbatm_instance->driver_data; + struct usb_interface *intf = usbatm_instance->usb_intf; /* struct atm_dev *atm_dev = usbatm_instance->atm_dev; */ @@ -649,14 +659,18 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance, return ret; } + #define CXACRU_DEVICE_CREATE_FILE(_name) \ + ret = device_create_file(&intf->dev, &dev_attr_##_name); \ + if (unlikely(ret)) \ + goto fail_sysfs; + CXACRU_ALL_FILES(CREATE); + #undef CXACRU_DEVICE_CREATE_FILE + /* start ADSL */ mutex_lock(&instance->adsl_state_serialize); ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0); - if (ret < 0) { + if (ret < 0) atm_err(usbatm_instance, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret); - mutex_unlock(&instance->adsl_state_serialize); - return ret; - } /* Start status polling */ mutex_lock(&instance->poll_state_serialize); @@ -680,6 +694,11 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance, if (start_polling) cxacru_poll_status(&instance->poll_work.work); return 0; + +fail_sysfs: + usb_err(usbatm_instance, "cxacru_atm_start: device_create_file failed (%d)\n", ret); + cxacru_remove_device_files(usbatm_instance, atm_dev); + return ret; } static void cxacru_poll_status(struct work_struct *work) @@ -1065,13 +1084,6 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance, goto fail; } - #define CXACRU_DEVICE_CREATE_FILE(_name) \ - ret = device_create_file(&intf->dev, &dev_attr_##_name); \ - if (unlikely(ret)) \ - goto fail_sysfs; - CXACRU_ALL_FILES(CREATE); - #undef CXACRU_DEVICE_CREATE_FILE - usb_fill_int_urb(instance->rcv_urb, usb_dev, usb_rcvintpipe(usb_dev, CXACRU_EP_CMD), instance->rcv_buf, PAGE_SIZE, @@ -1092,14 +1104,6 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance, return 0; - fail_sysfs: - dbg("cxacru_bind: device_create_file failed (%d)\n", ret); - - #define CXACRU_DEVICE_REMOVE_FILE(_name) \ - device_remove_file(&intf->dev, &dev_attr_##_name); - CXACRU_ALL_FILES(REMOVE); - #undef CXACRU_DEVICE_REVOVE_FILE - fail: free_page((unsigned long) instance->snd_buf); free_page((unsigned long) instance->rcv_buf); @@ -1146,11 +1150,6 @@ static void cxacru_unbind(struct usbatm_data *usbatm_instance, free_page((unsigned long) instance->snd_buf); free_page((unsigned long) instance->rcv_buf); - #define CXACRU_DEVICE_REMOVE_FILE(_name) \ - device_remove_file(&intf->dev, &dev_attr_##_name); - CXACRU_ALL_FILES(REMOVE); - #undef CXACRU_DEVICE_REVOVE_FILE - kfree(instance); usbatm_instance->driver_data = NULL; @@ -1231,6 +1230,7 @@ static struct usbatm_driver cxacru_driver = { .heavy_init = cxacru_heavy_init, .unbind = cxacru_unbind, .atm_start = cxacru_atm_start, + .atm_stop = cxacru_remove_device_files, .bulk_in = CXACRU_EP_DATA, .bulk_out = CXACRU_EP_DATA, .rx_padding = 3, diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index 7b1edfe46b28..6778f9af7943 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -347,10 +347,8 @@ static int handle_bidir (struct usblp *usblp) if (usblp->bidir && usblp->used && !usblp->sleeping) { usblp->readcount = 0; usblp->readurb->dev = usblp->dev; - if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0) { - usblp->used = 0; + if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0) return -EIO; - } } return 0; @@ -412,6 +410,7 @@ static int usblp_open(struct inode *inode, struct file *file) usblp->readurb->status = 0; if (handle_bidir(usblp) < 0) { + usblp->used = 0; file->private_data = NULL; retval = -EIO; } diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index f493fb1eaa27..346fc030c929 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig @@ -40,21 +40,25 @@ config USB_DEVICEFS config USB_DEVICE_CLASS bool "USB device class-devices (DEPRECATED)" depends on USB - default n + default y ---help--- Userspace access to USB devices is granted by device-nodes exported directly from the usbdev in sysfs. Old versions of the driver core and udev needed additional class devices to export device nodes. These additional devices are difficult to handle in userspace, if - information about USB interfaces must be available. One device contains - the device node, the other device contains the interface data. Both - devices are at the same level in sysfs (siblings) and one can't access - the other. The device node created directly by the usbdev is the parent - device of the interface and therefore easily accessible from the interface - event. - - This option provides backward compatibility if needed. + information about USB interfaces must be available. One device + contains the device node, the other device contains the interface + data. Both devices are at the same level in sysfs (siblings) and one + can't access the other. The device node created directly by the + usb device is the parent device of the interface and therefore + easily accessible from the interface event. + + This option provides backward compatibility for libusb device + nodes (lsusb) when usbfs is not used, and the following udev rule + doesn't exist: + SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ + NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" config USB_DYNAMIC_MINORS bool "Dynamic USB minor allocation (EXPERIMENTAL)" diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 2d4fd530e5e4..dd3482328ad2 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -1,4 +1,5 @@ #include <linux/usb.h> +#include <linux/usb/ch9.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> @@ -49,7 +50,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, unsigned char *buffer0 = buffer; struct usb_endpoint_descriptor *d; struct usb_host_endpoint *endpoint; - int n, i; + int n, i, j; d = (struct usb_endpoint_descriptor *) buffer; buffer += d->bLength; @@ -84,6 +85,45 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, memcpy(&endpoint->desc, d, n); INIT_LIST_HEAD(&endpoint->urb_list); + /* If the bInterval value is outside the legal range, + * set it to a default value: 32 ms */ + i = 0; /* i = min, j = max, n = default */ + j = 255; + if (usb_endpoint_xfer_int(d)) { + i = 1; + switch (to_usb_device(ddev)->speed) { + case USB_SPEED_HIGH: + n = 9; /* 32 ms = 2^(9-1) uframes */ + j = 16; + break; + default: /* USB_SPEED_FULL or _LOW */ + /* For low-speed, 10 ms is the official minimum. + * But some "overclocked" devices might want faster + * polling so we'll allow it. */ + n = 32; + break; + } + } else if (usb_endpoint_xfer_isoc(d)) { + i = 1; + j = 16; + switch (to_usb_device(ddev)->speed) { + case USB_SPEED_HIGH: + n = 9; /* 32 ms = 2^(9-1) uframes */ + break; + default: /* USB_SPEED_FULL */ + n = 6; /* 32 ms = 2^(6-1) frames */ + break; + } + } + if (d->bInterval < i || d->bInterval > j) { + dev_warn(ddev, "config %d interface %d altsetting %d " + "endpoint 0x%X has an invalid bInterval %d, " + "changing to %d\n", + cfgno, inum, asnum, + d->bEndpointAddress, d->bInterval, n); + endpoint->desc.bInterval = n; + } + /* Skip over any Class Specific or Vendor Specific descriptors; * find the next endpoint or interface descriptor */ endpoint->extra = buffer; diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index f28af06905a5..6042364402b8 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -132,7 +132,7 @@ ep_matches ( * where it's an output parameter representing the full speed limit. * the usb spec fixes high speed bulk maxpacket at 512 bytes. */ - max = 0x7ff & le16_to_cpup (&desc->wMaxPacketSize); + max = 0x7ff & le16_to_cpu(desc->wMaxPacketSize); switch (type) { case USB_ENDPOINT_XFER_INT: /* INT: limit 64 bytes full speed, 1024 high speed */ diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 188c74a95216..46d0e5252744 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c @@ -1369,12 +1369,12 @@ config_buf (struct dev_data *dev, u8 type, unsigned index) hs = !hs; if (hs) { dev->req->buf = dev->hs_config; - len = le16_to_cpup (&dev->hs_config->wTotalLength); + len = le16_to_cpu(dev->hs_config->wTotalLength); } else #endif { dev->req->buf = dev->config; - len = le16_to_cpup (&dev->config->wTotalLength); + len = le16_to_cpu(dev->config->wTotalLength); } ((u8 *)dev->req->buf) [1] = type; return len; @@ -1885,7 +1885,7 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) /* full or low speed config */ dev->config = (void *) kbuf; - total = le16_to_cpup (&dev->config->wTotalLength); + total = le16_to_cpu(dev->config->wTotalLength); if (!is_valid_config (dev->config) || total >= length) goto fail; kbuf += total; @@ -1894,7 +1894,7 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) /* optional high speed config */ if (kbuf [1] == USB_DT_CONFIG) { dev->hs_config = (void *) kbuf; - total = le16_to_cpup (&dev->hs_config->wTotalLength); + total = le16_to_cpu(dev->hs_config->wTotalLength); if (!is_valid_config (dev->hs_config) || total >= length) goto fail; kbuf += total; diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 52779c52b56d..d975ecf18e00 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -2440,9 +2440,9 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat) tmp = 0; -#define w_value le16_to_cpup (&u.r.wValue) -#define w_index le16_to_cpup (&u.r.wIndex) -#define w_length le16_to_cpup (&u.r.wLength) +#define w_value le16_to_cpu(u.r.wValue) +#define w_index le16_to_cpu(u.r.wIndex) +#define w_length le16_to_cpu(u.r.wLength) /* ack the irq */ writel (1 << SETUP_PACKET_INTERRUPT, &dev->regs->irqstat0); diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index b394e63894d2..c4975a6cf777 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c @@ -1651,9 +1651,9 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src) UDC_EP_NUM_REG = 0; } while (UDC_IRQ_SRC_REG & UDC_SETUP); -#define w_value le16_to_cpup (&u.r.wValue) -#define w_index le16_to_cpup (&u.r.wIndex) -#define w_length le16_to_cpup (&u.r.wLength) +#define w_value le16_to_cpu(u.r.wValue) +#define w_index le16_to_cpu(u.r.wIndex) +#define w_length le16_to_cpu(u.r.wLength) /* Delegate almost all control requests to the gadget driver, * except for a handful of ch9 status/feature requests that diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 6ec8cf1a3ccb..708657c89132 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c @@ -186,10 +186,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, DEBUG("query OID %08x value, len %d:\n", OID, buf_len); for (i = 0; i < buf_len; i += 16) { DEBUG ("%03d: %08x %08x %08x %08x\n", i, - le32_to_cpup((__le32 *)&buf[i]), - le32_to_cpup((__le32 *)&buf[i + 4]), - le32_to_cpup((__le32 *)&buf[i + 8]), - le32_to_cpup((__le32 *)&buf[i + 12])); + le32_to_cpu(get_unaligned((__le32 *) + &buf[i])), + le32_to_cpu(get_unaligned((__le32 *) + &buf[i + 4])), + le32_to_cpu(get_unaligned((__le32 *) + &buf[i + 8])), + le32_to_cpu(get_unaligned((__le32 *) + &buf[i + 12]))); } } @@ -665,7 +669,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, break; case OID_PNP_QUERY_POWER: DEBUG("%s: OID_PNP_QUERY_POWER D%d\n", __FUNCTION__, - le32_to_cpup((__le32 *) buf) - 1); + le32_to_cpu(get_unaligned((__le32 *)buf)) - 1); /* only suspend is a real power state, and * it can't be entered by OID_PNP_SET_POWER... */ @@ -704,10 +708,14 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, DEBUG("set OID %08x value, len %d:\n", OID, buf_len); for (i = 0; i < buf_len; i += 16) { DEBUG ("%03d: %08x %08x %08x %08x\n", i, - le32_to_cpup((__le32 *)&buf[i]), - le32_to_cpup((__le32 *)&buf[i + 4]), - le32_to_cpup((__le32 *)&buf[i + 8]), - le32_to_cpup((__le32 *)&buf[i + 12])); + le32_to_cpu(get_unaligned((__le32 *) + &buf[i])), + le32_to_cpu(get_unaligned((__le32 *) + &buf[i + 4])), + le32_to_cpu(get_unaligned((__le32 *) + &buf[i + 8])), + le32_to_cpu(get_unaligned((__le32 *) + &buf[i + 12]))); } } @@ -721,7 +729,8 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, * PROMISCUOUS, DIRECTED, * MULTICAST, ALL_MULTICAST, BROADCAST */ - *params->filter = (u16) le32_to_cpup((__le32 *)buf); + *params->filter = (u16) le32_to_cpu(get_unaligned( + (__le32 *)buf)); DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n", __FUNCTION__, *params->filter); @@ -771,7 +780,7 @@ update_linkstate: * resuming, Windows forces a reset, and then SET_POWER D0. * FIXME ... then things go batty; Windows wedges itself. */ - i = le32_to_cpup((__force __le32 *)buf); + i = le32_to_cpu(get_unaligned((__le32 *)buf)); DEBUG("%s: OID_PNP_SET_POWER D%d\n", __FUNCTION__, i - 1); switch (i) { case NdisDeviceStateD0: @@ -1058,8 +1067,8 @@ int rndis_msg_parser (u8 configNr, u8 *buf) return -ENOMEM; tmp = (__le32 *) buf; - MsgType = le32_to_cpup(tmp++); - MsgLength = le32_to_cpup(tmp++); + MsgType = le32_to_cpu(get_unaligned(tmp++)); + MsgLength = le32_to_cpu(get_unaligned(tmp++)); if (configNr >= RNDIS_MAX_CONFIGS) return -ENOTSUPP; diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 216c9c9d4d6d..bb9cc595219e 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c @@ -417,6 +417,8 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf) unsigned long flags; spin_lock_irqsave (&ohci->lock, flags); + if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) + goto done; /* undocumented erratum seen on at least rev D */ if ((ohci->flags & OHCI_QUIRK_AMD756) diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index d230ee72f9cd..54979c239c63 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -1179,8 +1179,8 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff, US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY ), -/* These are virtual windows driver CDs, which the zd1211rw driver automatically - * converts into a WLAN devices. */ +/* These are virtual windows driver CDs, which the zd1211rw driver + * automatically converts into WLAN devices. */ UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101, "ZyXEL", "G-220F USB-WLAN Install", @@ -1193,6 +1193,14 @@ UNUSUAL_DEV( 0x0ace, 0x20ff, 0x0101, 0x0101, US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_IGNORE_DEVICE ), +/* SanDisk that has a second LUN for a driver ISO, reported by + * Ben Collins <bcollins@ubuntu.com> */ +UNUSUAL_DEV( 0x0781, 0x5406, 0x0000, 0xffff, + "SanDisk", + "U3 Cruzer Micro driver ISO", + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_SINGLE_LUN ), + #ifdef CONFIG_USB_STORAGE_ISD200 UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, "ATI", @@ -1271,6 +1279,15 @@ UNUSUAL_DEV( 0x0dd8, 0x1060, 0x0000, 0xffff, US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY ), +/* Reported by Edward Chapman (taken from linux-usb mailing list) + Netac OnlyDisk Mini U2CV2 512MB USB 2.0 Flash Drive */ +UNUSUAL_DEV( 0x0dd8, 0xd202, 0x0000, 0x9999, + "Netac", + "USB Flash Disk", + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_IGNORE_RESIDUE ), + + /* Patch by Stephan Walter <stephan.walter@epfl.ch> * I don't know why, but it works... */ UNUSUAL_DEV( 0x0dda, 0x0001, 0x0012, 0x0012, diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile index 9b26dda18a38..ac46cc3f6a2a 100644 --- a/drivers/video/console/Makefile +++ b/drivers/video/console/Makefile @@ -47,7 +47,7 @@ targets := promcon_tbl.c quiet_cmd_conmakehash = CNMKHSH $@ cmd_conmakehash = scripts/conmakehash $< | \ sed -e '/\#include <[^>]*>/p' -e 's/types/init/' \ - -e 's/dfont\(_uni.*\]\)/promfont\1 __initdata/' > $@ + -e 's/dfont\(_uni.*\]\)/promfont\1 /' > $@ $(obj)/promcon_tbl.c: $(src)/prom.uni $(call cmd,conmakehash) diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index 1d4e8354b561..3f6c98fad437 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c @@ -656,7 +656,7 @@ static int ffb_setcolreg(unsigned regno, { u32 value; - if (regno >= 256) + if (regno >= 16) return 1; red >>= 8; @@ -903,7 +903,7 @@ ffb_init_fix(struct fb_info *info) struct all_info { struct fb_info info; struct ffb_par par; - u32 pseudo_palette[256]; + u32 pseudo_palette[16]; }; static int ffb_init_one(struct of_device *op) diff --git a/drivers/video/sunxvr2500.c b/drivers/video/sunxvr2500.c index 4316c7fe8e21..c3869a96ab58 100644 --- a/drivers/video/sunxvr2500.c +++ b/drivers/video/sunxvr2500.c @@ -28,7 +28,7 @@ struct s3d_info { unsigned int depth; unsigned int fb_size; - u32 pseudo_palette[256]; + u32 pseudo_palette[16]; }; static int __devinit s3d_get_props(struct s3d_info *sp) @@ -52,15 +52,14 @@ static int s3d_setcolreg(unsigned regno, { u32 value; - if (regno >= 256) - return 1; + if (regno < 16) { + red >>= 8; + green >>= 8; + blue >>= 8; - red >>= 8; - green >>= 8; - blue >>= 8; - - value = (blue << 24) | (green << 16) | (red << 8); - ((u32 *)info->pseudo_palette)[regno] = value; + value = (blue << 24) | (green << 16) | (red << 8); + ((u32 *)info->pseudo_palette)[regno] = value; + } return 0; } diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c index 08880a62bfa3..71bf3f1f00bc 100644 --- a/drivers/video/sunxvr500.c +++ b/drivers/video/sunxvr500.c @@ -50,7 +50,7 @@ struct e3d_info { u32 fb8_0_off; u32 fb8_1_off; - u32 pseudo_palette[256]; + u32 pseudo_palette[16]; }; static int __devinit e3d_get_props(struct e3d_info *ep) @@ -126,7 +126,9 @@ static int e3d_setcolreg(unsigned regno, blue_8 = blue >> 8; value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8); - ((u32 *)info->pseudo_palette)[regno] = value; + + if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 16) + ((u32 *)info->pseudo_palette)[regno] = value; red_10 = red >> 6; |