aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/cciss.c10
-rw-r--r--drivers/block/floppy.c12
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c1
-rw-r--r--drivers/char/synclink_gt.c14
-rw-r--r--drivers/char/watchdog/sbc8360.c4
-rw-r--r--drivers/ide/ide-proc.c2
-rw-r--r--drivers/ide/pci/aec62xx.c12
-rw-r--r--drivers/ide/pci/alim15x3.c2
-rw-r--r--drivers/ide/pci/serverworks.c10
-rw-r--r--drivers/ide/pci/sgiioc4.c60
-rw-r--r--drivers/ide/pci/siimage.c6
-rw-r--r--drivers/ide/pci/sis5513.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_allocator.c15
-rw-r--r--drivers/macintosh/via-pmu-backlight.c99
-rw-r--r--drivers/macintosh/via-pmu.c12
-rw-r--r--drivers/md/raid1.c57
-rw-r--r--drivers/media/Kconfig2
-rw-r--r--drivers/media/common/saa7146_video.c2
-rw-r--r--drivers/media/dvb/b2c2/Kconfig1
-rw-r--r--drivers/media/dvb/bt8xx/Kconfig1
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig1
-rw-r--r--drivers/media/dvb/frontends/Kconfig60
-rw-r--r--drivers/media/dvb/frontends/Makefile2
-rw-r--r--drivers/media/dvb/pluto2/Kconfig1
-rw-r--r--drivers/media/dvb/ttpci/Kconfig5
-rw-r--r--drivers/media/dvb/ttusb-budget/Kconfig3
-rw-r--r--drivers/media/video/Kconfig8
-rw-r--r--drivers/media/video/bt8xx/bttv-input.c1
-rw-r--r--drivers/media/video/cx88/Kconfig1
-rw-r--r--drivers/media/video/saa7134/Kconfig1
-rw-r--r--drivers/media/video/tuner-types.c10
-rw-r--r--drivers/media/video/zoran.h2
-rw-r--r--drivers/media/video/zoran_driver.c22
-rw-r--r--drivers/mmc/imxmmc.c69
-rw-r--r--drivers/mmc/mmc.c55
-rw-r--r--drivers/mmc/mmc_block.c60
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/dm9000.c4
-rw-r--r--drivers/pci/quirks.c1
-rw-r--r--drivers/s390/block/dasd.c192
-rw-r--r--drivers/s390/block/dasd_genhd.c10
-rw-r--r--drivers/s390/cio/ccwgroup.c14
-rw-r--r--drivers/s390/cio/chsc.c10
-rw-r--r--drivers/s390/cio/device.c19
-rw-r--r--drivers/s390/cio/device_fsm.c20
-rw-r--r--drivers/s390/cio/device_pgid.c27
-rw-r--r--drivers/scsi/ata_piix.c36
-rw-r--r--drivers/scsi/libata-core.c13
-rw-r--r--drivers/scsi/sata_mv.c3
-rw-r--r--drivers/scsi/sata_via.c1
-rw-r--r--drivers/scsi/scsi_error.c2
-rw-r--r--drivers/serial/8250_pci.c17
-rw-r--r--drivers/serial/serial_core.c3
-rw-r--r--drivers/serial/sh-sci.c4
-rw-r--r--drivers/usb/gadget/ether.c45
-rw-r--r--drivers/usb/host/uhci-q.c4
-rw-r--r--drivers/usb/input/hid-core.c149
-rw-r--r--drivers/usb/input/usbtouchscreen.c2
-rw-r--r--drivers/usb/input/yealink.c12
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c2
-rw-r--r--drivers/usb/net/pegasus.h3
-rw-r--r--drivers/usb/net/rtl8150.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.h5
-rw-r--r--drivers/usb/serial/usb-serial.c4
-rw-r--r--drivers/usb/storage/unusual_devs.h24
-rw-r--r--drivers/video/aty/aty128fb.c19
-rw-r--r--drivers/video/aty/atyfb_base.c19
-rw-r--r--drivers/video/aty/radeon_backlight.c4
-rw-r--r--drivers/video/nvidia/nv_backlight.c18
-rw-r--r--drivers/video/riva/fbdev.c19
71 files changed, 806 insertions, 528 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 7b0eca703a67..2cd3391ff878 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -48,14 +48,14 @@
48#include <linux/completion.h> 48#include <linux/completion.h>
49 49
50#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) 50#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin))
51#define DRIVER_NAME "HP CISS Driver (v 2.6.10)" 51#define DRIVER_NAME "HP CISS Driver (v 3.6.10)"
52#define DRIVER_VERSION CCISS_DRIVER_VERSION(2,6,10) 52#define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,10)
53 53
54/* Embedded module documentation macros - see modules.h */ 54/* Embedded module documentation macros - see modules.h */
55MODULE_AUTHOR("Hewlett-Packard Company"); 55MODULE_AUTHOR("Hewlett-Packard Company");
56MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 2.6.10"); 56MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 3.6.10");
57MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" 57MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400"
58 " SA6i P600 P800 P400 P400i E200 E200i"); 58 " SA6i P600 P800 P400 P400i E200 E200i E500");
59MODULE_LICENSE("GPL"); 59MODULE_LICENSE("GPL");
60 60
61#include "cciss_cmd.h" 61#include "cciss_cmd.h"
@@ -82,6 +82,7 @@ static const struct pci_device_id cciss_pci_device_id[] = {
82 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3213}, 82 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3213},
83 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3214}, 83 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3214},
84 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215}, 84 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215},
85 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3233},
85 {0,} 86 {0,}
86}; 87};
87 88
@@ -110,6 +111,7 @@ static struct board_type products[] = {
110 {0x3213103C, "Smart Array E200i", &SA5_access}, 111 {0x3213103C, "Smart Array E200i", &SA5_access},
111 {0x3214103C, "Smart Array E200i", &SA5_access}, 112 {0x3214103C, "Smart Array E200i", &SA5_access},
112 {0x3215103C, "Smart Array E200i", &SA5_access}, 113 {0x3215103C, "Smart Array E200i", &SA5_access},
114 {0x3233103C, "Smart Array E500", &SA5_access},
113}; 115};
114 116
115/* How long to wait (in milliseconds) for board to go into simple mode */ 117/* How long to wait (in milliseconds) for board to go into simple mode */
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 5109fa37c662..ad1d7065a1b2 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4177,6 +4177,11 @@ static int __init floppy_init(void)
4177 int i, unit, drive; 4177 int i, unit, drive;
4178 int err, dr; 4178 int err, dr;
4179 4179
4180#if defined(CONFIG_PPC_MERGE)
4181 if (check_legacy_ioport(FDC1))
4182 return -ENODEV;
4183#endif
4184
4180 raw_cmd = NULL; 4185 raw_cmd = NULL;
4181 4186
4182 for (dr = 0; dr < N_DRIVE; dr++) { 4187 for (dr = 0; dr < N_DRIVE; dr++) {
@@ -4234,13 +4239,6 @@ static int __init floppy_init(void)
4234 } 4239 }
4235 4240
4236 use_virtual_dma = can_use_virtual_dma & 1; 4241 use_virtual_dma = can_use_virtual_dma & 1;
4237#if defined(CONFIG_PPC_MERGE)
4238 if (check_legacy_ioport(FDC1)) {
4239 del_timer(&fd_timeout);
4240 err = -ENODEV;
4241 goto out_unreg_region;
4242 }
4243#endif
4244 fdc_state[0].address = FDC1; 4242 fdc_state[0].address = FDC1;
4245 if (fdc_state[0].address == -1) { 4243 if (fdc_state[0].address == -1) {
4246 del_timer(&fd_timeout); 4244 del_timer(&fd_timeout);
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 0aa5d608fe6f..843d34c8627c 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -3428,6 +3428,7 @@ struct ipmi_recv_msg *ipmi_alloc_recv_msg(void)
3428 3428
3429 rv = kmalloc(sizeof(struct ipmi_recv_msg), GFP_ATOMIC); 3429 rv = kmalloc(sizeof(struct ipmi_recv_msg), GFP_ATOMIC);
3430 if (rv) { 3430 if (rv) {
3431 rv->user = NULL;
3431 rv->done = free_recv_msg; 3432 rv->done = free_recv_msg;
3432 atomic_inc(&recv_msg_inuse_count); 3433 atomic_inc(&recv_msg_inuse_count);
3433 } 3434 }
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index b2dbbdb1bf81..2f07b085536b 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -391,8 +391,8 @@ static MGSL_PARAMS default_params = {
391#define DESC_LIST_SIZE 4096 391#define DESC_LIST_SIZE 4096
392 392
393#define MASK_PARITY BIT1 393#define MASK_PARITY BIT1
394#define MASK_FRAMING BIT2 394#define MASK_FRAMING BIT0
395#define MASK_BREAK BIT3 395#define MASK_BREAK BIT14
396#define MASK_OVERRUN BIT4 396#define MASK_OVERRUN BIT4
397 397
398#define GSR 0x00 /* global status */ 398#define GSR 0x00 /* global status */
@@ -1800,17 +1800,17 @@ static void rx_async(struct slgt_info *info)
1800 1800
1801 stat = 0; 1801 stat = 0;
1802 1802
1803 if ((status = *(p+1) & (BIT9 + BIT8))) { 1803 if ((status = *(p+1) & (BIT1 + BIT0))) {
1804 if (status & BIT9) 1804 if (status & BIT1)
1805 icount->parity++; 1805 icount->parity++;
1806 else if (status & BIT8) 1806 else if (status & BIT0)
1807 icount->frame++; 1807 icount->frame++;
1808 /* discard char if tty control flags say so */ 1808 /* discard char if tty control flags say so */
1809 if (status & info->ignore_status_mask) 1809 if (status & info->ignore_status_mask)
1810 continue; 1810 continue;
1811 if (status & BIT9) 1811 if (status & BIT1)
1812 stat = TTY_PARITY; 1812 stat = TTY_PARITY;
1813 else if (status & BIT8) 1813 else if (status & BIT0)
1814 stat = TTY_FRAME; 1814 stat = TTY_FRAME;
1815 } 1815 }
1816 if (tty) { 1816 if (tty) {
diff --git a/drivers/char/watchdog/sbc8360.c b/drivers/char/watchdog/sbc8360.c
index 1035be5b5019..41fc6f80c493 100644
--- a/drivers/char/watchdog/sbc8360.c
+++ b/drivers/char/watchdog/sbc8360.c
@@ -200,7 +200,7 @@ static int wd_margin = 0xB;
200static int wd_multiplier = 2; 200static int wd_multiplier = 2;
201static int nowayout = WATCHDOG_NOWAYOUT; 201static int nowayout = WATCHDOG_NOWAYOUT;
202 202
203module_param(timeout, int, 27); 203module_param(timeout, int, 0);
204MODULE_PARM_DESC(timeout, "Index into timeout table (0-63) (default=27 (60s))"); 204MODULE_PARM_DESC(timeout, "Index into timeout table (0-63) (default=27 (60s))");
205module_param(nowayout, int, 0); 205module_param(nowayout, int, 0);
206MODULE_PARM_DESC(nowayout, 206MODULE_PARM_DESC(nowayout,
@@ -407,7 +407,7 @@ module_exit(sbc8360_exit);
407MODULE_AUTHOR("Ian E. Morgan <imorgan@webcon.ca>"); 407MODULE_AUTHOR("Ian E. Morgan <imorgan@webcon.ca>");
408MODULE_DESCRIPTION("SBC8360 watchdog driver"); 408MODULE_DESCRIPTION("SBC8360 watchdog driver");
409MODULE_LICENSE("GPL"); 409MODULE_LICENSE("GPL");
410MODULE_VERSION("1.0"); 410MODULE_VERSION("1.01");
411MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 411MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
412 412
413/* end of sbc8360.c */ 413/* end of sbc8360.c */
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index c12f1b71e934..41b74b13a00c 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -376,6 +376,8 @@ static int proc_ide_read_media
376 break; 376 break;
377 case ide_floppy:media = "floppy\n"; 377 case ide_floppy:media = "floppy\n";
378 break; 378 break;
379 case ide_optical:media = "optical\n";
380 break;
379 default: media = "UNKNOWN\n"; 381 default: media = "UNKNOWN\n";
380 break; 382 break;
381 } 383 }
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index a7c725f8bf64..f286079d233f 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -425,12 +425,12 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
425 return d->init_setup(dev, d); 425 return d->init_setup(dev, d);
426} 426}
427 427
428static const struct pci_device_id aec62xx_pci_tbl[] = { 428static struct pci_device_id aec62xx_pci_tbl[] = {
429 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP850UF), 0 }, 429 { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP850UF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
430 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860), 1 }, 430 { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },
431 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860R), 2 }, 431 { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 },
432 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865), 3 }, 432 { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3 },
433 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R), 4 }, 433 { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 },
434 { 0, }, 434 { 0, },
435}; 435};
436MODULE_DEVICE_TABLE(pci, aec62xx_pci_tbl); 436MODULE_DEVICE_TABLE(pci, aec62xx_pci_tbl);
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 351dab2fcacf..d419e4bb54f4 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -730,7 +730,7 @@ static unsigned int __devinit ata66_ali15x3 (ide_hwif_t *hwif)
730 730
731 if(m5229_revision <= 0x20) 731 if(m5229_revision <= 0x20)
732 tmpbyte = (tmpbyte & (~0x02)) | 0x01; 732 tmpbyte = (tmpbyte & (~0x02)) | 0x01;
733 else if (m5229_revision == 0xc7) 733 else if (m5229_revision == 0xc7 || m5229_revision == 0xc8)
734 tmpbyte |= 0x03; 734 tmpbyte |= 0x03;
735 else 735 else
736 tmpbyte |= 0x01; 736 tmpbyte |= 0x01;
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 03677bff0d72..f063d954236c 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -649,11 +649,11 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device
649} 649}
650 650
651static struct pci_device_id svwks_pci_tbl[] = { 651static struct pci_device_id svwks_pci_tbl[] = {
652 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0}, 652 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
653 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE), 1}, 653 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
654 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE), 2}, 654 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
655 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2), 3}, 655 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
656 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE), 4}, 656 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
657 { 0, }, 657 { 0, },
658}; 658};
659MODULE_DEVICE_TABLE(pci, svwks_pci_tbl); 659MODULE_DEVICE_TABLE(pci, svwks_pci_tbl);
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index e125032bb403..d8a0d87df734 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -367,12 +367,13 @@ sgiioc4_INB(unsigned long port)
367static void __devinit 367static void __devinit
368ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) 368ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base)
369{ 369{
370 void __iomem *virt_dma_base;
370 int num_ports = sizeof (ioc4_dma_regs_t); 371 int num_ports = sizeof (ioc4_dma_regs_t);
371 372
372 printk(KERN_INFO "%s: BM-DMA at 0x%04lx-0x%04lx\n", hwif->name, 373 printk(KERN_INFO "%s: BM-DMA at 0x%04lx-0x%04lx\n", hwif->name,
373 dma_base, dma_base + num_ports - 1); 374 dma_base, dma_base + num_ports - 1);
374 375
375 if (!request_region(dma_base, num_ports, hwif->name)) { 376 if (!request_mem_region(dma_base, num_ports, hwif->name)) {
376 printk(KERN_ERR 377 printk(KERN_ERR
377 "%s(%s) -- ERROR, Addresses 0x%p to 0x%p " 378 "%s(%s) -- ERROR, Addresses 0x%p to 0x%p "
378 "ALREADY in use\n", 379 "ALREADY in use\n",
@@ -381,13 +382,21 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base)
381 goto dma_alloc_failure; 382 goto dma_alloc_failure;
382 } 383 }
383 384
384 hwif->dma_base = dma_base; 385 virt_dma_base = ioremap(dma_base, num_ports);
386 if (virt_dma_base == NULL) {
387 printk(KERN_ERR
388 "%s(%s) -- ERROR, Unable to map addresses 0x%lx to 0x%lx\n",
389 __FUNCTION__, hwif->name, dma_base, dma_base + num_ports - 1);
390 goto dma_remap_failure;
391 }
392 hwif->dma_base = (unsigned long) virt_dma_base;
393
385 hwif->dmatable_cpu = pci_alloc_consistent(hwif->pci_dev, 394 hwif->dmatable_cpu = pci_alloc_consistent(hwif->pci_dev,
386 IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, 395 IOC4_PRD_ENTRIES * IOC4_PRD_BYTES,
387 &hwif->dmatable_dma); 396 &hwif->dmatable_dma);
388 397
389 if (!hwif->dmatable_cpu) 398 if (!hwif->dmatable_cpu)
390 goto dma_alloc_failure; 399 goto dma_pci_alloc_failure;
391 400
392 hwif->sg_max_nents = IOC4_PRD_ENTRIES; 401 hwif->sg_max_nents = IOC4_PRD_ENTRIES;
393 402
@@ -411,6 +420,12 @@ dma_base2alloc_failure:
411 printk(KERN_INFO 420 printk(KERN_INFO
412 "Changing from DMA to PIO mode for Drive %s\n", hwif->name); 421 "Changing from DMA to PIO mode for Drive %s\n", hwif->name);
413 422
423dma_pci_alloc_failure:
424 iounmap(virt_dma_base);
425
426dma_remap_failure:
427 release_mem_region(dma_base, num_ports);
428
414dma_alloc_failure: 429dma_alloc_failure:
415 /* Disable DMA because we couldnot allocate any DMA maps */ 430 /* Disable DMA because we couldnot allocate any DMA maps */
416 hwif->autodma = 0; 431 hwif->autodma = 0;
@@ -607,18 +622,15 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
607 hwif->ide_dma_lostirq = &sgiioc4_ide_dma_lostirq; 622 hwif->ide_dma_lostirq = &sgiioc4_ide_dma_lostirq;
608 hwif->ide_dma_timeout = &__ide_dma_timeout; 623 hwif->ide_dma_timeout = &__ide_dma_timeout;
609 624
610 /*
611 * The IOC4 uses MMIO rather than Port IO.
612 * It also needs special workarounds for INB.
613 */
614 default_hwif_mmiops(hwif);
615 hwif->INB = &sgiioc4_INB; 625 hwif->INB = &sgiioc4_INB;
616} 626}
617 627
618static int __devinit 628static int __devinit
619sgiioc4_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t * d) 629sgiioc4_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t * d)
620{ 630{
621 unsigned long base, ctl, dma_base, irqport; 631 unsigned long cmd_base, dma_base, irqport;
632 unsigned long bar0, cmd_phys_base, ctl;
633 void __iomem *virt_base;
622 ide_hwif_t *hwif; 634 ide_hwif_t *hwif;
623 int h; 635 int h;
624 636
@@ -636,23 +648,32 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t * d)
636 } 648 }
637 649
638 /* Get the CmdBlk and CtrlBlk Base Registers */ 650 /* Get the CmdBlk and CtrlBlk Base Registers */
639 base = pci_resource_start(dev, 0) + IOC4_CMD_OFFSET; 651 bar0 = pci_resource_start(dev, 0);
640 ctl = pci_resource_start(dev, 0) + IOC4_CTRL_OFFSET; 652 virt_base = ioremap(bar0, pci_resource_len(dev, 0));
641 irqport = pci_resource_start(dev, 0) + IOC4_INTR_OFFSET; 653 if (virt_base == NULL) {
654 printk(KERN_ERR "%s: Unable to remap BAR 0 address: 0x%lx\n",
655 d->name, bar0);
656 return -ENOMEM;
657 }
658 cmd_base = (unsigned long) virt_base + IOC4_CMD_OFFSET;
659 ctl = (unsigned long) virt_base + IOC4_CTRL_OFFSET;
660 irqport = (unsigned long) virt_base + IOC4_INTR_OFFSET;
642 dma_base = pci_resource_start(dev, 0) + IOC4_DMA_OFFSET; 661 dma_base = pci_resource_start(dev, 0) + IOC4_DMA_OFFSET;
643 662
644 if (!request_region(base, IOC4_CMD_CTL_BLK_SIZE, hwif->name)) { 663 cmd_phys_base = bar0 + IOC4_CMD_OFFSET;
664 if (!request_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE,
665 hwif->name)) {
645 printk(KERN_ERR 666 printk(KERN_ERR
646 "%s : %s -- ERROR, Port Addresses " 667 "%s : %s -- ERROR, Addresses "
647 "0x%p to 0x%p ALREADY in use\n", 668 "0x%p to 0x%p ALREADY in use\n",
648 __FUNCTION__, hwif->name, (void *) base, 669 __FUNCTION__, hwif->name, (void *) cmd_phys_base,
649 (void *) base + IOC4_CMD_CTL_BLK_SIZE); 670 (void *) cmd_phys_base + IOC4_CMD_CTL_BLK_SIZE);
650 return -ENOMEM; 671 return -ENOMEM;
651 } 672 }
652 673
653 if (hwif->io_ports[IDE_DATA_OFFSET] != base) { 674 if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base) {
654 /* Initialize the IO registers */ 675 /* Initialize the IO registers */
655 sgiioc4_init_hwif_ports(&hwif->hw, base, ctl, irqport); 676 sgiioc4_init_hwif_ports(&hwif->hw, cmd_base, ctl, irqport);
656 memcpy(hwif->io_ports, hwif->hw.io_ports, 677 memcpy(hwif->io_ports, hwif->hw.io_ports,
657 sizeof (hwif->io_ports)); 678 sizeof (hwif->io_ports));
658 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; 679 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
@@ -665,6 +686,9 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t * d)
665 hwif->cds = (struct ide_pci_device_s *) d; 686 hwif->cds = (struct ide_pci_device_s *) d;
666 hwif->gendev.parent = &dev->dev;/* setup proper ancestral information */ 687 hwif->gendev.parent = &dev->dev;/* setup proper ancestral information */
667 688
689 /* The IOC4 uses MMIO rather than Port IO. */
690 default_hwif_mmiops(hwif);
691
668 /* Initializing chipset IRQ Registers */ 692 /* Initializing chipset IRQ Registers */
669 hwif->OUTL(0x03, irqport + IOC4_INTR_SET * 4); 693 hwif->OUTL(0x03, irqport + IOC4_INTR_SET * 4);
670 694
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 25ceb4a39ed2..20b392948f36 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -1082,10 +1082,10 @@ static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_devi
1082} 1082}
1083 1083
1084static struct pci_device_id siimage_pci_tbl[] = { 1084static struct pci_device_id siimage_pci_tbl[] = {
1085 { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_680), 0}, 1085 { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
1086#ifdef CONFIG_BLK_DEV_IDE_SATA 1086#ifdef CONFIG_BLK_DEV_IDE_SATA
1087 { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_3112), 1}, 1087 { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
1088 { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_1210SA), 2}, 1088 { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_1210SA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
1089#endif 1089#endif
1090 { 0, }, 1090 { 0, },
1091}; 1091};
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 8a6c23ac8cc1..f03196c5db37 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -86,6 +86,8 @@ static const struct {
86 u8 chipset_family; 86 u8 chipset_family;
87 u8 flags; 87 u8 flags;
88} SiSHostChipInfo[] = { 88} SiSHostChipInfo[] = {
89 { "SiS968", PCI_DEVICE_ID_SI_968, ATA_133 },
90 { "SiS966", PCI_DEVICE_ID_SI_966, ATA_133 },
89 { "SiS965", PCI_DEVICE_ID_SI_965, ATA_133 }, 91 { "SiS965", PCI_DEVICE_ID_SI_965, ATA_133 },
90 { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 }, 92 { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 },
91 { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 }, 93 { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 },
diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c
index 25157f57a6d0..f930e55b58fc 100644
--- a/drivers/infiniband/hw/mthca/mthca_allocator.c
+++ b/drivers/infiniband/hw/mthca/mthca_allocator.c
@@ -41,9 +41,11 @@
41/* Trivial bitmap-based allocator */ 41/* Trivial bitmap-based allocator */
42u32 mthca_alloc(struct mthca_alloc *alloc) 42u32 mthca_alloc(struct mthca_alloc *alloc)
43{ 43{
44 unsigned long flags;
44 u32 obj; 45 u32 obj;
45 46
46 spin_lock(&alloc->lock); 47 spin_lock_irqsave(&alloc->lock, flags);
48
47 obj = find_next_zero_bit(alloc->table, alloc->max, alloc->last); 49 obj = find_next_zero_bit(alloc->table, alloc->max, alloc->last);
48 if (obj >= alloc->max) { 50 if (obj >= alloc->max) {
49 alloc->top = (alloc->top + alloc->max) & alloc->mask; 51 alloc->top = (alloc->top + alloc->max) & alloc->mask;
@@ -56,19 +58,24 @@ u32 mthca_alloc(struct mthca_alloc *alloc)
56 } else 58 } else
57 obj = -1; 59 obj = -1;
58 60
59 spin_unlock(&alloc->lock); 61 spin_unlock_irqrestore(&alloc->lock, flags);
60 62
61 return obj; 63 return obj;
62} 64}
63 65
64void mthca_free(struct mthca_alloc *alloc, u32 obj) 66void mthca_free(struct mthca_alloc *alloc, u32 obj)
65{ 67{
68 unsigned long flags;
69
66 obj &= alloc->max - 1; 70 obj &= alloc->max - 1;
67 spin_lock(&alloc->lock); 71
72 spin_lock_irqsave(&alloc->lock, flags);
73
68 clear_bit(obj, alloc->table); 74 clear_bit(obj, alloc->table);
69 alloc->last = min(alloc->last, obj); 75 alloc->last = min(alloc->last, obj);
70 alloc->top = (alloc->top + alloc->max) & alloc->mask; 76 alloc->top = (alloc->top + alloc->max) & alloc->mask;
71 spin_unlock(&alloc->lock); 77
78 spin_unlock_irqrestore(&alloc->lock, flags);
72} 79}
73 80
74int mthca_alloc_init(struct mthca_alloc *alloc, u32 num, u32 mask, 81int mthca_alloc_init(struct mthca_alloc *alloc, u32 num, u32 mask,
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c
index d3f8d75bcbb4..a82f313d9dc9 100644
--- a/drivers/macintosh/via-pmu-backlight.c
+++ b/drivers/macintosh/via-pmu-backlight.c
@@ -18,17 +18,48 @@
18static struct backlight_properties pmu_backlight_data; 18static struct backlight_properties pmu_backlight_data;
19static spinlock_t pmu_backlight_lock; 19static spinlock_t pmu_backlight_lock;
20static int sleeping; 20static int sleeping;
21static u8 bl_curve[FB_BACKLIGHT_LEVELS];
21 22
22static int pmu_backlight_get_level_brightness(struct fb_info *info, 23static void pmu_backlight_init_curve(u8 off, u8 min, u8 max)
23 int level) 24{
25 unsigned int i, flat, count, range = (max - min);
26
27 bl_curve[0] = off;
28
29 for (flat = 1; flat < (FB_BACKLIGHT_LEVELS / 16); ++flat)
30 bl_curve[flat] = min;
31
32 count = FB_BACKLIGHT_LEVELS * 15 / 16;
33 for (i = 0; i < count; ++i)
34 bl_curve[flat + i] = min + (range * (i + 1) / count);
35}
36
37static int pmu_backlight_curve_lookup(int value)
38{
39 int level = (FB_BACKLIGHT_LEVELS - 1);
40 int i, max = 0;
41
42 /* Look for biggest value */
43 for (i = 0; i < FB_BACKLIGHT_LEVELS; i++)
44 max = max((int)bl_curve[i], max);
45
46 /* Look for nearest value */
47 for (i = 0; i < FB_BACKLIGHT_LEVELS; i++) {
48 int diff = abs(bl_curve[i] - value);
49 if (diff < max) {
50 max = diff;
51 level = i;
52 }
53 }
54 return level;
55}
56
57static int pmu_backlight_get_level_brightness(int level)
24{ 58{
25 int pmulevel; 59 int pmulevel;
26 60
27 /* Get and convert the value */ 61 /* Get and convert the value */
28 mutex_lock(&info->bl_mutex); 62 pmulevel = bl_curve[level] * FB_BACKLIGHT_MAX / MAX_PMU_LEVEL;
29 pmulevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_PMU_LEVEL;
30 mutex_unlock(&info->bl_mutex);
31
32 if (pmulevel < 0) 63 if (pmulevel < 0)
33 pmulevel = 0; 64 pmulevel = 0;
34 else if (pmulevel > MAX_PMU_LEVEL) 65 else if (pmulevel > MAX_PMU_LEVEL)
@@ -39,7 +70,6 @@ static int pmu_backlight_get_level_brightness(struct fb_info *info,
39 70
40static int pmu_backlight_update_status(struct backlight_device *bd) 71static int pmu_backlight_update_status(struct backlight_device *bd)
41{ 72{
42 struct fb_info *info = class_get_devdata(&bd->class_dev);
43 struct adb_request req; 73 struct adb_request req;
44 unsigned long flags; 74 unsigned long flags;
45 int level = bd->props->brightness; 75 int level = bd->props->brightness;
@@ -55,7 +85,7 @@ static int pmu_backlight_update_status(struct backlight_device *bd)
55 level = 0; 85 level = 0;
56 86
57 if (level > 0) { 87 if (level > 0) {
58 int pmulevel = pmu_backlight_get_level_brightness(info, level); 88 int pmulevel = pmu_backlight_get_level_brightness(level);
59 89
60 pmu_request(&req, NULL, 2, PMU_BACKLIGHT_BRIGHT, pmulevel); 90 pmu_request(&req, NULL, 2, PMU_BACKLIGHT_BRIGHT, pmulevel);
61 pmu_wait_complete(&req); 91 pmu_wait_complete(&req);
@@ -88,35 +118,19 @@ static struct backlight_properties pmu_backlight_data = {
88}; 118};
89 119
90#ifdef CONFIG_PM 120#ifdef CONFIG_PM
91static int pmu_backlight_sleep_call(struct pmu_sleep_notifier *self, int when) 121void pmu_backlight_set_sleep(int sleep)
92{ 122{
93 unsigned long flags; 123 unsigned long flags;
94 124
95 spin_lock_irqsave(&pmu_backlight_lock, flags); 125 spin_lock_irqsave(&pmu_backlight_lock, flags);
96 126 sleeping = sleep;
97 switch (when) {
98 case PBOOK_SLEEP_REQUEST:
99 sleeping = 1;
100 break;
101 case PBOOK_WAKE:
102 sleeping = 0;
103 break;
104 }
105
106 spin_unlock_irqrestore(&pmu_backlight_lock, flags); 127 spin_unlock_irqrestore(&pmu_backlight_lock, flags);
107
108 return PBOOK_SLEEP_OK;
109} 128}
110 129#endif /* CONFIG_PM */
111static struct pmu_sleep_notifier pmu_backlight_sleep_notif = {
112 .notifier_call = pmu_backlight_sleep_call,
113};
114#endif
115 130
116void __init pmu_backlight_init() 131void __init pmu_backlight_init()
117{ 132{
118 struct backlight_device *bd; 133 struct backlight_device *bd;
119 struct fb_info *info;
120 char name[10]; 134 char name[10];
121 int level, autosave; 135 int level, autosave;
122 136
@@ -131,27 +145,14 @@ void __init pmu_backlight_init()
131 !machine_is_compatible("PowerBook1,1")) 145 !machine_is_compatible("PowerBook1,1"))
132 return; 146 return;
133 147
134 /* Actually, this is a hack, but I don't know of a better way 148 snprintf(name, sizeof(name), "pmubl");
135 * to get the first framebuffer device.
136 */
137 info = registered_fb[0];
138 if (!info) {
139 printk("pmubl: No framebuffer found\n");
140 goto error;
141 }
142
143 snprintf(name, sizeof(name), "pmubl%d", info->node);
144 149
145 bd = backlight_device_register(name, info, &pmu_backlight_data); 150 bd = backlight_device_register(name, NULL, &pmu_backlight_data);
146 if (IS_ERR(bd)) { 151 if (IS_ERR(bd)) {
147 printk("pmubl: Backlight registration failed\n"); 152 printk("pmubl: Backlight registration failed\n");
148 goto error; 153 goto error;
149 } 154 }
150 155 pmu_backlight_init_curve(0x7F, 0x46, 0x0E);
151 mutex_lock(&info->bl_mutex);
152 info->bl_dev = bd;
153 fb_bl_default_curve(info, 0x7F, 0x46, 0x0E);
154 mutex_unlock(&info->bl_mutex);
155 156
156 level = pmu_backlight_data.max_brightness; 157 level = pmu_backlight_data.max_brightness;
157 158
@@ -161,28 +162,22 @@ void __init pmu_backlight_init()
161 pmu_request(&req, NULL, 2, 0xd9, 0); 162 pmu_request(&req, NULL, 2, 0xd9, 0);
162 pmu_wait_complete(&req); 163 pmu_wait_complete(&req);
163 164
164 mutex_lock(&info->bl_mutex); 165 level = pmu_backlight_curve_lookup(
165 level = pmac_backlight_curve_lookup(info,
166 (req.reply[0] >> 4) * 166 (req.reply[0] >> 4) *
167 pmu_backlight_data.max_brightness / 15); 167 pmu_backlight_data.max_brightness / 15);
168 mutex_unlock(&info->bl_mutex);
169 } 168 }
170 169
171 up(&bd->sem); 170 down(&bd->sem);
172 bd->props->brightness = level; 171 bd->props->brightness = level;
173 bd->props->power = FB_BLANK_UNBLANK; 172 bd->props->power = FB_BLANK_UNBLANK;
174 bd->props->update_status(bd); 173 bd->props->update_status(bd);
175 down(&bd->sem); 174 up(&bd->sem);
176 175
177 mutex_lock(&pmac_backlight_mutex); 176 mutex_lock(&pmac_backlight_mutex);
178 if (!pmac_backlight) 177 if (!pmac_backlight)
179 pmac_backlight = bd; 178 pmac_backlight = bd;
180 mutex_unlock(&pmac_backlight_mutex); 179 mutex_unlock(&pmac_backlight_mutex);
181 180
182#ifdef CONFIG_PM
183 pmu_register_sleep_notifier(&pmu_backlight_sleep_notif);
184#endif
185
186 printk("pmubl: Backlight initialized (%s)\n", name); 181 printk("pmubl: Backlight initialized (%s)\n", name);
187 182
188 return; 183 return;
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 0df500b9a66b..dda03985dcf5 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -1995,6 +1995,8 @@ restore_via_state(void)
1995 out_8(&via[IER], IER_SET | SR_INT | CB1_INT); 1995 out_8(&via[IER], IER_SET | SR_INT | CB1_INT);
1996} 1996}
1997 1997
1998extern void pmu_backlight_set_sleep(int sleep);
1999
1998static int 2000static int
1999pmac_suspend_devices(void) 2001pmac_suspend_devices(void)
2000{ 2002{
@@ -2032,6 +2034,11 @@ pmac_suspend_devices(void)
2032 return -EBUSY; 2034 return -EBUSY;
2033 } 2035 }
2034 2036
2037#ifdef CONFIG_PMAC_BACKLIGHT
2038 /* Tell backlight code not to muck around with the chip anymore */
2039 pmu_backlight_set_sleep(1);
2040#endif
2041
2035 /* Call platform functions marked "on sleep" */ 2042 /* Call platform functions marked "on sleep" */
2036 pmac_pfunc_i2c_suspend(); 2043 pmac_pfunc_i2c_suspend();
2037 pmac_pfunc_base_suspend(); 2044 pmac_pfunc_base_suspend();
@@ -2090,6 +2097,11 @@ pmac_wakeup_devices(void)
2090{ 2097{
2091 mdelay(100); 2098 mdelay(100);
2092 2099
2100#ifdef CONFIG_PMAC_BACKLIGHT
2101 /* Tell backlight code it can use the chip again */
2102 pmu_backlight_set_sleep(0);
2103#endif
2104
2093 /* Power back up system devices (including the PIC) */ 2105 /* Power back up system devices (including the PIC) */
2094 device_power_up(); 2106 device_power_up();
2095 2107
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 87bfe9e7d8ca..3b4d69c05623 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -930,10 +930,13 @@ static void status(struct seq_file *seq, mddev_t *mddev)
930 930
931 seq_printf(seq, " [%d/%d] [", conf->raid_disks, 931 seq_printf(seq, " [%d/%d] [", conf->raid_disks,
932 conf->working_disks); 932 conf->working_disks);
933 for (i = 0; i < conf->raid_disks; i++) 933 rcu_read_lock();
934 for (i = 0; i < conf->raid_disks; i++) {
935 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
934 seq_printf(seq, "%s", 936 seq_printf(seq, "%s",
935 conf->mirrors[i].rdev && 937 rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_");
936 test_bit(In_sync, &conf->mirrors[i].rdev->flags) ? "U" : "_"); 938 }
939 rcu_read_unlock();
937 seq_printf(seq, "]"); 940 seq_printf(seq, "]");
938} 941}
939 942
@@ -975,7 +978,6 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
975static void print_conf(conf_t *conf) 978static void print_conf(conf_t *conf)
976{ 979{
977 int i; 980 int i;
978 mirror_info_t *tmp;
979 981
980 printk("RAID1 conf printout:\n"); 982 printk("RAID1 conf printout:\n");
981 if (!conf) { 983 if (!conf) {
@@ -985,14 +987,17 @@ static void print_conf(conf_t *conf)
985 printk(" --- wd:%d rd:%d\n", conf->working_disks, 987 printk(" --- wd:%d rd:%d\n", conf->working_disks,
986 conf->raid_disks); 988 conf->raid_disks);
987 989
990 rcu_read_lock();
988 for (i = 0; i < conf->raid_disks; i++) { 991 for (i = 0; i < conf->raid_disks; i++) {
989 char b[BDEVNAME_SIZE]; 992 char b[BDEVNAME_SIZE];
990 tmp = conf->mirrors + i; 993 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
991 if (tmp->rdev) 994 if (rdev)
992 printk(" disk %d, wo:%d, o:%d, dev:%s\n", 995 printk(" disk %d, wo:%d, o:%d, dev:%s\n",
993 i, !test_bit(In_sync, &tmp->rdev->flags), !test_bit(Faulty, &tmp->rdev->flags), 996 i, !test_bit(In_sync, &rdev->flags),
994 bdevname(tmp->rdev->bdev,b)); 997 !test_bit(Faulty, &rdev->flags),
998 bdevname(rdev->bdev,b));
995 } 999 }
1000 rcu_read_unlock();
996} 1001}
997 1002
998static void close_sync(conf_t *conf) 1003static void close_sync(conf_t *conf)
@@ -1008,20 +1013,20 @@ static int raid1_spare_active(mddev_t *mddev)
1008{ 1013{
1009 int i; 1014 int i;
1010 conf_t *conf = mddev->private; 1015 conf_t *conf = mddev->private;
1011 mirror_info_t *tmp;
1012 1016
1013 /* 1017 /*
1014 * Find all failed disks within the RAID1 configuration 1018 * Find all failed disks within the RAID1 configuration
1015 * and mark them readable 1019 * and mark them readable.
1020 * Called under mddev lock, so rcu protection not needed.
1016 */ 1021 */
1017 for (i = 0; i < conf->raid_disks; i++) { 1022 for (i = 0; i < conf->raid_disks; i++) {
1018 tmp = conf->mirrors + i; 1023 mdk_rdev_t *rdev = conf->mirrors[i].rdev;
1019 if (tmp->rdev 1024 if (rdev
1020 && !test_bit(Faulty, &tmp->rdev->flags) 1025 && !test_bit(Faulty, &rdev->flags)
1021 && !test_bit(In_sync, &tmp->rdev->flags)) { 1026 && !test_bit(In_sync, &rdev->flags)) {
1022 conf->working_disks++; 1027 conf->working_disks++;
1023 mddev->degraded--; 1028 mddev->degraded--;
1024 set_bit(In_sync, &tmp->rdev->flags); 1029 set_bit(In_sync, &rdev->flags);
1025 } 1030 }
1026 } 1031 }
1027 1032
@@ -1237,7 +1242,7 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
1237 /* ouch - failed to read all of that. 1242 /* ouch - failed to read all of that.
1238 * Try some synchronous reads of other devices to get 1243 * Try some synchronous reads of other devices to get
1239 * good data, much like with normal read errors. Only 1244 * good data, much like with normal read errors. Only
1240 * read into the pages we already have so they we don't 1245 * read into the pages we already have so we don't
1241 * need to re-issue the read request. 1246 * need to re-issue the read request.
1242 * We don't need to freeze the array, because being in an 1247 * We don't need to freeze the array, because being in an
1243 * active sync request, there is no normal IO, and 1248 * active sync request, there is no normal IO, and
@@ -1257,6 +1262,10 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
1257 s = PAGE_SIZE >> 9; 1262 s = PAGE_SIZE >> 9;
1258 do { 1263 do {
1259 if (r1_bio->bios[d]->bi_end_io == end_sync_read) { 1264 if (r1_bio->bios[d]->bi_end_io == end_sync_read) {
1265 /* No rcu protection needed here devices
1266 * can only be removed when no resync is
1267 * active, and resync is currently active
1268 */
1260 rdev = conf->mirrors[d].rdev; 1269 rdev = conf->mirrors[d].rdev;
1261 if (sync_page_io(rdev->bdev, 1270 if (sync_page_io(rdev->bdev,
1262 sect + rdev->data_offset, 1271 sect + rdev->data_offset,
@@ -1463,6 +1472,11 @@ static void raid1d(mddev_t *mddev)
1463 s = PAGE_SIZE >> 9; 1472 s = PAGE_SIZE >> 9;
1464 1473
1465 do { 1474 do {
1475 /* Note: no rcu protection needed here
1476 * as this is synchronous in the raid1d thread
1477 * which is the thread that might remove
1478 * a device. If raid1d ever becomes multi-threaded....
1479 */
1466 rdev = conf->mirrors[d].rdev; 1480 rdev = conf->mirrors[d].rdev;
1467 if (rdev && 1481 if (rdev &&
1468 test_bit(In_sync, &rdev->flags) && 1482 test_bit(In_sync, &rdev->flags) &&
@@ -1486,7 +1500,6 @@ static void raid1d(mddev_t *mddev)
1486 d = conf->raid_disks; 1500 d = conf->raid_disks;
1487 d--; 1501 d--;
1488 rdev = conf->mirrors[d].rdev; 1502 rdev = conf->mirrors[d].rdev;
1489 atomic_add(s, &rdev->corrected_errors);
1490 if (rdev && 1503 if (rdev &&
1491 test_bit(In_sync, &rdev->flags)) { 1504 test_bit(In_sync, &rdev->flags)) {
1492 if (sync_page_io(rdev->bdev, 1505 if (sync_page_io(rdev->bdev,
@@ -1509,9 +1522,11 @@ static void raid1d(mddev_t *mddev)
1509 s<<9, conf->tmppage, READ) == 0) 1522 s<<9, conf->tmppage, READ) == 0)
1510 /* Well, this device is dead */ 1523 /* Well, this device is dead */
1511 md_error(mddev, rdev); 1524 md_error(mddev, rdev);
1512 else 1525 else {
1526 atomic_add(s, &rdev->corrected_errors);
1513 printk(KERN_INFO "raid1:%s: read error corrected (%d sectors at %llu on %s)\n", 1527 printk(KERN_INFO "raid1:%s: read error corrected (%d sectors at %llu on %s)\n",
1514 mdname(mddev), s, (unsigned long long)(sect + rdev->data_offset), bdevname(rdev->bdev, b)); 1528 mdname(mddev), s, (unsigned long long)(sect + rdev->data_offset), bdevname(rdev->bdev, b));
1529 }
1515 } 1530 }
1516 } 1531 }
1517 } else { 1532 } else {
@@ -1787,19 +1802,17 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1787 for (i=0; i<conf->raid_disks; i++) { 1802 for (i=0; i<conf->raid_disks; i++) {
1788 bio = r1_bio->bios[i]; 1803 bio = r1_bio->bios[i];
1789 if (bio->bi_end_io == end_sync_read) { 1804 if (bio->bi_end_io == end_sync_read) {
1790 md_sync_acct(conf->mirrors[i].rdev->bdev, nr_sectors); 1805 md_sync_acct(bio->bi_bdev, nr_sectors);
1791 generic_make_request(bio); 1806 generic_make_request(bio);
1792 } 1807 }
1793 } 1808 }
1794 } else { 1809 } else {
1795 atomic_set(&r1_bio->remaining, 1); 1810 atomic_set(&r1_bio->remaining, 1);
1796 bio = r1_bio->bios[r1_bio->read_disk]; 1811 bio = r1_bio->bios[r1_bio->read_disk];
1797 md_sync_acct(conf->mirrors[r1_bio->read_disk].rdev->bdev, 1812 md_sync_acct(bio->bi_bdev, nr_sectors);
1798 nr_sectors);
1799 generic_make_request(bio); 1813 generic_make_request(bio);
1800 1814
1801 } 1815 }
1802
1803 return nr_sectors; 1816 return nr_sectors;
1804} 1817}
1805 1818
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index ef52e6da01ed..ed4aa4e7912c 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -53,7 +53,7 @@ config VIDEO_V4L1_COMPAT
53 If you are unsure as to whether this is required, answer Y. 53 If you are unsure as to whether this is required, answer Y.
54 54
55config VIDEO_V4L2 55config VIDEO_V4L2
56 tristate 56 bool
57 default y 57 default y
58 58
59source "drivers/media/video/Kconfig" 59source "drivers/media/video/Kconfig"
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 8393d472d3b8..7e0cedc557df 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -1190,6 +1190,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1190 } 1190 }
1191 return err; 1191 return err;
1192 } 1192 }
1193#ifdef CONFIG_VIDEO_V4L1_COMPAT
1193 case VIDIOCGMBUF: 1194 case VIDIOCGMBUF:
1194 { 1195 {
1195 struct video_mbuf *mbuf = arg; 1196 struct video_mbuf *mbuf = arg;
@@ -1218,6 +1219,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1218 mutex_unlock(&q->lock); 1219 mutex_unlock(&q->lock);
1219 return 0; 1220 return 0;
1220 } 1221 }
1222#endif
1221 default: 1223 default:
1222 return v4l_compat_translate_ioctl(inode,file,cmd,arg, 1224 return v4l_compat_translate_ioctl(inode,file,cmd,arg,
1223 saa7146_video_do_ioctl); 1225 saa7146_video_do_ioctl);
diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig
index d7f1fd5b7b02..49a06fc54c51 100644
--- a/drivers/media/dvb/b2c2/Kconfig
+++ b/drivers/media/dvb/b2c2/Kconfig
@@ -1,6 +1,7 @@
1config DVB_B2C2_FLEXCOP 1config DVB_B2C2_FLEXCOP
2 tristate "Technisat/B2C2 FlexCopII(b) and FlexCopIII adapters" 2 tristate "Technisat/B2C2 FlexCopII(b) and FlexCopIII adapters"
3 depends on DVB_CORE && I2C 3 depends on DVB_CORE && I2C
4 select DVB_PLL
4 select DVB_STV0299 5 select DVB_STV0299
5 select DVB_MT352 6 select DVB_MT352
6 select DVB_MT312 7 select DVB_MT312
diff --git a/drivers/media/dvb/bt8xx/Kconfig b/drivers/media/dvb/bt8xx/Kconfig
index f394002118f8..7d0ee1ab2903 100644
--- a/drivers/media/dvb/bt8xx/Kconfig
+++ b/drivers/media/dvb/bt8xx/Kconfig
@@ -1,6 +1,7 @@
1config DVB_BT8XX 1config DVB_BT8XX
2 tristate "BT8xx based PCI cards" 2 tristate "BT8xx based PCI cards"
3 depends on DVB_CORE && PCI && I2C && VIDEO_BT848 3 depends on DVB_CORE && PCI && I2C && VIDEO_BT848
4 select DVB_PLL
4 select DVB_MT352 5 select DVB_MT352
5 select DVB_SP887X 6 select DVB_SP887X
6 select DVB_NXT6000 7 select DVB_NXT6000
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 3bc6722a6443..75824b77198a 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -2,6 +2,7 @@ config DVB_USB
2 tristate "Support for various USB DVB devices" 2 tristate "Support for various USB DVB devices"
3 depends on DVB_CORE && USB && I2C 3 depends on DVB_CORE && USB && I2C
4 select FW_LOADER 4 select FW_LOADER
5 select DVB_PLL
5 help 6 help
6 By enabling this you will be able to choose the various supported 7 By enabling this you will be able to choose the various supported
7 USB1.1 and USB2.0 DVB devices. 8 USB1.1 and USB2.0 DVB devices.
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index 0ef361f0309b..db978555b1eb 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -6,43 +6,43 @@ comment "DVB-S (satellite) frontends"
6 6
7config DVB_STV0299 7config DVB_STV0299
8 tristate "ST STV0299 based" 8 tristate "ST STV0299 based"
9 depends on DVB_CORE 9 depends on DVB_CORE && I2C
10 help 10 help
11 A DVB-S tuner module. Say Y when you want to support this frontend. 11 A DVB-S tuner module. Say Y when you want to support this frontend.
12 12
13config DVB_CX24110 13config DVB_CX24110
14 tristate "Conexant CX24110 based" 14 tristate "Conexant CX24110 based"
15 depends on DVB_CORE 15 depends on DVB_CORE && I2C
16 help 16 help
17 A DVB-S tuner module. Say Y when you want to support this frontend. 17 A DVB-S tuner module. Say Y when you want to support this frontend.
18 18
19config DVB_CX24123 19config DVB_CX24123
20 tristate "Conexant CX24123 based" 20 tristate "Conexant CX24123 based"
21 depends on DVB_CORE 21 depends on DVB_CORE && I2C
22 help 22 help
23 A DVB-S tuner module. Say Y when you want to support this frontend. 23 A DVB-S tuner module. Say Y when you want to support this frontend.
24 24
25config DVB_TDA8083 25config DVB_TDA8083
26 tristate "Philips TDA8083 based" 26 tristate "Philips TDA8083 based"
27 depends on DVB_CORE 27 depends on DVB_CORE && I2C
28 help 28 help
29 A DVB-S tuner module. Say Y when you want to support this frontend. 29 A DVB-S tuner module. Say Y when you want to support this frontend.
30 30
31config DVB_MT312 31config DVB_MT312
32 tristate "Zarlink VP310/MT312 based" 32 tristate "Zarlink VP310/MT312 based"
33 depends on DVB_CORE 33 depends on DVB_CORE && I2C
34 help 34 help
35 A DVB-S tuner module. Say Y when you want to support this frontend. 35 A DVB-S tuner module. Say Y when you want to support this frontend.
36 36
37config DVB_VES1X93 37config DVB_VES1X93
38 tristate "VLSI VES1893 or VES1993 based" 38 tristate "VLSI VES1893 or VES1993 based"
39 depends on DVB_CORE 39 depends on DVB_CORE && I2C
40 help 40 help
41 A DVB-S tuner module. Say Y when you want to support this frontend. 41 A DVB-S tuner module. Say Y when you want to support this frontend.
42 42
43config DVB_S5H1420 43config DVB_S5H1420
44 tristate "Samsung S5H1420 based" 44 tristate "Samsung S5H1420 based"
45 depends on DVB_CORE 45 depends on DVB_CORE && I2C
46 help 46 help
47 A DVB-S tuner module. Say Y when you want to support this frontend. 47 A DVB-S tuner module. Say Y when you want to support this frontend.
48 48
@@ -51,7 +51,7 @@ comment "DVB-T (terrestrial) frontends"
51 51
52config DVB_SP8870 52config DVB_SP8870
53 tristate "Spase sp8870 based" 53 tristate "Spase sp8870 based"
54 depends on DVB_CORE 54 depends on DVB_CORE && I2C
55 select FW_LOADER 55 select FW_LOADER
56 help 56 help
57 A DVB-T tuner module. Say Y when you want to support this frontend. 57 A DVB-T tuner module. Say Y when you want to support this frontend.
@@ -63,7 +63,7 @@ config DVB_SP8870
63 63
64config DVB_SP887X 64config DVB_SP887X
65 tristate "Spase sp887x based" 65 tristate "Spase sp887x based"
66 depends on DVB_CORE 66 depends on DVB_CORE && I2C
67 select FW_LOADER 67 select FW_LOADER
68 help 68 help
69 A DVB-T tuner module. Say Y when you want to support this frontend. 69 A DVB-T tuner module. Say Y when you want to support this frontend.
@@ -75,25 +75,25 @@ config DVB_SP887X
75 75
76config DVB_CX22700 76config DVB_CX22700
77 tristate "Conexant CX22700 based" 77 tristate "Conexant CX22700 based"
78 depends on DVB_CORE 78 depends on DVB_CORE && I2C
79 help 79 help
80 A DVB-T tuner module. Say Y when you want to support this frontend. 80 A DVB-T tuner module. Say Y when you want to support this frontend.
81 81
82config DVB_CX22702 82config DVB_CX22702
83 tristate "Conexant cx22702 demodulator (OFDM)" 83 tristate "Conexant cx22702 demodulator (OFDM)"
84 depends on DVB_CORE 84 depends on DVB_CORE && I2C
85 help 85 help
86 A DVB-T tuner module. Say Y when you want to support this frontend. 86 A DVB-T tuner module. Say Y when you want to support this frontend.
87 87
88config DVB_L64781 88config DVB_L64781
89 tristate "LSI L64781" 89 tristate "LSI L64781"
90 depends on DVB_CORE 90 depends on DVB_CORE && I2C
91 help 91 help
92 A DVB-T tuner module. Say Y when you want to support this frontend. 92 A DVB-T tuner module. Say Y when you want to support this frontend.
93 93
94config DVB_TDA1004X 94config DVB_TDA1004X
95 tristate "Philips TDA10045H/TDA10046H based" 95 tristate "Philips TDA10045H/TDA10046H based"
96 depends on DVB_CORE 96 depends on DVB_CORE && I2C
97 select FW_LOADER 97 select FW_LOADER
98 help 98 help
99 A DVB-T tuner module. Say Y when you want to support this frontend. 99 A DVB-T tuner module. Say Y when you want to support this frontend.
@@ -106,32 +106,32 @@ config DVB_TDA1004X
106 106
107config DVB_NXT6000 107config DVB_NXT6000
108 tristate "NxtWave Communications NXT6000 based" 108 tristate "NxtWave Communications NXT6000 based"
109 depends on DVB_CORE 109 depends on DVB_CORE && I2C
110 help 110 help
111 A DVB-T tuner module. Say Y when you want to support this frontend. 111 A DVB-T tuner module. Say Y when you want to support this frontend.
112 112
113config DVB_MT352 113config DVB_MT352
114 tristate "Zarlink MT352 based" 114 tristate "Zarlink MT352 based"
115 depends on DVB_CORE 115 depends on DVB_CORE && I2C
116 help 116 help
117 A DVB-T tuner module. Say Y when you want to support this frontend. 117 A DVB-T tuner module. Say Y when you want to support this frontend.
118 118
119config DVB_ZL10353 119config DVB_ZL10353
120 tristate "Zarlink ZL10353 based" 120 tristate "Zarlink ZL10353 based"
121 depends on DVB_CORE 121 depends on DVB_CORE && I2C
122 help 122 help
123 A DVB-T tuner module. Say Y when you want to support this frontend. 123 A DVB-T tuner module. Say Y when you want to support this frontend.
124 124
125config DVB_DIB3000MB 125config DVB_DIB3000MB
126 tristate "DiBcom 3000M-B" 126 tristate "DiBcom 3000M-B"
127 depends on DVB_CORE 127 depends on DVB_CORE && I2C
128 help 128 help
129 A DVB-T tuner module. Designed for mobile usage. Say Y when you want 129 A DVB-T tuner module. Designed for mobile usage. Say Y when you want
130 to support this frontend. 130 to support this frontend.
131 131
132config DVB_DIB3000MC 132config DVB_DIB3000MC
133 tristate "DiBcom 3000P/M-C" 133 tristate "DiBcom 3000P/M-C"
134 depends on DVB_CORE 134 depends on DVB_CORE && I2C
135 help 135 help
136 A DVB-T tuner module. Designed for mobile usage. Say Y when you want 136 A DVB-T tuner module. Designed for mobile usage. Say Y when you want
137 to support this frontend. 137 to support this frontend.
@@ -141,19 +141,19 @@ comment "DVB-C (cable) frontends"
141 141
142config DVB_VES1820 142config DVB_VES1820
143 tristate "VLSI VES1820 based" 143 tristate "VLSI VES1820 based"
144 depends on DVB_CORE 144 depends on DVB_CORE && I2C
145 help 145 help
146 A DVB-C tuner module. Say Y when you want to support this frontend. 146 A DVB-C tuner module. Say Y when you want to support this frontend.
147 147
148config DVB_TDA10021 148config DVB_TDA10021
149 tristate "Philips TDA10021 based" 149 tristate "Philips TDA10021 based"
150 depends on DVB_CORE 150 depends on DVB_CORE && I2C
151 help 151 help
152 A DVB-C tuner module. Say Y when you want to support this frontend. 152 A DVB-C tuner module. Say Y when you want to support this frontend.
153 153
154config DVB_STV0297 154config DVB_STV0297
155 tristate "ST STV0297 based" 155 tristate "ST STV0297 based"
156 depends on DVB_CORE 156 depends on DVB_CORE && I2C
157 help 157 help
158 A DVB-C tuner module. Say Y when you want to support this frontend. 158 A DVB-C tuner module. Say Y when you want to support this frontend.
159 159
@@ -162,7 +162,7 @@ comment "ATSC (North American/Korean Terrestrial/Cable DTV) frontends"
162 162
163config DVB_NXT200X 163config DVB_NXT200X
164 tristate "NxtWave Communications NXT2002/NXT2004 based" 164 tristate "NxtWave Communications NXT2002/NXT2004 based"
165 depends on DVB_CORE 165 depends on DVB_CORE && I2C
166 select FW_LOADER 166 select FW_LOADER
167 help 167 help
168 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want 168 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
@@ -176,7 +176,7 @@ config DVB_NXT200X
176 176
177config DVB_OR51211 177config DVB_OR51211
178 tristate "Oren OR51211 based" 178 tristate "Oren OR51211 based"
179 depends on DVB_CORE 179 depends on DVB_CORE && I2C
180 select FW_LOADER 180 select FW_LOADER
181 help 181 help
182 An ATSC 8VSB tuner module. Say Y when you want to support this frontend. 182 An ATSC 8VSB tuner module. Say Y when you want to support this frontend.
@@ -188,7 +188,7 @@ config DVB_OR51211
188 188
189config DVB_OR51132 189config DVB_OR51132
190 tristate "Oren OR51132 based" 190 tristate "Oren OR51132 based"
191 depends on DVB_CORE 191 depends on DVB_CORE && I2C
192 select FW_LOADER 192 select FW_LOADER
193 help 193 help
194 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want 194 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
@@ -203,7 +203,7 @@ config DVB_OR51132
203 203
204config DVB_BCM3510 204config DVB_BCM3510
205 tristate "Broadcom BCM3510" 205 tristate "Broadcom BCM3510"
206 depends on DVB_CORE 206 depends on DVB_CORE && I2C
207 select FW_LOADER 207 select FW_LOADER
208 help 208 help
209 An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to 209 An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to
@@ -211,7 +211,7 @@ config DVB_BCM3510
211 211
212config DVB_LGDT330X 212config DVB_LGDT330X
213 tristate "LG Electronics LGDT3302/LGDT3303 based" 213 tristate "LG Electronics LGDT3302/LGDT3303 based"
214 depends on DVB_CORE 214 depends on DVB_CORE && I2C
215 help 215 help
216 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want 216 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
217 to support this frontend. 217 to support this frontend.
@@ -220,15 +220,19 @@ config DVB_LGDT330X
220comment "Miscellaneous devices" 220comment "Miscellaneous devices"
221 depends on DVB_CORE 221 depends on DVB_CORE
222 222
223config DVB_PLL
224 tristate
225 depends on DVB_CORE && I2C
226
223config DVB_LNBP21 227config DVB_LNBP21
224 tristate "LNBP21 SEC controller" 228 tristate "LNBP21 SEC controller"
225 depends on DVB_CORE 229 depends on DVB_CORE && I2C
226 help 230 help
227 An SEC control chip. 231 An SEC control chip.
228 232
229config DVB_ISL6421 233config DVB_ISL6421
230 tristate "ISL6421 SEC controller" 234 tristate "ISL6421 SEC controller"
231 depends on DVB_CORE 235 depends on DVB_CORE && I2C
232 help 236 help
233 An SEC control chip. 237 An SEC control chip.
234 238
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
index 5222245c7f59..0e4880b6db14 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -4,7 +4,7 @@
4 4
5EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ 5EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
6 6
7obj-$(CONFIG_DVB_CORE) += dvb-pll.o 7obj-$(CONFIG_DVB_PLL) += dvb-pll.o
8obj-$(CONFIG_DVB_STV0299) += stv0299.o 8obj-$(CONFIG_DVB_STV0299) += stv0299.o
9obj-$(CONFIG_DVB_SP8870) += sp8870.o 9obj-$(CONFIG_DVB_SP8870) += sp8870.o
10obj-$(CONFIG_DVB_CX22700) += cx22700.o 10obj-$(CONFIG_DVB_CX22700) += cx22700.o
diff --git a/drivers/media/dvb/pluto2/Kconfig b/drivers/media/dvb/pluto2/Kconfig
index 7d8e6e87bdbb..9b84b1bdc313 100644
--- a/drivers/media/dvb/pluto2/Kconfig
+++ b/drivers/media/dvb/pluto2/Kconfig
@@ -2,6 +2,7 @@ config DVB_PLUTO2
2 tristate "Pluto2 cards" 2 tristate "Pluto2 cards"
3 depends on DVB_CORE && PCI && I2C 3 depends on DVB_CORE && PCI && I2C
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select DVB_PLL
5 select DVB_TDA1004X 6 select DVB_TDA1004X
6 help 7 help
7 Support for PCI cards based on the Pluto2 FPGA like the Satelco 8 Support for PCI cards based on the Pluto2 FPGA like the Satelco
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig
index 987881fa988c..5fb097595cfb 100644
--- a/drivers/media/dvb/ttpci/Kconfig
+++ b/drivers/media/dvb/ttpci/Kconfig
@@ -3,6 +3,7 @@ config DVB_AV7110
3 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 3 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1
4 select FW_LOADER 4 select FW_LOADER
5 select VIDEO_SAA7146_VV 5 select VIDEO_SAA7146_VV
6 select DVB_PLL
6 select DVB_VES1820 7 select DVB_VES1820
7 select DVB_VES1X93 8 select DVB_VES1X93
8 select DVB_STV0299 9 select DVB_STV0299
@@ -61,6 +62,7 @@ config DVB_BUDGET
61 tristate "Budget cards" 62 tristate "Budget cards"
62 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 63 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1
63 select VIDEO_SAA7146 64 select VIDEO_SAA7146
65 select DVB_PLL
64 select DVB_STV0299 66 select DVB_STV0299
65 select DVB_VES1X93 67 select DVB_VES1X93
66 select DVB_VES1820 68 select DVB_VES1820
@@ -83,6 +85,7 @@ config DVB_BUDGET_CI
83 tristate "Budget cards with onboard CI connector" 85 tristate "Budget cards with onboard CI connector"
84 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 86 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1
85 select VIDEO_SAA7146 87 select VIDEO_SAA7146
88 select DVB_PLL
86 select DVB_STV0297 89 select DVB_STV0297
87 select DVB_STV0299 90 select DVB_STV0299
88 select DVB_TDA1004X 91 select DVB_TDA1004X
@@ -104,6 +107,7 @@ config DVB_BUDGET_AV
104 tristate "Budget cards with analog video inputs" 107 tristate "Budget cards with analog video inputs"
105 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 108 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1
106 select VIDEO_SAA7146_VV 109 select VIDEO_SAA7146_VV
110 select DVB_PLL
107 select DVB_STV0299 111 select DVB_STV0299
108 select DVB_TDA1004X 112 select DVB_TDA1004X
109 select DVB_TDA10021 113 select DVB_TDA10021
@@ -122,6 +126,7 @@ config DVB_BUDGET_PATCH
122 tristate "AV7110 cards with Budget Patch" 126 tristate "AV7110 cards with Budget Patch"
123 depends on DVB_CORE && DVB_BUDGET && VIDEO_V4L1 127 depends on DVB_CORE && DVB_BUDGET && VIDEO_V4L1
124 select DVB_AV7110 128 select DVB_AV7110
129 select DVB_PLL
125 select DVB_STV0299 130 select DVB_STV0299
126 select DVB_VES1X93 131 select DVB_VES1X93
127 select DVB_TDA8083 132 select DVB_TDA8083
diff --git a/drivers/media/dvb/ttusb-budget/Kconfig b/drivers/media/dvb/ttusb-budget/Kconfig
index 92c7cdcf8981..46a6a60d2ab9 100644
--- a/drivers/media/dvb/ttusb-budget/Kconfig
+++ b/drivers/media/dvb/ttusb-budget/Kconfig
@@ -1,6 +1,7 @@
1config DVB_TTUSB_BUDGET 1config DVB_TTUSB_BUDGET
2 tristate "Technotrend/Hauppauge Nova-USB devices" 2 tristate "Technotrend/Hauppauge Nova-USB devices"
3 depends on DVB_CORE && USB 3 depends on DVB_CORE && USB && I2C
4 select DVB_PLL
4 select DVB_CX22700 5 select DVB_CX22700
5 select DVB_TDA1004X 6 select DVB_TDA1004X
6 select DVB_VES1820 7 select DVB_VES1820
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 732bf1e7c326..94d078b77bab 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -260,7 +260,7 @@ source "drivers/media/video/saa7134/Kconfig"
260 260
261config VIDEO_MXB 261config VIDEO_MXB
262 tristate "Siemens-Nixdorf 'Multimedia eXtension Board'" 262 tristate "Siemens-Nixdorf 'Multimedia eXtension Board'"
263 depends on PCI && VIDEO_V4L1 263 depends on PCI && VIDEO_V4L1 && I2C
264 select VIDEO_SAA7146_VV 264 select VIDEO_SAA7146_VV
265 select VIDEO_TUNER 265 select VIDEO_TUNER
266 ---help--- 266 ---help---
@@ -272,7 +272,7 @@ config VIDEO_MXB
272 272
273config VIDEO_DPC 273config VIDEO_DPC
274 tristate "Philips-Semiconductors 'dpc7146 demonstration board'" 274 tristate "Philips-Semiconductors 'dpc7146 demonstration board'"
275 depends on PCI && VIDEO_V4L1 275 depends on PCI && VIDEO_V4L1 && I2C
276 select VIDEO_SAA7146_VV 276 select VIDEO_SAA7146_VV
277 select VIDEO_V4L2 277 select VIDEO_V4L2
278 ---help--- 278 ---help---
@@ -287,7 +287,7 @@ config VIDEO_DPC
287 287
288config VIDEO_HEXIUM_ORION 288config VIDEO_HEXIUM_ORION
289 tristate "Hexium HV-PCI6 and Orion frame grabber" 289 tristate "Hexium HV-PCI6 and Orion frame grabber"
290 depends on PCI && VIDEO_V4L1 290 depends on PCI && VIDEO_V4L1 && I2C
291 select VIDEO_SAA7146_VV 291 select VIDEO_SAA7146_VV
292 select VIDEO_V4L2 292 select VIDEO_V4L2
293 ---help--- 293 ---help---
@@ -299,7 +299,7 @@ config VIDEO_HEXIUM_ORION
299 299
300config VIDEO_HEXIUM_GEMINI 300config VIDEO_HEXIUM_GEMINI
301 tristate "Hexium Gemini frame grabber" 301 tristate "Hexium Gemini frame grabber"
302 depends on PCI && VIDEO_V4L1 302 depends on PCI && VIDEO_V4L1 && I2C
303 select VIDEO_SAA7146_VV 303 select VIDEO_SAA7146_VV
304 select VIDEO_V4L2 304 select VIDEO_V4L2
305 ---help--- 305 ---help---
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c
index b41f81d2372c..933d6db09acb 100644
--- a/drivers/media/video/bt8xx/bttv-input.c
+++ b/drivers/media/video/bt8xx/bttv-input.c
@@ -303,6 +303,7 @@ int bttv_input_init(struct bttv *btv)
303 ir->mask_keyup = 0x010000; 303 ir->mask_keyup = 0x010000;
304 ir->polling = 50; // ms 304 ir->polling = 50; // ms
305 break; 305 break;
306 case BTTV_BOARD_PV_M4900:
306 case BTTV_BOARD_PV_BT878P_9B: 307 case BTTV_BOARD_PV_BT878P_9B:
307 case BTTV_BOARD_PV_BT878P_PLUS: 308 case BTTV_BOARD_PV_BT878P_PLUS:
308 ir_codes = ir_codes_pixelview; 309 ir_codes = ir_codes_pixelview;
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index 80e23ee9801c..7a94e6a11927 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -51,6 +51,7 @@ config VIDEO_CX88_DVB
51 tristate "DVB/ATSC Support for cx2388x based TV cards" 51 tristate "DVB/ATSC Support for cx2388x based TV cards"
52 depends on VIDEO_CX88 && DVB_CORE 52 depends on VIDEO_CX88 && DVB_CORE
53 select VIDEO_BUF_DVB 53 select VIDEO_BUF_DVB
54 select DVB_PLL
54 ---help--- 55 ---help---
55 This adds support for DVB/ATSC cards based on the 56 This adds support for DVB/ATSC cards based on the
56 Conexant 2388x chip. 57 Conexant 2388x chip.
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index e1c1805df1fb..f5543166d193 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -40,6 +40,7 @@ config VIDEO_SAA7134_DVB
40 depends on VIDEO_SAA7134 && DVB_CORE 40 depends on VIDEO_SAA7134 && DVB_CORE
41 select VIDEO_BUF_DVB 41 select VIDEO_BUF_DVB
42 select FW_LOADER 42 select FW_LOADER
43 select DVB_PLL
43 ---help--- 44 ---help---
44 This adds support for DVB cards based on the 45 This adds support for DVB cards based on the
45 Philips saa7134 chip. 46 Philips saa7134 chip.
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
index d7eadc2c298d..8b542599ed47 100644
--- a/drivers/media/video/tuner-types.c
+++ b/drivers/media/video/tuner-types.c
@@ -926,11 +926,17 @@ static struct tuner_params tuner_lg_tdvs_h06xf_params[] = {
926 926
927/* ------------ TUNER_YMEC_TVF66T5_B_DFF - Philips PAL ------------ */ 927/* ------------ TUNER_YMEC_TVF66T5_B_DFF - Philips PAL ------------ */
928 928
929static struct tuner_range tuner_ymec_tvf66t5_b_dff_pal_ranges[] = {
930 { 16 * 160.25 /*MHz*/, 0x8e, 0x01, },
931 { 16 * 464.25 /*MHz*/, 0x8e, 0x02, },
932 { 16 * 999.99 , 0x8e, 0x08, },
933};
934
929static struct tuner_params tuner_ymec_tvf66t5_b_dff_params[] = { 935static struct tuner_params tuner_ymec_tvf66t5_b_dff_params[] = {
930 { 936 {
931 .type = TUNER_PARAM_TYPE_PAL, 937 .type = TUNER_PARAM_TYPE_PAL,
932 .ranges = tuner_tena_9533_di_pal_ranges, 938 .ranges = tuner_ymec_tvf66t5_b_dff_pal_ranges,
933 .count = ARRAY_SIZE(tuner_tena_9533_di_pal_ranges), 939 .count = ARRAY_SIZE(tuner_ymec_tvf66t5_b_dff_pal_ranges),
934 }, 940 },
935}; 941};
936 942
diff --git a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h
index ffcda95ed9d4..8fb4a3414e0a 100644
--- a/drivers/media/video/zoran.h
+++ b/drivers/media/video/zoran.h
@@ -267,7 +267,7 @@ struct zoran_v4l_settings {
267}; 267};
268 268
269/* whoops, this one is undeclared if !v4l2 */ 269/* whoops, this one is undeclared if !v4l2 */
270#ifndef HAVE_V4L2 270#ifndef CONFIG_VIDEO_V4L2
271struct v4l2_jpegcompression { 271struct v4l2_jpegcompression {
272 int quality; 272 int quality;
273 int APPn; 273 int APPn;
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index d9a5876eb386..5f90db27892b 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -86,7 +86,7 @@
86#include "zoran_device.h" 86#include "zoran_device.h"
87#include "zoran_card.h" 87#include "zoran_card.h"
88 88
89#ifdef HAVE_V4L2 89#ifdef CONFIG_VIDEO_V4L2
90 /* we declare some card type definitions here, they mean 90 /* we declare some card type definitions here, they mean
91 * the same as the v4l1 ZORAN_VID_TYPE above, except it's v4l2 */ 91 * the same as the v4l1 ZORAN_VID_TYPE above, except it's v4l2 */
92#define ZORAN_V4L2_VID_FLAGS ( \ 92#define ZORAN_V4L2_VID_FLAGS ( \
@@ -103,7 +103,7 @@ const struct zoran_format zoran_formats[] = {
103 { 103 {
104 .name = "15-bit RGB", 104 .name = "15-bit RGB",
105 .palette = VIDEO_PALETTE_RGB555, 105 .palette = VIDEO_PALETTE_RGB555,
106#ifdef HAVE_V4L2 106#ifdef CONFIG_VIDEO_V4L2
107#ifdef __LITTLE_ENDIAN 107#ifdef __LITTLE_ENDIAN
108 .fourcc = V4L2_PIX_FMT_RGB555, 108 .fourcc = V4L2_PIX_FMT_RGB555,
109#else 109#else
@@ -117,7 +117,7 @@ const struct zoran_format zoran_formats[] = {
117 }, { 117 }, {
118 .name = "16-bit RGB", 118 .name = "16-bit RGB",
119 .palette = VIDEO_PALETTE_RGB565, 119 .palette = VIDEO_PALETTE_RGB565,
120#ifdef HAVE_V4L2 120#ifdef CONFIG_VIDEO_V4L2
121#ifdef __LITTLE_ENDIAN 121#ifdef __LITTLE_ENDIAN
122 .fourcc = V4L2_PIX_FMT_RGB565, 122 .fourcc = V4L2_PIX_FMT_RGB565,
123#else 123#else
@@ -131,7 +131,7 @@ const struct zoran_format zoran_formats[] = {
131 }, { 131 }, {
132 .name = "24-bit RGB", 132 .name = "24-bit RGB",
133 .palette = VIDEO_PALETTE_RGB24, 133 .palette = VIDEO_PALETTE_RGB24,
134#ifdef HAVE_V4L2 134#ifdef CONFIG_VIDEO_V4L2
135#ifdef __LITTLE_ENDIAN 135#ifdef __LITTLE_ENDIAN
136 .fourcc = V4L2_PIX_FMT_BGR24, 136 .fourcc = V4L2_PIX_FMT_BGR24,
137#else 137#else
@@ -145,7 +145,7 @@ const struct zoran_format zoran_formats[] = {
145 }, { 145 }, {
146 .name = "32-bit RGB", 146 .name = "32-bit RGB",
147 .palette = VIDEO_PALETTE_RGB32, 147 .palette = VIDEO_PALETTE_RGB32,
148#ifdef HAVE_V4L2 148#ifdef CONFIG_VIDEO_V4L2
149#ifdef __LITTLE_ENDIAN 149#ifdef __LITTLE_ENDIAN
150 .fourcc = V4L2_PIX_FMT_BGR32, 150 .fourcc = V4L2_PIX_FMT_BGR32,
151#else 151#else
@@ -159,7 +159,7 @@ const struct zoran_format zoran_formats[] = {
159 }, { 159 }, {
160 .name = "4:2:2, packed, YUYV", 160 .name = "4:2:2, packed, YUYV",
161 .palette = VIDEO_PALETTE_YUV422, 161 .palette = VIDEO_PALETTE_YUV422,
162#ifdef HAVE_V4L2 162#ifdef CONFIG_VIDEO_V4L2
163 .fourcc = V4L2_PIX_FMT_YUYV, 163 .fourcc = V4L2_PIX_FMT_YUYV,
164 .colorspace = V4L2_COLORSPACE_SMPTE170M, 164 .colorspace = V4L2_COLORSPACE_SMPTE170M,
165#endif 165#endif
@@ -169,7 +169,7 @@ const struct zoran_format zoran_formats[] = {
169 }, { 169 }, {
170 .name = "Hardware-encoded Motion-JPEG", 170 .name = "Hardware-encoded Motion-JPEG",
171 .palette = -1, 171 .palette = -1,
172#ifdef HAVE_V4L2 172#ifdef CONFIG_VIDEO_V4L2
173 .fourcc = V4L2_PIX_FMT_MJPEG, 173 .fourcc = V4L2_PIX_FMT_MJPEG,
174 .colorspace = V4L2_COLORSPACE_SMPTE170M, 174 .colorspace = V4L2_COLORSPACE_SMPTE170M,
175#endif 175#endif
@@ -210,7 +210,7 @@ static int lock_norm = 0; /* 1=Don't change TV standard (norm) */
210module_param(lock_norm, int, 0); 210module_param(lock_norm, int, 0);
211MODULE_PARM_DESC(lock_norm, "Users can't change norm"); 211MODULE_PARM_DESC(lock_norm, "Users can't change norm");
212 212
213#ifdef HAVE_V4L2 213#ifdef CONFIG_VIDEO_V4L2
214 /* small helper function for calculating buffersizes for v4l2 214 /* small helper function for calculating buffersizes for v4l2
215 * we calculate the nearest higher power-of-two, which 215 * we calculate the nearest higher power-of-two, which
216 * will be the recommended buffersize */ 216 * will be the recommended buffersize */
@@ -1761,7 +1761,7 @@ setup_overlay (struct file *file,
1761 return wait_grab_pending(zr); 1761 return wait_grab_pending(zr);
1762} 1762}
1763 1763
1764#ifdef HAVE_V4L2 1764#ifdef CONFIG_VIDEO_V4L2
1765 /* get the status of a buffer in the clients buffer queue */ 1765 /* get the status of a buffer in the clients buffer queue */
1766static int 1766static int
1767zoran_v4l2_buffer_status (struct file *file, 1767zoran_v4l2_buffer_status (struct file *file,
@@ -2676,7 +2676,7 @@ zoran_do_ioctl (struct inode *inode,
2676 } 2676 }
2677 break; 2677 break;
2678 2678
2679#ifdef HAVE_V4L2 2679#ifdef CONFIG_VIDEO_V4L2
2680 2680
2681 /* The new video4linux2 capture interface - much nicer than video4linux1, since 2681 /* The new video4linux2 capture interface - much nicer than video4linux1, since
2682 * it allows for integrating the JPEG capturing calls inside standard v4l2 2682 * it allows for integrating the JPEG capturing calls inside standard v4l2
@@ -4689,7 +4689,7 @@ static struct file_operations zoran_fops = {
4689struct video_device zoran_template __devinitdata = { 4689struct video_device zoran_template __devinitdata = {
4690 .name = ZORAN_NAME, 4690 .name = ZORAN_NAME,
4691 .type = ZORAN_VID_TYPE, 4691 .type = ZORAN_VID_TYPE,
4692#ifdef HAVE_V4L2 4692#ifdef CONFIG_VIDEO_V4L2
4693 .type2 = ZORAN_V4L2_VID_FLAGS, 4693 .type2 = ZORAN_V4L2_VID_FLAGS,
4694#endif 4694#endif
4695 .hardware = ZORAN_HARDWARE, 4695 .hardware = ZORAN_HARDWARE,
diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/imxmmc.c
index 7ca9e95bdf89..fb6565b98f32 100644
--- a/drivers/mmc/imxmmc.c
+++ b/drivers/mmc/imxmmc.c
@@ -91,6 +91,8 @@ struct imxmci_host {
91 int dma_allocated; 91 int dma_allocated;
92 92
93 unsigned char actual_bus_width; 93 unsigned char actual_bus_width;
94
95 int prev_cmd_code;
94}; 96};
95 97
96#define IMXMCI_PEND_IRQ_b 0 98#define IMXMCI_PEND_IRQ_b 0
@@ -248,16 +250,14 @@ static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data)
248 * partial FIFO fills and reads. The length has to be rounded up to burst size multiple. 250 * partial FIFO fills and reads. The length has to be rounded up to burst size multiple.
249 * This is required for SCR read at least. 251 * This is required for SCR read at least.
250 */ 252 */
251 if (datasz < 64) { 253 if (datasz < 512) {
252 host->dma_size = datasz; 254 host->dma_size = datasz;
253 if (data->flags & MMC_DATA_READ) { 255 if (data->flags & MMC_DATA_READ) {
254 host->dma_dir = DMA_FROM_DEVICE; 256 host->dma_dir = DMA_FROM_DEVICE;
255 257
256 /* Hack to enable read SCR */ 258 /* Hack to enable read SCR */
257 if(datasz < 16) { 259 MMC_NOB = 1;
258 MMC_NOB = 1; 260 MMC_BLK_LEN = 512;
259 MMC_BLK_LEN = 16;
260 }
261 } else { 261 } else {
262 host->dma_dir = DMA_TO_DEVICE; 262 host->dma_dir = DMA_TO_DEVICE;
263 } 263 }
@@ -409,6 +409,9 @@ static void imxmci_finish_request(struct imxmci_host *host, struct mmc_request *
409 409
410 spin_unlock_irqrestore(&host->lock, flags); 410 spin_unlock_irqrestore(&host->lock, flags);
411 411
412 if(req && req->cmd)
413 host->prev_cmd_code = req->cmd->opcode;
414
412 host->req = NULL; 415 host->req = NULL;
413 host->cmd = NULL; 416 host->cmd = NULL;
414 host->data = NULL; 417 host->data = NULL;
@@ -553,7 +556,6 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat)
553{ 556{
554 int i; 557 int i;
555 int burst_len; 558 int burst_len;
556 int flush_len;
557 int trans_done = 0; 559 int trans_done = 0;
558 unsigned int stat = *pstat; 560 unsigned int stat = *pstat;
559 561
@@ -566,44 +568,43 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat)
566 dev_dbg(mmc_dev(host->mmc), "imxmci_cpu_driven_data running STATUS = 0x%x\n", 568 dev_dbg(mmc_dev(host->mmc), "imxmci_cpu_driven_data running STATUS = 0x%x\n",
567 stat); 569 stat);
568 570
571 udelay(20); /* required for clocks < 8MHz*/
572
569 if(host->dma_dir == DMA_FROM_DEVICE) { 573 if(host->dma_dir == DMA_FROM_DEVICE) {
570 imxmci_busy_wait_for_status(host, &stat, 574 imxmci_busy_wait_for_status(host, &stat,
571 STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE, 575 STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE,
572 20, "imxmci_cpu_driven_data read"); 576 50, "imxmci_cpu_driven_data read");
573 577
574 while((stat & (STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE)) && 578 while((stat & (STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE)) &&
575 (host->data_cnt < host->dma_size)) { 579 (host->data_cnt < 512)) {
576 if(burst_len >= host->dma_size - host->data_cnt) { 580
577 flush_len = burst_len; 581 udelay(20); /* required for clocks < 8MHz*/
578 burst_len = host->dma_size - host->data_cnt;
579 flush_len -= burst_len;
580 host->data_cnt = host->dma_size;
581 trans_done = 1;
582 } else {
583 flush_len = 0;
584 host->data_cnt += burst_len;
585 }
586 582
587 for(i = burst_len; i>=2 ; i-=2) { 583 for(i = burst_len; i>=2 ; i-=2) {
588 *(host->data_ptr++) = MMC_BUFFER_ACCESS; 584 u16 data;
589 udelay(20); /* required for clocks < 8MHz*/ 585 data = MMC_BUFFER_ACCESS;
586 udelay(10); /* required for clocks < 8MHz*/
587 if(host->data_cnt+2 <= host->dma_size) {
588 *(host->data_ptr++) = data;
589 } else {
590 if(host->data_cnt < host->dma_size)
591 *(u8*)(host->data_ptr) = data;
592 }
593 host->data_cnt += 2;
590 } 594 }
591 595
592 if(i == 1)
593 *(u8*)(host->data_ptr) = MMC_BUFFER_ACCESS;
594
595 stat = MMC_STATUS; 596 stat = MMC_STATUS;
596 597
597 /* Flush extra bytes from FIFO */ 598 dev_dbg(mmc_dev(host->mmc), "imxmci_cpu_driven_data read %d burst %d STATUS = 0x%x\n",
598 while(flush_len && !(stat & STATUS_DATA_TRANS_DONE)){ 599 host->data_cnt, burst_len, stat);
599 i = MMC_BUFFER_ACCESS;
600 stat = MMC_STATUS;
601 stat &= ~STATUS_CRC_READ_ERR; /* Stupid but required there */
602 }
603
604 dev_dbg(mmc_dev(host->mmc), "imxmci_cpu_driven_data read burst %d STATUS = 0x%x\n",
605 burst_len, stat);
606 } 600 }
601
602 if((stat & STATUS_DATA_TRANS_DONE) && (host->data_cnt >= 512))
603 trans_done = 1;
604
605 if(host->dma_size & 0x1ff)
606 stat &= ~STATUS_CRC_READ_ERR;
607
607 } else { 608 } else {
608 imxmci_busy_wait_for_status(host, &stat, 609 imxmci_busy_wait_for_status(host, &stat,
609 STATUS_APPL_BUFF_FE, 610 STATUS_APPL_BUFF_FE,
@@ -692,8 +693,8 @@ static void imxmci_tasklet_fnc(unsigned long data)
692 what, stat, MMC_INT_MASK); 693 what, stat, MMC_INT_MASK);
693 dev_err(mmc_dev(host->mmc), "CMD_DAT_CONT = 0x%04x, MMC_BLK_LEN = 0x%04x, MMC_NOB = 0x%04x, DMA_CCR = 0x%08x\n", 694 dev_err(mmc_dev(host->mmc), "CMD_DAT_CONT = 0x%04x, MMC_BLK_LEN = 0x%04x, MMC_NOB = 0x%04x, DMA_CCR = 0x%08x\n",
694 MMC_CMD_DAT_CONT, MMC_BLK_LEN, MMC_NOB, CCR(host->dma)); 695 MMC_CMD_DAT_CONT, MMC_BLK_LEN, MMC_NOB, CCR(host->dma));
695 dev_err(mmc_dev(host->mmc), "CMD%d, bus %d-bit, dma_size = 0x%x\n", 696 dev_err(mmc_dev(host->mmc), "CMD%d, prevCMD%d, bus %d-bit, dma_size = 0x%x\n",
696 host->cmd?host->cmd->opcode:0, 1<<host->actual_bus_width, host->dma_size); 697 host->cmd?host->cmd->opcode:0, host->prev_cmd_code, 1<<host->actual_bus_width, host->dma_size);
697 } 698 }
698 699
699 if(!host->present || timeout) 700 if(!host->present || timeout)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 33525bdf2ab6..74eaaee66de0 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -247,6 +247,55 @@ int mmc_wait_for_app_cmd(struct mmc_host *host, unsigned int rca,
247 247
248EXPORT_SYMBOL(mmc_wait_for_app_cmd); 248EXPORT_SYMBOL(mmc_wait_for_app_cmd);
249 249
250/**
251 * mmc_set_data_timeout - set the timeout for a data command
252 * @data: data phase for command
253 * @card: the MMC card associated with the data transfer
254 * @write: flag to differentiate reads from writes
255 */
256void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card,
257 int write)
258{
259 unsigned int mult;
260
261 /*
262 * SD cards use a 100 multiplier rather than 10
263 */
264 mult = mmc_card_sd(card) ? 100 : 10;
265
266 /*
267 * Scale up the multiplier (and therefore the timeout) by
268 * the r2w factor for writes.
269 */
270 if (write)
271 mult <<= card->csd.r2w_factor;
272
273 data->timeout_ns = card->csd.tacc_ns * mult;
274 data->timeout_clks = card->csd.tacc_clks * mult;
275
276 /*
277 * SD cards also have an upper limit on the timeout.
278 */
279 if (mmc_card_sd(card)) {
280 unsigned int timeout_us, limit_us;
281
282 timeout_us = data->timeout_ns / 1000;
283 timeout_us += data->timeout_clks * 1000 /
284 (card->host->ios.clock / 1000);
285
286 if (write)
287 limit_us = 250000;
288 else
289 limit_us = 100000;
290
291 if (timeout_us > limit_us) {
292 data->timeout_ns = limit_us * 1000;
293 data->timeout_clks = 0;
294 }
295 }
296}
297EXPORT_SYMBOL(mmc_set_data_timeout);
298
250static int mmc_select_card(struct mmc_host *host, struct mmc_card *card); 299static int mmc_select_card(struct mmc_host *host, struct mmc_card *card);
251 300
252/** 301/**
@@ -908,11 +957,9 @@ static void mmc_read_scrs(struct mmc_host *host)
908{ 957{
909 int err; 958 int err;
910 struct mmc_card *card; 959 struct mmc_card *card;
911
912 struct mmc_request mrq; 960 struct mmc_request mrq;
913 struct mmc_command cmd; 961 struct mmc_command cmd;
914 struct mmc_data data; 962 struct mmc_data data;
915
916 struct scatterlist sg; 963 struct scatterlist sg;
917 964
918 list_for_each_entry(card, &host->cards, node) { 965 list_for_each_entry(card, &host->cards, node) {
@@ -947,8 +994,8 @@ static void mmc_read_scrs(struct mmc_host *host)
947 994
948 memset(&data, 0, sizeof(struct mmc_data)); 995 memset(&data, 0, sizeof(struct mmc_data));
949 996
950 data.timeout_ns = card->csd.tacc_ns * 10; 997 mmc_set_data_timeout(&data, card, 0);
951 data.timeout_clks = card->csd.tacc_clks * 10; 998
952 data.blksz_bits = 3; 999 data.blksz_bits = 3;
953 data.blksz = 1 << 3; 1000 data.blksz = 1 << 3;
954 data.blocks = 1; 1001 data.blocks = 1;
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index 115cc21094b9..a0e0dad1b419 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -30,6 +30,7 @@
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31 31
32#include <linux/mmc/card.h> 32#include <linux/mmc/card.h>
33#include <linux/mmc/host.h>
33#include <linux/mmc/protocol.h> 34#include <linux/mmc/protocol.h>
34 35
35#include <asm/system.h> 36#include <asm/system.h>
@@ -171,8 +172,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
171 172
172 brq.cmd.arg = req->sector << 9; 173 brq.cmd.arg = req->sector << 9;
173 brq.cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC; 174 brq.cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
174 brq.data.timeout_ns = card->csd.tacc_ns * 10;
175 brq.data.timeout_clks = card->csd.tacc_clks * 10;
176 brq.data.blksz_bits = md->block_bits; 175 brq.data.blksz_bits = md->block_bits;
177 brq.data.blksz = 1 << md->block_bits; 176 brq.data.blksz = 1 << md->block_bits;
178 brq.data.blocks = req->nr_sectors >> (md->block_bits - 9); 177 brq.data.blocks = req->nr_sectors >> (md->block_bits - 9);
@@ -180,6 +179,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
180 brq.stop.arg = 0; 179 brq.stop.arg = 0;
181 brq.stop.flags = MMC_RSP_R1B | MMC_CMD_AC; 180 brq.stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
182 181
182 mmc_set_data_timeout(&brq.data, card, rq_data_dir(req) != READ);
183
183 if (rq_data_dir(req) == READ) { 184 if (rq_data_dir(req) == READ) {
184 brq.cmd.opcode = brq.data.blocks > 1 ? MMC_READ_MULTIPLE_BLOCK : MMC_READ_SINGLE_BLOCK; 185 brq.cmd.opcode = brq.data.blocks > 1 ? MMC_READ_MULTIPLE_BLOCK : MMC_READ_SINGLE_BLOCK;
185 brq.data.flags |= MMC_DATA_READ; 186 brq.data.flags |= MMC_DATA_READ;
@@ -187,12 +188,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
187 brq.cmd.opcode = MMC_WRITE_BLOCK; 188 brq.cmd.opcode = MMC_WRITE_BLOCK;
188 brq.data.flags |= MMC_DATA_WRITE; 189 brq.data.flags |= MMC_DATA_WRITE;
189 brq.data.blocks = 1; 190 brq.data.blocks = 1;
190
191 /*
192 * Scale up the timeout by the r2w factor
193 */
194 brq.data.timeout_ns <<= card->csd.r2w_factor;
195 brq.data.timeout_clks <<= card->csd.r2w_factor;
196 } 191 }
197 192
198 if (brq.data.blocks > 1) { 193 if (brq.data.blocks > 1) {
@@ -324,52 +319,11 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
324 md->read_only = mmc_blk_readonly(card); 319 md->read_only = mmc_blk_readonly(card);
325 320
326 /* 321 /*
327 * Figure out a workable block size. MMC cards have: 322 * Both SD and MMC specifications state (although a bit
328 * - two block sizes, one for read and one for write. 323 * unclearly in the MMC case) that a block size of 512
329 * - may support partial reads and/or writes 324 * bytes must always be supported by the card.
330 * (allows block sizes smaller than specified)
331 */
332 md->block_bits = card->csd.read_blkbits;
333 if (card->csd.write_blkbits != card->csd.read_blkbits) {
334 if (card->csd.write_blkbits < card->csd.read_blkbits &&
335 card->csd.read_partial) {
336 /*
337 * write block size is smaller than read block
338 * size, but we support partial reads, so choose
339 * the smaller write block size.
340 */
341 md->block_bits = card->csd.write_blkbits;
342 } else if (card->csd.write_blkbits > card->csd.read_blkbits &&
343 card->csd.write_partial) {
344 /*
345 * read block size is smaller than write block
346 * size, but we support partial writes. Use read
347 * block size.
348 */
349 } else {
350 /*
351 * We don't support this configuration for writes.
352 */
353 printk(KERN_ERR "%s: unable to select block size for "
354 "writing (rb%u wb%u rp%u wp%u)\n",
355 mmc_card_id(card),
356 1 << card->csd.read_blkbits,
357 1 << card->csd.write_blkbits,
358 card->csd.read_partial,
359 card->csd.write_partial);
360 md->read_only = 1;
361 }
362 }
363
364 /*
365 * Refuse to allow block sizes smaller than 512 bytes.
366 */ 325 */
367 if (md->block_bits < 9) { 326 md->block_bits = 9;
368 printk(KERN_ERR "%s: unable to support block size %u\n",
369 mmc_card_id(card), 1 << md->block_bits);
370 ret = -EINVAL;
371 goto err_kfree;
372 }
373 327
374 md->disk = alloc_disk(1 << MMC_SHIFT); 328 md->disk = alloc_disk(1 << MMC_SHIFT);
375 if (md->disk == NULL) { 329 if (md->disk == NULL) {
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 30b3671d833d..a2bd8119270e 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2393,7 +2393,7 @@ config MYRI10GE
2393 you will need a newer firmware image. 2393 you will need a newer firmware image.
2394 You may get this image or more information, at: 2394 You may get this image or more information, at:
2395 2395
2396 <http://www.myri.com/Myri-10G/> 2396 <http://www.myri.com/scs/download-Myri10GE.html>
2397 2397
2398 To compile this driver as a module, choose M here and read 2398 To compile this driver as a module, choose M here and read
2399 <file:Documentation/networking/net-modules.txt>. The module 2399 <file:Documentation/networking/net-modules.txt>. The module
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 3d76fa144c4f..a860ebbbf815 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -377,8 +377,8 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db)
377 kfree(db->data_req); 377 kfree(db->data_req);
378 } 378 }
379 379
380 if (db->addr_res != NULL) { 380 if (db->addr_req != NULL) {
381 release_resource(db->addr_res); 381 release_resource(db->addr_req);
382 kfree(db->addr_req); 382 kfree(db->addr_req);
383 } 383 }
384} 384}
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 73177429fe74..17e709e7d72a 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -667,6 +667,7 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, quirk_vi
667DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, quirk_via_irq); 667DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, quirk_via_irq);
668DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_2, quirk_via_irq); 668DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_2, quirk_via_irq);
669DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_irq); 669DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_irq);
670DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235_USB_2, quirk_via_irq);
670DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq); 671DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq);
671DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq); 672DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq);
672DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq); 673DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq);
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index d8e9b95f0a1a..25c1ef6dfd44 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -52,7 +52,7 @@ static void dasd_setup_queue(struct dasd_device * device);
52static void dasd_free_queue(struct dasd_device * device); 52static void dasd_free_queue(struct dasd_device * device);
53static void dasd_flush_request_queue(struct dasd_device *); 53static void dasd_flush_request_queue(struct dasd_device *);
54static void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *); 54static void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *);
55static void dasd_flush_ccw_queue(struct dasd_device *, int); 55static int dasd_flush_ccw_queue(struct dasd_device *, int);
56static void dasd_tasklet(struct dasd_device *); 56static void dasd_tasklet(struct dasd_device *);
57static void do_kick_device(void *data); 57static void do_kick_device(void *data);
58 58
@@ -60,6 +60,7 @@ static void do_kick_device(void *data);
60 * SECTION: Operations on the device structure. 60 * SECTION: Operations on the device structure.
61 */ 61 */
62static wait_queue_head_t dasd_init_waitq; 62static wait_queue_head_t dasd_init_waitq;
63static wait_queue_head_t dasd_flush_wq;
63 64
64/* 65/*
65 * Allocate memory for a new device structure. 66 * Allocate memory for a new device structure.
@@ -121,7 +122,7 @@ dasd_free_device(struct dasd_device *device)
121/* 122/*
122 * Make a new device known to the system. 123 * Make a new device known to the system.
123 */ 124 */
124static inline int 125static int
125dasd_state_new_to_known(struct dasd_device *device) 126dasd_state_new_to_known(struct dasd_device *device)
126{ 127{
127 int rc; 128 int rc;
@@ -145,7 +146,7 @@ dasd_state_new_to_known(struct dasd_device *device)
145/* 146/*
146 * Let the system forget about a device. 147 * Let the system forget about a device.
147 */ 148 */
148static inline void 149static int
149dasd_state_known_to_new(struct dasd_device * device) 150dasd_state_known_to_new(struct dasd_device * device)
150{ 151{
151 /* Disable extended error reporting for this device. */ 152 /* Disable extended error reporting for this device. */
@@ -163,12 +164,13 @@ dasd_state_known_to_new(struct dasd_device * device)
163 164
164 /* Give up reference we took in dasd_state_new_to_known. */ 165 /* Give up reference we took in dasd_state_new_to_known. */
165 dasd_put_device(device); 166 dasd_put_device(device);
167 return 0;
166} 168}
167 169
168/* 170/*
169 * Request the irq line for the device. 171 * Request the irq line for the device.
170 */ 172 */
171static inline int 173static int
172dasd_state_known_to_basic(struct dasd_device * device) 174dasd_state_known_to_basic(struct dasd_device * device)
173{ 175{
174 int rc; 176 int rc;
@@ -192,17 +194,23 @@ dasd_state_known_to_basic(struct dasd_device * device)
192/* 194/*
193 * Release the irq line for the device. Terminate any running i/o. 195 * Release the irq line for the device. Terminate any running i/o.
194 */ 196 */
195static inline void 197static int
196dasd_state_basic_to_known(struct dasd_device * device) 198dasd_state_basic_to_known(struct dasd_device * device)
197{ 199{
200 int rc;
201
198 dasd_gendisk_free(device); 202 dasd_gendisk_free(device);
199 dasd_flush_ccw_queue(device, 1); 203 rc = dasd_flush_ccw_queue(device, 1);
204 if (rc)
205 return rc;
206
200 DBF_DEV_EVENT(DBF_EMERG, device, "%p debug area deleted", device); 207 DBF_DEV_EVENT(DBF_EMERG, device, "%p debug area deleted", device);
201 if (device->debug_area != NULL) { 208 if (device->debug_area != NULL) {
202 debug_unregister(device->debug_area); 209 debug_unregister(device->debug_area);
203 device->debug_area = NULL; 210 device->debug_area = NULL;
204 } 211 }
205 device->state = DASD_STATE_KNOWN; 212 device->state = DASD_STATE_KNOWN;
213 return 0;
206} 214}
207 215
208/* 216/*
@@ -219,7 +227,7 @@ dasd_state_basic_to_known(struct dasd_device * device)
219 * In case the analysis returns an error, the device setup is stopped 227 * In case the analysis returns an error, the device setup is stopped
220 * (a fake disk was already added to allow formatting). 228 * (a fake disk was already added to allow formatting).
221 */ 229 */
222static inline int 230static int
223dasd_state_basic_to_ready(struct dasd_device * device) 231dasd_state_basic_to_ready(struct dasd_device * device)
224{ 232{
225 int rc; 233 int rc;
@@ -247,25 +255,31 @@ dasd_state_basic_to_ready(struct dasd_device * device)
247 * Forget format information. Check if the target level is basic 255 * Forget format information. Check if the target level is basic
248 * and if it is create fake disk for formatting. 256 * and if it is create fake disk for formatting.
249 */ 257 */
250static inline void 258static int
251dasd_state_ready_to_basic(struct dasd_device * device) 259dasd_state_ready_to_basic(struct dasd_device * device)
252{ 260{
253 dasd_flush_ccw_queue(device, 0); 261 int rc;
262
263 rc = dasd_flush_ccw_queue(device, 0);
264 if (rc)
265 return rc;
254 dasd_destroy_partitions(device); 266 dasd_destroy_partitions(device);
255 dasd_flush_request_queue(device); 267 dasd_flush_request_queue(device);
256 device->blocks = 0; 268 device->blocks = 0;
257 device->bp_block = 0; 269 device->bp_block = 0;
258 device->s2b_shift = 0; 270 device->s2b_shift = 0;
259 device->state = DASD_STATE_BASIC; 271 device->state = DASD_STATE_BASIC;
272 return 0;
260} 273}
261 274
262/* 275/*
263 * Back to basic. 276 * Back to basic.
264 */ 277 */
265static inline void 278static int
266dasd_state_unfmt_to_basic(struct dasd_device * device) 279dasd_state_unfmt_to_basic(struct dasd_device * device)
267{ 280{
268 device->state = DASD_STATE_BASIC; 281 device->state = DASD_STATE_BASIC;
282 return 0;
269} 283}
270 284
271/* 285/*
@@ -273,7 +287,7 @@ dasd_state_unfmt_to_basic(struct dasd_device * device)
273 * the requeueing of requests from the linux request queue to the 287 * the requeueing of requests from the linux request queue to the
274 * ccw queue. 288 * ccw queue.
275 */ 289 */
276static inline int 290static int
277dasd_state_ready_to_online(struct dasd_device * device) 291dasd_state_ready_to_online(struct dasd_device * device)
278{ 292{
279 device->state = DASD_STATE_ONLINE; 293 device->state = DASD_STATE_ONLINE;
@@ -284,16 +298,17 @@ dasd_state_ready_to_online(struct dasd_device * device)
284/* 298/*
285 * Stop the requeueing of requests again. 299 * Stop the requeueing of requests again.
286 */ 300 */
287static inline void 301static int
288dasd_state_online_to_ready(struct dasd_device * device) 302dasd_state_online_to_ready(struct dasd_device * device)
289{ 303{
290 device->state = DASD_STATE_READY; 304 device->state = DASD_STATE_READY;
305 return 0;
291} 306}
292 307
293/* 308/*
294 * Device startup state changes. 309 * Device startup state changes.
295 */ 310 */
296static inline int 311static int
297dasd_increase_state(struct dasd_device *device) 312dasd_increase_state(struct dasd_device *device)
298{ 313{
299 int rc; 314 int rc;
@@ -329,30 +344,37 @@ dasd_increase_state(struct dasd_device *device)
329/* 344/*
330 * Device shutdown state changes. 345 * Device shutdown state changes.
331 */ 346 */
332static inline int 347static int
333dasd_decrease_state(struct dasd_device *device) 348dasd_decrease_state(struct dasd_device *device)
334{ 349{
350 int rc;
351
352 rc = 0;
335 if (device->state == DASD_STATE_ONLINE && 353 if (device->state == DASD_STATE_ONLINE &&
336 device->target <= DASD_STATE_READY) 354 device->target <= DASD_STATE_READY)
337 dasd_state_online_to_ready(device); 355 rc = dasd_state_online_to_ready(device);
338 356
339 if (device->state == DASD_STATE_READY && 357 if (!rc &&
358 device->state == DASD_STATE_READY &&
340 device->target <= DASD_STATE_BASIC) 359 device->target <= DASD_STATE_BASIC)
341 dasd_state_ready_to_basic(device); 360 rc = dasd_state_ready_to_basic(device);
342 361
343 if (device->state == DASD_STATE_UNFMT && 362 if (!rc &&
363 device->state == DASD_STATE_UNFMT &&
344 device->target <= DASD_STATE_BASIC) 364 device->target <= DASD_STATE_BASIC)
345 dasd_state_unfmt_to_basic(device); 365 rc = dasd_state_unfmt_to_basic(device);
346 366
347 if (device->state == DASD_STATE_BASIC && 367 if (!rc &&
368 device->state == DASD_STATE_BASIC &&
348 device->target <= DASD_STATE_KNOWN) 369 device->target <= DASD_STATE_KNOWN)
349 dasd_state_basic_to_known(device); 370 rc = dasd_state_basic_to_known(device);
350 371
351 if (device->state == DASD_STATE_KNOWN && 372 if (!rc &&
373 device->state == DASD_STATE_KNOWN &&
352 device->target <= DASD_STATE_NEW) 374 device->target <= DASD_STATE_NEW)
353 dasd_state_known_to_new(device); 375 rc = dasd_state_known_to_new(device);
354 376
355 return 0; 377 return rc;
356} 378}
357 379
358/* 380/*
@@ -701,6 +723,7 @@ dasd_term_IO(struct dasd_ccw_req * cqr)
701 cqr->retries--; 723 cqr->retries--;
702 cqr->status = DASD_CQR_CLEAR; 724 cqr->status = DASD_CQR_CLEAR;
703 cqr->stopclk = get_clock(); 725 cqr->stopclk = get_clock();
726 cqr->starttime = 0;
704 DBF_DEV_EVENT(DBF_DEBUG, device, 727 DBF_DEV_EVENT(DBF_DEBUG, device,
705 "terminate cqr %p successful", 728 "terminate cqr %p successful",
706 cqr); 729 cqr);
@@ -978,6 +1001,7 @@ dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
978 irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) { 1001 irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) {
979 cqr->status = DASD_CQR_QUEUED; 1002 cqr->status = DASD_CQR_QUEUED;
980 dasd_clear_timer(device); 1003 dasd_clear_timer(device);
1004 wake_up(&dasd_flush_wq);
981 dasd_schedule_bh(device); 1005 dasd_schedule_bh(device);
982 return; 1006 return;
983 } 1007 }
@@ -1241,6 +1265,10 @@ __dasd_check_expire(struct dasd_device * device)
1241 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); 1265 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list);
1242 if (cqr->status == DASD_CQR_IN_IO && cqr->expires != 0) { 1266 if (cqr->status == DASD_CQR_IN_IO && cqr->expires != 0) {
1243 if (time_after_eq(jiffies, cqr->expires + cqr->starttime)) { 1267 if (time_after_eq(jiffies, cqr->expires + cqr->starttime)) {
1268 DEV_MESSAGE(KERN_ERR, device,
1269 "internal error - timeout (%is) expired "
1270 "for cqr %p (%i retries left)",
1271 (cqr->expires/HZ), cqr, cqr->retries);
1244 if (device->discipline->term_IO(cqr) != 0) 1272 if (device->discipline->term_IO(cqr) != 0)
1245 /* Hmpf, try again in 1/10 sec */ 1273 /* Hmpf, try again in 1/10 sec */
1246 dasd_set_timer(device, 10); 1274 dasd_set_timer(device, 10);
@@ -1285,46 +1313,100 @@ __dasd_start_head(struct dasd_device * device)
1285 dasd_set_timer(device, 50); 1313 dasd_set_timer(device, 50);
1286} 1314}
1287 1315
1316static inline int
1317_wait_for_clear(struct dasd_ccw_req *cqr)
1318{
1319 return (cqr->status == DASD_CQR_QUEUED);
1320}
1321
1288/* 1322/*
1289 * Remove requests from the ccw queue. 1323 * Remove all requests from the ccw queue (all = '1') or only block device
1324 * requests in case all = '0'.
1325 * Take care of the erp-chain (chained via cqr->refers) and remove either
1326 * the whole erp-chain or none of the erp-requests.
1327 * If a request is currently running, term_IO is called and the request
1328 * is re-queued. Prior to removing the terminated request we need to wait
1329 * for the clear-interrupt.
1330 * In case termination is not possible we stop processing and just finishing
1331 * the already moved requests.
1290 */ 1332 */
1291static void 1333static int
1292dasd_flush_ccw_queue(struct dasd_device * device, int all) 1334dasd_flush_ccw_queue(struct dasd_device * device, int all)
1293{ 1335{
1336 struct dasd_ccw_req *cqr, *orig, *n;
1337 int rc, i;
1338
1294 struct list_head flush_queue; 1339 struct list_head flush_queue;
1295 struct list_head *l, *n;
1296 struct dasd_ccw_req *cqr;
1297 1340
1298 INIT_LIST_HEAD(&flush_queue); 1341 INIT_LIST_HEAD(&flush_queue);
1299 spin_lock_irq(get_ccwdev_lock(device->cdev)); 1342 spin_lock_irq(get_ccwdev_lock(device->cdev));
1300 list_for_each_safe(l, n, &device->ccw_queue) { 1343 rc = 0;
1301 cqr = list_entry(l, struct dasd_ccw_req, list); 1344restart:
1345 list_for_each_entry_safe(cqr, n, &device->ccw_queue, list) {
1346 /* get original request of erp request-chain */
1347 for (orig = cqr; orig->refers != NULL; orig = orig->refers);
1348
1302 /* Flush all request or only block device requests? */ 1349 /* Flush all request or only block device requests? */
1303 if (all == 0 && cqr->callback == dasd_end_request_cb) 1350 if (all == 0 && cqr->callback != dasd_end_request_cb &&
1351 orig->callback != dasd_end_request_cb) {
1304 continue; 1352 continue;
1305 if (cqr->status == DASD_CQR_IN_IO) 1353 }
1306 device->discipline->term_IO(cqr); 1354 /* Check status and move request to flush_queue */
1307 if (cqr->status != DASD_CQR_DONE || 1355 switch (cqr->status) {
1308 cqr->status != DASD_CQR_FAILED) { 1356 case DASD_CQR_IN_IO:
1309 cqr->status = DASD_CQR_FAILED; 1357 rc = device->discipline->term_IO(cqr);
1358 if (rc) {
1359 /* unable to terminate requeust */
1360 DEV_MESSAGE(KERN_ERR, device,
1361 "dasd flush ccw_queue is unable "
1362 " to terminate request %p",
1363 cqr);
1364 /* stop flush processing */
1365 goto finished;
1366 }
1367 break;
1368 case DASD_CQR_QUEUED:
1369 case DASD_CQR_ERROR:
1370 /* set request to FAILED */
1310 cqr->stopclk = get_clock(); 1371 cqr->stopclk = get_clock();
1372 cqr->status = DASD_CQR_FAILED;
1373 break;
1374 default: /* do not touch the others */
1375 break;
1376 }
1377 /* Rechain request (including erp chain) */
1378 for (i = 0; cqr != NULL; cqr = cqr->refers, i++) {
1379 cqr->endclk = get_clock();
1380 list_move_tail(&cqr->list, &flush_queue);
1381 }
1382 if (i > 1)
1383 /* moved more than one request - need to restart */
1384 goto restart;
1385 }
1386
1387finished:
1388 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1389 /* Now call the callback function of flushed requests */
1390restart_cb:
1391 list_for_each_entry_safe(cqr, n, &flush_queue, list) {
1392 if (cqr->status == DASD_CQR_CLEAR) {
1393 /* wait for clear interrupt! */
1394 wait_event(dasd_flush_wq, _wait_for_clear(cqr));
1395 cqr->status = DASD_CQR_FAILED;
1311 } 1396 }
1312 /* Process finished ERP request. */ 1397 /* Process finished ERP request. */
1313 if (cqr->refers) { 1398 if (cqr->refers) {
1314 __dasd_process_erp(device, cqr); 1399 __dasd_process_erp(device, cqr);
1315 continue; 1400 /* restart list_for_xx loop since dasd_process_erp
1401 * might remove multiple elements */
1402 goto restart_cb;
1316 } 1403 }
1317 /* Rechain request on device request queue */ 1404 /* call the callback function */
1318 cqr->endclk = get_clock(); 1405 cqr->endclk = get_clock();
1319 list_move_tail(&cqr->list, &flush_queue);
1320 }
1321 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1322 /* Now call the callback function of flushed requests */
1323 list_for_each_safe(l, n, &flush_queue) {
1324 cqr = list_entry(l, struct dasd_ccw_req, list);
1325 if (cqr->callback != NULL) 1406 if (cqr->callback != NULL)
1326 (cqr->callback)(cqr, cqr->callback_data); 1407 (cqr->callback)(cqr, cqr->callback_data);
1327 } 1408 }
1409 return rc;
1328} 1410}
1329 1411
1330/* 1412/*
@@ -1510,10 +1592,8 @@ dasd_sleep_on_interruptible(struct dasd_ccw_req * cqr)
1510 if (device->discipline->term_IO) { 1592 if (device->discipline->term_IO) {
1511 cqr->retries = -1; 1593 cqr->retries = -1;
1512 device->discipline->term_IO(cqr); 1594 device->discipline->term_IO(cqr);
1513 /*nished = 1595 /* wait (non-interruptible) for final status
1514 * wait (non-interruptible) for final status 1596 * because signal ist still pending */
1515 * because signal ist still pending
1516 */
1517 spin_unlock_irq(get_ccwdev_lock(device->cdev)); 1597 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1518 wait_event(wait_q, _wait_for_wakeup(cqr)); 1598 wait_event(wait_q, _wait_for_wakeup(cqr));
1519 spin_lock_irq(get_ccwdev_lock(device->cdev)); 1599 spin_lock_irq(get_ccwdev_lock(device->cdev));
@@ -1546,19 +1626,11 @@ static inline int
1546_dasd_term_running_cqr(struct dasd_device *device) 1626_dasd_term_running_cqr(struct dasd_device *device)
1547{ 1627{
1548 struct dasd_ccw_req *cqr; 1628 struct dasd_ccw_req *cqr;
1549 int rc;
1550 1629
1551 if (list_empty(&device->ccw_queue)) 1630 if (list_empty(&device->ccw_queue))
1552 return 0; 1631 return 0;
1553 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); 1632 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list);
1554 rc = device->discipline->term_IO(cqr); 1633 return device->discipline->term_IO(cqr);
1555 if (rc == 0) {
1556 /* termination successful */
1557 cqr->status = DASD_CQR_QUEUED;
1558 cqr->startclk = cqr->stopclk = 0;
1559 cqr->starttime = 0;
1560 }
1561 return rc;
1562} 1634}
1563 1635
1564int 1636int
@@ -1726,10 +1798,7 @@ dasd_flush_request_queue(struct dasd_device * device)
1726 return; 1798 return;
1727 1799
1728 spin_lock_irq(&device->request_queue_lock); 1800 spin_lock_irq(&device->request_queue_lock);
1729 while (!list_empty(&device->request_queue->queue_head)) { 1801 while ((req = elv_next_request(device->request_queue))) {
1730 req = elv_next_request(device->request_queue);
1731 if (req == NULL)
1732 break;
1733 blkdev_dequeue_request(req); 1802 blkdev_dequeue_request(req);
1734 dasd_end_request(req, 0); 1803 dasd_end_request(req, 0);
1735 } 1804 }
@@ -2091,6 +2160,7 @@ dasd_init(void)
2091 int rc; 2160 int rc;
2092 2161
2093 init_waitqueue_head(&dasd_init_waitq); 2162 init_waitqueue_head(&dasd_init_waitq);
2163 init_waitqueue_head(&dasd_flush_wq);
2094 2164
2095 /* register 'common' DASD debug area, used for all DBF_XXX calls */ 2165 /* register 'common' DASD debug area, used for all DBF_XXX calls */
2096 dasd_debug_area = debug_register("dasd", 1, 2, 8 * sizeof (long)); 2166 dasd_debug_area = debug_register("dasd", 1, 2, 8 * sizeof (long));
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c
index 4c272b70f41a..d163632101d2 100644
--- a/drivers/s390/block/dasd_genhd.c
+++ b/drivers/s390/block/dasd_genhd.c
@@ -83,10 +83,12 @@ dasd_gendisk_alloc(struct dasd_device *device)
83void 83void
84dasd_gendisk_free(struct dasd_device *device) 84dasd_gendisk_free(struct dasd_device *device)
85{ 85{
86 del_gendisk(device->gdp); 86 if (device->gdp) {
87 device->gdp->queue = NULL; 87 del_gendisk(device->gdp);
88 put_disk(device->gdp); 88 device->gdp->queue = NULL;
89 device->gdp = NULL; 89 put_disk(device->gdp);
90 device->gdp = NULL;
91 }
90} 92}
91 93
92/* 94/*
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 3cba6c9fab11..38954f5cd14c 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -183,11 +183,9 @@ ccwgroup_create(struct device *root,
183 183
184 gdev->creator_id = creator_id; 184 gdev->creator_id = creator_id;
185 gdev->count = argc; 185 gdev->count = argc;
186 gdev->dev = (struct device ) { 186 gdev->dev.bus = &ccwgroup_bus_type;
187 .bus = &ccwgroup_bus_type, 187 gdev->dev.parent = root;
188 .parent = root, 188 gdev->dev.release = ccwgroup_release;
189 .release = ccwgroup_release,
190 };
191 189
192 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s", 190 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s",
193 gdev->cdev[0]->dev.bus_id); 191 gdev->cdev[0]->dev.bus_id);
@@ -391,10 +389,8 @@ int
391ccwgroup_driver_register (struct ccwgroup_driver *cdriver) 389ccwgroup_driver_register (struct ccwgroup_driver *cdriver)
392{ 390{
393 /* register our new driver with the core */ 391 /* register our new driver with the core */
394 cdriver->driver = (struct device_driver) { 392 cdriver->driver.bus = &ccwgroup_bus_type;
395 .bus = &ccwgroup_bus_type, 393 cdriver->driver.name = cdriver->name;
396 .name = cdriver->name,
397 };
398 394
399 return driver_register(&cdriver->driver); 395 return driver_register(&cdriver->driver);
400} 396}
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 61ce3f1d5228..c28444af0919 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -238,8 +238,6 @@ s390_subchannel_remove_chpid(struct device *dev, void *data)
238 /* Check for single path devices. */ 238 /* Check for single path devices. */
239 if (sch->schib.pmcw.pim == 0x80) 239 if (sch->schib.pmcw.pim == 0x80)
240 goto out_unreg; 240 goto out_unreg;
241 if (sch->vpm == mask)
242 goto out_unreg;
243 241
244 if ((sch->schib.scsw.actl & SCSW_ACTL_DEVACT) && 242 if ((sch->schib.scsw.actl & SCSW_ACTL_DEVACT) &&
245 (sch->schib.scsw.actl & SCSW_ACTL_SCHACT) && 243 (sch->schib.scsw.actl & SCSW_ACTL_SCHACT) &&
@@ -258,6 +256,8 @@ s390_subchannel_remove_chpid(struct device *dev, void *data)
258 /* trigger path verification. */ 256 /* trigger path verification. */
259 if (sch->driver && sch->driver->verify) 257 if (sch->driver && sch->driver->verify)
260 sch->driver->verify(&sch->dev); 258 sch->driver->verify(&sch->dev);
259 else if (sch->vpm == mask)
260 goto out_unreg;
261out_unlock: 261out_unlock:
262 spin_unlock_irq(&sch->lock); 262 spin_unlock_irq(&sch->lock);
263 return 0; 263 return 0;
@@ -1391,10 +1391,8 @@ new_channel_path(int chpid)
1391 /* fill in status, etc. */ 1391 /* fill in status, etc. */
1392 chp->id = chpid; 1392 chp->id = chpid;
1393 chp->state = 1; 1393 chp->state = 1;
1394 chp->dev = (struct device) { 1394 chp->dev.parent = &css[0]->device;
1395 .parent = &css[0]->device, 1395 chp->dev.release = chp_release;
1396 .release = chp_release,
1397 };
1398 snprintf(chp->dev.bus_id, BUS_ID_SIZE, "chp0.%x", chpid); 1396 snprintf(chp->dev.bus_id, BUS_ID_SIZE, "chp0.%x", chpid);
1399 1397
1400 /* Obtain channel path description and fill it in. */ 1398 /* Obtain channel path description and fill it in. */
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 585fa04233c3..646da5640401 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -556,12 +556,11 @@ get_disc_ccwdev_by_devno(unsigned int devno, unsigned int ssid,
556 struct ccw_device *sibling) 556 struct ccw_device *sibling)
557{ 557{
558 struct device *dev; 558 struct device *dev;
559 struct match_data data = { 559 struct match_data data;
560 .devno = devno,
561 .ssid = ssid,
562 .sibling = sibling,
563 };
564 560
561 data.devno = devno;
562 data.ssid = ssid;
563 data.sibling = sibling;
565 dev = bus_find_device(&ccw_bus_type, NULL, &data, match_devno); 564 dev = bus_find_device(&ccw_bus_type, NULL, &data, match_devno);
566 565
567 return dev ? to_ccwdev(dev) : NULL; 566 return dev ? to_ccwdev(dev) : NULL;
@@ -835,10 +834,8 @@ io_subchannel_probe (struct subchannel *sch)
835 return -ENOMEM; 834 return -ENOMEM;
836 } 835 }
837 atomic_set(&cdev->private->onoff, 0); 836 atomic_set(&cdev->private->onoff, 0);
838 cdev->dev = (struct device) { 837 cdev->dev.parent = &sch->dev;
839 .parent = &sch->dev, 838 cdev->dev.release = ccw_device_release;
840 .release = ccw_device_release,
841 };
842 INIT_LIST_HEAD(&cdev->private->kick_work.entry); 839 INIT_LIST_HEAD(&cdev->private->kick_work.entry);
843 /* Do first half of device_register. */ 840 /* Do first half of device_register. */
844 device_initialize(&cdev->dev); 841 device_initialize(&cdev->dev);
@@ -977,9 +974,7 @@ ccw_device_console_enable (struct ccw_device *cdev, struct subchannel *sch)
977 int rc; 974 int rc;
978 975
979 /* Initialize the ccw_device structure. */ 976 /* Initialize the ccw_device structure. */
980 cdev->dev = (struct device) { 977 cdev->dev.parent= &sch->dev;
981 .parent = &sch->dev,
982 };
983 rc = io_subchannel_recog(cdev, sch); 978 rc = io_subchannel_recog(cdev, sch);
984 if (rc) 979 if (rc)
985 return rc; 980 return rc;
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 6d91c2eb205b..35e162ba6d54 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -267,12 +267,10 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
267 notify = 1; 267 notify = 1;
268 } 268 }
269 /* fill out sense information */ 269 /* fill out sense information */
270 cdev->id = (struct ccw_device_id) { 270 cdev->id.cu_type = cdev->private->senseid.cu_type;
271 .cu_type = cdev->private->senseid.cu_type, 271 cdev->id.cu_model = cdev->private->senseid.cu_model;
272 .cu_model = cdev->private->senseid.cu_model, 272 cdev->id.dev_type = cdev->private->senseid.dev_type;
273 .dev_type = cdev->private->senseid.dev_type, 273 cdev->id.dev_model = cdev->private->senseid.dev_model;
274 .dev_model = cdev->private->senseid.dev_model,
275 };
276 if (notify) { 274 if (notify) {
277 cdev->private->state = DEV_STATE_OFFLINE; 275 cdev->private->state = DEV_STATE_OFFLINE;
278 if (same_dev) { 276 if (same_dev) {
@@ -566,12 +564,10 @@ ccw_device_verify_done(struct ccw_device *cdev, int err)
566 /* Deliver fake irb to device driver, if needed. */ 564 /* Deliver fake irb to device driver, if needed. */
567 if (cdev->private->flags.fake_irb) { 565 if (cdev->private->flags.fake_irb) {
568 memset(&cdev->private->irb, 0, sizeof(struct irb)); 566 memset(&cdev->private->irb, 0, sizeof(struct irb));
569 cdev->private->irb.scsw = (struct scsw) { 567 cdev->private->irb.scsw.cc = 1;
570 .cc = 1, 568 cdev->private->irb.scsw.fctl = SCSW_FCTL_START_FUNC;
571 .fctl = SCSW_FCTL_START_FUNC, 569 cdev->private->irb.scsw.actl = SCSW_ACTL_START_PEND;
572 .actl = SCSW_ACTL_START_PEND, 570 cdev->private->irb.scsw.stctl = SCSW_STCTL_STATUS_PEND;
573 .stctl = SCSW_STCTL_STATUS_PEND,
574 };
575 cdev->private->flags.fake_irb = 0; 571 cdev->private->flags.fake_irb = 0;
576 if (cdev->handler) 572 if (cdev->handler)
577 cdev->handler(cdev, cdev->private->intparm, 573 cdev->handler(cdev, cdev->private->intparm,
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c
index 32610fd8868e..1693a102dcfe 100644
--- a/drivers/s390/cio/device_pgid.c
+++ b/drivers/s390/cio/device_pgid.c
@@ -24,6 +24,21 @@
24#include "ioasm.h" 24#include "ioasm.h"
25 25
26/* 26/*
27 * Helper function called from interrupt context to decide whether an
28 * operation should be tried again.
29 */
30static int __ccw_device_should_retry(struct scsw *scsw)
31{
32 /* CC is only valid if start function bit is set. */
33 if ((scsw->fctl & SCSW_FCTL_START_FUNC) && scsw->cc == 1)
34 return 1;
35 /* No more activity. For sense and set PGID we stubbornly try again. */
36 if (!scsw->actl)
37 return 1;
38 return 0;
39}
40
41/*
27 * Start Sense Path Group ID helper function. Used in ccw_device_recog 42 * Start Sense Path Group ID helper function. Used in ccw_device_recog
28 * and ccw_device_sense_pgid. 43 * and ccw_device_sense_pgid.
29 */ 44 */
@@ -155,10 +170,10 @@ ccw_device_sense_pgid_irq(struct ccw_device *cdev, enum dev_event dev_event)
155 int ret; 170 int ret;
156 171
157 irb = (struct irb *) __LC_IRB; 172 irb = (struct irb *) __LC_IRB;
158 /* Retry sense pgid for cc=1. */ 173
159 if (irb->scsw.stctl == 174 if (irb->scsw.stctl ==
160 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) { 175 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
161 if (irb->scsw.cc == 1) { 176 if (__ccw_device_should_retry(&irb->scsw)) {
162 ret = __ccw_device_sense_pgid_start(cdev); 177 ret = __ccw_device_sense_pgid_start(cdev);
163 if (ret && ret != -EBUSY) 178 if (ret && ret != -EBUSY)
164 ccw_device_sense_pgid_done(cdev, ret); 179 ccw_device_sense_pgid_done(cdev, ret);
@@ -391,10 +406,10 @@ ccw_device_verify_irq(struct ccw_device *cdev, enum dev_event dev_event)
391 int ret; 406 int ret;
392 407
393 irb = (struct irb *) __LC_IRB; 408 irb = (struct irb *) __LC_IRB;
394 /* Retry set pgid for cc=1. */ 409
395 if (irb->scsw.stctl == 410 if (irb->scsw.stctl ==
396 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) { 411 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
397 if (irb->scsw.cc == 1) 412 if (__ccw_device_should_retry(&irb->scsw))
398 __ccw_device_verify_start(cdev); 413 __ccw_device_verify_start(cdev);
399 return; 414 return;
400 } 415 }
@@ -494,10 +509,10 @@ ccw_device_disband_irq(struct ccw_device *cdev, enum dev_event dev_event)
494 int ret; 509 int ret;
495 510
496 irb = (struct irb *) __LC_IRB; 511 irb = (struct irb *) __LC_IRB;
497 /* Retry set pgid for cc=1. */ 512
498 if (irb->scsw.stctl == 513 if (irb->scsw.stctl ==
499 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) { 514 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
500 if (irb->scsw.cc == 1) 515 if (__ccw_device_should_retry(&irb->scsw))
501 __ccw_device_disband_start(cdev); 516 __ccw_device_disband_start(cdev);
502 return; 517 return;
503 } 518 }
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 2d20caf377f5..a9bb3cb7e89b 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -123,7 +123,8 @@ enum {
123 ich6_sata = 4, 123 ich6_sata = 4,
124 ich6_sata_ahci = 5, 124 ich6_sata_ahci = 5,
125 ich6m_sata_ahci = 6, 125 ich6m_sata_ahci = 6,
126 ich8_sata_ahci = 7, 126 ich7m_sata_ahci = 7,
127 ich8_sata_ahci = 8,
127 128
128 /* constants for mapping table */ 129 /* constants for mapping table */
129 P0 = 0, /* port 0 */ 130 P0 = 0, /* port 0 */
@@ -188,7 +189,7 @@ static const struct pci_device_id piix_pci_tbl[] = {
188 /* 82801GB/GR/GH (ICH7, identical to ICH6) */ 189 /* 82801GB/GR/GH (ICH7, identical to ICH6) */
189 { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, 190 { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
190 /* 2801GBM/GHM (ICH7M, identical to ICH6M) */ 191 /* 2801GBM/GHM (ICH7M, identical to ICH6M) */
191 { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6m_sata_ahci }, 192 { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich7m_sata_ahci },
192 /* Enterprise Southbridge 2 (where's the datasheet?) */ 193 /* Enterprise Southbridge 2 (where's the datasheet?) */
193 { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, 194 { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
194 /* SATA Controller 1 IDE (ICH8, no datasheet yet) */ 195 /* SATA Controller 1 IDE (ICH8, no datasheet yet) */
@@ -336,6 +337,24 @@ static const struct piix_map_db ich6m_map_db = {
336 }, 337 },
337}; 338};
338 339
340static const struct piix_map_db ich7m_map_db = {
341 .mask = 0x3,
342 .port_enable = 0x5,
343 .present_shift = 4,
344
345 /* Map 01b isn't specified in the doc but some notebooks use
346 * it anyway. ATM, the only case spotted carries subsystem ID
347 * 1025:0107. This is the only difference from ich6m.
348 */
349 .map = {
350 /* PM PS SM SS MAP */
351 { P0, P2, RV, RV }, /* 00b */
352 { IDE, IDE, P1, P3 }, /* 01b */
353 { P0, P2, IDE, IDE }, /* 10b */
354 { RV, RV, RV, RV },
355 },
356};
357
339static const struct piix_map_db ich8_map_db = { 358static const struct piix_map_db ich8_map_db = {
340 .mask = 0x3, 359 .mask = 0x3,
341 .port_enable = 0x3, 360 .port_enable = 0x3,
@@ -355,6 +374,7 @@ static const struct piix_map_db *piix_map_db_table[] = {
355 [ich6_sata] = &ich6_map_db, 374 [ich6_sata] = &ich6_map_db,
356 [ich6_sata_ahci] = &ich6_map_db, 375 [ich6_sata_ahci] = &ich6_map_db,
357 [ich6m_sata_ahci] = &ich6m_map_db, 376 [ich6m_sata_ahci] = &ich6m_map_db,
377 [ich7m_sata_ahci] = &ich7m_map_db,
358 [ich8_sata_ahci] = &ich8_map_db, 378 [ich8_sata_ahci] = &ich8_map_db,
359}; 379};
360 380
@@ -444,6 +464,18 @@ static struct ata_port_info piix_port_info[] = {
444 .port_ops = &piix_sata_ops, 464 .port_ops = &piix_sata_ops,
445 }, 465 },
446 466
467 /* ich7m_sata_ahci */
468 {
469 .sht = &piix_sht,
470 .host_flags = ATA_FLAG_SATA |
471 PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR |
472 PIIX_FLAG_AHCI,
473 .pio_mask = 0x1f, /* pio0-4 */
474 .mwdma_mask = 0x07, /* mwdma0-2 */
475 .udma_mask = 0x7f, /* udma0-6 */
476 .port_ops = &piix_sata_ops,
477 },
478
447 /* ich8_sata_ahci */ 479 /* ich8_sata_ahci */
448 { 480 {
449 .sht = &piix_sht, 481 .sht = &piix_sht,
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 73dd6c8deede..427b73a3886a 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1256,10 +1256,15 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
1256 swap_buf_le16(id, ATA_ID_WORDS); 1256 swap_buf_le16(id, ATA_ID_WORDS);
1257 1257
1258 /* sanity check */ 1258 /* sanity check */
1259 if ((class == ATA_DEV_ATA) != (ata_id_is_ata(id) | ata_id_is_cfa(id))) { 1259 rc = -EINVAL;
1260 rc = -EINVAL; 1260 reason = "device reports illegal type";
1261 reason = "device reports illegal type"; 1261
1262 goto err_out; 1262 if (class == ATA_DEV_ATA) {
1263 if (!ata_id_is_ata(id) && !ata_id_is_cfa(id))
1264 goto err_out;
1265 } else {
1266 if (ata_id_is_ata(id))
1267 goto err_out;
1263 } 1268 }
1264 1269
1265 if (post_reset && class == ATA_DEV_ATA) { 1270 if (post_reset && class == ATA_DEV_ATA) {
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 1053c7c76b7d..fa38a413d16b 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -1961,8 +1961,7 @@ comreset_retry:
1961 timeout = jiffies + msecs_to_jiffies(200); 1961 timeout = jiffies + msecs_to_jiffies(200);
1962 do { 1962 do {
1963 sata_scr_read(ap, SCR_STATUS, &sstatus); 1963 sata_scr_read(ap, SCR_STATUS, &sstatus);
1964 sstatus &= 0x3; 1964 if (((sstatus & 0x3) == 3) || ((sstatus & 0x3) == 0))
1965 if ((sstatus == 3) || (sstatus == 0))
1966 break; 1965 break;
1967 1966
1968 __msleep(1, can_sleep); 1967 __msleep(1, can_sleep);
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index 01d40369a8a5..a3727af8b9c1 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -77,6 +77,7 @@ static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
77static void vt6420_error_handler(struct ata_port *ap); 77static void vt6420_error_handler(struct ata_port *ap);
78 78
79static const struct pci_device_id svia_pci_tbl[] = { 79static const struct pci_device_id svia_pci_tbl[] = {
80 { 0x1106, 0x0591, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 },
80 { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 }, 81 { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 },
81 { 0x1106, 0x3249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6421 }, 82 { 0x1106, 0x3249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6421 },
82 83
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index a8ed5a22009d..3d355d054612 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -466,7 +466,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
466 struct scsi_device *sdev = scmd->device; 466 struct scsi_device *sdev = scmd->device;
467 struct Scsi_Host *shost = sdev->host; 467 struct Scsi_Host *shost = sdev->host;
468 int old_result = scmd->result; 468 int old_result = scmd->result;
469 DECLARE_COMPLETION(done); 469 DECLARE_COMPLETION_ONSTACK(done);
470 unsigned long timeleft; 470 unsigned long timeleft;
471 unsigned long flags; 471 unsigned long flags;
472 unsigned char old_cmnd[MAX_COMMAND_SIZE]; 472 unsigned char old_cmnd[MAX_COMMAND_SIZE];
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index cd1979daf2b8..851e4839d6d9 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -458,11 +458,11 @@ static int pci_siig_setup(struct serial_private *priv,
458 * growing *huge*, we use this function to collapse some 70 entries 458 * growing *huge*, we use this function to collapse some 70 entries
459 * in the PCI table into one, for sanity's and compactness's sake. 459 * in the PCI table into one, for sanity's and compactness's sake.
460 */ 460 */
461static unsigned short timedia_single_port[] = { 461static const unsigned short timedia_single_port[] = {
462 0x4025, 0x4027, 0x4028, 0x5025, 0x5027, 0 462 0x4025, 0x4027, 0x4028, 0x5025, 0x5027, 0
463}; 463};
464 464
465static unsigned short timedia_dual_port[] = { 465static const unsigned short timedia_dual_port[] = {
466 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085, 466 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085,
467 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079, 467 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079,
468 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079, 468 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079,
@@ -470,35 +470,34 @@ static unsigned short timedia_dual_port[] = {
470 0xD079, 0 470 0xD079, 0
471}; 471};
472 472
473static unsigned short timedia_quad_port[] = { 473static const unsigned short timedia_quad_port[] = {
474 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157, 474 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157,
475 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159, 475 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159,
476 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056, 476 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056,
477 0xB157, 0 477 0xB157, 0
478}; 478};
479 479
480static unsigned short timedia_eight_port[] = { 480static const unsigned short timedia_eight_port[] = {
481 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166, 481 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166,
482 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 482 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
483}; 483};
484 484
485static const struct timedia_struct { 485static const struct timedia_struct {
486 int num; 486 int num;
487 unsigned short *ids; 487 const unsigned short *ids;
488} timedia_data[] = { 488} timedia_data[] = {
489 { 1, timedia_single_port }, 489 { 1, timedia_single_port },
490 { 2, timedia_dual_port }, 490 { 2, timedia_dual_port },
491 { 4, timedia_quad_port }, 491 { 4, timedia_quad_port },
492 { 8, timedia_eight_port }, 492 { 8, timedia_eight_port }
493 { 0, NULL }
494}; 493};
495 494
496static int pci_timedia_init(struct pci_dev *dev) 495static int pci_timedia_init(struct pci_dev *dev)
497{ 496{
498 unsigned short *ids; 497 const unsigned short *ids;
499 int i, j; 498 int i, j;
500 499
501 for (i = 0; timedia_data[i].num; i++) { 500 for (i = 0; i < ARRAY_SIZE(timedia_data); i++) {
502 ids = timedia_data[i].ids; 501 ids = timedia_data[i].ids;
503 for (j = 0; ids[j]; j++) 502 for (j = 0; ids[j]; j++)
504 if (dev->subsystem_device == ids[j]) 503 if (dev->subsystem_device == ids[j])
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 80ef7d482756..372e47f7d596 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2377,6 +2377,9 @@ int uart_match_port(struct uart_port *port1, struct uart_port *port2)
2377 return (port1->iobase == port2->iobase) && 2377 return (port1->iobase == port2->iobase) &&
2378 (port1->hub6 == port2->hub6); 2378 (port1->hub6 == port2->hub6);
2379 case UPIO_MEM: 2379 case UPIO_MEM:
2380 case UPIO_MEM32:
2381 case UPIO_AU:
2382 case UPIO_TSI:
2380 return (port1->mapbase == port2->mapbase); 2383 return (port1->mapbase == port2->mapbase);
2381 } 2384 }
2382 return 0; 2385 return 0;
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 301573373c30..cbede06cac27 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -1579,7 +1579,7 @@ static int __init serial_console_setup(struct console *co, char *options)
1579 h8300_sci_enable(port, sci_enable); 1579 h8300_sci_enable(port, sci_enable);
1580#endif 1580#endif
1581#elif defined(CONFIG_SUPERH64) 1581#elif defined(CONFIG_SUPERH64)
1582 port->uartclk = current_cpu_info.module_clock * 16; 1582 port->uartclk = current_cpu_data.module_clock * 16;
1583#else 1583#else
1584 { 1584 {
1585 struct clk *clk = clk_get("module_clk"); 1585 struct clk *clk = clk_get("module_clk");
@@ -1720,7 +1720,7 @@ static int __init sci_init(void)
1720#if defined(__H8300H__) || defined(__H8300S__) 1720#if defined(__H8300H__) || defined(__H8300S__)
1721 sciport->port.uartclk = CONFIG_CPU_CLOCK; 1721 sciport->port.uartclk = CONFIG_CPU_CLOCK;
1722#elif defined(CONFIG_SUPERH64) 1722#elif defined(CONFIG_SUPERH64)
1723 sciport->port.uartclk = current_cpu_info.module_clock * 16; 1723 sciport->port.uartclk = current_cpu_data.module_clock * 16;
1724#else 1724#else
1725 struct clk *clk = clk_get("module_clk"); 1725 struct clk *clk = clk_get("module_clk");
1726 sciport->port.uartclk = clk_get_rate(clk) * 16; 1726 sciport->port.uartclk = clk_get_rate(clk) * 16;
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 4fe1bec1c255..30299c620d97 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -117,6 +117,8 @@ struct eth_dev {
117 struct usb_ep *in_ep, *out_ep, *status_ep; 117 struct usb_ep *in_ep, *out_ep, *status_ep;
118 const struct usb_endpoint_descriptor 118 const struct usb_endpoint_descriptor
119 *in, *out, *status; 119 *in, *out, *status;
120
121 spinlock_t req_lock;
120 struct list_head tx_reqs, rx_reqs; 122 struct list_head tx_reqs, rx_reqs;
121 123
122 struct net_device *net; 124 struct net_device *net;
@@ -1066,21 +1068,31 @@ static void eth_reset_config (struct eth_dev *dev)
1066 */ 1068 */
1067 if (dev->in) { 1069 if (dev->in) {
1068 usb_ep_disable (dev->in_ep); 1070 usb_ep_disable (dev->in_ep);
1071 spin_lock(&dev->req_lock);
1069 while (likely (!list_empty (&dev->tx_reqs))) { 1072 while (likely (!list_empty (&dev->tx_reqs))) {
1070 req = container_of (dev->tx_reqs.next, 1073 req = container_of (dev->tx_reqs.next,
1071 struct usb_request, list); 1074 struct usb_request, list);
1072 list_del (&req->list); 1075 list_del (&req->list);
1076
1077 spin_unlock(&dev->req_lock);
1073 usb_ep_free_request (dev->in_ep, req); 1078 usb_ep_free_request (dev->in_ep, req);
1079 spin_lock(&dev->req_lock);
1074 } 1080 }
1081 spin_unlock(&dev->req_lock);
1075 } 1082 }
1076 if (dev->out) { 1083 if (dev->out) {
1077 usb_ep_disable (dev->out_ep); 1084 usb_ep_disable (dev->out_ep);
1085 spin_lock(&dev->req_lock);
1078 while (likely (!list_empty (&dev->rx_reqs))) { 1086 while (likely (!list_empty (&dev->rx_reqs))) {
1079 req = container_of (dev->rx_reqs.next, 1087 req = container_of (dev->rx_reqs.next,
1080 struct usb_request, list); 1088 struct usb_request, list);
1081 list_del (&req->list); 1089 list_del (&req->list);
1090
1091 spin_unlock(&dev->req_lock);
1082 usb_ep_free_request (dev->out_ep, req); 1092 usb_ep_free_request (dev->out_ep, req);
1093 spin_lock(&dev->req_lock);
1083 } 1094 }
1095 spin_unlock(&dev->req_lock);
1084 } 1096 }
1085 1097
1086 if (dev->status) { 1098 if (dev->status) {
@@ -1659,9 +1671,9 @@ enomem:
1659 if (retval) { 1671 if (retval) {
1660 DEBUG (dev, "rx submit --> %d\n", retval); 1672 DEBUG (dev, "rx submit --> %d\n", retval);
1661 dev_kfree_skb_any (skb); 1673 dev_kfree_skb_any (skb);
1662 spin_lock (&dev->lock); 1674 spin_lock(&dev->req_lock);
1663 list_add (&req->list, &dev->rx_reqs); 1675 list_add (&req->list, &dev->rx_reqs);
1664 spin_unlock (&dev->lock); 1676 spin_unlock(&dev->req_lock);
1665 } 1677 }
1666 return retval; 1678 return retval;
1667} 1679}
@@ -1730,8 +1742,9 @@ quiesce:
1730 dev_kfree_skb_any (skb); 1742 dev_kfree_skb_any (skb);
1731 if (!netif_running (dev->net)) { 1743 if (!netif_running (dev->net)) {
1732clean: 1744clean:
1733 /* nobody reading rx_reqs, so no dev->lock */ 1745 spin_lock(&dev->req_lock);
1734 list_add (&req->list, &dev->rx_reqs); 1746 list_add (&req->list, &dev->rx_reqs);
1747 spin_unlock(&dev->req_lock);
1735 req = NULL; 1748 req = NULL;
1736 } 1749 }
1737 if (req) 1750 if (req)
@@ -1782,15 +1795,18 @@ static int alloc_requests (struct eth_dev *dev, unsigned n, gfp_t gfp_flags)
1782{ 1795{
1783 int status; 1796 int status;
1784 1797
1798 spin_lock(&dev->req_lock);
1785 status = prealloc (&dev->tx_reqs, dev->in_ep, n, gfp_flags); 1799 status = prealloc (&dev->tx_reqs, dev->in_ep, n, gfp_flags);
1786 if (status < 0) 1800 if (status < 0)
1787 goto fail; 1801 goto fail;
1788 status = prealloc (&dev->rx_reqs, dev->out_ep, n, gfp_flags); 1802 status = prealloc (&dev->rx_reqs, dev->out_ep, n, gfp_flags);
1789 if (status < 0) 1803 if (status < 0)
1790 goto fail; 1804 goto fail;
1791 return 0; 1805 goto done;
1792fail: 1806fail:
1793 DEBUG (dev, "can't alloc requests\n"); 1807 DEBUG (dev, "can't alloc requests\n");
1808done:
1809 spin_unlock(&dev->req_lock);
1794 return status; 1810 return status;
1795} 1811}
1796 1812
@@ -1800,21 +1816,21 @@ static void rx_fill (struct eth_dev *dev, gfp_t gfp_flags)
1800 unsigned long flags; 1816 unsigned long flags;
1801 1817
1802 /* fill unused rxq slots with some skb */ 1818 /* fill unused rxq slots with some skb */
1803 spin_lock_irqsave (&dev->lock, flags); 1819 spin_lock_irqsave(&dev->req_lock, flags);
1804 while (!list_empty (&dev->rx_reqs)) { 1820 while (!list_empty (&dev->rx_reqs)) {
1805 req = container_of (dev->rx_reqs.next, 1821 req = container_of (dev->rx_reqs.next,
1806 struct usb_request, list); 1822 struct usb_request, list);
1807 list_del_init (&req->list); 1823 list_del_init (&req->list);
1808 spin_unlock_irqrestore (&dev->lock, flags); 1824 spin_unlock_irqrestore(&dev->req_lock, flags);
1809 1825
1810 if (rx_submit (dev, req, gfp_flags) < 0) { 1826 if (rx_submit (dev, req, gfp_flags) < 0) {
1811 defer_kevent (dev, WORK_RX_MEMORY); 1827 defer_kevent (dev, WORK_RX_MEMORY);
1812 return; 1828 return;
1813 } 1829 }
1814 1830
1815 spin_lock_irqsave (&dev->lock, flags); 1831 spin_lock_irqsave(&dev->req_lock, flags);
1816 } 1832 }
1817 spin_unlock_irqrestore (&dev->lock, flags); 1833 spin_unlock_irqrestore(&dev->req_lock, flags);
1818} 1834}
1819 1835
1820static void eth_work (void *_dev) 1836static void eth_work (void *_dev)
@@ -1848,9 +1864,9 @@ static void tx_complete (struct usb_ep *ep, struct usb_request *req)
1848 } 1864 }
1849 dev->stats.tx_packets++; 1865 dev->stats.tx_packets++;
1850 1866
1851 spin_lock (&dev->lock); 1867 spin_lock(&dev->req_lock);
1852 list_add (&req->list, &dev->tx_reqs); 1868 list_add (&req->list, &dev->tx_reqs);
1853 spin_unlock (&dev->lock); 1869 spin_unlock(&dev->req_lock);
1854 dev_kfree_skb_any (skb); 1870 dev_kfree_skb_any (skb);
1855 1871
1856 atomic_dec (&dev->tx_qlen); 1872 atomic_dec (&dev->tx_qlen);
@@ -1896,12 +1912,12 @@ static int eth_start_xmit (struct sk_buff *skb, struct net_device *net)
1896 /* ignores USB_CDC_PACKET_TYPE_DIRECTED */ 1912 /* ignores USB_CDC_PACKET_TYPE_DIRECTED */
1897 } 1913 }
1898 1914
1899 spin_lock_irqsave (&dev->lock, flags); 1915 spin_lock_irqsave(&dev->req_lock, flags);
1900 req = container_of (dev->tx_reqs.next, struct usb_request, list); 1916 req = container_of (dev->tx_reqs.next, struct usb_request, list);
1901 list_del (&req->list); 1917 list_del (&req->list);
1902 if (list_empty (&dev->tx_reqs)) 1918 if (list_empty (&dev->tx_reqs))
1903 netif_stop_queue (net); 1919 netif_stop_queue (net);
1904 spin_unlock_irqrestore (&dev->lock, flags); 1920 spin_unlock_irqrestore(&dev->req_lock, flags);
1905 1921
1906 /* no buffer copies needed, unless the network stack did it 1922 /* no buffer copies needed, unless the network stack did it
1907 * or the hardware can't use skb buffers. 1923 * or the hardware can't use skb buffers.
@@ -1955,11 +1971,11 @@ static int eth_start_xmit (struct sk_buff *skb, struct net_device *net)
1955drop: 1971drop:
1956 dev->stats.tx_dropped++; 1972 dev->stats.tx_dropped++;
1957 dev_kfree_skb_any (skb); 1973 dev_kfree_skb_any (skb);
1958 spin_lock_irqsave (&dev->lock, flags); 1974 spin_lock_irqsave(&dev->req_lock, flags);
1959 if (list_empty (&dev->tx_reqs)) 1975 if (list_empty (&dev->tx_reqs))
1960 netif_start_queue (net); 1976 netif_start_queue (net);
1961 list_add (&req->list, &dev->tx_reqs); 1977 list_add (&req->list, &dev->tx_reqs);
1962 spin_unlock_irqrestore (&dev->lock, flags); 1978 spin_unlock_irqrestore(&dev->req_lock, flags);
1963 } 1979 }
1964 return 0; 1980 return 0;
1965} 1981}
@@ -2378,6 +2394,7 @@ autoconf_fail:
2378 return status; 2394 return status;
2379 dev = netdev_priv(net); 2395 dev = netdev_priv(net);
2380 spin_lock_init (&dev->lock); 2396 spin_lock_init (&dev->lock);
2397 spin_lock_init (&dev->req_lock);
2381 INIT_WORK (&dev->work, eth_work, dev); 2398 INIT_WORK (&dev->work, eth_work, dev);
2382 INIT_LIST_HEAD (&dev->tx_reqs); 2399 INIT_LIST_HEAD (&dev->tx_reqs);
2383 INIT_LIST_HEAD (&dev->rx_reqs); 2400 INIT_LIST_HEAD (&dev->rx_reqs);
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 66c3f61bc9d1..431e8f31f1a9 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -372,7 +372,7 @@ static void uhci_fixup_toggles(struct uhci_qh *qh, int skip_first)
372 * need to change any toggles in this URB */ 372 * need to change any toggles in this URB */
373 td = list_entry(urbp->td_list.next, struct uhci_td, list); 373 td = list_entry(urbp->td_list.next, struct uhci_td, list);
374 if (toggle > 1 || uhci_toggle(td_token(td)) == toggle) { 374 if (toggle > 1 || uhci_toggle(td_token(td)) == toggle) {
375 td = list_entry(urbp->td_list.next, struct uhci_td, 375 td = list_entry(urbp->td_list.prev, struct uhci_td,
376 list); 376 list);
377 toggle = uhci_toggle(td_token(td)) ^ 1; 377 toggle = uhci_toggle(td_token(td)) ^ 1;
378 378
@@ -1348,7 +1348,7 @@ static void uhci_scan_qh(struct uhci_hcd *uhci, struct uhci_qh *qh,
1348 } 1348 }
1349 1349
1350 uhci_giveback_urb(uhci, qh, urb, regs); 1350 uhci_giveback_urb(uhci, qh, urb, regs);
1351 if (status < 0) 1351 if (status < 0 && qh->type != USB_ENDPOINT_XFER_ISOC)
1352 break; 1352 break;
1353 } 1353 }
1354 1354
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 8ea9c915fbf9..a2c56b2de589 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -1411,17 +1411,54 @@ void hid_init_reports(struct hid_device *hid)
1411 warn("timeout initializing reports"); 1411 warn("timeout initializing reports");
1412} 1412}
1413 1413
1414#define USB_VENDOR_ID_GTCO 0x078c
1415#define USB_DEVICE_ID_GTCO_90 0x0090
1416#define USB_DEVICE_ID_GTCO_100 0x0100
1417#define USB_DEVICE_ID_GTCO_101 0x0101
1418#define USB_DEVICE_ID_GTCO_103 0x0103
1419#define USB_DEVICE_ID_GTCO_104 0x0104
1420#define USB_DEVICE_ID_GTCO_105 0x0105
1421#define USB_DEVICE_ID_GTCO_106 0x0106
1422#define USB_DEVICE_ID_GTCO_107 0x0107
1423#define USB_DEVICE_ID_GTCO_108 0x0108
1424#define USB_DEVICE_ID_GTCO_200 0x0200
1425#define USB_DEVICE_ID_GTCO_201 0x0201
1426#define USB_DEVICE_ID_GTCO_202 0x0202
1427#define USB_DEVICE_ID_GTCO_203 0x0203
1428#define USB_DEVICE_ID_GTCO_204 0x0204
1429#define USB_DEVICE_ID_GTCO_205 0x0205
1430#define USB_DEVICE_ID_GTCO_206 0x0206
1431#define USB_DEVICE_ID_GTCO_207 0x0207
1432#define USB_DEVICE_ID_GTCO_300 0x0300
1433#define USB_DEVICE_ID_GTCO_301 0x0301
1434#define USB_DEVICE_ID_GTCO_302 0x0302
1435#define USB_DEVICE_ID_GTCO_303 0x0303
1436#define USB_DEVICE_ID_GTCO_304 0x0304
1437#define USB_DEVICE_ID_GTCO_305 0x0305
1438#define USB_DEVICE_ID_GTCO_306 0x0306
1439#define USB_DEVICE_ID_GTCO_307 0x0307
1440#define USB_DEVICE_ID_GTCO_308 0x0308
1441#define USB_DEVICE_ID_GTCO_309 0x0309
1442#define USB_DEVICE_ID_GTCO_400 0x0400
1443#define USB_DEVICE_ID_GTCO_401 0x0401
1444#define USB_DEVICE_ID_GTCO_402 0x0402
1445#define USB_DEVICE_ID_GTCO_403 0x0403
1446#define USB_DEVICE_ID_GTCO_404 0x0404
1447#define USB_DEVICE_ID_GTCO_405 0x0405
1448#define USB_DEVICE_ID_GTCO_500 0x0500
1449#define USB_DEVICE_ID_GTCO_501 0x0501
1450#define USB_DEVICE_ID_GTCO_502 0x0502
1451#define USB_DEVICE_ID_GTCO_503 0x0503
1452#define USB_DEVICE_ID_GTCO_504 0x0504
1453#define USB_DEVICE_ID_GTCO_1000 0x1000
1454#define USB_DEVICE_ID_GTCO_1001 0x1001
1455#define USB_DEVICE_ID_GTCO_1002 0x1002
1456#define USB_DEVICE_ID_GTCO_1003 0x1003
1457#define USB_DEVICE_ID_GTCO_1004 0x1004
1458#define USB_DEVICE_ID_GTCO_1005 0x1005
1459#define USB_DEVICE_ID_GTCO_1006 0x1006
1460
1414#define USB_VENDOR_ID_WACOM 0x056a 1461#define USB_VENDOR_ID_WACOM 0x056a
1415#define USB_DEVICE_ID_WACOM_PENPARTNER 0x0000
1416#define USB_DEVICE_ID_WACOM_GRAPHIRE 0x0010
1417#define USB_DEVICE_ID_WACOM_INTUOS 0x0020
1418#define USB_DEVICE_ID_WACOM_PL 0x0030
1419#define USB_DEVICE_ID_WACOM_INTUOS2 0x0040
1420#define USB_DEVICE_ID_WACOM_VOLITO 0x0060
1421#define USB_DEVICE_ID_WACOM_PTU 0x0003
1422#define USB_DEVICE_ID_WACOM_INTUOS3 0x00B0
1423#define USB_DEVICE_ID_WACOM_CINTIQ 0x003F
1424#define USB_DEVICE_ID_WACOM_DTF 0x00C0
1425 1462
1426#define USB_VENDOR_ID_ACECAD 0x0460 1463#define USB_VENDOR_ID_ACECAD 0x0460
1427#define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 1464#define USB_DEVICE_ID_ACECAD_FLAIR 0x0004
@@ -1588,6 +1625,51 @@ static const struct hid_blacklist {
1588 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE }, 1625 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE },
1589 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, 1626 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE },
1590 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, 1627 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE },
1628 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90, HID_QUIRK_IGNORE },
1629 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100, HID_QUIRK_IGNORE },
1630 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101, HID_QUIRK_IGNORE },
1631 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103, HID_QUIRK_IGNORE },
1632 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104, HID_QUIRK_IGNORE },
1633 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105, HID_QUIRK_IGNORE },
1634 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106, HID_QUIRK_IGNORE },
1635 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107, HID_QUIRK_IGNORE },
1636 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108, HID_QUIRK_IGNORE },
1637 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200, HID_QUIRK_IGNORE },
1638 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201, HID_QUIRK_IGNORE },
1639 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202, HID_QUIRK_IGNORE },
1640 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203, HID_QUIRK_IGNORE },
1641 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204, HID_QUIRK_IGNORE },
1642 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205, HID_QUIRK_IGNORE },
1643 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206, HID_QUIRK_IGNORE },
1644 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207, HID_QUIRK_IGNORE },
1645 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300, HID_QUIRK_IGNORE },
1646 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301, HID_QUIRK_IGNORE },
1647 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302, HID_QUIRK_IGNORE },
1648 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303, HID_QUIRK_IGNORE },
1649 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304, HID_QUIRK_IGNORE },
1650 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305, HID_QUIRK_IGNORE },
1651 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306, HID_QUIRK_IGNORE },
1652 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307, HID_QUIRK_IGNORE },
1653 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308, HID_QUIRK_IGNORE },
1654 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309, HID_QUIRK_IGNORE },
1655 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400, HID_QUIRK_IGNORE },
1656 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401, HID_QUIRK_IGNORE },
1657 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402, HID_QUIRK_IGNORE },
1658 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403, HID_QUIRK_IGNORE },
1659 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404, HID_QUIRK_IGNORE },
1660 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405, HID_QUIRK_IGNORE },
1661 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500, HID_QUIRK_IGNORE },
1662 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501, HID_QUIRK_IGNORE },
1663 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502, HID_QUIRK_IGNORE },
1664 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503, HID_QUIRK_IGNORE },
1665 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504, HID_QUIRK_IGNORE },
1666 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000, HID_QUIRK_IGNORE },
1667 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001, HID_QUIRK_IGNORE },
1668 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002, HID_QUIRK_IGNORE },
1669 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003, HID_QUIRK_IGNORE },
1670 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004, HID_QUIRK_IGNORE },
1671 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005, HID_QUIRK_IGNORE },
1672 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006, HID_QUIRK_IGNORE },
1591 { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, 1673 { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE },
1592 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE }, 1674 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE },
1593 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY, HID_QUIRK_IGNORE }, 1675 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY, HID_QUIRK_IGNORE },
@@ -1617,49 +1699,6 @@ static const struct hid_blacklist {
1617 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, 1699 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE },
1618 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, 1700 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE },
1619 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS, HID_QUIRK_IGNORE }, 1701 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS, HID_QUIRK_IGNORE },
1620 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PENPARTNER, HID_QUIRK_IGNORE },
1621 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE, HID_QUIRK_IGNORE },
1622 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 1, HID_QUIRK_IGNORE },
1623 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 2, HID_QUIRK_IGNORE },
1624 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 3, HID_QUIRK_IGNORE },
1625 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 4, HID_QUIRK_IGNORE },
1626 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS, HID_QUIRK_IGNORE },
1627 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 1, HID_QUIRK_IGNORE },
1628 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 2, HID_QUIRK_IGNORE },
1629 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 3, HID_QUIRK_IGNORE },
1630 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 4, HID_QUIRK_IGNORE },
1631 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL, HID_QUIRK_IGNORE },
1632 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 1, HID_QUIRK_IGNORE },
1633 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 2, HID_QUIRK_IGNORE },
1634 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 3, HID_QUIRK_IGNORE },
1635 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 4, HID_QUIRK_IGNORE },
1636 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 5, HID_QUIRK_IGNORE },
1637 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 7, HID_QUIRK_IGNORE },
1638 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 8, HID_QUIRK_IGNORE },
1639 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 9, HID_QUIRK_IGNORE },
1640 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 1, HID_QUIRK_IGNORE },
1641 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 2, HID_QUIRK_IGNORE },
1642 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 3, HID_QUIRK_IGNORE },
1643 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 4, HID_QUIRK_IGNORE },
1644 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 5, HID_QUIRK_IGNORE },
1645 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 7, HID_QUIRK_IGNORE },
1646 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO, HID_QUIRK_IGNORE },
1647 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 1, HID_QUIRK_IGNORE },
1648 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 2, HID_QUIRK_IGNORE },
1649 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 3, HID_QUIRK_IGNORE },
1650 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 4, HID_QUIRK_IGNORE },
1651 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 5, HID_QUIRK_IGNORE },
1652 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 6, HID_QUIRK_IGNORE },
1653 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PTU, HID_QUIRK_IGNORE },
1654 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3, HID_QUIRK_IGNORE },
1655 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 1, HID_QUIRK_IGNORE },
1656 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 2, HID_QUIRK_IGNORE },
1657 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 3, HID_QUIRK_IGNORE },
1658 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 4, HID_QUIRK_IGNORE },
1659 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 5, HID_QUIRK_IGNORE },
1660 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_CINTIQ, HID_QUIRK_IGNORE },
1661 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF, HID_QUIRK_IGNORE },
1662 { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF + 3, HID_QUIRK_IGNORE },
1663 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, 1702 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE },
1664 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, 1703 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE },
1665 { USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K, HID_QUIRK_IGNORE }, 1704 { USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K, HID_QUIRK_IGNORE },
@@ -1778,6 +1817,10 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
1778 char *rdesc; 1817 char *rdesc;
1779 int n, len, insize = 0; 1818 int n, len, insize = 0;
1780 1819
1820 /* Ignore all Wacom devices */
1821 if (dev->descriptor.idVendor == USB_VENDOR_ID_WACOM)
1822 return NULL;
1823
1781 for (n = 0; hid_blacklist[n].idVendor; n++) 1824 for (n = 0; hid_blacklist[n].idVendor; n++)
1782 if ((hid_blacklist[n].idVendor == le16_to_cpu(dev->descriptor.idVendor)) && 1825 if ((hid_blacklist[n].idVendor == le16_to_cpu(dev->descriptor.idVendor)) &&
1783 (hid_blacklist[n].idProduct == le16_to_cpu(dev->descriptor.idProduct))) 1826 (hid_blacklist[n].idProduct == le16_to_cpu(dev->descriptor.idProduct)))
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c
index 3b175aa482cd..a338bf4c2d78 100644
--- a/drivers/usb/input/usbtouchscreen.c
+++ b/drivers/usb/input/usbtouchscreen.c
@@ -286,7 +286,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch)
286static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) 286static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press)
287{ 287{
288 *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); 288 *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F);
289 *x = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); 289 *y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F);
290 *press = ((pkt[2] & 0x1F) << 7) | (pkt[5] & 0x7F); 290 *press = ((pkt[2] & 0x1F) << 7) | (pkt[5] & 0x7F);
291 *touch = ~pkt[7] & 0x20; 291 *touch = ~pkt[7] & 0x20;
292 292
diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c
index 575a4e672e96..7b45fd3de911 100644
--- a/drivers/usb/input/yealink.c
+++ b/drivers/usb/input/yealink.c
@@ -810,12 +810,9 @@ static int usb_cleanup(struct yealink_dev *yld, int err)
810 if (yld == NULL) 810 if (yld == NULL)
811 return err; 811 return err;
812 812
813 if (yld->urb_irq) { 813 usb_kill_urb(yld->urb_irq); /* parameter validation in core/urb */
814 usb_kill_urb(yld->urb_irq); 814 usb_kill_urb(yld->urb_ctl); /* parameter validation in core/urb */
815 usb_free_urb(yld->urb_irq); 815
816 }
817 if (yld->urb_ctl)
818 usb_free_urb(yld->urb_ctl);
819 if (yld->idev) { 816 if (yld->idev) {
820 if (err) 817 if (err)
821 input_free_device(yld->idev); 818 input_free_device(yld->idev);
@@ -831,6 +828,9 @@ static int usb_cleanup(struct yealink_dev *yld, int err)
831 if (yld->irq_data) 828 if (yld->irq_data)
832 usb_buffer_free(yld->udev, USB_PKT_LEN, 829 usb_buffer_free(yld->udev, USB_PKT_LEN,
833 yld->irq_data, yld->irq_dma); 830 yld->irq_data, yld->irq_dma);
831
832 usb_free_urb(yld->urb_irq); /* parameter validation in core/urb */
833 usb_free_urb(yld->urb_ctl); /* parameter validation in core/urb */
834 kfree(yld); 834 kfree(yld);
835 return err; 835 return err;
836} 836}
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 738bd7c7451f..e16582f3733c 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3435,6 +3435,8 @@ static void sisusb_disconnect(struct usb_interface *intf)
3435 3435
3436static struct usb_device_id sisusb_table [] = { 3436static struct usb_device_id sisusb_table [] = {
3437 { USB_DEVICE(0x0711, 0x0900) }, 3437 { USB_DEVICE(0x0711, 0x0900) },
3438 { USB_DEVICE(0x0711, 0x0901) },
3439 { USB_DEVICE(0x0711, 0x0902) },
3438 { USB_DEVICE(0x182d, 0x021c) }, 3440 { USB_DEVICE(0x182d, 0x021c) },
3439 { USB_DEVICE(0x182d, 0x0269) }, 3441 { USB_DEVICE(0x182d, 0x0269) },
3440 { } 3442 { }
diff --git a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h
index a54752ce1493..006438069b66 100644
--- a/drivers/usb/net/pegasus.h
+++ b/drivers/usb/net/pegasus.h
@@ -131,6 +131,7 @@ struct usb_eth_dev {
131#define VENDOR_COREGA 0x07aa 131#define VENDOR_COREGA 0x07aa
132#define VENDOR_DLINK 0x2001 132#define VENDOR_DLINK 0x2001
133#define VENDOR_ELCON 0x0db7 133#define VENDOR_ELCON 0x0db7
134#define VENDOR_ELECOM 0x056e
134#define VENDOR_ELSA 0x05cc 135#define VENDOR_ELSA 0x05cc
135#define VENDOR_GIGABYTE 0x1044 136#define VENDOR_GIGABYTE 0x1044
136#define VENDOR_HAWKING 0x0e66 137#define VENDOR_HAWKING 0x0e66
@@ -233,6 +234,8 @@ PEGASUS_DEV( "D-Link DSB-650", VENDOR_DLINK, 0xabc1,
233 DEFAULT_GPIO_RESET ) 234 DEFAULT_GPIO_RESET )
234PEGASUS_DEV( "GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002, 235PEGASUS_DEV( "GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002,
235 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA ) 236 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA )
237PEGASUS_DEV( "ELECOM USB Ethernet LD-USB20", VENDOR_ELECOM, 0x4010,
238 DEFAULT_GPIO_RESET | PEGASUS_II )
236PEGASUS_DEV( "EasiDock Ethernet", VENDOR_MOBILITY, 0x0304, 239PEGASUS_DEV( "EasiDock Ethernet", VENDOR_MOBILITY, 0x0304,
237 DEFAULT_GPIO_RESET ) 240 DEFAULT_GPIO_RESET )
238PEGASUS_DEV( "Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000, 241PEGASUS_DEV( "Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000,
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
index bd09232ce13c..a72685b96061 100644
--- a/drivers/usb/net/rtl8150.c
+++ b/drivers/usb/net/rtl8150.c
@@ -972,6 +972,7 @@ static void rtl8150_disconnect(struct usb_interface *intf)
972 if (dev) { 972 if (dev) {
973 set_bit(RTL8150_UNPLUG, &dev->flags); 973 set_bit(RTL8150_UNPLUG, &dev->flags);
974 tasklet_disable(&dev->tl); 974 tasklet_disable(&dev->tl);
975 tasklet_kill(&dev->tl);
975 unregister_netdev(dev->netdev); 976 unregister_netdev(dev->netdev);
976 unlink_all_urbs(dev); 977 unlink_all_urbs(dev);
977 free_all_urbs(dev); 978 free_all_urbs(dev);
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 15945e806f03..c6115aa1b445 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -506,6 +506,7 @@ static struct usb_device_id id_table_combined [] = {
506 { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, 506 { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) },
507 { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, 507 { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) },
508 { USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) }, 508 { USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) },
509 { USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) },
509 { }, /* Optional parameter entry */ 510 { }, /* Optional parameter entry */
510 { } /* Terminating entry */ 511 { } /* Terminating entry */
511}; 512};
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 8888cd80a491..77299996f7ee 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -467,6 +467,11 @@
467#define TESTO_VID 0x128D 467#define TESTO_VID 0x128D
468#define TESTO_USB_INTERFACE_PID 0x0001 468#define TESTO_USB_INTERFACE_PID 0x0001
469 469
470/*
471 * Gamma Scout (http://gamma-scout.com/). Submitted by rsc@runtux.com.
472 */
473#define FTDI_GAMMA_SCOUT_PID 0xD678 /* Gamma Scout online */
474
470/* Commands */ 475/* Commands */
471#define FTDI_SIO_RESET 0 /* Reset the port */ 476#define FTDI_SIO_RESET 0 /* Reset the port */
472#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 477#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 12c1694d322e..e06a41bd0f3b 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -464,8 +464,10 @@ static int serial_read_proc (char *page, char **start, off_t off, int count, int
464 length += sprintf (page+length, " path:%s", tmp); 464 length += sprintf (page+length, " path:%s", tmp);
465 465
466 length += sprintf (page+length, "\n"); 466 length += sprintf (page+length, "\n");
467 if ((length + begin) > (off + count)) 467 if ((length + begin) > (off + count)) {
468 usb_serial_put(serial);
468 goto done; 469 goto done;
470 }
469 if ((length + begin) < off) { 471 if ((length + begin) < off) {
470 begin += length; 472 begin += length;
471 length = 0; 473 length = 0;
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 4a803d69fa36..b130e170b4a8 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -241,16 +241,6 @@ UNUSUAL_DEV( 0x0482, 0x0103, 0x0100, 0x0100,
241 "Finecam S5", 241 "Finecam S5",
242 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY), 242 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY),
243 243
244/* Patch for Kyocera Finecam L3
245 * Submitted by Michael Krauth <michael.krauth@web.de>
246 * and Alessandro Fracchetti <al.fracchetti@tin.it>
247 */
248UNUSUAL_DEV( 0x0482, 0x0105, 0x0100, 0x0100,
249 "Kyocera",
250 "Finecam L3",
251 US_SC_SCSI, US_PR_BULK, NULL,
252 US_FL_FIX_INQUIRY),
253
254/* Reported by Paul Stewart <stewart@wetlogic.net> 244/* Reported by Paul Stewart <stewart@wetlogic.net>
255 * This entry is needed because the device reports Sub=ff */ 245 * This entry is needed because the device reports Sub=ff */
256UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001, 246UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001,
@@ -599,6 +589,13 @@ UNUSUAL_DEV( 0x054c, 0x0099, 0x0000, 0x9999,
599 US_SC_DEVICE, US_PR_DEVICE, NULL, 589 US_SC_DEVICE, US_PR_DEVICE, NULL,
600 US_FL_FIX_INQUIRY ), 590 US_FL_FIX_INQUIRY ),
601 591
592/* floppy reports multiple luns */
593UNUSUAL_DEV( 0x055d, 0x2020, 0x0000, 0x0210,
594 "SAMSUNG",
595 "SFD-321U [FW 0C]",
596 US_SC_DEVICE, US_PR_DEVICE, NULL,
597 US_FL_SINGLE_LUN ),
598
602 599
603UNUSUAL_DEV( 0x057b, 0x0000, 0x0000, 0x0299, 600UNUSUAL_DEV( 0x057b, 0x0000, 0x0000, 0x0299,
604 "Y-E Data", 601 "Y-E Data",
@@ -1257,6 +1254,13 @@ UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
1257 US_SC_DEVICE, US_PR_DEVICE, NULL, 1254 US_SC_DEVICE, US_PR_DEVICE, NULL,
1258 US_FL_NO_WP_DETECT ), 1255 US_FL_NO_WP_DETECT ),
1259 1256
1257/* Reported by Emmanuel Vasilakis <evas@forthnet.gr> */
1258UNUSUAL_DEV( 0x0fce, 0xe031, 0x0000, 0x0000,
1259 "Sony Ericsson",
1260 "M600i",
1261 US_SC_DEVICE, US_PR_DEVICE, NULL,
1262 US_FL_FIX_CAPACITY ),
1263
1260/* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> 1264/* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu>
1261 * Tested on hardware version 1.10. 1265 * Tested on hardware version 1.10.
1262 * Entry is needed only for the initializer function override. 1266 * Entry is needed only for the initializer function override.
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 106d428b72c9..276a21530b95 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -1800,14 +1800,15 @@ static struct backlight_properties aty128_bl_data = {
1800 1800
1801static void aty128_bl_set_power(struct fb_info *info, int power) 1801static void aty128_bl_set_power(struct fb_info *info, int power)
1802{ 1802{
1803 if (info->bl_dev == NULL)
1804 return;
1805
1806 mutex_lock(&info->bl_mutex); 1803 mutex_lock(&info->bl_mutex);
1807 up(&info->bl_dev->sem); 1804
1808 info->bl_dev->props->power = power; 1805 if (info->bl_dev) {
1809 __aty128_bl_update_status(info->bl_dev); 1806 down(&info->bl_dev->sem);
1810 down(&info->bl_dev->sem); 1807 info->bl_dev->props->power = power;
1808 __aty128_bl_update_status(info->bl_dev);
1809 up(&info->bl_dev->sem);
1810 }
1811
1811 mutex_unlock(&info->bl_mutex); 1812 mutex_unlock(&info->bl_mutex);
1812} 1813}
1813 1814
@@ -1842,11 +1843,11 @@ static void aty128_bl_init(struct aty128fb_par *par)
1842 219 * FB_BACKLIGHT_MAX / MAX_LEVEL); 1843 219 * FB_BACKLIGHT_MAX / MAX_LEVEL);
1843 mutex_unlock(&info->bl_mutex); 1844 mutex_unlock(&info->bl_mutex);
1844 1845
1845 up(&bd->sem); 1846 down(&bd->sem);
1846 bd->props->brightness = aty128_bl_data.max_brightness; 1847 bd->props->brightness = aty128_bl_data.max_brightness;
1847 bd->props->power = FB_BLANK_UNBLANK; 1848 bd->props->power = FB_BLANK_UNBLANK;
1848 bd->props->update_status(bd); 1849 bd->props->update_status(bd);
1849 down(&bd->sem); 1850 up(&bd->sem);
1850 1851
1851#ifdef CONFIG_PMAC_BACKLIGHT 1852#ifdef CONFIG_PMAC_BACKLIGHT
1852 mutex_lock(&pmac_backlight_mutex); 1853 mutex_lock(&pmac_backlight_mutex);
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 510e4ea296ed..19a71f045784 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2199,14 +2199,15 @@ static struct backlight_properties aty_bl_data = {
2199 2199
2200static void aty_bl_set_power(struct fb_info *info, int power) 2200static void aty_bl_set_power(struct fb_info *info, int power)
2201{ 2201{
2202 if (info->bl_dev == NULL)
2203 return;
2204
2205 mutex_lock(&info->bl_mutex); 2202 mutex_lock(&info->bl_mutex);
2206 up(&info->bl_dev->sem); 2203
2207 info->bl_dev->props->power = power; 2204 if (info->bl_dev) {
2208 __aty_bl_update_status(info->bl_dev); 2205 down(&info->bl_dev->sem);
2209 down(&info->bl_dev->sem); 2206 info->bl_dev->props->power = power;
2207 __aty_bl_update_status(info->bl_dev);
2208 up(&info->bl_dev->sem);
2209 }
2210
2210 mutex_unlock(&info->bl_mutex); 2211 mutex_unlock(&info->bl_mutex);
2211} 2212}
2212 2213
@@ -2237,11 +2238,11 @@ static void aty_bl_init(struct atyfb_par *par)
2237 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); 2238 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL);
2238 mutex_unlock(&info->bl_mutex); 2239 mutex_unlock(&info->bl_mutex);
2239 2240
2240 up(&bd->sem); 2241 down(&bd->sem);
2241 bd->props->brightness = aty_bl_data.max_brightness; 2242 bd->props->brightness = aty_bl_data.max_brightness;
2242 bd->props->power = FB_BLANK_UNBLANK; 2243 bd->props->power = FB_BLANK_UNBLANK;
2243 bd->props->update_status(bd); 2244 bd->props->update_status(bd);
2244 down(&bd->sem); 2245 up(&bd->sem);
2245 2246
2246#ifdef CONFIG_PMAC_BACKLIGHT 2247#ifdef CONFIG_PMAC_BACKLIGHT
2247 mutex_lock(&pmac_backlight_mutex); 2248 mutex_lock(&pmac_backlight_mutex);
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c
index 1755dddf1899..585eb7b9e636 100644
--- a/drivers/video/aty/radeon_backlight.c
+++ b/drivers/video/aty/radeon_backlight.c
@@ -195,11 +195,11 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
195 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); 195 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL);
196 mutex_unlock(&rinfo->info->bl_mutex); 196 mutex_unlock(&rinfo->info->bl_mutex);
197 197
198 up(&bd->sem); 198 down(&bd->sem);
199 bd->props->brightness = radeon_bl_data.max_brightness; 199 bd->props->brightness = radeon_bl_data.max_brightness;
200 bd->props->power = FB_BLANK_UNBLANK; 200 bd->props->power = FB_BLANK_UNBLANK;
201 bd->props->update_status(bd); 201 bd->props->update_status(bd);
202 down(&bd->sem); 202 up(&bd->sem);
203 203
204#ifdef CONFIG_PMAC_BACKLIGHT 204#ifdef CONFIG_PMAC_BACKLIGHT
205 mutex_lock(&pmac_backlight_mutex); 205 mutex_lock(&pmac_backlight_mutex);
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c
index 14c37c42191c..5b75ae4e9457 100644
--- a/drivers/video/nvidia/nv_backlight.c
+++ b/drivers/video/nvidia/nv_backlight.c
@@ -112,13 +112,15 @@ static struct backlight_properties nvidia_bl_data = {
112 112
113void nvidia_bl_set_power(struct fb_info *info, int power) 113void nvidia_bl_set_power(struct fb_info *info, int power)
114{ 114{
115 if (info->bl_dev == NULL)
116 return;
117 mutex_lock(&info->bl_mutex); 115 mutex_lock(&info->bl_mutex);
118 up(&info->bl_dev->sem); 116
119 info->bl_dev->props->power = power; 117 if (info->bl_dev) {
120 __nvidia_bl_update_status(info->bl_dev); 118 down(&info->bl_dev->sem);
121 down(&info->bl_dev->sem); 119 info->bl_dev->props->power = power;
120 __nvidia_bl_update_status(info->bl_dev);
121 up(&info->bl_dev->sem);
122 }
123
122 mutex_unlock(&info->bl_mutex); 124 mutex_unlock(&info->bl_mutex);
123} 125}
124 126
@@ -153,11 +155,11 @@ void nvidia_bl_init(struct nvidia_par *par)
153 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); 155 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL);
154 mutex_unlock(&info->bl_mutex); 156 mutex_unlock(&info->bl_mutex);
155 157
156 up(&bd->sem); 158 down(&bd->sem);
157 bd->props->brightness = nvidia_bl_data.max_brightness; 159 bd->props->brightness = nvidia_bl_data.max_brightness;
158 bd->props->power = FB_BLANK_UNBLANK; 160 bd->props->power = FB_BLANK_UNBLANK;
159 bd->props->update_status(bd); 161 bd->props->update_status(bd);
160 down(&bd->sem); 162 up(&bd->sem);
161 163
162#ifdef CONFIG_PMAC_BACKLIGHT 164#ifdef CONFIG_PMAC_BACKLIGHT
163 mutex_lock(&pmac_backlight_mutex); 165 mutex_lock(&pmac_backlight_mutex);
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 511c362d3b0d..67d1e1c8813d 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -354,14 +354,15 @@ static struct backlight_properties riva_bl_data = {
354 354
355static void riva_bl_set_power(struct fb_info *info, int power) 355static void riva_bl_set_power(struct fb_info *info, int power)
356{ 356{
357 if (info->bl_dev == NULL)
358 return;
359
360 mutex_lock(&info->bl_mutex); 357 mutex_lock(&info->bl_mutex);
361 up(&info->bl_dev->sem); 358
362 info->bl_dev->props->power = power; 359 if (info->bl_dev) {
363 __riva_bl_update_status(info->bl_dev); 360 down(&info->bl_dev->sem);
364 down(&info->bl_dev->sem); 361 info->bl_dev->props->power = power;
362 __riva_bl_update_status(info->bl_dev);
363 up(&info->bl_dev->sem);
364 }
365
365 mutex_unlock(&info->bl_mutex); 366 mutex_unlock(&info->bl_mutex);
366} 367}
367 368
@@ -396,11 +397,11 @@ static void riva_bl_init(struct riva_par *par)
396 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); 397 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL);
397 mutex_unlock(&info->bl_mutex); 398 mutex_unlock(&info->bl_mutex);
398 399
399 up(&bd->sem); 400 down(&bd->sem);
400 bd->props->brightness = riva_bl_data.max_brightness; 401 bd->props->brightness = riva_bl_data.max_brightness;
401 bd->props->power = FB_BLANK_UNBLANK; 402 bd->props->power = FB_BLANK_UNBLANK;
402 bd->props->update_status(bd); 403 bd->props->update_status(bd);
403 down(&bd->sem); 404 up(&bd->sem);
404 405
405#ifdef CONFIG_PMAC_BACKLIGHT 406#ifdef CONFIG_PMAC_BACKLIGHT
406 mutex_lock(&pmac_backlight_mutex); 407 mutex_lock(&pmac_backlight_mutex);