aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/kernel/signal.c11
-rw-r--r--arch/arm/kernel/signal.c5
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c2
-rw-r--r--arch/arm26/kernel/signal.c13
-rw-r--r--arch/cris/arch-v10/kernel/signal.c11
-rw-r--r--arch/cris/arch-v32/kernel/signal.c11
-rw-r--r--arch/frv/kernel/signal.c11
-rw-r--r--arch/h8300/kernel/signal.c11
-rw-r--r--arch/i386/kernel/signal.c5
-rw-r--r--arch/ia64/kernel/signal.c15
-rw-r--r--arch/ia64/pci/pci.c1
-rw-r--r--arch/m32r/kernel/signal.c11
-rw-r--r--arch/m68knommu/kernel/signal.c11
-rw-r--r--arch/mips/kernel/irixsig.c11
-rw-r--r--arch/mips/kernel/signal.c11
-rw-r--r--arch/mips/kernel/signal32.c11
-rw-r--r--arch/parisc/kernel/signal.c11
-rw-r--r--arch/ppc/kernel/signal.c11
-rw-r--r--arch/ppc/syslib/m8xx_setup.c2
-rw-r--r--arch/ppc64/kernel/setup.c2
-rw-r--r--arch/ppc64/kernel/signal.c5
-rw-r--r--arch/ppc64/kernel/signal32.c5
-rw-r--r--arch/s390/kernel/compat_signal.c11
-rw-r--r--arch/s390/kernel/signal.c11
-rw-r--r--arch/sh/kernel/signal.c11
-rw-r--r--arch/sh64/kernel/signal.c11
-rw-r--r--arch/sparc/kernel/signal.c11
-rw-r--r--arch/sparc64/kernel/pci.c1
-rw-r--r--arch/sparc64/kernel/signal.c11
-rw-r--r--arch/sparc64/kernel/signal32.c11
-rw-r--r--arch/um/drivers/mmapper_kern.c41
-rw-r--r--arch/um/kernel/signal_kern.c6
-rw-r--r--arch/v850/kernel/signal.c11
-rw-r--r--arch/x86_64/defconfig21
-rw-r--r--arch/x86_64/kernel/e820.c34
-rw-r--r--arch/x86_64/kernel/signal.c5
-rw-r--r--arch/x86_64/mm/init.c16
-rw-r--r--arch/x86_64/mm/numa.c8
-rw-r--r--arch/xtensa/kernel/signal.c11
-rw-r--r--drivers/acpi/sleep/poweroff.c6
-rw-r--r--drivers/block/cfq-iosched.c31
-rw-r--r--drivers/char/vt.c2
-rw-r--r--drivers/hwmon/adm1026.c4
-rw-r--r--drivers/hwmon/adm1031.c4
-rw-r--r--drivers/hwmon/adm9240.c2
-rw-r--r--drivers/hwmon/fscpos.c2
-rw-r--r--drivers/hwmon/smsc47b397.c2
-rw-r--r--drivers/hwmon/smsc47m1.c2
-rw-r--r--drivers/ieee1394/ohci1394.c8
-rw-r--r--drivers/infiniband/core/uverbs_main.c3
-rw-r--r--drivers/isdn/capi/capifs.c4
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-common.c19
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-dvb.c5
-rw-r--r--drivers/net/hamradio/6pack.c9
-rw-r--r--drivers/net/ibm_emac/ibm_emac_core.c2
-rw-r--r--drivers/net/tg3.c6
-rw-r--r--drivers/pci/setup-bus.c2
-rw-r--r--drivers/pci/setup-res.c4
-rw-r--r--drivers/s390/cio/qdio.c2
-rw-r--r--drivers/s390/scsi/zfcp_aux.c28
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c10
-rw-r--r--drivers/s390/scsi/zfcp_def.h2
-rw-r--r--drivers/s390/scsi/zfcp_erp.c25
-rw-r--r--drivers/s390/scsi/zfcp_ext.h2
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c1
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c25
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_port.c2
-rw-r--r--drivers/scsi/ahci.c12
-rw-r--r--drivers/scsi/ata_piix.c14
-rw-r--r--drivers/scsi/libata-core.c247
-rw-r--r--drivers/scsi/libata-scsi.c66
-rw-r--r--drivers/scsi/libata.h2
-rw-r--r--drivers/scsi/sata_nv.c24
-rw-r--r--drivers/scsi/sata_promise.c12
-rw-r--r--drivers/scsi/sata_qstor.c12
-rw-r--r--drivers/scsi/sata_sil.c36
-rw-r--r--drivers/scsi/sata_sis.c2
-rw-r--r--drivers/scsi/sata_svw.c10
-rw-r--r--drivers/scsi/sata_sx4.c146
-rw-r--r--drivers/scsi/sata_uli.c2
-rw-r--r--drivers/scsi/sata_via.c2
-rw-r--r--drivers/scsi/sata_vsc.c5
-rw-r--r--drivers/scsi/sg.c13
-rw-r--r--fs/cifs/file.c2
-rw-r--r--fs/hppfs/hppfs_kern.c30
-rw-r--r--fs/inotify.c2
-rw-r--r--fs/sysfs/inode.c4
-rw-r--r--include/asm-m68k/page.h6
-rw-r--r--include/asm-ppc64/bug.h7
-rw-r--r--include/asm-x86_64/e820.h2
-rw-r--r--include/linux/ata.h2
-rw-r--r--include/linux/libata.h8
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--kernel/cpuset.c30
-rw-r--r--lib/idr.c2
-rw-r--r--net/ipv4/fib_trie.c14
100 files changed, 862 insertions, 493 deletions
diff --git a/Makefile b/Makefile
index 300f61f6f6a2..5acd1fc68d17 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 13 3SUBLEVEL = 13
4EXTRAVERSION =-rc7 4EXTRAVERSION =
5NAME=Woozy Numbat 5NAME=Woozy Numbat
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c
index 08fe8071a7f8..2e45e8604e32 100644
--- a/arch/alpha/kernel/signal.c
+++ b/arch/alpha/kernel/signal.c
@@ -566,13 +566,12 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
566 if (ka->sa.sa_flags & SA_RESETHAND) 566 if (ka->sa.sa_flags & SA_RESETHAND)
567 ka->sa.sa_handler = SIG_DFL; 567 ka->sa.sa_handler = SIG_DFL;
568 568
569 if (!(ka->sa.sa_flags & SA_NODEFER)) { 569 spin_lock_irq(&current->sighand->siglock);
570 spin_lock_irq(&current->sighand->siglock); 570 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
571 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 571 if (!(ka->sa.sa_flags & SA_NODEFER))
572 sigaddset(&current->blocked,sig); 572 sigaddset(&current->blocked,sig);
573 recalc_sigpending(); 573 recalc_sigpending();
574 spin_unlock_irq(&current->sighand->siglock); 574 spin_unlock_irq(&current->sighand->siglock);
575 }
576} 575}
577 576
578static inline void 577static inline void
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 5e435e42dacd..a94d75fef598 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -658,11 +658,12 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
658 /* 658 /*
659 * Block the signal if we were unsuccessful. 659 * Block the signal if we were unsuccessful.
660 */ 660 */
661 if (ret != 0 || !(ka->sa.sa_flags & SA_NODEFER)) { 661 if (ret != 0) {
662 spin_lock_irq(&tsk->sighand->siglock); 662 spin_lock_irq(&tsk->sighand->siglock);
663 sigorsets(&tsk->blocked, &tsk->blocked, 663 sigorsets(&tsk->blocked, &tsk->blocked,
664 &ka->sa.sa_mask); 664 &ka->sa.sa_mask);
665 sigaddset(&tsk->blocked, sig); 665 if (!(ka->sa.sa_flags & SA_NODEFER))
666 sigaddset(&tsk->blocked, sig);
666 recalc_sigpending(); 667 recalc_sigpending();
667 spin_unlock_irq(&tsk->sighand->siglock); 668 spin_unlock_irq(&tsk->sighand->siglock);
668 } 669 }
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index 7f58afb27e71..411ea9996190 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -36,7 +36,7 @@ static struct flash_platform_data coyote_flash_data = {
36 36
37static struct resource coyote_flash_resource = { 37static struct resource coyote_flash_resource = {
38 .start = COYOTE_FLASH_BASE, 38 .start = COYOTE_FLASH_BASE,
39 .end = COYOTE_FLASH_BASE + COYOTE_FLASH_SIZE, 39 .end = COYOTE_FLASH_BASE + COYOTE_FLASH_SIZE - 1,
40 .flags = IORESOURCE_MEM, 40 .flags = IORESOURCE_MEM,
41}; 41};
42 42
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index 65e356bd10d6..333459d6aa46 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -114,7 +114,7 @@ static struct flash_platform_data gtwx5715_flash_data = {
114 114
115static struct resource gtwx5715_flash_resource = { 115static struct resource gtwx5715_flash_resource = {
116 .start = GTWX5715_FLASH_BASE, 116 .start = GTWX5715_FLASH_BASE,
117 .end = GTWX5715_FLASH_BASE + GTWX5715_FLASH_SIZE, 117 .end = GTWX5715_FLASH_BASE + GTWX5715_FLASH_SIZE - 1,
118 .flags = IORESOURCE_MEM, 118 .flags = IORESOURCE_MEM,
119}; 119};
120 120
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 4633470a6a37..fa0646c8693b 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -36,7 +36,7 @@ static struct flash_platform_data ixdp425_flash_data = {
36 36
37static struct resource ixdp425_flash_resource = { 37static struct resource ixdp425_flash_resource = {
38 .start = IXDP425_FLASH_BASE, 38 .start = IXDP425_FLASH_BASE,
39 .end = IXDP425_FLASH_BASE + IXDP425_FLASH_SIZE, 39 .end = IXDP425_FLASH_BASE + IXDP425_FLASH_SIZE - 1,
40 .flags = IORESOURCE_MEM, 40 .flags = IORESOURCE_MEM,
41}; 41};
42 42
diff --git a/arch/arm26/kernel/signal.c b/arch/arm26/kernel/signal.c
index 356d9809cc0b..ce2055bdc9ee 100644
--- a/arch/arm26/kernel/signal.c
+++ b/arch/arm26/kernel/signal.c
@@ -454,14 +454,13 @@ handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
454 if (ka->sa.sa_flags & SA_ONESHOT) 454 if (ka->sa.sa_flags & SA_ONESHOT)
455 ka->sa.sa_handler = SIG_DFL; 455 ka->sa.sa_handler = SIG_DFL;
456 456
457 if (!(ka->sa.sa_flags & SA_NODEFER)) { 457 spin_lock_irq(&tsk->sighand->siglock);
458 spin_lock_irq(&tsk->sighand->siglock); 458 sigorsets(&tsk->blocked, &tsk->blocked,
459 sigorsets(&tsk->blocked, &tsk->blocked, 459 &ka->sa.sa_mask);
460 &ka->sa.sa_mask); 460 if (!(ka->sa.sa_flags & SA_NODEFER))
461 sigaddset(&tsk->blocked, sig); 461 sigaddset(&tsk->blocked, sig);
462 recalc_sigpending(); 462 recalc_sigpending();
463 spin_unlock_irq(&tsk->sighand->siglock); 463 spin_unlock_irq(&tsk->sighand->siglock);
464 }
465 return; 464 return;
466 } 465 }
467 466
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
index 85e0032e664f..693771961f85 100644
--- a/arch/cris/arch-v10/kernel/signal.c
+++ b/arch/cris/arch-v10/kernel/signal.c
@@ -517,13 +517,12 @@ handle_signal(int canrestart, unsigned long sig,
517 if (ka->sa.sa_flags & SA_ONESHOT) 517 if (ka->sa.sa_flags & SA_ONESHOT)
518 ka->sa.sa_handler = SIG_DFL; 518 ka->sa.sa_handler = SIG_DFL;
519 519
520 if (!(ka->sa.sa_flags & SA_NODEFER)) { 520 spin_lock_irq(&current->sighand->siglock);
521 spin_lock_irq(&current->sighand->siglock); 521 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
522 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 522 if (!(ka->sa.sa_flags & SA_NODEFER))
523 sigaddset(&current->blocked,sig); 523 sigaddset(&current->blocked,sig);
524 recalc_sigpending(); 524 recalc_sigpending();
525 spin_unlock_irq(&current->sighand->siglock); 525 spin_unlock_irq(&current->sighand->siglock);
526 }
527} 526}
528 527
529/* 528/*
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index fb4c79d5b76b..0a3614dab887 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -568,13 +568,12 @@ handle_signal(int canrestart, unsigned long sig,
568 if (ka->sa.sa_flags & SA_ONESHOT) 568 if (ka->sa.sa_flags & SA_ONESHOT)
569 ka->sa.sa_handler = SIG_DFL; 569 ka->sa.sa_handler = SIG_DFL;
570 570
571 if (!(ka->sa.sa_flags & SA_NODEFER)) { 571 spin_lock_irq(&current->sighand->siglock);
572 spin_lock_irq(&current->sighand->siglock); 572 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
573 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 573 if (!(ka->sa.sa_flags & SA_NODEFER))
574 sigaddset(&current->blocked,sig); 574 sigaddset(&current->blocked,sig);
575 recalc_sigpending(); 575 recalc_sigpending();
576 spin_unlock_irq(&current->sighand->siglock); 576 spin_unlock_irq(&current->sighand->siglock);
577 }
578} 577}
579 578
580/* 579/*
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index 36a2dffc8ebd..d4ccc0728dfe 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -506,13 +506,12 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
506 else 506 else
507 setup_frame(sig, ka, oldset, regs); 507 setup_frame(sig, ka, oldset, regs);
508 508
509 if (!(ka->sa.sa_flags & SA_NODEFER)) { 509 spin_lock_irq(&current->sighand->siglock);
510 spin_lock_irq(&current->sighand->siglock); 510 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
511 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask); 511 if (!(ka->sa.sa_flags & SA_NODEFER))
512 sigaddset(&current->blocked, sig); 512 sigaddset(&current->blocked, sig);
513 recalc_sigpending(); 513 recalc_sigpending();
514 spin_unlock_irq(&current->sighand->siglock); 514 spin_unlock_irq(&current->sighand->siglock);
515 }
516} /* end handle_signal() */ 515} /* end handle_signal() */
517 516
518/*****************************************************************************/ 517/*****************************************************************************/
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c
index 5aab87eae1f9..f13d5e82d4b9 100644
--- a/arch/h8300/kernel/signal.c
+++ b/arch/h8300/kernel/signal.c
@@ -488,13 +488,12 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
488 else 488 else
489 setup_frame(sig, ka, oldset, regs); 489 setup_frame(sig, ka, oldset, regs);
490 490
491 if (!(ka->sa.sa_flags & SA_NODEFER)) { 491 spin_lock_irq(&current->sighand->siglock);
492 spin_lock_irq(&current->sighand->siglock); 492 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
493 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 493 if (!(ka->sa.sa_flags & SA_NODEFER))
494 sigaddset(&current->blocked,sig); 494 sigaddset(&current->blocked,sig);
495 recalc_sigpending(); 495 recalc_sigpending();
496 spin_unlock_irq(&current->sighand->siglock); 496 spin_unlock_irq(&current->sighand->siglock);
497 }
498} 497}
499 498
500/* 499/*
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
index 89ef7adc63a4..140e340569c6 100644
--- a/arch/i386/kernel/signal.c
+++ b/arch/i386/kernel/signal.c
@@ -577,10 +577,11 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
577 else 577 else
578 ret = setup_frame(sig, ka, oldset, regs); 578 ret = setup_frame(sig, ka, oldset, regs);
579 579
580 if (ret && !(ka->sa.sa_flags & SA_NODEFER)) { 580 if (ret) {
581 spin_lock_irq(&current->sighand->siglock); 581 spin_lock_irq(&current->sighand->siglock);
582 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 582 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
583 sigaddset(&current->blocked,sig); 583 if (!(ka->sa.sa_flags & SA_NODEFER))
584 sigaddset(&current->blocked,sig);
584 recalc_sigpending(); 585 recalc_sigpending();
585 spin_unlock_irq(&current->sighand->siglock); 586 spin_unlock_irq(&current->sighand->siglock);
586 } 587 }
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index b8a0a7d257a9..774f34b675cf 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -467,15 +467,12 @@ handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, sigse
467 if (!setup_frame(sig, ka, info, oldset, scr)) 467 if (!setup_frame(sig, ka, info, oldset, scr))
468 return 0; 468 return 0;
469 469
470 if (!(ka->sa.sa_flags & SA_NODEFER)) { 470 spin_lock_irq(&current->sighand->siglock);
471 spin_lock_irq(&current->sighand->siglock); 471 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
472 { 472 if (!(ka->sa.sa_flags & SA_NODEFER))
473 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask); 473 sigaddset(&current->blocked, sig);
474 sigaddset(&current->blocked, sig); 474 recalc_sigpending();
475 recalc_sigpending(); 475 spin_unlock_irq(&current->sighand->siglock);
476 }
477 spin_unlock_irq(&current->sighand->siglock);
478 }
479 return 1; 476 return 1;
480} 477}
481 478
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 54d9ed444e4a..f9472c50ab42 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -380,6 +380,7 @@ void pcibios_bus_to_resource(struct pci_dev *dev,
380 res->start = region->start + offset; 380 res->start = region->start + offset;
381 res->end = region->end + offset; 381 res->end = region->end + offset;
382} 382}
383EXPORT_SYMBOL(pcibios_bus_to_resource);
383 384
384static int __devinit is_valid_resource(struct pci_dev *dev, int idx) 385static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
385{ 386{
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index 5aef7e406ef5..71763f7a1d19 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -341,13 +341,12 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
341 /* Set up the stack frame */ 341 /* Set up the stack frame */
342 setup_rt_frame(sig, ka, info, oldset, regs); 342 setup_rt_frame(sig, ka, info, oldset, regs);
343 343
344 if (!(ka->sa.sa_flags & SA_NODEFER)) { 344 spin_lock_irq(&current->sighand->siglock);
345 spin_lock_irq(&current->sighand->siglock); 345 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
346 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 346 if (!(ka->sa.sa_flags & SA_NODEFER))
347 sigaddset(&current->blocked,sig); 347 sigaddset(&current->blocked,sig);
348 recalc_sigpending(); 348 recalc_sigpending();
349 spin_unlock_irq(&current->sighand->siglock); 349 spin_unlock_irq(&current->sighand->siglock);
350 }
351} 350}
352 351
353/* 352/*
diff --git a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c
index 30dceb59a462..43a2726c0d0a 100644
--- a/arch/m68knommu/kernel/signal.c
+++ b/arch/m68knommu/kernel/signal.c
@@ -732,13 +732,12 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
732 if (ka->sa.sa_flags & SA_ONESHOT) 732 if (ka->sa.sa_flags & SA_ONESHOT)
733 ka->sa.sa_handler = SIG_DFL; 733 ka->sa.sa_handler = SIG_DFL;
734 734
735 if (!(ka->sa.sa_flags & SA_NODEFER)) { 735 spin_lock_irq(&current->sighand->siglock);
736 spin_lock_irq(&current->sighand->siglock); 736 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
737 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 737 if (!(ka->sa.sa_flags & SA_NODEFER))
738 sigaddset(&current->blocked,sig); 738 sigaddset(&current->blocked,sig);
739 recalc_sigpending(); 739 recalc_sigpending();
740 spin_unlock_irq(&current->sighand->siglock); 740 spin_unlock_irq(&current->sighand->siglock);
741 }
742} 741}
743 742
744/* 743/*
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 40244782a8e5..4c114ae21793 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -155,13 +155,12 @@ static inline void handle_signal(unsigned long sig, siginfo_t *info,
155 else 155 else
156 setup_irix_frame(ka, regs, sig, oldset); 156 setup_irix_frame(ka, regs, sig, oldset);
157 157
158 if (!(ka->sa.sa_flags & SA_NODEFER)) { 158 spin_lock_irq(&current->sighand->siglock);
159 spin_lock_irq(&current->sighand->siglock); 159 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
160 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 160 if (!(ka->sa.sa_flags & SA_NODEFER))
161 sigaddset(&current->blocked,sig); 161 sigaddset(&current->blocked,sig);
162 recalc_sigpending(); 162 recalc_sigpending();
163 spin_unlock_irq(&current->sighand->siglock); 163 spin_unlock_irq(&current->sighand->siglock);
164 }
165} 164}
166 165
167asmlinkage int do_irix_signal(sigset_t *oldset, struct pt_regs *regs) 166asmlinkage int do_irix_signal(sigset_t *oldset, struct pt_regs *regs)
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 65ee15396ffd..0209c1dd1429 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -425,13 +425,12 @@ static inline void handle_signal(unsigned long sig, siginfo_t *info,
425 setup_frame(ka, regs, sig, oldset); 425 setup_frame(ka, regs, sig, oldset);
426#endif 426#endif
427 427
428 if (!(ka->sa.sa_flags & SA_NODEFER)) { 428 spin_lock_irq(&current->sighand->siglock);
429 spin_lock_irq(&current->sighand->siglock); 429 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
430 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 430 if (!(ka->sa.sa_flags & SA_NODEFER))
431 sigaddset(&current->blocked,sig); 431 sigaddset(&current->blocked,sig);
432 recalc_sigpending(); 432 recalc_sigpending();
433 spin_unlock_irq(&current->sighand->siglock); 433 spin_unlock_irq(&current->sighand->siglock);
434 }
435} 434}
436 435
437extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); 436extern int do_signal32(sigset_t *oldset, struct pt_regs *regs);
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index c1a69cf232f9..f6875f023a29 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -751,13 +751,12 @@ static inline void handle_signal(unsigned long sig, siginfo_t *info,
751 else 751 else
752 setup_frame(ka, regs, sig, oldset); 752 setup_frame(ka, regs, sig, oldset);
753 753
754 if (!(ka->sa.sa_flags & SA_NODEFER)) { 754 spin_lock_irq(&current->sighand->siglock);
755 spin_lock_irq(&current->sighand->siglock); 755 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
756 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 756 if (!(ka->sa.sa_flags & SA_NODEFER))
757 sigaddset(&current->blocked,sig); 757 sigaddset(&current->blocked,sig);
758 recalc_sigpending(); 758 recalc_sigpending();
759 spin_unlock_irq(&current->sighand->siglock); 759 spin_unlock_irq(&current->sighand->siglock);
760 }
761} 760}
762 761
763int do_signal32(sigset_t *oldset, struct pt_regs *regs) 762int do_signal32(sigset_t *oldset, struct pt_regs *regs)
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 9421bb98ea63..55d71c15e1f7 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -517,13 +517,12 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
517 if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall)) 517 if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall))
518 return 0; 518 return 0;
519 519
520 if (!(ka->sa.sa_flags & SA_NODEFER)) { 520 spin_lock_irq(&current->sighand->siglock);
521 spin_lock_irq(&current->sighand->siglock); 521 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
522 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 522 if (!(ka->sa.sa_flags & SA_NODEFER))
523 sigaddset(&current->blocked,sig); 523 sigaddset(&current->blocked,sig);
524 recalc_sigpending(); 524 recalc_sigpending();
525 spin_unlock_irq(&current->sighand->siglock); 525 spin_unlock_irq(&current->sighand->siglock);
526 }
527 return 1; 526 return 1;
528} 527}
529 528
diff --git a/arch/ppc/kernel/signal.c b/arch/ppc/kernel/signal.c
index 8aaeb6f4e750..2244bf91e593 100644
--- a/arch/ppc/kernel/signal.c
+++ b/arch/ppc/kernel/signal.c
@@ -759,13 +759,12 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
759 else 759 else
760 handle_signal(signr, &ka, &info, oldset, regs, newsp); 760 handle_signal(signr, &ka, &info, oldset, regs, newsp);
761 761
762 if (!(ka.sa.sa_flags & SA_NODEFER)) { 762 spin_lock_irq(&current->sighand->siglock);
763 spin_lock_irq(&current->sighand->siglock); 763 sigorsets(&current->blocked,&current->blocked,&ka.sa.sa_mask);
764 sigorsets(&current->blocked,&current->blocked,&ka.sa.sa_mask); 764 if (!(ka.sa.sa_flags & SA_NODEFER))
765 sigaddset(&current->blocked, signr); 765 sigaddset(&current->blocked, signr);
766 recalc_sigpending(); 766 recalc_sigpending();
767 spin_unlock_irq(&current->sighand->siglock); 767 spin_unlock_irq(&current->sighand->siglock);
768 }
769 768
770 return 1; 769 return 1;
771} 770}
diff --git a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c
index 55a381af4e37..a3702cfe8f7c 100644
--- a/arch/ppc/syslib/m8xx_setup.c
+++ b/arch/ppc/syslib/m8xx_setup.c
@@ -423,7 +423,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
423 ppc_md.find_end_of_memory = m8xx_find_end_of_memory; 423 ppc_md.find_end_of_memory = m8xx_find_end_of_memory;
424 ppc_md.setup_io_mappings = m8xx_map_io; 424 ppc_md.setup_io_mappings = m8xx_map_io;
425 425
426#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) 426#if defined(CONFIG_BLK_DEV_MPC8xx_IDE)
427 m8xx_ide_init(); 427 m8xx_ide_init();
428#endif 428#endif
429} 429}
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index 687e85595208..e9c24d2dbd91 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -706,6 +706,8 @@ void machine_power_off(void)
706 local_irq_disable(); 706 local_irq_disable();
707 while (1) ; 707 while (1) ;
708} 708}
709/* Used by the G5 thermal driver */
710EXPORT_SYMBOL_GPL(machine_power_off);
709 711
710void machine_halt(void) 712void machine_halt(void)
711{ 713{
diff --git a/arch/ppc64/kernel/signal.c b/arch/ppc64/kernel/signal.c
index bf782276984c..49a79a55c32d 100644
--- a/arch/ppc64/kernel/signal.c
+++ b/arch/ppc64/kernel/signal.c
@@ -481,10 +481,11 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka,
481 /* Set up Signal Frame */ 481 /* Set up Signal Frame */
482 ret = setup_rt_frame(sig, ka, info, oldset, regs); 482 ret = setup_rt_frame(sig, ka, info, oldset, regs);
483 483
484 if (ret && !(ka->sa.sa_flags & SA_NODEFER)) { 484 if (ret) {
485 spin_lock_irq(&current->sighand->siglock); 485 spin_lock_irq(&current->sighand->siglock);
486 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask); 486 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
487 sigaddset(&current->blocked,sig); 487 if (!(ka->sa.sa_flags & SA_NODEFER))
488 sigaddset(&current->blocked,sig);
488 recalc_sigpending(); 489 recalc_sigpending();
489 spin_unlock_irq(&current->sighand->siglock); 490 spin_unlock_irq(&current->sighand->siglock);
490 } 491 }
diff --git a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c
index 3c2fa5c284c0..46f4d6cc7fc9 100644
--- a/arch/ppc64/kernel/signal32.c
+++ b/arch/ppc64/kernel/signal32.c
@@ -976,11 +976,12 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs)
976 else 976 else
977 ret = handle_signal32(signr, &ka, &info, oldset, regs, newsp); 977 ret = handle_signal32(signr, &ka, &info, oldset, regs, newsp);
978 978
979 if (ret && !(ka.sa.sa_flags & SA_NODEFER)) { 979 if (ret) {
980 spin_lock_irq(&current->sighand->siglock); 980 spin_lock_irq(&current->sighand->siglock);
981 sigorsets(&current->blocked, &current->blocked, 981 sigorsets(&current->blocked, &current->blocked,
982 &ka.sa.sa_mask); 982 &ka.sa.sa_mask);
983 sigaddset(&current->blocked, signr); 983 if (!(ka.sa.sa_flags & SA_NODEFER))
984 sigaddset(&current->blocked, signr);
984 recalc_sigpending(); 985 recalc_sigpending();
985 spin_unlock_irq(&current->sighand->siglock); 986 spin_unlock_irq(&current->sighand->siglock);
986 } 987 }
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index d05d65ac9694..7358cdb8441f 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -637,12 +637,11 @@ handle_signal32(unsigned long sig, struct k_sigaction *ka,
637 else 637 else
638 setup_frame32(sig, ka, oldset, regs); 638 setup_frame32(sig, ka, oldset, regs);
639 639
640 if (!(ka->sa.sa_flags & SA_NODEFER)) { 640 spin_lock_irq(&current->sighand->siglock);
641 spin_lock_irq(&current->sighand->siglock); 641 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
642 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 642 if (!(ka->sa.sa_flags & SA_NODEFER))
643 sigaddset(&current->blocked,sig); 643 sigaddset(&current->blocked,sig);
644 recalc_sigpending(); 644 recalc_sigpending();
645 spin_unlock_irq(&current->sighand->siglock); 645 spin_unlock_irq(&current->sighand->siglock);
646 }
647} 646}
648 647
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 610c1d03e975..6a3f5b7473a9 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -429,13 +429,12 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
429 else 429 else
430 setup_frame(sig, ka, oldset, regs); 430 setup_frame(sig, ka, oldset, regs);
431 431
432 if (!(ka->sa.sa_flags & SA_NODEFER)) { 432 spin_lock_irq(&current->sighand->siglock);
433 spin_lock_irq(&current->sighand->siglock); 433 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
434 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 434 if (!(ka->sa.sa_flags & SA_NODEFER))
435 sigaddset(&current->blocked,sig); 435 sigaddset(&current->blocked,sig);
436 recalc_sigpending(); 436 recalc_sigpending();
437 spin_unlock_irq(&current->sighand->siglock); 437 spin_unlock_irq(&current->sighand->siglock);
438 }
439} 438}
440 439
441/* 440/*
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
index 8022243f0178..b475c4d2405f 100644
--- a/arch/sh/kernel/signal.c
+++ b/arch/sh/kernel/signal.c
@@ -546,13 +546,12 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
546 if (ka->sa.sa_flags & SA_ONESHOT) 546 if (ka->sa.sa_flags & SA_ONESHOT)
547 ka->sa.sa_handler = SIG_DFL; 547 ka->sa.sa_handler = SIG_DFL;
548 548
549 if (!(ka->sa.sa_flags & SA_NODEFER)) { 549 spin_lock_irq(&current->sighand->siglock);
550 spin_lock_irq(&current->sighand->siglock); 550 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
551 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 551 if (!(ka->sa.sa_flags & SA_NODEFER))
552 sigaddset(&current->blocked,sig); 552 sigaddset(&current->blocked,sig);
553 recalc_sigpending(); 553 recalc_sigpending();
554 spin_unlock_irq(&current->sighand->siglock); 554 spin_unlock_irq(&current->sighand->siglock);
555 }
556} 555}
557 556
558/* 557/*
diff --git a/arch/sh64/kernel/signal.c b/arch/sh64/kernel/signal.c
index c6a14a87c59b..3ea8929e483b 100644
--- a/arch/sh64/kernel/signal.c
+++ b/arch/sh64/kernel/signal.c
@@ -664,13 +664,12 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
664 else 664 else
665 setup_frame(sig, ka, oldset, regs); 665 setup_frame(sig, ka, oldset, regs);
666 666
667 if (!(ka->sa.sa_flags & SA_NODEFER)) { 667 spin_lock_irq(&current->sighand->siglock);
668 spin_lock_irq(&current->sighand->siglock); 668 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
669 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 669 if (!(ka->sa.sa_flags & SA_NODEFER))
670 sigaddset(&current->blocked,sig); 670 sigaddset(&current->blocked,sig);
671 recalc_sigpending(); 671 recalc_sigpending();
672 spin_unlock_irq(&current->sighand->siglock); 672 spin_unlock_irq(&current->sighand->siglock);
673 }
674} 673}
675 674
676/* 675/*
diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
index 011ff35057a5..5f34d7dc2b89 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal.c
@@ -1034,13 +1034,12 @@ handle_signal(unsigned long signr, struct k_sigaction *ka,
1034 else 1034 else
1035 setup_frame(&ka->sa, regs, signr, oldset, info); 1035 setup_frame(&ka->sa, regs, signr, oldset, info);
1036 } 1036 }
1037 if (!(ka->sa.sa_flags & SA_NOMASK)) { 1037 spin_lock_irq(&current->sighand->siglock);
1038 spin_lock_irq(&current->sighand->siglock); 1038 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
1039 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 1039 if (!(ka->sa.sa_flags & SA_NOMASK))
1040 sigaddset(&current->blocked, signr); 1040 sigaddset(&current->blocked, signr);
1041 recalc_sigpending(); 1041 recalc_sigpending();
1042 spin_unlock_irq(&current->sighand->siglock); 1042 spin_unlock_irq(&current->sighand->siglock);
1043 }
1044} 1043}
1045 1044
1046static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, 1045static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index bba140d98b1b..f21c993f8856 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -540,6 +540,7 @@ void pcibios_bus_to_resource(struct pci_dev *pdev, struct resource *res,
540 540
541 pbm->parent->resource_adjust(pdev, res, root); 541 pbm->parent->resource_adjust(pdev, res, root);
542} 542}
543EXPORT_SYMBOL(pcibios_bus_to_resource);
543 544
544char * __init pcibios_setup(char *str) 545char * __init pcibios_setup(char *str)
545{ 546{
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index b27934671c35..60f5dfabb1e1 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -574,13 +574,12 @@ static inline void handle_signal(unsigned long signr, struct k_sigaction *ka,
574{ 574{
575 setup_rt_frame(ka, regs, signr, oldset, 575 setup_rt_frame(ka, regs, signr, oldset,
576 (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); 576 (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL);
577 if (!(ka->sa.sa_flags & SA_NOMASK)) { 577 spin_lock_irq(&current->sighand->siglock);
578 spin_lock_irq(&current->sighand->siglock); 578 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
579 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 579 if (!(ka->sa.sa_flags & SA_NOMASK))
580 sigaddset(&current->blocked,signr); 580 sigaddset(&current->blocked,signr);
581 recalc_sigpending(); 581 recalc_sigpending();
582 spin_unlock_irq(&current->sighand->siglock); 582 spin_unlock_irq(&current->sighand->siglock);
583 }
584} 583}
585 584
586static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, 585static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index f28428f4170e..b1ed23091fbb 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -1325,13 +1325,12 @@ static inline void handle_signal32(unsigned long signr, struct k_sigaction *ka,
1325 else 1325 else
1326 setup_frame32(&ka->sa, regs, signr, oldset, info); 1326 setup_frame32(&ka->sa, regs, signr, oldset, info);
1327 } 1327 }
1328 if (!(ka->sa.sa_flags & SA_NOMASK)) { 1328 spin_lock_irq(&current->sighand->siglock);
1329 spin_lock_irq(&current->sighand->siglock); 1329 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
1330 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 1330 if (!(ka->sa.sa_flags & SA_NOMASK))
1331 sigaddset(&current->blocked,signr); 1331 sigaddset(&current->blocked,signr);
1332 recalc_sigpending(); 1332 recalc_sigpending();
1333 spin_unlock_irq(&current->sighand->siglock); 1333 spin_unlock_irq(&current->sighand->siglock);
1334 }
1335} 1334}
1336 1335
1337static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs, 1336static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs,
diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c
index a37a5ac13c22..022f67bb6873 100644
--- a/arch/um/drivers/mmapper_kern.c
+++ b/arch/um/drivers/mmapper_kern.c
@@ -9,19 +9,11 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/types.h> 12#include <linux/init.h>
13#include <linux/kdev_t.h>
14#include <linux/time.h>
15#include <linux/devfs_fs_kernel.h>
16#include <linux/module.h> 13#include <linux/module.h>
17#include <linux/mm.h> 14#include <linux/mm.h>
18#include <linux/slab.h>
19#include <linux/init.h>
20#include <linux/smp_lock.h>
21#include <linux/miscdevice.h> 15#include <linux/miscdevice.h>
22#include <asm/uaccess.h> 16#include <asm/uaccess.h>
23#include <asm/irq.h>
24#include <asm/pgtable.h>
25#include "mem_user.h" 17#include "mem_user.h"
26#include "user_util.h" 18#include "user_util.h"
27 19
@@ -31,35 +23,22 @@ static unsigned long p_buf = 0;
31static char *v_buf = NULL; 23static char *v_buf = NULL;
32 24
33static ssize_t 25static ssize_t
34mmapper_read(struct file *file, char *buf, size_t count, loff_t *ppos) 26mmapper_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
35{ 27{
36 if(*ppos > mmapper_size) 28 return simple_read_from_buffer(buf, count, ppos, v_buf, mmapper_size);
37 return -EINVAL;
38
39 if(count + *ppos > mmapper_size)
40 count = count + *ppos - mmapper_size;
41
42 if(count < 0)
43 return -EINVAL;
44
45 copy_to_user(buf,&v_buf[*ppos],count);
46
47 return count;
48} 29}
49 30
50static ssize_t 31static ssize_t
51mmapper_write(struct file *file, const char *buf, size_t count, loff_t *ppos) 32mmapper_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
52{ 33{
53 if(*ppos > mmapper_size) 34 if (*ppos > mmapper_size)
54 return -EINVAL; 35 return -EINVAL;
55 36
56 if(count + *ppos > mmapper_size) 37 if (count > mmapper_size - *ppos)
57 count = count + *ppos - mmapper_size; 38 count = mmapper_size - *ppos;
58
59 if(count < 0)
60 return -EINVAL;
61 39
62 copy_from_user(&v_buf[*ppos],buf,count); 40 if (copy_from_user(&v_buf[*ppos], buf, count))
41 return -EFAULT;
63 42
64 return count; 43 return count;
65} 44}
@@ -77,7 +56,6 @@ mmapper_mmap(struct file *file, struct vm_area_struct * vma)
77 int ret = -EINVAL; 56 int ret = -EINVAL;
78 int size; 57 int size;
79 58
80 lock_kernel();
81 if (vma->vm_pgoff != 0) 59 if (vma->vm_pgoff != 0)
82 goto out; 60 goto out;
83 61
@@ -92,7 +70,6 @@ mmapper_mmap(struct file *file, struct vm_area_struct * vma)
92 goto out; 70 goto out;
93 ret = 0; 71 ret = 0;
94out: 72out:
95 unlock_kernel();
96 return ret; 73 return ret;
97} 74}
98 75
diff --git a/arch/um/kernel/signal_kern.c b/arch/um/kernel/signal_kern.c
index 7807a3e8c426..03618bd13d55 100644
--- a/arch/um/kernel/signal_kern.c
+++ b/arch/um/kernel/signal_kern.c
@@ -87,12 +87,12 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr,
87 recalc_sigpending(); 87 recalc_sigpending();
88 spin_unlock_irq(&current->sighand->siglock); 88 spin_unlock_irq(&current->sighand->siglock);
89 force_sigsegv(signr, current); 89 force_sigsegv(signr, current);
90 } 90 } else {
91 else if(!(ka->sa.sa_flags & SA_NODEFER)){
92 spin_lock_irq(&current->sighand->siglock); 91 spin_lock_irq(&current->sighand->siglock);
93 sigorsets(&current->blocked, &current->blocked, 92 sigorsets(&current->blocked, &current->blocked,
94 &ka->sa.sa_mask); 93 &ka->sa.sa_mask);
95 sigaddset(&current->blocked, signr); 94 if(!(ka->sa.sa_flags & SA_NODEFER))
95 sigaddset(&current->blocked, signr);
96 recalc_sigpending(); 96 recalc_sigpending();
97 spin_unlock_irq(&current->sighand->siglock); 97 spin_unlock_irq(&current->sighand->siglock);
98 } 98 }
diff --git a/arch/v850/kernel/signal.c b/arch/v850/kernel/signal.c
index 37061e32e1a4..633e4e1b825f 100644
--- a/arch/v850/kernel/signal.c
+++ b/arch/v850/kernel/signal.c
@@ -462,13 +462,12 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
462 else 462 else
463 setup_frame(sig, ka, oldset, regs); 463 setup_frame(sig, ka, oldset, regs);
464 464
465 if (!(ka->sa.sa_flags & SA_NODEFER)) { 465 spin_lock_irq(&current->sighand->siglock);
466 spin_lock_irq(&current->sighand->siglock); 466 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
467 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 467 if (!(ka->sa.sa_flags & SA_NODEFER))
468 sigaddset(&current->blocked,sig); 468 sigaddset(&current->blocked,sig);
469 recalc_sigpending(); 469 recalc_sigpending();
470 spin_unlock_irq(&current->sighand->siglock); 470 spin_unlock_irq(&current->sighand->siglock);
471 }
472} 471}
473 472
474/* 473/*
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 776f3c866b70..b97a61e1c71c 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.13-rc3 3# Linux kernel version: 2.6.13-rc6-git3
4# Fri Jul 22 16:47:31 2005 4# Fri Aug 12 16:40:34 2005
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -284,10 +284,6 @@ CONFIG_IPV6=y
284# Network testing 284# Network testing
285# 285#
286# CONFIG_NET_PKTGEN is not set 286# CONFIG_NET_PKTGEN is not set
287CONFIG_NETPOLL=y
288# CONFIG_NETPOLL_RX is not set
289# CONFIG_NETPOLL_TRAP is not set
290CONFIG_NET_POLL_CONTROLLER=y
291# CONFIG_HAMRADIO is not set 287# CONFIG_HAMRADIO is not set
292# CONFIG_IRDA is not set 288# CONFIG_IRDA is not set
293# CONFIG_BT is not set 289# CONFIG_BT is not set
@@ -463,6 +459,7 @@ CONFIG_AIC79XX_DEBUG_MASK=0
463# CONFIG_MEGARAID_NEWGEN is not set 459# CONFIG_MEGARAID_NEWGEN is not set
464# CONFIG_MEGARAID_LEGACY is not set 460# CONFIG_MEGARAID_LEGACY is not set
465CONFIG_SCSI_SATA=y 461CONFIG_SCSI_SATA=y
462# CONFIG_SCSI_SATA_AHCI is not set
466# CONFIG_SCSI_SATA_SVW is not set 463# CONFIG_SCSI_SATA_SVW is not set
467CONFIG_SCSI_ATA_PIIX=y 464CONFIG_SCSI_ATA_PIIX=y
468# CONFIG_SCSI_SATA_NV is not set 465# CONFIG_SCSI_SATA_NV is not set
@@ -492,6 +489,7 @@ CONFIG_SCSI_QLA2XXX=y
492# CONFIG_SCSI_QLA2300 is not set 489# CONFIG_SCSI_QLA2300 is not set
493# CONFIG_SCSI_QLA2322 is not set 490# CONFIG_SCSI_QLA2322 is not set
494# CONFIG_SCSI_QLA6312 is not set 491# CONFIG_SCSI_QLA6312 is not set
492# CONFIG_SCSI_QLA24XX is not set
495# CONFIG_SCSI_LPFC is not set 493# CONFIG_SCSI_LPFC is not set
496# CONFIG_SCSI_DC395x is not set 494# CONFIG_SCSI_DC395x is not set
497# CONFIG_SCSI_DC390T is not set 495# CONFIG_SCSI_DC390T is not set
@@ -512,9 +510,11 @@ CONFIG_BLK_DEV_DM=y
512# 510#
513# Fusion MPT device support 511# Fusion MPT device support
514# 512#
515# CONFIG_FUSION is not set 513CONFIG_FUSION=y
516# CONFIG_FUSION_SPI is not set 514CONFIG_FUSION_SPI=y
517# CONFIG_FUSION_FC is not set 515# CONFIG_FUSION_FC is not set
516CONFIG_FUSION_MAX_SGE=128
517# CONFIG_FUSION_CTL is not set
518 518
519# 519#
520# IEEE 1394 (FireWire) support 520# IEEE 1394 (FireWire) support
@@ -585,6 +585,7 @@ CONFIG_8139TOO=y
585# CONFIG_ACENIC is not set 585# CONFIG_ACENIC is not set
586# CONFIG_DL2K is not set 586# CONFIG_DL2K is not set
587CONFIG_E1000=y 587CONFIG_E1000=y
588# CONFIG_E1000_NAPI is not set
588# CONFIG_NS83820 is not set 589# CONFIG_NS83820 is not set
589# CONFIG_HAMACHI is not set 590# CONFIG_HAMACHI is not set
590# CONFIG_YELLOWFIN is not set 591# CONFIG_YELLOWFIN is not set
@@ -624,6 +625,10 @@ CONFIG_S2IO=m
624# CONFIG_NET_FC is not set 625# CONFIG_NET_FC is not set
625# CONFIG_SHAPER is not set 626# CONFIG_SHAPER is not set
626CONFIG_NETCONSOLE=y 627CONFIG_NETCONSOLE=y
628CONFIG_NETPOLL=y
629# CONFIG_NETPOLL_RX is not set
630# CONFIG_NETPOLL_TRAP is not set
631CONFIG_NET_POLL_CONTROLLER=y
627 632
628# 633#
629# ISDN subsystem 634# ISDN subsystem
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index 6ded3a50dfe6..b548dea4e5b9 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -185,6 +185,40 @@ unsigned long __init e820_end_of_ram(void)
185} 185}
186 186
187/* 187/*
188 * Compute how much memory is missing in a range.
189 * Unlike the other functions in this file the arguments are in page numbers.
190 */
191unsigned long __init
192e820_hole_size(unsigned long start_pfn, unsigned long end_pfn)
193{
194 unsigned long ram = 0;
195 unsigned long start = start_pfn << PAGE_SHIFT;
196 unsigned long end = end_pfn << PAGE_SHIFT;
197 int i;
198 for (i = 0; i < e820.nr_map; i++) {
199 struct e820entry *ei = &e820.map[i];
200 unsigned long last, addr;
201
202 if (ei->type != E820_RAM ||
203 ei->addr+ei->size <= start ||
204 ei->addr >= end)
205 continue;
206
207 addr = round_up(ei->addr, PAGE_SIZE);
208 if (addr < start)
209 addr = start;
210
211 last = round_down(ei->addr + ei->size, PAGE_SIZE);
212 if (last >= end)
213 last = end;
214
215 if (last > addr)
216 ram += last - addr;
217 }
218 return ((end - start) - ram) >> PAGE_SHIFT;
219}
220
221/*
188 * Mark e820 reserved areas as busy for the resource manager. 222 * Mark e820 reserved areas as busy for the resource manager.
189 */ 223 */
190void __init e820_reserve_resources(void) 224void __init e820_reserve_resources(void)
diff --git a/arch/x86_64/kernel/signal.c b/arch/x86_64/kernel/signal.c
index 98590a989f3d..d642fbf3da29 100644
--- a/arch/x86_64/kernel/signal.c
+++ b/arch/x86_64/kernel/signal.c
@@ -394,10 +394,11 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
394#endif 394#endif
395 ret = setup_rt_frame(sig, ka, info, oldset, regs); 395 ret = setup_rt_frame(sig, ka, info, oldset, regs);
396 396
397 if (ret && !(ka->sa.sa_flags & SA_NODEFER)) { 397 if (ret) {
398 spin_lock_irq(&current->sighand->siglock); 398 spin_lock_irq(&current->sighand->siglock);
399 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 399 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
400 sigaddset(&current->blocked,sig); 400 if (!(ka->sa.sa_flags & SA_NODEFER))
401 sigaddset(&current->blocked,sig);
401 recalc_sigpending(); 402 recalc_sigpending();
402 spin_unlock_irq(&current->sighand->siglock); 403 spin_unlock_irq(&current->sighand->siglock);
403 } 404 }
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index 72e4b364ed73..aa4a5189ecee 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -322,18 +322,26 @@ void zap_low_mappings(void)
322void __init paging_init(void) 322void __init paging_init(void)
323{ 323{
324 { 324 {
325 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; 325 unsigned long zones_size[MAX_NR_ZONES];
326 unsigned long holes[MAX_NR_ZONES];
326 unsigned int max_dma; 327 unsigned int max_dma;
327 328
329 memset(zones_size, 0, sizeof(zones_size));
330 memset(holes, 0, sizeof(holes));
331
328 max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; 332 max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
329 333
330 if (end_pfn < max_dma) 334 if (end_pfn < max_dma) {
331 zones_size[ZONE_DMA] = end_pfn; 335 zones_size[ZONE_DMA] = end_pfn;
332 else { 336 holes[ZONE_DMA] = e820_hole_size(0, end_pfn);
337 } else {
333 zones_size[ZONE_DMA] = max_dma; 338 zones_size[ZONE_DMA] = max_dma;
339 holes[ZONE_DMA] = e820_hole_size(0, max_dma);
334 zones_size[ZONE_NORMAL] = end_pfn - max_dma; 340 zones_size[ZONE_NORMAL] = end_pfn - max_dma;
341 holes[ZONE_NORMAL] = e820_hole_size(max_dma, end_pfn);
335 } 342 }
336 free_area_init(zones_size); 343 free_area_init_node(0, NODE_DATA(0), zones_size,
344 __pa(PAGE_OFFSET) >> PAGE_SHIFT, holes);
337 } 345 }
338 return; 346 return;
339} 347}
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 70cb2904a90f..6a156f5692ae 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -126,9 +126,11 @@ void __init setup_node_zones(int nodeid)
126{ 126{
127 unsigned long start_pfn, end_pfn; 127 unsigned long start_pfn, end_pfn;
128 unsigned long zones[MAX_NR_ZONES]; 128 unsigned long zones[MAX_NR_ZONES];
129 unsigned long holes[MAX_NR_ZONES];
129 unsigned long dma_end_pfn; 130 unsigned long dma_end_pfn;
130 131
131 memset(zones, 0, sizeof(unsigned long) * MAX_NR_ZONES); 132 memset(zones, 0, sizeof(unsigned long) * MAX_NR_ZONES);
133 memset(holes, 0, sizeof(unsigned long) * MAX_NR_ZONES);
132 134
133 start_pfn = node_start_pfn(nodeid); 135 start_pfn = node_start_pfn(nodeid);
134 end_pfn = node_end_pfn(nodeid); 136 end_pfn = node_end_pfn(nodeid);
@@ -139,13 +141,17 @@ void __init setup_node_zones(int nodeid)
139 dma_end_pfn = __pa(MAX_DMA_ADDRESS) >> PAGE_SHIFT; 141 dma_end_pfn = __pa(MAX_DMA_ADDRESS) >> PAGE_SHIFT;
140 if (start_pfn < dma_end_pfn) { 142 if (start_pfn < dma_end_pfn) {
141 zones[ZONE_DMA] = dma_end_pfn - start_pfn; 143 zones[ZONE_DMA] = dma_end_pfn - start_pfn;
144 holes[ZONE_DMA] = e820_hole_size(start_pfn, dma_end_pfn);
142 zones[ZONE_NORMAL] = end_pfn - dma_end_pfn; 145 zones[ZONE_NORMAL] = end_pfn - dma_end_pfn;
146 holes[ZONE_NORMAL] = e820_hole_size(dma_end_pfn, end_pfn);
147
143 } else { 148 } else {
144 zones[ZONE_NORMAL] = end_pfn - start_pfn; 149 zones[ZONE_NORMAL] = end_pfn - start_pfn;
150 holes[ZONE_NORMAL] = e820_hole_size(start_pfn, end_pfn);
145 } 151 }
146 152
147 free_area_init_node(nodeid, NODE_DATA(nodeid), zones, 153 free_area_init_node(nodeid, NODE_DATA(nodeid), zones,
148 start_pfn, NULL); 154 start_pfn, holes);
149} 155}
150 156
151void __init numa_init_array(void) 157void __init numa_init_array(void)
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c
index df6e1e17b096..dc42cede9394 100644
--- a/arch/xtensa/kernel/signal.c
+++ b/arch/xtensa/kernel/signal.c
@@ -702,12 +702,11 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
702 if (ka.sa.sa_flags & SA_ONESHOT) 702 if (ka.sa.sa_flags & SA_ONESHOT)
703 ka.sa.sa_handler = SIG_DFL; 703 ka.sa.sa_handler = SIG_DFL;
704 704
705 if (!(ka.sa.sa_flags & SA_NODEFER)) { 705 spin_lock_irq(&current->sighand->siglock);
706 spin_lock_irq(&current->sighand->siglock); 706 sigorsets(&current->blocked, &current->blocked, &ka.sa.sa_mask);
707 sigorsets(&current->blocked, &current->blocked, &ka.sa.sa_mask); 707 if (!(ka.sa.sa_flags & SA_NODEFER))
708 sigaddset(&current->blocked, signr); 708 sigaddset(&current->blocked, signr);
709 recalc_sigpending(); 709 recalc_sigpending();
710 spin_unlock_irq(&current->sighand->siglock); 710 spin_unlock_irq(&current->sighand->siglock);
711 }
712 return 1; 711 return 1;
713} 712}
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c
index 186b182c5825..f93d2ee54800 100644
--- a/drivers/acpi/sleep/poweroff.c
+++ b/drivers/acpi/sleep/poweroff.c
@@ -55,7 +55,11 @@ void acpi_power_off(void)
55 55
56static int acpi_shutdown(struct sys_device *x) 56static int acpi_shutdown(struct sys_device *x)
57{ 57{
58 return acpi_sleep_prepare(ACPI_STATE_S5); 58 if (system_state == SYSTEM_POWER_OFF) {
59 /* Prepare if we are going to power off the system */
60 return acpi_sleep_prepare(ACPI_STATE_S5);
61 }
62 return 0;
59} 63}
60 64
61static struct sysdev_class acpi_sysclass = { 65static struct sysdev_class acpi_sysclass = {
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c
index 2435a7c99b2b..cd056e7e64ec 100644
--- a/drivers/block/cfq-iosched.c
+++ b/drivers/block/cfq-iosched.c
@@ -47,7 +47,7 @@ static int cfq_slice_idle = HZ / 100;
47/* 47/*
48 * disable queueing at the driver/hardware level 48 * disable queueing at the driver/hardware level
49 */ 49 */
50static int cfq_max_depth = 1; 50static int cfq_max_depth = 2;
51 51
52/* 52/*
53 * for the hash of cfqq inside the cfqd 53 * for the hash of cfqq inside the cfqd
@@ -385,9 +385,15 @@ cfq_choose_req(struct cfq_data *cfqd, struct cfq_rq *crq1, struct cfq_rq *crq2)
385 return crq2; 385 return crq2;
386 if (crq2 == NULL) 386 if (crq2 == NULL)
387 return crq1; 387 return crq1;
388 if (cfq_crq_requeued(crq1)) 388
389 if (cfq_crq_requeued(crq1) && !cfq_crq_requeued(crq2))
389 return crq1; 390 return crq1;
390 if (cfq_crq_requeued(crq2)) 391 else if (cfq_crq_requeued(crq2) && !cfq_crq_requeued(crq1))
392 return crq2;
393
394 if (cfq_crq_is_sync(crq1) && !cfq_crq_is_sync(crq2))
395 return crq1;
396 else if (cfq_crq_is_sync(crq2) && !cfq_crq_is_sync(crq1))
391 return crq2; 397 return crq2;
392 398
393 s1 = crq1->request->sector; 399 s1 = crq1->request->sector;
@@ -1769,18 +1775,23 @@ static void
1769cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, 1775cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1770 struct cfq_rq *crq) 1776 struct cfq_rq *crq)
1771{ 1777{
1772 const int sync = cfq_crq_is_sync(crq); 1778 struct cfq_io_context *cic;
1773 1779
1774 cfqq->next_crq = cfq_choose_req(cfqd, cfqq->next_crq, crq); 1780 cfqq->next_crq = cfq_choose_req(cfqd, cfqq->next_crq, crq);
1775 1781
1776 if (sync) { 1782 /*
1777 struct cfq_io_context *cic = crq->io_context; 1783 * we never wait for an async request and we don't allow preemption
1784 * of an async request. so just return early
1785 */
1786 if (!cfq_crq_is_sync(crq))
1787 return;
1778 1788
1779 cfq_update_io_thinktime(cfqd, cic); 1789 cic = crq->io_context;
1780 cfq_update_idle_window(cfqd, cfqq, cic);
1781 1790
1782 cic->last_queue = jiffies; 1791 cfq_update_io_thinktime(cfqd, cic);
1783 } 1792 cfq_update_idle_window(cfqd, cfqq, cic);
1793
1794 cic->last_queue = jiffies;
1784 1795
1785 if (cfqq == cfqd->active_queue) { 1796 if (cfqq == cfqd->active_queue) {
1786 /* 1797 /*
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 30d96739fb23..665103ccaee8 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -2433,7 +2433,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
2433 int ret = 0; 2433 int ret = 0;
2434 2434
2435 acquire_console_sem(); 2435 acquire_console_sem();
2436 if (tty->count == 1) { 2436 if (tty->driver_data == NULL) {
2437 ret = vc_allocate(currcons); 2437 ret = vc_allocate(currcons);
2438 if (ret == 0) { 2438 if (ret == 0) {
2439 struct vc_data *vc = vc_cons[currcons].d; 2439 struct vc_data *vc = vc_cons[currcons].d;
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index 4fa17c76eea2..c8a7f47911f9 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -325,7 +325,7 @@ int adm1026_attach_adapter(struct i2c_adapter *adapter)
325int adm1026_detach_client(struct i2c_client *client) 325int adm1026_detach_client(struct i2c_client *client)
326{ 326{
327 i2c_detach_client(client); 327 i2c_detach_client(client);
328 kfree(client); 328 kfree(i2c_get_clientdata(client));
329 return 0; 329 return 0;
330} 330}
331 331
@@ -1691,7 +1691,7 @@ int adm1026_detect(struct i2c_adapter *adapter, int address,
1691 1691
1692 /* Error out and cleanup code */ 1692 /* Error out and cleanup code */
1693exitfree: 1693exitfree:
1694 kfree(new_client); 1694 kfree(data);
1695exit: 1695exit:
1696 return err; 1696 return err;
1697} 1697}
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 9168e983ca1d..936250957270 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -834,7 +834,7 @@ static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind)
834 return 0; 834 return 0;
835 835
836exit_free: 836exit_free:
837 kfree(new_client); 837 kfree(data);
838exit: 838exit:
839 return err; 839 return err;
840} 840}
@@ -845,7 +845,7 @@ static int adm1031_detach_client(struct i2c_client *client)
845 if ((ret = i2c_detach_client(client)) != 0) { 845 if ((ret = i2c_detach_client(client)) != 0) {
846 return ret; 846 return ret;
847 } 847 }
848 kfree(client); 848 kfree(i2c_get_clientdata(client));
849 return 0; 849 return 0;
850} 850}
851 851
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
index 5c68e9c311aa..ce2a6eb93f6e 100644
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -616,7 +616,7 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind)
616 616
617 return 0; 617 return 0;
618exit_free: 618exit_free:
619 kfree(new_client); 619 kfree(data);
620exit: 620exit:
621 return err; 621 return err;
622} 622}
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c
index 270015b626ad..301ae98bd0ad 100644
--- a/drivers/hwmon/fscpos.c
+++ b/drivers/hwmon/fscpos.c
@@ -167,7 +167,7 @@ static ssize_t set_temp_reset(struct i2c_client *client, struct fscpos_data
167 "experience to the module author.\n"); 167 "experience to the module author.\n");
168 168
169 /* Supported value: 2 (clears the status) */ 169 /* Supported value: 2 (clears the status) */
170 fscpos_write_value(client, FSCPOS_REG_TEMP_STATE[nr], 2); 170 fscpos_write_value(client, FSCPOS_REG_TEMP_STATE[nr - 1], 2);
171 return count; 171 return count;
172} 172}
173 173
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c
index 251ac2659554..fdeeb3ab6f2f 100644
--- a/drivers/hwmon/smsc47b397.c
+++ b/drivers/hwmon/smsc47b397.c
@@ -298,7 +298,7 @@ static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind)
298 return 0; 298 return 0;
299 299
300error_free: 300error_free:
301 kfree(new_client); 301 kfree(data);
302error_release: 302error_release:
303 release_region(addr, SMSC_EXTENT); 303 release_region(addr, SMSC_EXTENT);
304 return err; 304 return err;
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 897117a7213f..7166ad0b2fda 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -495,7 +495,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
495 return 0; 495 return 0;
496 496
497error_free: 497error_free:
498 kfree(new_client); 498 kfree(data);
499error_release: 499error_release:
500 release_region(address, SMSC_EXTENT); 500 release_region(address, SMSC_EXTENT);
501 return err; 501 return err;
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index b12a970cc9a3..27018c8efc24 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -478,7 +478,6 @@ static void ohci_initialize(struct ti_ohci *ohci)
478 int num_ports, i; 478 int num_ports, i;
479 479
480 spin_lock_init(&ohci->phy_reg_lock); 480 spin_lock_init(&ohci->phy_reg_lock);
481 spin_lock_init(&ohci->event_lock);
482 481
483 /* Put some defaults to these undefined bus options */ 482 /* Put some defaults to these undefined bus options */
484 buf = reg_read(ohci, OHCI1394_BusOptions); 483 buf = reg_read(ohci, OHCI1394_BusOptions);
@@ -3402,7 +3401,14 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3402 /* We hopefully don't have to pre-allocate IT DMA like we did 3401 /* We hopefully don't have to pre-allocate IT DMA like we did
3403 * for IR DMA above. Allocate it on-demand and mark inactive. */ 3402 * for IR DMA above. Allocate it on-demand and mark inactive. */
3404 ohci->it_legacy_context.ohci = NULL; 3403 ohci->it_legacy_context.ohci = NULL;
3404 spin_lock_init(&ohci->event_lock);
3405 3405
3406 /*
3407 * interrupts are disabled, all right, but... due to SA_SHIRQ we
3408 * might get called anyway. We'll see no event, of course, but
3409 * we need to get to that "no event", so enough should be initialized
3410 * by that point.
3411 */
3406 if (request_irq(dev->irq, ohci_irq_handler, SA_SHIRQ, 3412 if (request_irq(dev->irq, ohci_irq_handler, SA_SHIRQ,
3407 OHCI1394_DRIVER_NAME, ohci)) 3413 OHCI1394_DRIVER_NAME, ohci))
3408 FAIL(-ENOMEM, "Failed to allocate shared interrupt %d", dev->irq); 3414 FAIL(-ENOMEM, "Failed to allocate shared interrupt %d", dev->irq);
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index eb99e693dec2..5f6e9ea29cd7 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -130,13 +130,14 @@ static int ib_dealloc_ucontext(struct ib_ucontext *context)
130 130
131 list_for_each_entry_safe(uobj, tmp, &context->mr_list, list) { 131 list_for_each_entry_safe(uobj, tmp, &context->mr_list, list) {
132 struct ib_mr *mr = idr_find(&ib_uverbs_mr_idr, uobj->id); 132 struct ib_mr *mr = idr_find(&ib_uverbs_mr_idr, uobj->id);
133 struct ib_device *mrdev = mr->device;
133 struct ib_umem_object *memobj; 134 struct ib_umem_object *memobj;
134 135
135 idr_remove(&ib_uverbs_mr_idr, uobj->id); 136 idr_remove(&ib_uverbs_mr_idr, uobj->id);
136 ib_dereg_mr(mr); 137 ib_dereg_mr(mr);
137 138
138 memobj = container_of(uobj, struct ib_umem_object, uobject); 139 memobj = container_of(uobj, struct ib_umem_object, uobject);
139 ib_umem_release_on_close(mr->device, &memobj->umem); 140 ib_umem_release_on_close(mrdev, &memobj->umem);
140 141
141 list_del(&uobj->list); 142 list_del(&uobj->list);
142 kfree(memobj); 143 kfree(memobj);
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c
index f8570fd9d2ab..3abd7fc6e5ef 100644
--- a/drivers/isdn/capi/capifs.c
+++ b/drivers/isdn/capi/capifs.c
@@ -191,8 +191,10 @@ static int __init capifs_init(void)
191 err = register_filesystem(&capifs_fs_type); 191 err = register_filesystem(&capifs_fs_type);
192 if (!err) { 192 if (!err) {
193 capifs_mnt = kern_mount(&capifs_fs_type); 193 capifs_mnt = kern_mount(&capifs_fs_type);
194 if (IS_ERR(capifs_mnt)) 194 if (IS_ERR(capifs_mnt)) {
195 err = PTR_ERR(capifs_mnt); 195 err = PTR_ERR(capifs_mnt);
196 unregister_filesystem(&capifs_fs_type);
197 }
196 } 198 }
197 if (!err) 199 if (!err)
198 printk(KERN_NOTICE "capifs: Rev %s\n", rev); 200 printk(KERN_NOTICE "capifs: Rev %s\n", rev);
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 486ee50cfdda..20ca80b7dc20 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1689,6 +1689,7 @@ static int do_md_run(mddev_t * mddev)
1689 mddev->pers = pers[pnum]; 1689 mddev->pers = pers[pnum];
1690 spin_unlock(&pers_lock); 1690 spin_unlock(&pers_lock);
1691 1691
1692 mddev->recovery = 0;
1692 mddev->resync_max_sectors = mddev->size << 1; /* may be over-ridden by personality */ 1693 mddev->resync_max_sectors = mddev->size << 1; /* may be over-ridden by personality */
1693 1694
1694 /* before we start the array running, initialise the bitmap */ 1695 /* before we start the array running, initialise the bitmap */
@@ -4011,3 +4012,4 @@ EXPORT_SYMBOL(md_print_devices);
4011EXPORT_SYMBOL(md_check_recovery); 4012EXPORT_SYMBOL(md_check_recovery);
4012MODULE_LICENSE("GPL"); 4013MODULE_LICENSE("GPL");
4013MODULE_ALIAS("md"); 4014MODULE_ALIAS("md");
4015MODULE_ALIAS_BLOCKDEV_MAJOR(MD_MAJOR);
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c
index 63b626f70c81..9b9d6f8ee74e 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-common.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-common.c
@@ -70,13 +70,22 @@ EXPORT_SYMBOL(dibusb_power_ctrl);
70 70
71int dibusb2_0_streaming_ctrl(struct dvb_usb_device *d, int onoff) 71int dibusb2_0_streaming_ctrl(struct dvb_usb_device *d, int onoff)
72{ 72{
73 u8 b[2]; 73 u8 b[3] = { 0 };
74 b[0] = DIBUSB_REQ_SET_IOCTL; 74 int ret;
75 b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM; 75
76 if ((ret = dibusb_streaming_ctrl(d,onoff)) < 0)
77 return ret;
76 78
77 dvb_usb_generic_write(d,b,3); 79 if (onoff) {
80 b[0] = DIBUSB_REQ_SET_STREAMING_MODE;
81 b[1] = 0x00;
82 if ((ret = dvb_usb_generic_write(d,b,2)) < 0)
83 return ret;
84 }
78 85
79 return dibusb_streaming_ctrl(d,onoff); 86 b[0] = DIBUSB_REQ_SET_IOCTL;
87 b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM;
88 return dvb_usb_generic_write(d,b,3);
80} 89}
81EXPORT_SYMBOL(dibusb2_0_streaming_ctrl); 90EXPORT_SYMBOL(dibusb2_0_streaming_ctrl);
82 91
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
index 3491ff40885c..6fa92100248b 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
@@ -23,12 +23,12 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
23 */ 23 */
24 if (newfeedcount == 0) { 24 if (newfeedcount == 0) {
25 deb_ts("stop feeding\n"); 25 deb_ts("stop feeding\n");
26 dvb_usb_urb_kill(d);
26 27
27 if (d->props.streaming_ctrl != NULL) 28 if (d->props.streaming_ctrl != NULL)
28 if ((ret = d->props.streaming_ctrl(d,0))) 29 if ((ret = d->props.streaming_ctrl(d,0)))
29 err("error while stopping stream."); 30 err("error while stopping stream.");
30 31
31 dvb_usb_urb_kill(d);
32 } 32 }
33 33
34 d->feedcount = newfeedcount; 34 d->feedcount = newfeedcount;
@@ -44,6 +44,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
44 * for reception. 44 * for reception.
45 */ 45 */
46 if (d->feedcount == onoff && d->feedcount > 0) { 46 if (d->feedcount == onoff && d->feedcount > 0) {
47 deb_ts("submitting all URBs\n");
48 dvb_usb_urb_submit(d);
47 49
48 deb_ts("controlling pid parser\n"); 50 deb_ts("controlling pid parser\n");
49 if (d->props.caps & DVB_USB_HAS_PID_FILTER && 51 if (d->props.caps & DVB_USB_HAS_PID_FILTER &&
@@ -59,7 +61,6 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
59 return -ENODEV; 61 return -ENODEV;
60 } 62 }
61 63
62 dvb_usb_urb_submit(d);
63 } 64 }
64 return 0; 65 return 0;
65} 66}
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index f9e3be96963c..0b230222bfea 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -308,12 +308,6 @@ static int sp_set_mac_address(struct net_device *dev, void *addr)
308{ 308{
309 struct sockaddr_ax25 *sa = addr; 309 struct sockaddr_ax25 *sa = addr;
310 310
311 if (sa->sax25_family != AF_AX25)
312 return -EINVAL;
313
314 if (!sa->sax25_ndigis)
315 return -EINVAL;
316
317 spin_lock_irq(&dev->xmit_lock); 311 spin_lock_irq(&dev->xmit_lock);
318 memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN); 312 memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN);
319 spin_unlock_irq(&dev->xmit_lock); 313 spin_unlock_irq(&dev->xmit_lock);
@@ -668,6 +662,9 @@ static int sixpack_open(struct tty_struct *tty)
668 netif_start_queue(dev); 662 netif_start_queue(dev);
669 663
670 init_timer(&sp->tx_t); 664 init_timer(&sp->tx_t);
665 sp->tx_t.function = sp_xmit_on_air;
666 sp->tx_t.data = (unsigned long) sp;
667
671 init_timer(&sp->resync_t); 668 init_timer(&sp->resync_t);
672 669
673 spin_unlock_bh(&sp->lock); 670 spin_unlock_bh(&sp->lock);
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
index c7fb3675c09d..0de3bb906174 100644
--- a/drivers/net/ibm_emac/ibm_emac_core.c
+++ b/drivers/net/ibm_emac/ibm_emac_core.c
@@ -1253,7 +1253,7 @@ static int emac_init_tah(struct ocp_enet_private *fep)
1253 TAH_MR_CVR | TAH_MR_ST_768 | TAH_MR_TFS_10KB | TAH_MR_DTFP | 1253 TAH_MR_CVR | TAH_MR_ST_768 | TAH_MR_TFS_10KB | TAH_MR_DTFP |
1254 TAH_MR_DIG); 1254 TAH_MR_DIG);
1255 1255
1256 iounmap(&tahp); 1256 iounmap(tahp);
1257 1257
1258 return 0; 1258 return 0;
1259} 1259}
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 01419aff333e..6d4ab1e333b5 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -66,8 +66,8 @@
66 66
67#define DRV_MODULE_NAME "tg3" 67#define DRV_MODULE_NAME "tg3"
68#define PFX DRV_MODULE_NAME ": " 68#define PFX DRV_MODULE_NAME ": "
69#define DRV_MODULE_VERSION "3.36" 69#define DRV_MODULE_VERSION "3.37"
70#define DRV_MODULE_RELDATE "August 19, 2005" 70#define DRV_MODULE_RELDATE "August 25, 2005"
71 71
72#define TG3_DEF_MAC_MODE 0 72#define TG3_DEF_MAC_MODE 0
73#define TG3_DEF_RX_MODE 0 73#define TG3_DEF_RX_MODE 0
@@ -7865,8 +7865,6 @@ static int tg3_test_loopback(struct tg3 *tp)
7865 7865
7866 err = -EIO; 7866 err = -EIO;
7867 7867
7868 tg3_abort_hw(tp, 1);
7869
7870 tg3_reset_hw(tp); 7868 tg3_reset_hw(tp);
7871 7869
7872 mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | 7870 mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index a2eebc6eaacc..6d864c502a1f 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -40,7 +40,7 @@
40 * FIXME: IO should be max 256 bytes. However, since we may 40 * FIXME: IO should be max 256 bytes. However, since we may
41 * have a P2P bridge below a cardbus bridge, we need 4K. 41 * have a P2P bridge below a cardbus bridge, we need 4K.
42 */ 42 */
43#define CARDBUS_IO_SIZE (4096) 43#define CARDBUS_IO_SIZE (256)
44#define CARDBUS_MEM_SIZE (32*1024*1024) 44#define CARDBUS_MEM_SIZE (32*1024*1024)
45 45
46static void __devinit 46static void __devinit
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 84eedc965688..5598b4714f77 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -53,7 +53,9 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
53 if (resno < 6) { 53 if (resno < 6) {
54 reg = PCI_BASE_ADDRESS_0 + 4 * resno; 54 reg = PCI_BASE_ADDRESS_0 + 4 * resno;
55 } else if (resno == PCI_ROM_RESOURCE) { 55 } else if (resno == PCI_ROM_RESOURCE) {
56 new |= res->flags & IORESOURCE_ROM_ENABLE; 56 if (!(res->flags & IORESOURCE_ROM_ENABLE))
57 return;
58 new |= PCI_ROM_ADDRESS_ENABLE;
57 reg = dev->rom_base_reg; 59 reg = dev->rom_base_reg;
58 } else { 60 } else {
59 /* Hmm, non-standard resource. */ 61 /* Hmm, non-standard resource. */
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index 533f90c05cdf..381f339e3200 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -112,7 +112,7 @@ qdio_min(int a,int b)
112 112
113/***************** SCRUBBER HELPER ROUTINES **********************/ 113/***************** SCRUBBER HELPER ROUTINES **********************/
114 114
115static inline volatile __u64 115static inline __u64
116qdio_get_micros(void) 116qdio_get_micros(void)
117{ 117{
118 return (get_clock() >> 10); /* time>>12 is microseconds */ 118 return (get_clock() >> 10); /* time>>12 is microseconds */
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index e17b4d58a9f6..bfe3ba73bc0f 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -1299,13 +1299,10 @@ struct zfcp_port *
1299zfcp_port_enqueue(struct zfcp_adapter *adapter, wwn_t wwpn, u32 status, 1299zfcp_port_enqueue(struct zfcp_adapter *adapter, wwn_t wwpn, u32 status,
1300 u32 d_id) 1300 u32 d_id)
1301{ 1301{
1302 struct zfcp_port *port, *tmp_port; 1302 struct zfcp_port *port;
1303 int check_wwpn; 1303 int check_wwpn;
1304 scsi_id_t scsi_id;
1305 int found;
1306 1304
1307 check_wwpn = !(status & ZFCP_STATUS_PORT_NO_WWPN); 1305 check_wwpn = !(status & ZFCP_STATUS_PORT_NO_WWPN);
1308
1309 /* 1306 /*
1310 * check that there is no port with this WWPN already in list 1307 * check that there is no port with this WWPN already in list
1311 */ 1308 */
@@ -1368,7 +1365,7 @@ zfcp_port_enqueue(struct zfcp_adapter *adapter, wwn_t wwpn, u32 status,
1368 } else { 1365 } else {
1369 snprintf(port->sysfs_device.bus_id, 1366 snprintf(port->sysfs_device.bus_id,
1370 BUS_ID_SIZE, "0x%016llx", wwpn); 1367 BUS_ID_SIZE, "0x%016llx", wwpn);
1371 port->sysfs_device.parent = &adapter->ccw_device->dev; 1368 port->sysfs_device.parent = &adapter->ccw_device->dev;
1372 } 1369 }
1373 port->sysfs_device.release = zfcp_sysfs_port_release; 1370 port->sysfs_device.release = zfcp_sysfs_port_release;
1374 dev_set_drvdata(&port->sysfs_device, port); 1371 dev_set_drvdata(&port->sysfs_device, port);
@@ -1388,24 +1385,8 @@ zfcp_port_enqueue(struct zfcp_adapter *adapter, wwn_t wwpn, u32 status,
1388 1385
1389 zfcp_port_get(port); 1386 zfcp_port_get(port);
1390 1387
1391 scsi_id = 1;
1392 found = 0;
1393 write_lock_irq(&zfcp_data.config_lock); 1388 write_lock_irq(&zfcp_data.config_lock);
1394 list_for_each_entry(tmp_port, &adapter->port_list_head, list) { 1389 list_add_tail(&port->list, &adapter->port_list_head);
1395 if (atomic_test_mask(ZFCP_STATUS_PORT_NO_SCSI_ID,
1396 &tmp_port->status))
1397 continue;
1398 if (tmp_port->scsi_id != scsi_id) {
1399 found = 1;
1400 break;
1401 }
1402 scsi_id++;
1403 }
1404 port->scsi_id = scsi_id;
1405 if (found)
1406 list_add_tail(&port->list, &tmp_port->list);
1407 else
1408 list_add_tail(&port->list, &adapter->port_list_head);
1409 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status); 1390 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status);
1410 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, &port->status); 1391 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, &port->status);
1411 if (d_id == ZFCP_DID_DIRECTORY_SERVICE) 1392 if (d_id == ZFCP_DID_DIRECTORY_SERVICE)
@@ -1427,6 +1408,9 @@ zfcp_port_dequeue(struct zfcp_port *port)
1427 list_del(&port->list); 1408 list_del(&port->list);
1428 port->adapter->ports--; 1409 port->adapter->ports--;
1429 write_unlock_irq(&zfcp_data.config_lock); 1410 write_unlock_irq(&zfcp_data.config_lock);
1411 if (port->rport)
1412 fc_remote_port_delete(port->rport);
1413 port->rport = NULL;
1430 zfcp_adapter_put(port->adapter); 1414 zfcp_adapter_put(port->adapter);
1431 zfcp_sysfs_port_remove_files(&port->sysfs_device, 1415 zfcp_sysfs_port_remove_files(&port->sysfs_device,
1432 atomic_read(&port->status)); 1416 atomic_read(&port->status));
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index 0fc46381fc22..b30abab77da3 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -202,9 +202,19 @@ static int
202zfcp_ccw_set_offline(struct ccw_device *ccw_device) 202zfcp_ccw_set_offline(struct ccw_device *ccw_device)
203{ 203{
204 struct zfcp_adapter *adapter; 204 struct zfcp_adapter *adapter;
205 struct zfcp_port *port;
206 struct fc_rport *rport;
205 207
206 down(&zfcp_data.config_sema); 208 down(&zfcp_data.config_sema);
207 adapter = dev_get_drvdata(&ccw_device->dev); 209 adapter = dev_get_drvdata(&ccw_device->dev);
210 /* might be racy, but we cannot take config_lock due to the fact that
211 fc_remote_port_delete might sleep */
212 list_for_each_entry(port, &adapter->port_list_head, list)
213 if (port->rport) {
214 rport = port->rport;
215 port->rport = NULL;
216 fc_remote_port_delete(rport);
217 }
208 zfcp_erp_adapter_shutdown(adapter, 0); 218 zfcp_erp_adapter_shutdown(adapter, 0);
209 zfcp_erp_wait(adapter); 219 zfcp_erp_wait(adapter);
210 zfcp_adapter_scsi_unregister(adapter); 220 zfcp_adapter_scsi_unregister(adapter);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 4103b5be7683..455e902533a9 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -906,6 +906,7 @@ struct zfcp_adapter {
906 */ 906 */
907struct zfcp_port { 907struct zfcp_port {
908 struct device sysfs_device; /* sysfs device */ 908 struct device sysfs_device; /* sysfs device */
909 struct fc_rport *rport; /* rport of fc transport class */
909 struct list_head list; /* list of remote ports */ 910 struct list_head list; /* list of remote ports */
910 atomic_t refcount; /* reference count */ 911 atomic_t refcount; /* reference count */
911 wait_queue_head_t remove_wq; /* can be used to wait for 912 wait_queue_head_t remove_wq; /* can be used to wait for
@@ -916,7 +917,6 @@ struct zfcp_port {
916 list */ 917 list */
917 u32 units; /* # of logical units in list */ 918 u32 units; /* # of logical units in list */
918 atomic_t status; /* status of this remote port */ 919 atomic_t status; /* status of this remote port */
919 scsi_id_t scsi_id; /* own SCSI ID */
920 wwn_t wwnn; /* WWNN if known */ 920 wwn_t wwnn; /* WWNN if known */
921 wwn_t wwpn; /* WWPN */ 921 wwn_t wwpn; /* WWPN */
922 fc_id_t d_id; /* D_ID */ 922 fc_id_t d_id; /* D_ID */
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 0cf31f7d1c0f..cb4f612550ba 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -3360,13 +3360,32 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
3360 if ((result == ZFCP_ERP_SUCCEEDED) 3360 if ((result == ZFCP_ERP_SUCCEEDED)
3361 && (!atomic_test_mask(ZFCP_STATUS_UNIT_TEMPORARY, 3361 && (!atomic_test_mask(ZFCP_STATUS_UNIT_TEMPORARY,
3362 &unit->status)) 3362 &unit->status))
3363 && (!unit->device)) 3363 && !unit->device
3364 scsi_add_device(unit->port->adapter->scsi_host, 0, 3364 && port->rport)
3365 unit->port->scsi_id, unit->scsi_lun); 3365 scsi_add_device(port->adapter->scsi_host, 0,
3366 port->rport->scsi_target_id,
3367 unit->scsi_lun);
3366 zfcp_unit_put(unit); 3368 zfcp_unit_put(unit);
3367 break; 3369 break;
3368 case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: 3370 case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
3369 case ZFCP_ERP_ACTION_REOPEN_PORT: 3371 case ZFCP_ERP_ACTION_REOPEN_PORT:
3372 if ((result == ZFCP_ERP_SUCCEEDED)
3373 && !atomic_test_mask(ZFCP_STATUS_PORT_NO_WWPN,
3374 &port->status)
3375 && !port->rport) {
3376 struct fc_rport_identifiers ids;
3377 ids.node_name = port->wwnn;
3378 ids.port_name = port->wwpn;
3379 ids.port_id = port->d_id;
3380 ids.roles = FC_RPORT_ROLE_FCP_TARGET;
3381 port->rport =
3382 fc_remote_port_add(adapter->scsi_host, 0, &ids);
3383 if (!port->rport)
3384 ZFCP_LOG_NORMAL("failed registration of rport"
3385 "(adapter %s, wwpn=0x%016Lx)\n",
3386 zfcp_get_busid_by_port(port),
3387 port->wwpn);
3388 }
3370 zfcp_port_put(port); 3389 zfcp_port_put(port);
3371 break; 3390 break;
3372 case ZFCP_ERP_ACTION_REOPEN_ADAPTER: 3391 case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 42df7e57eeae..cd98a2de9f8f 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -143,6 +143,8 @@ extern int zfcp_scsi_command_async(struct zfcp_adapter *,struct zfcp_unit *,
143 struct scsi_cmnd *, struct timer_list *); 143 struct scsi_cmnd *, struct timer_list *);
144extern int zfcp_scsi_command_sync(struct zfcp_unit *, struct scsi_cmnd *, 144extern int zfcp_scsi_command_sync(struct zfcp_unit *, struct scsi_cmnd *,
145 struct timer_list *); 145 struct timer_list *);
146extern void zfcp_set_fc_host_attrs(struct zfcp_adapter *);
147extern void zfcp_set_fc_rport_attrs(struct zfcp_port *);
146extern struct scsi_transport_template *zfcp_transport_template; 148extern struct scsi_transport_template *zfcp_transport_template;
147extern struct fc_function_template zfcp_transport_functions; 149extern struct fc_function_template zfcp_transport_functions;
148 150
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 0d9f20edc490..c007b6424e74 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2062,6 +2062,7 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
2062 zfcp_erp_adapter_shutdown(adapter, 0); 2062 zfcp_erp_adapter_shutdown(adapter, 0);
2063 return -EIO; 2063 return -EIO;
2064 } 2064 }
2065 zfcp_set_fc_host_attrs(adapter);
2065 return 0; 2066 return 0;
2066} 2067}
2067 2068
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index b61d309352c3..31a76065cf28 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -389,7 +389,7 @@ zfcp_unit_lookup(struct zfcp_adapter *adapter, int channel, scsi_id_t id,
389 struct zfcp_unit *unit, *retval = NULL; 389 struct zfcp_unit *unit, *retval = NULL;
390 390
391 list_for_each_entry(port, &adapter->port_list_head, list) { 391 list_for_each_entry(port, &adapter->port_list_head, list) {
392 if (id != port->scsi_id) 392 if (!port->rport || (id != port->rport->scsi_target_id))
393 continue; 393 continue;
394 list_for_each_entry(unit, &port->unit_list_head, list) { 394 list_for_each_entry(unit, &port->unit_list_head, list) {
395 if (lun == unit->scsi_lun) { 395 if (lun == unit->scsi_lun) {
@@ -408,7 +408,7 @@ zfcp_port_lookup(struct zfcp_adapter *adapter, int channel, scsi_id_t id)
408 struct zfcp_port *port; 408 struct zfcp_port *port;
409 409
410 list_for_each_entry(port, &adapter->port_list_head, list) { 410 list_for_each_entry(port, &adapter->port_list_head, list) {
411 if (id == port->scsi_id) 411 if (port->rport && (id == port->rport->scsi_target_id))
412 return port; 412 return port;
413 } 413 }
414 return (struct zfcp_port *) NULL; 414 return (struct zfcp_port *) NULL;
@@ -634,7 +634,6 @@ zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
634{ 634{
635 int retval; 635 int retval;
636 struct zfcp_unit *unit = (struct zfcp_unit *) scpnt->device->hostdata; 636 struct zfcp_unit *unit = (struct zfcp_unit *) scpnt->device->hostdata;
637 struct Scsi_Host *scsi_host = scpnt->device->host;
638 637
639 if (!unit) { 638 if (!unit) {
640 ZFCP_LOG_NORMAL("bug: Tried reset for nonexistent unit\n"); 639 ZFCP_LOG_NORMAL("bug: Tried reset for nonexistent unit\n");
@@ -729,7 +728,6 @@ zfcp_scsi_eh_bus_reset_handler(struct scsi_cmnd *scpnt)
729{ 728{
730 int retval = 0; 729 int retval = 0;
731 struct zfcp_unit *unit; 730 struct zfcp_unit *unit;
732 struct Scsi_Host *scsi_host = scpnt->device->host;
733 731
734 unit = (struct zfcp_unit *) scpnt->device->hostdata; 732 unit = (struct zfcp_unit *) scpnt->device->hostdata;
735 ZFCP_LOG_NORMAL("bus reset because of problems with " 733 ZFCP_LOG_NORMAL("bus reset because of problems with "
@@ -753,7 +751,6 @@ zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
753{ 751{
754 int retval = 0; 752 int retval = 0;
755 struct zfcp_unit *unit; 753 struct zfcp_unit *unit;
756 struct Scsi_Host *scsi_host = scpnt->device->host;
757 754
758 unit = (struct zfcp_unit *) scpnt->device->hostdata; 755 unit = (struct zfcp_unit *) scpnt->device->hostdata;
759 ZFCP_LOG_NORMAL("host reset because of problems with " 756 ZFCP_LOG_NORMAL("host reset because of problems with "
@@ -833,6 +830,7 @@ zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter)
833 shost = adapter->scsi_host; 830 shost = adapter->scsi_host;
834 if (!shost) 831 if (!shost)
835 return; 832 return;
833 fc_remove_host(shost);
836 scsi_remove_host(shost); 834 scsi_remove_host(shost);
837 scsi_host_put(shost); 835 scsi_host_put(shost);
838 adapter->scsi_host = NULL; 836 adapter->scsi_host = NULL;
@@ -906,6 +904,18 @@ zfcp_get_node_name(struct scsi_target *starget)
906 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 904 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
907} 905}
908 906
907void
908zfcp_set_fc_host_attrs(struct zfcp_adapter *adapter)
909{
910 struct Scsi_Host *shost = adapter->scsi_host;
911
912 fc_host_node_name(shost) = adapter->wwnn;
913 fc_host_port_name(shost) = adapter->wwpn;
914 strncpy(fc_host_serial_number(shost), adapter->serial_number,
915 min(FC_SERIAL_NUMBER_SIZE, 32));
916 fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
917}
918
909struct fc_function_template zfcp_transport_functions = { 919struct fc_function_template zfcp_transport_functions = {
910 .get_starget_port_id = zfcp_get_port_id, 920 .get_starget_port_id = zfcp_get_port_id,
911 .get_starget_port_name = zfcp_get_port_name, 921 .get_starget_port_name = zfcp_get_port_name,
@@ -913,6 +923,11 @@ struct fc_function_template zfcp_transport_functions = {
913 .show_starget_port_id = 1, 923 .show_starget_port_id = 1,
914 .show_starget_port_name = 1, 924 .show_starget_port_name = 1,
915 .show_starget_node_name = 1, 925 .show_starget_node_name = 1,
926 .show_rport_supported_classes = 1,
927 .show_host_node_name = 1,
928 .show_host_port_name = 1,
929 .show_host_supported_classes = 1,
930 .show_host_serial_number = 1,
916}; 931};
917 932
918/** 933/**
diff --git a/drivers/s390/scsi/zfcp_sysfs_port.c b/drivers/s390/scsi/zfcp_sysfs_port.c
index 7a84c7d474d9..c55e82d91deb 100644
--- a/drivers/s390/scsi/zfcp_sysfs_port.c
+++ b/drivers/s390/scsi/zfcp_sysfs_port.c
@@ -67,7 +67,6 @@ static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_port_##_name##_show, NULL);
67ZFCP_DEFINE_PORT_ATTR(status, "0x%08x\n", atomic_read(&port->status)); 67ZFCP_DEFINE_PORT_ATTR(status, "0x%08x\n", atomic_read(&port->status));
68ZFCP_DEFINE_PORT_ATTR(wwnn, "0x%016llx\n", port->wwnn); 68ZFCP_DEFINE_PORT_ATTR(wwnn, "0x%016llx\n", port->wwnn);
69ZFCP_DEFINE_PORT_ATTR(d_id, "0x%06x\n", port->d_id); 69ZFCP_DEFINE_PORT_ATTR(d_id, "0x%06x\n", port->d_id);
70ZFCP_DEFINE_PORT_ATTR(scsi_id, "0x%x\n", port->scsi_id);
71ZFCP_DEFINE_PORT_ATTR(in_recovery, "%d\n", atomic_test_mask 70ZFCP_DEFINE_PORT_ATTR(in_recovery, "%d\n", atomic_test_mask
72 (ZFCP_STATUS_COMMON_ERP_INUSE, &port->status)); 71 (ZFCP_STATUS_COMMON_ERP_INUSE, &port->status));
73ZFCP_DEFINE_PORT_ATTR(access_denied, "%d\n", atomic_test_mask 72ZFCP_DEFINE_PORT_ATTR(access_denied, "%d\n", atomic_test_mask
@@ -263,7 +262,6 @@ static struct attribute_group zfcp_port_common_attr_group = {
263static struct attribute *zfcp_port_no_ns_attrs[] = { 262static struct attribute *zfcp_port_no_ns_attrs[] = {
264 &dev_attr_unit_add.attr, 263 &dev_attr_unit_add.attr,
265 &dev_attr_unit_remove.attr, 264 &dev_attr_unit_remove.attr,
266 &dev_attr_scsi_id.attr,
267 NULL 265 NULL
268}; 266};
269 267
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index e3b9692b9688..841f4e2cfe08 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -269,6 +269,8 @@ static struct pci_device_id ahci_pci_tbl[] = {
269 board_ahci }, /* ESB2 */ 269 board_ahci }, /* ESB2 */
270 { PCI_VENDOR_ID_INTEL, 0x2683, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 270 { PCI_VENDOR_ID_INTEL, 0x2683, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
271 board_ahci }, /* ESB2 */ 271 board_ahci }, /* ESB2 */
272 { PCI_VENDOR_ID_INTEL, 0x27c6, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
273 board_ahci }, /* ICH7-M DH */
272 { } /* terminate list */ 274 { } /* terminate list */
273}; 275};
274 276
@@ -584,12 +586,16 @@ static void ahci_intr_error(struct ata_port *ap, u32 irq_stat)
584 586
585static void ahci_eng_timeout(struct ata_port *ap) 587static void ahci_eng_timeout(struct ata_port *ap)
586{ 588{
587 void *mmio = ap->host_set->mmio_base; 589 struct ata_host_set *host_set = ap->host_set;
590 void *mmio = host_set->mmio_base;
588 void *port_mmio = ahci_port_base(mmio, ap->port_no); 591 void *port_mmio = ahci_port_base(mmio, ap->port_no);
589 struct ata_queued_cmd *qc; 592 struct ata_queued_cmd *qc;
593 unsigned long flags;
590 594
591 DPRINTK("ENTER\n"); 595 DPRINTK("ENTER\n");
592 596
597 spin_lock_irqsave(&host_set->lock, flags);
598
593 ahci_intr_error(ap, readl(port_mmio + PORT_IRQ_STAT)); 599 ahci_intr_error(ap, readl(port_mmio + PORT_IRQ_STAT));
594 600
595 qc = ata_qc_from_tag(ap, ap->active_tag); 601 qc = ata_qc_from_tag(ap, ap->active_tag);
@@ -607,6 +613,7 @@ static void ahci_eng_timeout(struct ata_port *ap)
607 ata_qc_complete(qc, ATA_ERR); 613 ata_qc_complete(qc, ATA_ERR);
608 } 614 }
609 615
616 spin_unlock_irqrestore(&host_set->lock, flags);
610} 617}
611 618
612static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) 619static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
@@ -696,9 +703,6 @@ static int ahci_qc_issue(struct ata_queued_cmd *qc)
696 struct ata_port *ap = qc->ap; 703 struct ata_port *ap = qc->ap;
697 void *port_mmio = (void *) ap->ioaddr.cmd_addr; 704 void *port_mmio = (void *) ap->ioaddr.cmd_addr;
698 705
699 writel(1, port_mmio + PORT_SCR_ACT);
700 readl(port_mmio + PORT_SCR_ACT); /* flush */
701
702 writel(1, port_mmio + PORT_CMD_ISSUE); 706 writel(1, port_mmio + PORT_CMD_ISSUE);
703 readl(port_mmio + PORT_CMD_ISSUE); /* flush */ 707 readl(port_mmio + PORT_CMD_ISSUE); /* flush */
704 708
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index d96ebf9d2228..03695616e59e 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -629,13 +629,13 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
629 port_info[1] = NULL; 629 port_info[1] = NULL;
630 630
631 if (port_info[0]->host_flags & PIIX_FLAG_AHCI) { 631 if (port_info[0]->host_flags & PIIX_FLAG_AHCI) {
632 u8 tmp; 632 u8 tmp;
633 pci_read_config_byte(pdev, PIIX_SCC, &tmp); 633 pci_read_config_byte(pdev, PIIX_SCC, &tmp);
634 if (tmp == PIIX_AHCI_DEVICE) { 634 if (tmp == PIIX_AHCI_DEVICE) {
635 int rc = piix_disable_ahci(pdev); 635 int rc = piix_disable_ahci(pdev);
636 if (rc) 636 if (rc)
637 return rc; 637 return rc;
638 } 638 }
639 } 639 }
640 640
641 if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) { 641 if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) {
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index f4e7dcb6492b..f15a07f9f471 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1304,12 +1304,12 @@ static inline u8 ata_dev_knobble(struct ata_port *ap)
1304/** 1304/**
1305 * ata_dev_config - Run device specific handlers and check for 1305 * ata_dev_config - Run device specific handlers and check for
1306 * SATA->PATA bridges 1306 * SATA->PATA bridges
1307 * @ap: Bus 1307 * @ap: Bus
1308 * @i: Device 1308 * @i: Device
1309 * 1309 *
1310 * LOCKING: 1310 * LOCKING:
1311 */ 1311 */
1312 1312
1313void ata_dev_config(struct ata_port *ap, unsigned int i) 1313void ata_dev_config(struct ata_port *ap, unsigned int i)
1314{ 1314{
1315 /* limit bridge transfers to udma5, 200 sectors */ 1315 /* limit bridge transfers to udma5, 200 sectors */
@@ -2377,6 +2377,27 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
2377} 2377}
2378 2378
2379/** 2379/**
2380 * ata_poll_qc_complete - turn irq back on and finish qc
2381 * @qc: Command to complete
2382 * @drv_stat: ATA status register content
2383 *
2384 * LOCKING:
2385 * None. (grabs host lock)
2386 */
2387
2388void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
2389{
2390 struct ata_port *ap = qc->ap;
2391 unsigned long flags;
2392
2393 spin_lock_irqsave(&ap->host_set->lock, flags);
2394 ap->flags &= ~ATA_FLAG_NOINTR;
2395 ata_irq_on(ap);
2396 ata_qc_complete(qc, drv_stat);
2397 spin_unlock_irqrestore(&ap->host_set->lock, flags);
2398}
2399
2400/**
2380 * ata_pio_poll - 2401 * ata_pio_poll -
2381 * @ap: 2402 * @ap:
2382 * 2403 *
@@ -2438,11 +2459,10 @@ static void ata_pio_complete (struct ata_port *ap)
2438 u8 drv_stat; 2459 u8 drv_stat;
2439 2460
2440 /* 2461 /*
2441 * This is purely hueristic. This is a fast path. 2462 * This is purely heuristic. This is a fast path. Sometimes when
2442 * Sometimes when we enter, BSY will be cleared in 2463 * we enter, BSY will be cleared in a chk-status or two. If not,
2443 * a chk-status or two. If not, the drive is probably seeking 2464 * the drive is probably seeking or something. Snooze for a couple
2444 * or something. Snooze for a couple msecs, then 2465 * msecs, then chk-status again. If still busy, fall back to
2445 * chk-status again. If still busy, fall back to
2446 * PIO_ST_POLL state. 2466 * PIO_ST_POLL state.
2447 */ 2467 */
2448 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); 2468 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10);
@@ -2467,9 +2487,7 @@ static void ata_pio_complete (struct ata_port *ap)
2467 2487
2468 ap->pio_task_state = PIO_ST_IDLE; 2488 ap->pio_task_state = PIO_ST_IDLE;
2469 2489
2470 ata_irq_on(ap); 2490 ata_poll_qc_complete(qc, drv_stat);
2471
2472 ata_qc_complete(qc, drv_stat);
2473} 2491}
2474 2492
2475 2493
@@ -2494,6 +2512,20 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
2494#endif /* __BIG_ENDIAN */ 2512#endif /* __BIG_ENDIAN */
2495} 2513}
2496 2514
2515/**
2516 * ata_mmio_data_xfer - Transfer data by MMIO
2517 * @ap: port to read/write
2518 * @buf: data buffer
2519 * @buflen: buffer length
2520 * @do_write: read/write
2521 *
2522 * Transfer data from/to the device data register by MMIO.
2523 *
2524 * LOCKING:
2525 * Inherited from caller.
2526 *
2527 */
2528
2497static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, 2529static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf,
2498 unsigned int buflen, int write_data) 2530 unsigned int buflen, int write_data)
2499{ 2531{
@@ -2502,6 +2534,7 @@ static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf,
2502 u16 *buf16 = (u16 *) buf; 2534 u16 *buf16 = (u16 *) buf;
2503 void __iomem *mmio = (void __iomem *)ap->ioaddr.data_addr; 2535 void __iomem *mmio = (void __iomem *)ap->ioaddr.data_addr;
2504 2536
2537 /* Transfer multiple of 2 bytes */
2505 if (write_data) { 2538 if (write_data) {
2506 for (i = 0; i < words; i++) 2539 for (i = 0; i < words; i++)
2507 writew(le16_to_cpu(buf16[i]), mmio); 2540 writew(le16_to_cpu(buf16[i]), mmio);
@@ -2509,19 +2542,76 @@ static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf,
2509 for (i = 0; i < words; i++) 2542 for (i = 0; i < words; i++)
2510 buf16[i] = cpu_to_le16(readw(mmio)); 2543 buf16[i] = cpu_to_le16(readw(mmio));
2511 } 2544 }
2545
2546 /* Transfer trailing 1 byte, if any. */
2547 if (unlikely(buflen & 0x01)) {
2548 u16 align_buf[1] = { 0 };
2549 unsigned char *trailing_buf = buf + buflen - 1;
2550
2551 if (write_data) {
2552 memcpy(align_buf, trailing_buf, 1);
2553 writew(le16_to_cpu(align_buf[0]), mmio);
2554 } else {
2555 align_buf[0] = cpu_to_le16(readw(mmio));
2556 memcpy(trailing_buf, align_buf, 1);
2557 }
2558 }
2512} 2559}
2513 2560
2561/**
2562 * ata_pio_data_xfer - Transfer data by PIO
2563 * @ap: port to read/write
2564 * @buf: data buffer
2565 * @buflen: buffer length
2566 * @do_write: read/write
2567 *
2568 * Transfer data from/to the device data register by PIO.
2569 *
2570 * LOCKING:
2571 * Inherited from caller.
2572 *
2573 */
2574
2514static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf, 2575static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf,
2515 unsigned int buflen, int write_data) 2576 unsigned int buflen, int write_data)
2516{ 2577{
2517 unsigned int dwords = buflen >> 1; 2578 unsigned int words = buflen >> 1;
2518 2579
2580 /* Transfer multiple of 2 bytes */
2519 if (write_data) 2581 if (write_data)
2520 outsw(ap->ioaddr.data_addr, buf, dwords); 2582 outsw(ap->ioaddr.data_addr, buf, words);
2521 else 2583 else
2522 insw(ap->ioaddr.data_addr, buf, dwords); 2584 insw(ap->ioaddr.data_addr, buf, words);
2585
2586 /* Transfer trailing 1 byte, if any. */
2587 if (unlikely(buflen & 0x01)) {
2588 u16 align_buf[1] = { 0 };
2589 unsigned char *trailing_buf = buf + buflen - 1;
2590
2591 if (write_data) {
2592 memcpy(align_buf, trailing_buf, 1);
2593 outw(le16_to_cpu(align_buf[0]), ap->ioaddr.data_addr);
2594 } else {
2595 align_buf[0] = cpu_to_le16(inw(ap->ioaddr.data_addr));
2596 memcpy(trailing_buf, align_buf, 1);
2597 }
2598 }
2523} 2599}
2524 2600
2601/**
2602 * ata_data_xfer - Transfer data from/to the data register.
2603 * @ap: port to read/write
2604 * @buf: data buffer
2605 * @buflen: buffer length
2606 * @do_write: read/write
2607 *
2608 * Transfer data from/to the device data register.
2609 *
2610 * LOCKING:
2611 * Inherited from caller.
2612 *
2613 */
2614
2525static void ata_data_xfer(struct ata_port *ap, unsigned char *buf, 2615static void ata_data_xfer(struct ata_port *ap, unsigned char *buf,
2526 unsigned int buflen, int do_write) 2616 unsigned int buflen, int do_write)
2527{ 2617{
@@ -2531,6 +2621,16 @@ static void ata_data_xfer(struct ata_port *ap, unsigned char *buf,
2531 ata_pio_data_xfer(ap, buf, buflen, do_write); 2621 ata_pio_data_xfer(ap, buf, buflen, do_write);
2532} 2622}
2533 2623
2624/**
2625 * ata_pio_sector - Transfer ATA_SECT_SIZE (512 bytes) of data.
2626 * @qc: Command on going
2627 *
2628 * Transfer ATA_SECT_SIZE of data from/to the ATA device.
2629 *
2630 * LOCKING:
2631 * Inherited from caller.
2632 */
2633
2534static void ata_pio_sector(struct ata_queued_cmd *qc) 2634static void ata_pio_sector(struct ata_queued_cmd *qc)
2535{ 2635{
2536 int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); 2636 int do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
@@ -2569,6 +2669,18 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
2569 kunmap(page); 2669 kunmap(page);
2570} 2670}
2571 2671
2672/**
2673 * __atapi_pio_bytes - Transfer data from/to the ATAPI device.
2674 * @qc: Command on going
2675 * @bytes: number of bytes
2676 *
2677 * Transfer Transfer data from/to the ATAPI device.
2678 *
2679 * LOCKING:
2680 * Inherited from caller.
2681 *
2682 */
2683
2572static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes) 2684static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
2573{ 2685{
2574 int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); 2686 int do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
@@ -2578,10 +2690,33 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
2578 unsigned char *buf; 2690 unsigned char *buf;
2579 unsigned int offset, count; 2691 unsigned int offset, count;
2580 2692
2581 if (qc->curbytes == qc->nbytes - bytes) 2693 if (qc->curbytes + bytes >= qc->nbytes)
2582 ap->pio_task_state = PIO_ST_LAST; 2694 ap->pio_task_state = PIO_ST_LAST;
2583 2695
2584next_sg: 2696next_sg:
2697 if (unlikely(qc->cursg >= qc->n_elem)) {
2698 /*
2699 * The end of qc->sg is reached and the device expects
2700 * more data to transfer. In order not to overrun qc->sg
2701 * and fulfill length specified in the byte count register,
2702 * - for read case, discard trailing data from the device
2703 * - for write case, padding zero data to the device
2704 */
2705 u16 pad_buf[1] = { 0 };
2706 unsigned int words = bytes >> 1;
2707 unsigned int i;
2708
2709 if (words) /* warning if bytes > 1 */
2710 printk(KERN_WARNING "ata%u: %u bytes trailing data\n",
2711 ap->id, bytes);
2712
2713 for (i = 0; i < words; i++)
2714 ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write);
2715
2716 ap->pio_task_state = PIO_ST_LAST;
2717 return;
2718 }
2719
2585 sg = &qc->sg[qc->cursg]; 2720 sg = &qc->sg[qc->cursg];
2586 2721
2587 page = sg->page; 2722 page = sg->page;
@@ -2615,11 +2750,21 @@ next_sg:
2615 2750
2616 kunmap(page); 2751 kunmap(page);
2617 2752
2618 if (bytes) { 2753 if (bytes)
2619 goto next_sg; 2754 goto next_sg;
2620 }
2621} 2755}
2622 2756
2757/**
2758 * atapi_pio_bytes - Transfer data from/to the ATAPI device.
2759 * @qc: Command on going
2760 *
2761 * Transfer Transfer data from/to the ATAPI device.
2762 *
2763 * LOCKING:
2764 * Inherited from caller.
2765 *
2766 */
2767
2623static void atapi_pio_bytes(struct ata_queued_cmd *qc) 2768static void atapi_pio_bytes(struct ata_queued_cmd *qc)
2624{ 2769{
2625 struct ata_port *ap = qc->ap; 2770 struct ata_port *ap = qc->ap;
@@ -2692,9 +2837,7 @@ static void ata_pio_block(struct ata_port *ap)
2692 if ((status & ATA_DRQ) == 0) { 2837 if ((status & ATA_DRQ) == 0) {
2693 ap->pio_task_state = PIO_ST_IDLE; 2838 ap->pio_task_state = PIO_ST_IDLE;
2694 2839
2695 ata_irq_on(ap); 2840 ata_poll_qc_complete(qc, status);
2696
2697 ata_qc_complete(qc, status);
2698 return; 2841 return;
2699 } 2842 }
2700 2843
@@ -2724,9 +2867,7 @@ static void ata_pio_error(struct ata_port *ap)
2724 2867
2725 ap->pio_task_state = PIO_ST_IDLE; 2868 ap->pio_task_state = PIO_ST_IDLE;
2726 2869
2727 ata_irq_on(ap); 2870 ata_poll_qc_complete(qc, drv_stat | ATA_ERR);
2728
2729 ata_qc_complete(qc, drv_stat | ATA_ERR);
2730} 2871}
2731 2872
2732static void ata_pio_task(void *_data) 2873static void ata_pio_task(void *_data)
@@ -2832,8 +2973,10 @@ static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
2832static void ata_qc_timeout(struct ata_queued_cmd *qc) 2973static void ata_qc_timeout(struct ata_queued_cmd *qc)
2833{ 2974{
2834 struct ata_port *ap = qc->ap; 2975 struct ata_port *ap = qc->ap;
2976 struct ata_host_set *host_set = ap->host_set;
2835 struct ata_device *dev = qc->dev; 2977 struct ata_device *dev = qc->dev;
2836 u8 host_stat = 0, drv_stat; 2978 u8 host_stat = 0, drv_stat;
2979 unsigned long flags;
2837 2980
2838 DPRINTK("ENTER\n"); 2981 DPRINTK("ENTER\n");
2839 2982
@@ -2844,7 +2987,9 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
2844 if (!(cmd->eh_eflags & SCSI_EH_CANCEL_CMD)) { 2987 if (!(cmd->eh_eflags & SCSI_EH_CANCEL_CMD)) {
2845 2988
2846 /* finish completing original command */ 2989 /* finish completing original command */
2990 spin_lock_irqsave(&host_set->lock, flags);
2847 __ata_qc_complete(qc); 2991 __ata_qc_complete(qc);
2992 spin_unlock_irqrestore(&host_set->lock, flags);
2848 2993
2849 atapi_request_sense(ap, dev, cmd); 2994 atapi_request_sense(ap, dev, cmd);
2850 2995
@@ -2855,6 +3000,8 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
2855 } 3000 }
2856 } 3001 }
2857 3002
3003 spin_lock_irqsave(&host_set->lock, flags);
3004
2858 /* hack alert! We cannot use the supplied completion 3005 /* hack alert! We cannot use the supplied completion
2859 * function from inside the ->eh_strategy_handler() thread. 3006 * function from inside the ->eh_strategy_handler() thread.
2860 * libata is the only user of ->eh_strategy_handler() in 3007 * libata is the only user of ->eh_strategy_handler() in
@@ -2870,7 +3017,7 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
2870 host_stat = ap->ops->bmdma_status(ap); 3017 host_stat = ap->ops->bmdma_status(ap);
2871 3018
2872 /* before we do anything else, clear DMA-Start bit */ 3019 /* before we do anything else, clear DMA-Start bit */
2873 ap->ops->bmdma_stop(ap); 3020 ap->ops->bmdma_stop(qc);
2874 3021
2875 /* fall through */ 3022 /* fall through */
2876 3023
@@ -2888,6 +3035,9 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
2888 ata_qc_complete(qc, drv_stat); 3035 ata_qc_complete(qc, drv_stat);
2889 break; 3036 break;
2890 } 3037 }
3038
3039 spin_unlock_irqrestore(&host_set->lock, flags);
3040
2891out: 3041out:
2892 DPRINTK("EXIT\n"); 3042 DPRINTK("EXIT\n");
2893} 3043}
@@ -3061,9 +3211,14 @@ void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
3061 if (likely(qc->flags & ATA_QCFLAG_DMAMAP)) 3211 if (likely(qc->flags & ATA_QCFLAG_DMAMAP))
3062 ata_sg_clean(qc); 3212 ata_sg_clean(qc);
3063 3213
3214 /* atapi: mark qc as inactive to prevent the interrupt handler
3215 * from completing the command twice later, before the error handler
3216 * is called. (when rc != 0 and atapi request sense is needed)
3217 */
3218 qc->flags &= ~ATA_QCFLAG_ACTIVE;
3219
3064 /* call completion callback */ 3220 /* call completion callback */
3065 rc = qc->complete_fn(qc, drv_stat); 3221 rc = qc->complete_fn(qc, drv_stat);
3066 qc->flags &= ~ATA_QCFLAG_ACTIVE;
3067 3222
3068 /* if callback indicates not to complete command (non-zero), 3223 /* if callback indicates not to complete command (non-zero),
3069 * return immediately 3224 * return immediately
@@ -3193,11 +3348,13 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)
3193 break; 3348 break;
3194 3349
3195 case ATA_PROT_ATAPI_NODATA: 3350 case ATA_PROT_ATAPI_NODATA:
3351 ap->flags |= ATA_FLAG_NOINTR;
3196 ata_tf_to_host_nolock(ap, &qc->tf); 3352 ata_tf_to_host_nolock(ap, &qc->tf);
3197 queue_work(ata_wq, &ap->packet_task); 3353 queue_work(ata_wq, &ap->packet_task);
3198 break; 3354 break;
3199 3355
3200 case ATA_PROT_ATAPI_DMA: 3356 case ATA_PROT_ATAPI_DMA:
3357 ap->flags |= ATA_FLAG_NOINTR;
3201 ap->ops->tf_load(ap, &qc->tf); /* load tf registers */ 3358 ap->ops->tf_load(ap, &qc->tf); /* load tf registers */
3202 ap->ops->bmdma_setup(qc); /* set up bmdma */ 3359 ap->ops->bmdma_setup(qc); /* set up bmdma */
3203 queue_work(ata_wq, &ap->packet_task); 3360 queue_work(ata_wq, &ap->packet_task);
@@ -3242,7 +3399,7 @@ static void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc)
3242} 3399}
3243 3400
3244/** 3401/**
3245 * ata_bmdma_start - Start a PCI IDE BMDMA transaction 3402 * ata_bmdma_start_mmio - Start a PCI IDE BMDMA transaction
3246 * @qc: Info associated with this ATA transaction. 3403 * @qc: Info associated with this ATA transaction.
3247 * 3404 *
3248 * LOCKING: 3405 * LOCKING:
@@ -3413,7 +3570,7 @@ u8 ata_bmdma_status(struct ata_port *ap)
3413 3570
3414/** 3571/**
3415 * ata_bmdma_stop - Stop PCI IDE BMDMA transfer 3572 * ata_bmdma_stop - Stop PCI IDE BMDMA transfer
3416 * @ap: Port associated with this ATA transaction. 3573 * @qc: Command we are ending DMA for
3417 * 3574 *
3418 * Clears the ATA_DMA_START flag in the dma control register 3575 * Clears the ATA_DMA_START flag in the dma control register
3419 * 3576 *
@@ -3423,8 +3580,9 @@ u8 ata_bmdma_status(struct ata_port *ap)
3423 * spin_lock_irqsave(host_set lock) 3580 * spin_lock_irqsave(host_set lock)
3424 */ 3581 */
3425 3582
3426void ata_bmdma_stop(struct ata_port *ap) 3583void ata_bmdma_stop(struct ata_queued_cmd *qc)
3427{ 3584{
3585 struct ata_port *ap = qc->ap;
3428 if (ap->flags & ATA_FLAG_MMIO) { 3586 if (ap->flags & ATA_FLAG_MMIO) {
3429 void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 3587 void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr;
3430 3588
@@ -3476,7 +3634,7 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
3476 goto idle_irq; 3634 goto idle_irq;
3477 3635
3478 /* before we do anything else, clear DMA-Start bit */ 3636 /* before we do anything else, clear DMA-Start bit */
3479 ap->ops->bmdma_stop(ap); 3637 ap->ops->bmdma_stop(qc);
3480 3638
3481 /* fall through */ 3639 /* fall through */
3482 3640
@@ -3551,7 +3709,8 @@ irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
3551 struct ata_port *ap; 3709 struct ata_port *ap;
3552 3710
3553 ap = host_set->ports[i]; 3711 ap = host_set->ports[i];
3554 if (ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) { 3712 if (ap &&
3713 !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) {
3555 struct ata_queued_cmd *qc; 3714 struct ata_queued_cmd *qc;
3556 3715
3557 qc = ata_qc_from_tag(ap, ap->active_tag); 3716 qc = ata_qc_from_tag(ap, ap->active_tag);
@@ -3603,19 +3762,27 @@ static void atapi_packet_task(void *_data)
3603 /* send SCSI cdb */ 3762 /* send SCSI cdb */
3604 DPRINTK("send cdb\n"); 3763 DPRINTK("send cdb\n");
3605 assert(ap->cdb_len >= 12); 3764 assert(ap->cdb_len >= 12);
3606 ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1);
3607 3765
3608 /* if we are DMA'ing, irq handler takes over from here */ 3766 if (qc->tf.protocol == ATA_PROT_ATAPI_DMA ||
3609 if (qc->tf.protocol == ATA_PROT_ATAPI_DMA) 3767 qc->tf.protocol == ATA_PROT_ATAPI_NODATA) {
3610 ap->ops->bmdma_start(qc); /* initiate bmdma */ 3768 unsigned long flags;
3611 3769
3612 /* non-data commands are also handled via irq */ 3770 /* Once we're done issuing command and kicking bmdma,
3613 else if (qc->tf.protocol == ATA_PROT_ATAPI_NODATA) { 3771 * irq handler takes over. To not lose irq, we need
3614 /* do nothing */ 3772 * to clear NOINTR flag before sending cdb, but
3615 } 3773 * interrupt handler shouldn't be invoked before we're
3774 * finished. Hence, the following locking.
3775 */
3776 spin_lock_irqsave(&ap->host_set->lock, flags);
3777 ap->flags &= ~ATA_FLAG_NOINTR;
3778 ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1);
3779 if (qc->tf.protocol == ATA_PROT_ATAPI_DMA)
3780 ap->ops->bmdma_start(qc); /* initiate bmdma */
3781 spin_unlock_irqrestore(&ap->host_set->lock, flags);
3782 } else {
3783 ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1);
3616 3784
3617 /* PIO commands are handled by polling */ 3785 /* PIO commands are handled by polling */
3618 else {
3619 ap->pio_task_state = PIO_ST; 3786 ap->pio_task_state = PIO_ST;
3620 queue_work(ata_wq, &ap->pio_task); 3787 queue_work(ata_wq, &ap->pio_task);
3621 } 3788 }
@@ -3623,7 +3790,7 @@ static void atapi_packet_task(void *_data)
3623 return; 3790 return;
3624 3791
3625err_out: 3792err_out:
3626 ata_qc_complete(qc, ATA_ERR); 3793 ata_poll_qc_complete(qc, ATA_ERR);
3627} 3794}
3628 3795
3629 3796
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 6a75ec2187fd..4074e7877ba3 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -392,6 +392,60 @@ int ata_scsi_error(struct Scsi_Host *host)
392} 392}
393 393
394/** 394/**
395 * ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command
396 * @qc: Storage for translated ATA taskfile
397 * @scsicmd: SCSI command to translate
398 *
399 * Sets up an ATA taskfile to issue STANDBY (to stop) or READ VERIFY
400 * (to start). Perhaps these commands should be preceded by
401 * CHECK POWER MODE to see what power mode the device is already in.
402 * [See SAT revision 5 at www.t10.org]
403 *
404 * LOCKING:
405 * spin_lock_irqsave(host_set lock)
406 *
407 * RETURNS:
408 * Zero on success, non-zero on error.
409 */
410
411static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc,
412 u8 *scsicmd)
413{
414 struct ata_taskfile *tf = &qc->tf;
415
416 tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
417 tf->protocol = ATA_PROT_NODATA;
418 if (scsicmd[1] & 0x1) {
419 ; /* ignore IMMED bit, violates sat-r05 */
420 }
421 if (scsicmd[4] & 0x2)
422 return 1; /* LOEJ bit set not supported */
423 if (((scsicmd[4] >> 4) & 0xf) != 0)
424 return 1; /* power conditions not supported */
425 if (scsicmd[4] & 0x1) {
426 tf->nsect = 1; /* 1 sector, lba=0 */
427 tf->lbah = 0x0;
428 tf->lbam = 0x0;
429 tf->lbal = 0x0;
430 tf->device |= ATA_LBA;
431 tf->command = ATA_CMD_VERIFY; /* READ VERIFY */
432 } else {
433 tf->nsect = 0; /* time period value (0 implies now) */
434 tf->command = ATA_CMD_STANDBY;
435 /* Consider: ATA STANDBY IMMEDIATE command */
436 }
437 /*
438 * Standby and Idle condition timers could be implemented but that
439 * would require libata to implement the Power condition mode page
440 * and allow the user to change it. Changing mode pages requires
441 * MODE SELECT to be implemented.
442 */
443
444 return 0;
445}
446
447
448/**
395 * ata_scsi_flush_xlat - Translate SCSI SYNCHRONIZE CACHE command 449 * ata_scsi_flush_xlat - Translate SCSI SYNCHRONIZE CACHE command
396 * @qc: Storage for translated ATA taskfile 450 * @qc: Storage for translated ATA taskfile
397 * @scsicmd: SCSI command to translate (ignored) 451 * @scsicmd: SCSI command to translate (ignored)
@@ -576,11 +630,19 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
576 tf->lbah = scsicmd[3]; 630 tf->lbah = scsicmd[3];
577 631
578 VPRINTK("ten-byte command\n"); 632 VPRINTK("ten-byte command\n");
633 if (qc->nsect == 0) /* we don't support length==0 cmds */
634 return 1;
579 return 0; 635 return 0;
580 } 636 }
581 637
582 if (scsicmd[0] == READ_6 || scsicmd[0] == WRITE_6) { 638 if (scsicmd[0] == READ_6 || scsicmd[0] == WRITE_6) {
583 qc->nsect = tf->nsect = scsicmd[4]; 639 qc->nsect = tf->nsect = scsicmd[4];
640 if (!qc->nsect) {
641 qc->nsect = 256;
642 if (lba48)
643 tf->hob_nsect = 1;
644 }
645
584 tf->lbal = scsicmd[3]; 646 tf->lbal = scsicmd[3];
585 tf->lbam = scsicmd[2]; 647 tf->lbam = scsicmd[2];
586 tf->lbah = scsicmd[1] & 0x1f; /* mask out reserved bits */ 648 tf->lbah = scsicmd[1] & 0x1f; /* mask out reserved bits */
@@ -620,6 +682,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
620 tf->lbah = scsicmd[7]; 682 tf->lbah = scsicmd[7];
621 683
622 VPRINTK("sixteen-byte command\n"); 684 VPRINTK("sixteen-byte command\n");
685 if (qc->nsect == 0) /* we don't support length==0 cmds */
686 return 1;
623 return 0; 687 return 0;
624 } 688 }
625 689
@@ -1435,6 +1499,8 @@ static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
1435 case VERIFY: 1499 case VERIFY:
1436 case VERIFY_16: 1500 case VERIFY_16:
1437 return ata_scsi_verify_xlat; 1501 return ata_scsi_verify_xlat;
1502 case START_STOP:
1503 return ata_scsi_start_stop_xlat;
1438 } 1504 }
1439 1505
1440 return NULL; 1506 return NULL;
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index 3e7f4843020f..620d21772bd6 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -72,7 +72,7 @@ extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf,
72extern void ata_scsi_badcmd(struct scsi_cmnd *cmd, 72extern void ata_scsi_badcmd(struct scsi_cmnd *cmd,
73 void (*done)(struct scsi_cmnd *), 73 void (*done)(struct scsi_cmnd *),
74 u8 asc, u8 ascq); 74 u8 asc, u8 ascq);
75extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args, 75extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
76 unsigned int (*actor) (struct ata_scsi_args *args, 76 unsigned int (*actor) (struct ata_scsi_args *args,
77 u8 *rbuf, unsigned int buflen)); 77 u8 *rbuf, unsigned int buflen));
78 78
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c
index b0403ccd8a25..41a3421b02b4 100644
--- a/drivers/scsi/sata_nv.c
+++ b/drivers/scsi/sata_nv.c
@@ -20,6 +20,12 @@
20 * If you do not delete the provisions above, a recipient may use your 20 * If you do not delete the provisions above, a recipient may use your
21 * version of this file under either the OSL or the GPL. 21 * version of this file under either the OSL or the GPL.
22 * 22 *
23 * 0.08
24 * - Added support for MCP51 and MCP55.
25 *
26 * 0.07
27 * - Added support for RAID class code.
28 *
23 * 0.06 29 * 0.06
24 * - Added generic SATA support by using a pci_device_id that filters on 30 * - Added generic SATA support by using a pci_device_id that filters on
25 * the IDE storage class code. 31 * the IDE storage class code.
@@ -48,7 +54,7 @@
48#include <linux/libata.h> 54#include <linux/libata.h>
49 55
50#define DRV_NAME "sata_nv" 56#define DRV_NAME "sata_nv"
51#define DRV_VERSION "0.6" 57#define DRV_VERSION "0.8"
52 58
53#define NV_PORTS 2 59#define NV_PORTS 2
54#define NV_PIO_MASK 0x1f 60#define NV_PIO_MASK 0x1f
@@ -116,7 +122,9 @@ enum nv_host_type
116 GENERIC, 122 GENERIC,
117 NFORCE2, 123 NFORCE2,
118 NFORCE3, 124 NFORCE3,
119 CK804 125 CK804,
126 MCP51,
127 MCP55
120}; 128};
121 129
122static struct pci_device_id nv_pci_tbl[] = { 130static struct pci_device_id nv_pci_tbl[] = {
@@ -134,9 +142,18 @@ static struct pci_device_id nv_pci_tbl[] = {
134 PCI_ANY_ID, PCI_ANY_ID, 0, 0, CK804 }, 142 PCI_ANY_ID, PCI_ANY_ID, 0, 0, CK804 },
135 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2, 143 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2,
136 PCI_ANY_ID, PCI_ANY_ID, 0, 0, CK804 }, 144 PCI_ANY_ID, PCI_ANY_ID, 0, 0, CK804 },
145 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA,
146 PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP51 },
147 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2,
148 PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP51 },
149 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA,
150 PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP55 },
137 { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, 151 { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
138 PCI_ANY_ID, PCI_ANY_ID, 152 PCI_ANY_ID, PCI_ANY_ID,
139 PCI_CLASS_STORAGE_IDE<<8, 0xffff00, GENERIC }, 153 PCI_CLASS_STORAGE_IDE<<8, 0xffff00, GENERIC },
154 { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
155 PCI_ANY_ID, PCI_ANY_ID,
156 PCI_CLASS_STORAGE_RAID<<8, 0xffff00, GENERIC },
140 { 0, } /* terminate list */ 157 { 0, } /* terminate list */
141}; 158};
142 159
@@ -274,7 +291,8 @@ static irqreturn_t nv_interrupt (int irq, void *dev_instance,
274 struct ata_port *ap; 291 struct ata_port *ap;
275 292
276 ap = host_set->ports[i]; 293 ap = host_set->ports[i];
277 if (ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) { 294 if (ap &&
295 !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) {
278 struct ata_queued_cmd *qc; 296 struct ata_queued_cmd *qc;
279 297
280 qc = ata_qc_from_tag(ap, ap->active_tag); 298 qc = ata_qc_from_tag(ap, ap->active_tag);
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 919fb314ad10..b8dc49fed769 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -181,6 +181,10 @@ static struct pci_device_id pdc_ata_pci_tbl[] = {
181 board_20319 }, 181 board_20319 },
182 { PCI_VENDOR_ID_PROMISE, 0x3319, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 182 { PCI_VENDOR_ID_PROMISE, 0x3319, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
183 board_20319 }, 183 board_20319 },
184 { PCI_VENDOR_ID_PROMISE, 0x3519, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
185 board_20319 },
186 { PCI_VENDOR_ID_PROMISE, 0x3d17, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
187 board_20319 },
184 { PCI_VENDOR_ID_PROMISE, 0x3d18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 188 { PCI_VENDOR_ID_PROMISE, 0x3d18, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
185 board_20319 }, 189 board_20319 },
186 190
@@ -321,11 +325,15 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)
321 325
322static void pdc_eng_timeout(struct ata_port *ap) 326static void pdc_eng_timeout(struct ata_port *ap)
323{ 327{
328 struct ata_host_set *host_set = ap->host_set;
324 u8 drv_stat; 329 u8 drv_stat;
325 struct ata_queued_cmd *qc; 330 struct ata_queued_cmd *qc;
331 unsigned long flags;
326 332
327 DPRINTK("ENTER\n"); 333 DPRINTK("ENTER\n");
328 334
335 spin_lock_irqsave(&host_set->lock, flags);
336
329 qc = ata_qc_from_tag(ap, ap->active_tag); 337 qc = ata_qc_from_tag(ap, ap->active_tag);
330 if (!qc) { 338 if (!qc) {
331 printk(KERN_ERR "ata%u: BUG: timeout without command\n", 339 printk(KERN_ERR "ata%u: BUG: timeout without command\n",
@@ -359,6 +367,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
359 } 367 }
360 368
361out: 369out:
370 spin_unlock_irqrestore(&host_set->lock, flags);
362 DPRINTK("EXIT\n"); 371 DPRINTK("EXIT\n");
363} 372}
364 373
@@ -441,7 +450,8 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
441 VPRINTK("port %u\n", i); 450 VPRINTK("port %u\n", i);
442 ap = host_set->ports[i]; 451 ap = host_set->ports[i];
443 tmp = mask & (1 << (i + 1)); 452 tmp = mask & (1 << (i + 1));
444 if (tmp && ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) { 453 if (tmp && ap &&
454 !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) {
445 struct ata_queued_cmd *qc; 455 struct ata_queued_cmd *qc;
446 456
447 qc = ata_qc_from_tag(ap, ap->active_tag); 457 qc = ata_qc_from_tag(ap, ap->active_tag);
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index 1383e8a28d72..93fd06fb4f15 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -117,7 +117,7 @@ static void qs_phy_reset(struct ata_port *ap);
117static void qs_qc_prep(struct ata_queued_cmd *qc); 117static void qs_qc_prep(struct ata_queued_cmd *qc);
118static int qs_qc_issue(struct ata_queued_cmd *qc); 118static int qs_qc_issue(struct ata_queued_cmd *qc);
119static int qs_check_atapi_dma(struct ata_queued_cmd *qc); 119static int qs_check_atapi_dma(struct ata_queued_cmd *qc);
120static void qs_bmdma_stop(struct ata_port *ap); 120static void qs_bmdma_stop(struct ata_queued_cmd *qc);
121static u8 qs_bmdma_status(struct ata_port *ap); 121static u8 qs_bmdma_status(struct ata_port *ap);
122static void qs_irq_clear(struct ata_port *ap); 122static void qs_irq_clear(struct ata_port *ap);
123static void qs_eng_timeout(struct ata_port *ap); 123static void qs_eng_timeout(struct ata_port *ap);
@@ -198,7 +198,7 @@ static int qs_check_atapi_dma(struct ata_queued_cmd *qc)
198 return 1; /* ATAPI DMA not supported */ 198 return 1; /* ATAPI DMA not supported */
199} 199}
200 200
201static void qs_bmdma_stop(struct ata_port *ap) 201static void qs_bmdma_stop(struct ata_queued_cmd *qc)
202{ 202{
203 /* nothing */ 203 /* nothing */
204} 204}
@@ -386,7 +386,8 @@ static inline unsigned int qs_intr_pkt(struct ata_host_set *host_set)
386 DPRINTK("SFF=%08x%08x: sCHAN=%u sHST=%d sDST=%02x\n", 386 DPRINTK("SFF=%08x%08x: sCHAN=%u sHST=%d sDST=%02x\n",
387 sff1, sff0, port_no, sHST, sDST); 387 sff1, sff0, port_no, sHST, sDST);
388 handled = 1; 388 handled = 1;
389 if (ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) { 389 if (ap && !(ap->flags &
390 (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) {
390 struct ata_queued_cmd *qc; 391 struct ata_queued_cmd *qc;
391 struct qs_port_priv *pp = ap->private_data; 392 struct qs_port_priv *pp = ap->private_data;
392 if (!pp || pp->state != qs_state_pkt) 393 if (!pp || pp->state != qs_state_pkt)
@@ -417,7 +418,8 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set)
417 for (port_no = 0; port_no < host_set->n_ports; ++port_no) { 418 for (port_no = 0; port_no < host_set->n_ports; ++port_no) {
418 struct ata_port *ap; 419 struct ata_port *ap;
419 ap = host_set->ports[port_no]; 420 ap = host_set->ports[port_no];
420 if (ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) { 421 if (ap &&
422 !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) {
421 struct ata_queued_cmd *qc; 423 struct ata_queued_cmd *qc;
422 struct qs_port_priv *pp = ap->private_data; 424 struct qs_port_priv *pp = ap->private_data;
423 if (!pp || pp->state != qs_state_mmio) 425 if (!pp || pp->state != qs_state_mmio)
@@ -431,7 +433,7 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set)
431 continue; 433 continue;
432 DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", 434 DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n",
433 ap->id, qc->tf.protocol, status); 435 ap->id, qc->tf.protocol, status);
434 436
435 /* complete taskfile transaction */ 437 /* complete taskfile transaction */
436 pp->state = qs_state_idle; 438 pp->state = qs_state_idle;
437 ata_qc_complete(qc, status); 439 ata_qc_complete(qc, status);
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index 49ed557a4b66..9d24d6c328b4 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -24,6 +24,11 @@
24 * If you do not delete the provisions above, a recipient may use your 24 * If you do not delete the provisions above, a recipient may use your
25 * version of this file under either the OSL or the GPL. 25 * version of this file under either the OSL or the GPL.
26 * 26 *
27 * Documentation for SiI 3112:
28 * http://gkernel.sourceforge.net/specs/sii/3112A_SiI-DS-0095-B2.pdf.bz2
29 *
30 * Other errata and documentation available under NDA.
31 *
27 */ 32 */
28 33
29#include <linux/kernel.h> 34#include <linux/kernel.h>
@@ -41,8 +46,11 @@
41#define DRV_VERSION "0.9" 46#define DRV_VERSION "0.9"
42 47
43enum { 48enum {
49 SIL_FLAG_MOD15WRITE = (1 << 30),
50
44 sil_3112 = 0, 51 sil_3112 = 0,
45 sil_3114 = 1, 52 sil_3112_m15w = 1,
53 sil_3114 = 2,
46 54
47 SIL_FIFO_R0 = 0x40, 55 SIL_FIFO_R0 = 0x40,
48 SIL_FIFO_W0 = 0x41, 56 SIL_FIFO_W0 = 0x41,
@@ -76,13 +84,13 @@ static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
76static void sil_post_set_mode (struct ata_port *ap); 84static void sil_post_set_mode (struct ata_port *ap);
77 85
78static struct pci_device_id sil_pci_tbl[] = { 86static struct pci_device_id sil_pci_tbl[] = {
79 { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, 87 { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
80 { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, 88 { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
81 { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, 89 { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 },
82 { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 }, 90 { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 },
83 { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, 91 { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
84 { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, 92 { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
85 { 0x1002, 0x437a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, 93 { 0x1002, 0x437a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
86 { } /* terminate list */ 94 { } /* terminate list */
87}; 95};
88 96
@@ -174,6 +182,16 @@ static struct ata_port_info sil_port_info[] = {
174 .mwdma_mask = 0x07, /* mwdma0-2 */ 182 .mwdma_mask = 0x07, /* mwdma0-2 */
175 .udma_mask = 0x3f, /* udma0-5 */ 183 .udma_mask = 0x3f, /* udma0-5 */
176 .port_ops = &sil_ops, 184 .port_ops = &sil_ops,
185 }, /* sil_3112_15w - keep it sync'd w/ sil_3112 */
186 {
187 .sht = &sil_sht,
188 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
189 ATA_FLAG_SRST | ATA_FLAG_MMIO |
190 SIL_FLAG_MOD15WRITE,
191 .pio_mask = 0x1f, /* pio0-4 */
192 .mwdma_mask = 0x07, /* mwdma0-2 */
193 .udma_mask = 0x3f, /* udma0-5 */
194 .port_ops = &sil_ops,
177 }, /* sil_3114 */ 195 }, /* sil_3114 */
178 { 196 {
179 .sht = &sil_sht, 197 .sht = &sil_sht,
@@ -323,15 +341,15 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
323 while ((len > 0) && (s[len - 1] == ' ')) 341 while ((len > 0) && (s[len - 1] == ' '))
324 len--; 342 len--;
325 343
326 for (n = 0; sil_blacklist[n].product; n++) 344 for (n = 0; sil_blacklist[n].product; n++)
327 if (!memcmp(sil_blacklist[n].product, s, 345 if (!memcmp(sil_blacklist[n].product, s,
328 strlen(sil_blacklist[n].product))) { 346 strlen(sil_blacklist[n].product))) {
329 quirks = sil_blacklist[n].quirk; 347 quirks = sil_blacklist[n].quirk;
330 break; 348 break;
331 } 349 }
332 350
333 /* limit requests to 15 sectors */ 351 /* limit requests to 15 sectors */
334 if (quirks & SIL_QUIRK_MOD15WRITE) { 352 if ((ap->flags & SIL_FLAG_MOD15WRITE) && (quirks & SIL_QUIRK_MOD15WRITE)) {
335 printk(KERN_INFO "ata%u(%u): applying Seagate errata fix\n", 353 printk(KERN_INFO "ata%u(%u): applying Seagate errata fix\n",
336 ap->id, dev->devno); 354 ap->id, dev->devno);
337 ap->host->max_sectors = 15; 355 ap->host->max_sectors = 15;
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
index e418b89c6b9d..b250ae0c7773 100644
--- a/drivers/scsi/sata_sis.c
+++ b/drivers/scsi/sata_sis.c
@@ -234,7 +234,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
234 pci_read_config_dword(pdev, SIS_GENCTL, &genctl); 234 pci_read_config_dword(pdev, SIS_GENCTL, &genctl);
235 if ((genctl & GENCTL_IOMAPPED_SCR) == 0) 235 if ((genctl & GENCTL_IOMAPPED_SCR) == 0)
236 probe_ent->host_flags |= SIS_FLAG_CFGSCR; 236 probe_ent->host_flags |= SIS_FLAG_CFGSCR;
237 237
238 /* if hardware thinks SCRs are in IO space, but there are 238 /* if hardware thinks SCRs are in IO space, but there are
239 * no IO resources assigned, change to PCI cfg space. 239 * no IO resources assigned, change to PCI cfg space.
240 */ 240 */
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index 858e07185dbd..6fd2ce1ffcd8 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -195,18 +195,18 @@ static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc)
195 /* start host DMA transaction */ 195 /* start host DMA transaction */
196 dmactl = readb(mmio + ATA_DMA_CMD); 196 dmactl = readb(mmio + ATA_DMA_CMD);
197 writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD); 197 writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD);
198 /* There is a race condition in certain SATA controllers that can 198 /* There is a race condition in certain SATA controllers that can
199 be seen when the r/w command is given to the controller before the 199 be seen when the r/w command is given to the controller before the
200 host DMA is started. On a Read command, the controller would initiate 200 host DMA is started. On a Read command, the controller would initiate
201 the command to the drive even before it sees the DMA start. When there 201 the command to the drive even before it sees the DMA start. When there
202 are very fast drives connected to the controller, or when the data request 202 are very fast drives connected to the controller, or when the data request
203 hits in the drive cache, there is the possibility that the drive returns a part 203 hits in the drive cache, there is the possibility that the drive returns a part
204 or all of the requested data to the controller before the DMA start is issued. 204 or all of the requested data to the controller before the DMA start is issued.
205 In this case, the controller would become confused as to what to do with the data. 205 In this case, the controller would become confused as to what to do with the data.
206 In the worst case when all the data is returned back to the controller, the 206 In the worst case when all the data is returned back to the controller, the
207 controller could hang. In other cases it could return partial data returning 207 controller could hang. In other cases it could return partial data returning
208 in data corruption. This problem has been seen in PPC systems and can also appear 208 in data corruption. This problem has been seen in PPC systems and can also appear
209 on an system with very fast disks, where the SATA controller is sitting behind a 209 on an system with very fast disks, where the SATA controller is sitting behind a
210 number of bridges, and hence there is significant latency between the r/w command 210 number of bridges, and hence there is significant latency between the r/w command
211 and the start command. */ 211 and the start command. */
212 /* issue r/w command if the access is to ATA*/ 212 /* issue r/w command if the access is to ATA*/
@@ -214,7 +214,7 @@ static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc)
214 ap->ops->exec_command(ap, &qc->tf); 214 ap->ops->exec_command(ap, &qc->tf);
215} 215}
216 216
217 217
218static u8 k2_stat_check_status(struct ata_port *ap) 218static u8 k2_stat_check_status(struct ata_port *ap)
219{ 219{
220 return readl((void *) ap->ioaddr.status_addr); 220 return readl((void *) ap->ioaddr.status_addr);
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index efd7d7a61135..a20d4285090a 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -94,7 +94,7 @@ enum {
94 PDC_DIMM1_CONTROL_OFFSET = 0x84, 94 PDC_DIMM1_CONTROL_OFFSET = 0x84,
95 PDC_SDRAM_CONTROL_OFFSET = 0x88, 95 PDC_SDRAM_CONTROL_OFFSET = 0x88,
96 PDC_I2C_WRITE = 0x00000000, 96 PDC_I2C_WRITE = 0x00000000,
97 PDC_I2C_READ = 0x00000040, 97 PDC_I2C_READ = 0x00000040,
98 PDC_I2C_START = 0x00000080, 98 PDC_I2C_START = 0x00000080,
99 PDC_I2C_MASK_INT = 0x00000020, 99 PDC_I2C_MASK_INT = 0x00000020,
100 PDC_I2C_COMPLETE = 0x00010000, 100 PDC_I2C_COMPLETE = 0x00010000,
@@ -105,16 +105,16 @@ enum {
105 PDC_DIMM_SPD_COLUMN_NUM = 4, 105 PDC_DIMM_SPD_COLUMN_NUM = 4,
106 PDC_DIMM_SPD_MODULE_ROW = 5, 106 PDC_DIMM_SPD_MODULE_ROW = 5,
107 PDC_DIMM_SPD_TYPE = 11, 107 PDC_DIMM_SPD_TYPE = 11,
108 PDC_DIMM_SPD_FRESH_RATE = 12, 108 PDC_DIMM_SPD_FRESH_RATE = 12,
109 PDC_DIMM_SPD_BANK_NUM = 17, 109 PDC_DIMM_SPD_BANK_NUM = 17,
110 PDC_DIMM_SPD_CAS_LATENCY = 18, 110 PDC_DIMM_SPD_CAS_LATENCY = 18,
111 PDC_DIMM_SPD_ATTRIBUTE = 21, 111 PDC_DIMM_SPD_ATTRIBUTE = 21,
112 PDC_DIMM_SPD_ROW_PRE_CHARGE = 27, 112 PDC_DIMM_SPD_ROW_PRE_CHARGE = 27,
113 PDC_DIMM_SPD_ROW_ACTIVE_DELAY = 28, 113 PDC_DIMM_SPD_ROW_ACTIVE_DELAY = 28,
114 PDC_DIMM_SPD_RAS_CAS_DELAY = 29, 114 PDC_DIMM_SPD_RAS_CAS_DELAY = 29,
115 PDC_DIMM_SPD_ACTIVE_PRECHARGE = 30, 115 PDC_DIMM_SPD_ACTIVE_PRECHARGE = 30,
116 PDC_DIMM_SPD_SYSTEM_FREQ = 126, 116 PDC_DIMM_SPD_SYSTEM_FREQ = 126,
117 PDC_CTL_STATUS = 0x08, 117 PDC_CTL_STATUS = 0x08,
118 PDC_DIMM_WINDOW_CTLR = 0x0C, 118 PDC_DIMM_WINDOW_CTLR = 0x0C,
119 PDC_TIME_CONTROL = 0x3C, 119 PDC_TIME_CONTROL = 0x3C,
120 PDC_TIME_PERIOD = 0x40, 120 PDC_TIME_PERIOD = 0x40,
@@ -157,15 +157,15 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
157static void pdc20621_host_stop(struct ata_host_set *host_set); 157static void pdc20621_host_stop(struct ata_host_set *host_set);
158static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe); 158static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe);
159static int pdc20621_detect_dimm(struct ata_probe_ent *pe); 159static int pdc20621_detect_dimm(struct ata_probe_ent *pe);
160static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, 160static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe,
161 u32 device, u32 subaddr, u32 *pdata); 161 u32 device, u32 subaddr, u32 *pdata);
162static int pdc20621_prog_dimm0(struct ata_probe_ent *pe); 162static int pdc20621_prog_dimm0(struct ata_probe_ent *pe);
163static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe); 163static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe);
164#ifdef ATA_VERBOSE_DEBUG 164#ifdef ATA_VERBOSE_DEBUG
165static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, 165static void pdc20621_get_from_dimm(struct ata_probe_ent *pe,
166 void *psource, u32 offset, u32 size); 166 void *psource, u32 offset, u32 size);
167#endif 167#endif
168static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, 168static void pdc20621_put_to_dimm(struct ata_probe_ent *pe,
169 void *psource, u32 offset, u32 size); 169 void *psource, u32 offset, u32 size);
170static void pdc20621_irq_clear(struct ata_port *ap); 170static void pdc20621_irq_clear(struct ata_port *ap);
171static int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc); 171static int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc);
@@ -825,7 +825,8 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_re
825 ap = host_set->ports[port_no]; 825 ap = host_set->ports[port_no];
826 tmp = mask & (1 << i); 826 tmp = mask & (1 << i);
827 VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp); 827 VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp);
828 if (tmp && ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) { 828 if (tmp && ap &&
829 !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) {
829 struct ata_queued_cmd *qc; 830 struct ata_queued_cmd *qc;
830 831
831 qc = ata_qc_from_tag(ap, ap->active_tag); 832 qc = ata_qc_from_tag(ap, ap->active_tag);
@@ -847,10 +848,14 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_re
847static void pdc_eng_timeout(struct ata_port *ap) 848static void pdc_eng_timeout(struct ata_port *ap)
848{ 849{
849 u8 drv_stat; 850 u8 drv_stat;
851 struct ata_host_set *host_set = ap->host_set;
850 struct ata_queued_cmd *qc; 852 struct ata_queued_cmd *qc;
853 unsigned long flags;
851 854
852 DPRINTK("ENTER\n"); 855 DPRINTK("ENTER\n");
853 856
857 spin_lock_irqsave(&host_set->lock, flags);
858
854 qc = ata_qc_from_tag(ap, ap->active_tag); 859 qc = ata_qc_from_tag(ap, ap->active_tag);
855 if (!qc) { 860 if (!qc) {
856 printk(KERN_ERR "ata%u: BUG: timeout without command\n", 861 printk(KERN_ERR "ata%u: BUG: timeout without command\n",
@@ -884,6 +889,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
884 } 889 }
885 890
886out: 891out:
892 spin_unlock_irqrestore(&host_set->lock, flags);
887 DPRINTK("EXIT\n"); 893 DPRINTK("EXIT\n");
888} 894}
889 895
@@ -922,7 +928,7 @@ static void pdc_sata_setup_port(struct ata_ioports *port, unsigned long base)
922 928
923 929
924#ifdef ATA_VERBOSE_DEBUG 930#ifdef ATA_VERBOSE_DEBUG
925static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource, 931static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource,
926 u32 offset, u32 size) 932 u32 offset, u32 size)
927{ 933{
928 u32 window_size; 934 u32 window_size;
@@ -936,9 +942,9 @@ static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource,
936 /* hard-code chip #0 */ 942 /* hard-code chip #0 */
937 mmio += PDC_CHIP0_OFS; 943 mmio += PDC_CHIP0_OFS;
938 944
939 page_mask = 0x00; 945 page_mask = 0x00;
940 window_size = 0x2000 * 4; /* 32K byte uchar size */ 946 window_size = 0x2000 * 4; /* 32K byte uchar size */
941 idx = (u16) (offset / window_size); 947 idx = (u16) (offset / window_size);
942 948
943 writel(0x01, mmio + PDC_GENERAL_CTLR); 949 writel(0x01, mmio + PDC_GENERAL_CTLR);
944 readl(mmio + PDC_GENERAL_CTLR); 950 readl(mmio + PDC_GENERAL_CTLR);
@@ -947,19 +953,19 @@ static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource,
947 953
948 offset -= (idx * window_size); 954 offset -= (idx * window_size);
949 idx++; 955 idx++;
950 dist = ((long) (window_size - (offset + size))) >= 0 ? size : 956 dist = ((long) (window_size - (offset + size))) >= 0 ? size :
951 (long) (window_size - offset); 957 (long) (window_size - offset);
952 memcpy_fromio((char *) psource, (char *) (dimm_mmio + offset / 4), 958 memcpy_fromio((char *) psource, (char *) (dimm_mmio + offset / 4),
953 dist); 959 dist);
954 960
955 psource += dist; 961 psource += dist;
956 size -= dist; 962 size -= dist;
957 for (; (long) size >= (long) window_size ;) { 963 for (; (long) size >= (long) window_size ;) {
958 writel(0x01, mmio + PDC_GENERAL_CTLR); 964 writel(0x01, mmio + PDC_GENERAL_CTLR);
959 readl(mmio + PDC_GENERAL_CTLR); 965 readl(mmio + PDC_GENERAL_CTLR);
960 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); 966 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
961 readl(mmio + PDC_DIMM_WINDOW_CTLR); 967 readl(mmio + PDC_DIMM_WINDOW_CTLR);
962 memcpy_fromio((char *) psource, (char *) (dimm_mmio), 968 memcpy_fromio((char *) psource, (char *) (dimm_mmio),
963 window_size / 4); 969 window_size / 4);
964 psource += window_size; 970 psource += window_size;
965 size -= window_size; 971 size -= window_size;
@@ -971,14 +977,14 @@ static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource,
971 readl(mmio + PDC_GENERAL_CTLR); 977 readl(mmio + PDC_GENERAL_CTLR);
972 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); 978 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
973 readl(mmio + PDC_DIMM_WINDOW_CTLR); 979 readl(mmio + PDC_DIMM_WINDOW_CTLR);
974 memcpy_fromio((char *) psource, (char *) (dimm_mmio), 980 memcpy_fromio((char *) psource, (char *) (dimm_mmio),
975 size / 4); 981 size / 4);
976 } 982 }
977} 983}
978#endif 984#endif
979 985
980 986
981static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource, 987static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
982 u32 offset, u32 size) 988 u32 offset, u32 size)
983{ 989{
984 u32 window_size; 990 u32 window_size;
@@ -989,16 +995,16 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
989 struct pdc_host_priv *hpriv = pe->private_data; 995 struct pdc_host_priv *hpriv = pe->private_data;
990 void *dimm_mmio = hpriv->dimm_mmio; 996 void *dimm_mmio = hpriv->dimm_mmio;
991 997
992 /* hard-code chip #0 */ 998 /* hard-code chip #0 */
993 mmio += PDC_CHIP0_OFS; 999 mmio += PDC_CHIP0_OFS;
994 1000
995 page_mask = 0x00; 1001 page_mask = 0x00;
996 window_size = 0x2000 * 4; /* 32K byte uchar size */ 1002 window_size = 0x2000 * 4; /* 32K byte uchar size */
997 idx = (u16) (offset / window_size); 1003 idx = (u16) (offset / window_size);
998 1004
999 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); 1005 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
1000 readl(mmio + PDC_DIMM_WINDOW_CTLR); 1006 readl(mmio + PDC_DIMM_WINDOW_CTLR);
1001 offset -= (idx * window_size); 1007 offset -= (idx * window_size);
1002 idx++; 1008 idx++;
1003 dist = ((long)(s32)(window_size - (offset + size))) >= 0 ? size : 1009 dist = ((long)(s32)(window_size - (offset + size))) >= 0 ? size :
1004 (long) (window_size - offset); 1010 (long) (window_size - offset);
@@ -1006,12 +1012,12 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
1006 writel(0x01, mmio + PDC_GENERAL_CTLR); 1012 writel(0x01, mmio + PDC_GENERAL_CTLR);
1007 readl(mmio + PDC_GENERAL_CTLR); 1013 readl(mmio + PDC_GENERAL_CTLR);
1008 1014
1009 psource += dist; 1015 psource += dist;
1010 size -= dist; 1016 size -= dist;
1011 for (; (long) size >= (long) window_size ;) { 1017 for (; (long) size >= (long) window_size ;) {
1012 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); 1018 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
1013 readl(mmio + PDC_DIMM_WINDOW_CTLR); 1019 readl(mmio + PDC_DIMM_WINDOW_CTLR);
1014 memcpy_toio((char *) (dimm_mmio), (char *) psource, 1020 memcpy_toio((char *) (dimm_mmio), (char *) psource,
1015 window_size / 4); 1021 window_size / 4);
1016 writel(0x01, mmio + PDC_GENERAL_CTLR); 1022 writel(0x01, mmio + PDC_GENERAL_CTLR);
1017 readl(mmio + PDC_GENERAL_CTLR); 1023 readl(mmio + PDC_GENERAL_CTLR);
@@ -1019,7 +1025,7 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
1019 size -= window_size; 1025 size -= window_size;
1020 idx ++; 1026 idx ++;
1021 } 1027 }
1022 1028
1023 if (size) { 1029 if (size) {
1024 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); 1030 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
1025 readl(mmio + PDC_DIMM_WINDOW_CTLR); 1031 readl(mmio + PDC_DIMM_WINDOW_CTLR);
@@ -1030,12 +1036,12 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
1030} 1036}
1031 1037
1032 1038
1033static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, u32 device, 1039static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, u32 device,
1034 u32 subaddr, u32 *pdata) 1040 u32 subaddr, u32 *pdata)
1035{ 1041{
1036 void *mmio = pe->mmio_base; 1042 void *mmio = pe->mmio_base;
1037 u32 i2creg = 0; 1043 u32 i2creg = 0;
1038 u32 status; 1044 u32 status;
1039 u32 count =0; 1045 u32 count =0;
1040 1046
1041 /* hard-code chip #0 */ 1047 /* hard-code chip #0 */
@@ -1049,7 +1055,7 @@ static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, u32 device,
1049 readl(mmio + PDC_I2C_ADDR_DATA_OFFSET); 1055 readl(mmio + PDC_I2C_ADDR_DATA_OFFSET);
1050 1056
1051 /* Write Control to perform read operation, mask int */ 1057 /* Write Control to perform read operation, mask int */
1052 writel(PDC_I2C_READ | PDC_I2C_START | PDC_I2C_MASK_INT, 1058 writel(PDC_I2C_READ | PDC_I2C_START | PDC_I2C_MASK_INT,
1053 mmio + PDC_I2C_CONTROL_OFFSET); 1059 mmio + PDC_I2C_CONTROL_OFFSET);
1054 1060
1055 for (count = 0; count <= 1000; count ++) { 1061 for (count = 0; count <= 1000; count ++) {
@@ -1062,26 +1068,26 @@ static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, u32 device,
1062 } 1068 }
1063 1069
1064 *pdata = (status >> 8) & 0x000000ff; 1070 *pdata = (status >> 8) & 0x000000ff;
1065 return 1; 1071 return 1;
1066} 1072}
1067 1073
1068 1074
1069static int pdc20621_detect_dimm(struct ata_probe_ent *pe) 1075static int pdc20621_detect_dimm(struct ata_probe_ent *pe)
1070{ 1076{
1071 u32 data=0 ; 1077 u32 data=0 ;
1072 if (pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 1078 if (pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS,
1073 PDC_DIMM_SPD_SYSTEM_FREQ, &data)) { 1079 PDC_DIMM_SPD_SYSTEM_FREQ, &data)) {
1074 if (data == 100) 1080 if (data == 100)
1075 return 100; 1081 return 100;
1076 } else 1082 } else
1077 return 0; 1083 return 0;
1078 1084
1079 if (pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 9, &data)) { 1085 if (pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 9, &data)) {
1080 if(data <= 0x75) 1086 if(data <= 0x75)
1081 return 133; 1087 return 133;
1082 } else 1088 } else
1083 return 0; 1089 return 0;
1084 1090
1085 return 0; 1091 return 0;
1086} 1092}
1087 1093
@@ -1091,15 +1097,15 @@ static int pdc20621_prog_dimm0(struct ata_probe_ent *pe)
1091 u32 spd0[50]; 1097 u32 spd0[50];
1092 u32 data = 0; 1098 u32 data = 0;
1093 int size, i; 1099 int size, i;
1094 u8 bdimmsize; 1100 u8 bdimmsize;
1095 void *mmio = pe->mmio_base; 1101 void *mmio = pe->mmio_base;
1096 static const struct { 1102 static const struct {
1097 unsigned int reg; 1103 unsigned int reg;
1098 unsigned int ofs; 1104 unsigned int ofs;
1099 } pdc_i2c_read_data [] = { 1105 } pdc_i2c_read_data [] = {
1100 { PDC_DIMM_SPD_TYPE, 11 }, 1106 { PDC_DIMM_SPD_TYPE, 11 },
1101 { PDC_DIMM_SPD_FRESH_RATE, 12 }, 1107 { PDC_DIMM_SPD_FRESH_RATE, 12 },
1102 { PDC_DIMM_SPD_COLUMN_NUM, 4 }, 1108 { PDC_DIMM_SPD_COLUMN_NUM, 4 },
1103 { PDC_DIMM_SPD_ATTRIBUTE, 21 }, 1109 { PDC_DIMM_SPD_ATTRIBUTE, 21 },
1104 { PDC_DIMM_SPD_ROW_NUM, 3 }, 1110 { PDC_DIMM_SPD_ROW_NUM, 3 },
1105 { PDC_DIMM_SPD_BANK_NUM, 17 }, 1111 { PDC_DIMM_SPD_BANK_NUM, 17 },
@@ -1108,7 +1114,7 @@ static int pdc20621_prog_dimm0(struct ata_probe_ent *pe)
1108 { PDC_DIMM_SPD_ROW_ACTIVE_DELAY, 28 }, 1114 { PDC_DIMM_SPD_ROW_ACTIVE_DELAY, 28 },
1109 { PDC_DIMM_SPD_RAS_CAS_DELAY, 29 }, 1115 { PDC_DIMM_SPD_RAS_CAS_DELAY, 29 },
1110 { PDC_DIMM_SPD_ACTIVE_PRECHARGE, 30 }, 1116 { PDC_DIMM_SPD_ACTIVE_PRECHARGE, 30 },
1111 { PDC_DIMM_SPD_CAS_LATENCY, 18 }, 1117 { PDC_DIMM_SPD_CAS_LATENCY, 18 },
1112 }; 1118 };
1113 1119
1114 /* hard-code chip #0 */ 1120 /* hard-code chip #0 */
@@ -1116,17 +1122,17 @@ static int pdc20621_prog_dimm0(struct ata_probe_ent *pe)
1116 1122
1117 for(i=0; i<ARRAY_SIZE(pdc_i2c_read_data); i++) 1123 for(i=0; i<ARRAY_SIZE(pdc_i2c_read_data); i++)
1118 pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 1124 pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS,
1119 pdc_i2c_read_data[i].reg, 1125 pdc_i2c_read_data[i].reg,
1120 &spd0[pdc_i2c_read_data[i].ofs]); 1126 &spd0[pdc_i2c_read_data[i].ofs]);
1121 1127
1122 data |= (spd0[4] - 8) | ((spd0[21] != 0) << 3) | ((spd0[3]-11) << 4); 1128 data |= (spd0[4] - 8) | ((spd0[21] != 0) << 3) | ((spd0[3]-11) << 4);
1123 data |= ((spd0[17] / 4) << 6) | ((spd0[5] / 2) << 7) | 1129 data |= ((spd0[17] / 4) << 6) | ((spd0[5] / 2) << 7) |
1124 ((((spd0[27] + 9) / 10) - 1) << 8) ; 1130 ((((spd0[27] + 9) / 10) - 1) << 8) ;
1125 data |= (((((spd0[29] > spd0[28]) 1131 data |= (((((spd0[29] > spd0[28])
1126 ? spd0[29] : spd0[28]) + 9) / 10) - 1) << 10; 1132 ? spd0[29] : spd0[28]) + 9) / 10) - 1) << 10;
1127 data |= ((spd0[30] - spd0[29] + 9) / 10 - 2) << 12; 1133 data |= ((spd0[30] - spd0[29] + 9) / 10 - 2) << 12;
1128 1134
1129 if (spd0[18] & 0x08) 1135 if (spd0[18] & 0x08)
1130 data |= ((0x03) << 14); 1136 data |= ((0x03) << 14);
1131 else if (spd0[18] & 0x04) 1137 else if (spd0[18] & 0x04)
1132 data |= ((0x02) << 14); 1138 data |= ((0x02) << 14);
@@ -1135,7 +1141,7 @@ static int pdc20621_prog_dimm0(struct ata_probe_ent *pe)
1135 else 1141 else
1136 data |= (0 << 14); 1142 data |= (0 << 14);
1137 1143
1138 /* 1144 /*
1139 Calculate the size of bDIMMSize (power of 2) and 1145 Calculate the size of bDIMMSize (power of 2) and
1140 merge the DIMM size by program start/end address. 1146 merge the DIMM size by program start/end address.
1141 */ 1147 */
@@ -1145,9 +1151,9 @@ static int pdc20621_prog_dimm0(struct ata_probe_ent *pe)
1145 data |= (((size / 16) - 1) << 16); 1151 data |= (((size / 16) - 1) << 16);
1146 data |= (0 << 23); 1152 data |= (0 << 23);
1147 data |= 8; 1153 data |= 8;
1148 writel(data, mmio + PDC_DIMM0_CONTROL_OFFSET); 1154 writel(data, mmio + PDC_DIMM0_CONTROL_OFFSET);
1149 readl(mmio + PDC_DIMM0_CONTROL_OFFSET); 1155 readl(mmio + PDC_DIMM0_CONTROL_OFFSET);
1150 return size; 1156 return size;
1151} 1157}
1152 1158
1153 1159
@@ -1167,12 +1173,12 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe)
1167 Refresh Enable (bit 17) 1173 Refresh Enable (bit 17)
1168 */ 1174 */
1169 1175
1170 data = 0x022259F1; 1176 data = 0x022259F1;
1171 writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET); 1177 writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET);
1172 readl(mmio + PDC_SDRAM_CONTROL_OFFSET); 1178 readl(mmio + PDC_SDRAM_CONTROL_OFFSET);
1173 1179
1174 /* Turn on for ECC */ 1180 /* Turn on for ECC */
1175 pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 1181 pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS,
1176 PDC_DIMM_SPD_TYPE, &spd0); 1182 PDC_DIMM_SPD_TYPE, &spd0);
1177 if (spd0 == 0x02) { 1183 if (spd0 == 0x02) {
1178 data |= (0x01 << 16); 1184 data |= (0x01 << 16);
@@ -1186,22 +1192,22 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe)
1186 data |= (1<<19); 1192 data |= (1<<19);
1187 writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET); 1193 writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET);
1188 1194
1189 error = 1; 1195 error = 1;
1190 for (i = 1; i <= 10; i++) { /* polling ~5 secs */ 1196 for (i = 1; i <= 10; i++) { /* polling ~5 secs */
1191 data = readl(mmio + PDC_SDRAM_CONTROL_OFFSET); 1197 data = readl(mmio + PDC_SDRAM_CONTROL_OFFSET);
1192 if (!(data & (1<<19))) { 1198 if (!(data & (1<<19))) {
1193 error = 0; 1199 error = 0;
1194 break; 1200 break;
1195 } 1201 }
1196 msleep(i*100); 1202 msleep(i*100);
1197 } 1203 }
1198 return error; 1204 return error;
1199} 1205}
1200 1206
1201 1207
1202static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe) 1208static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
1203{ 1209{
1204 int speed, size, length; 1210 int speed, size, length;
1205 u32 addr,spd0,pci_status; 1211 u32 addr,spd0,pci_status;
1206 u32 tmp=0; 1212 u32 tmp=0;
1207 u32 time_period=0; 1213 u32 time_period=0;
@@ -1228,7 +1234,7 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
1228 /* Wait 3 seconds */ 1234 /* Wait 3 seconds */
1229 msleep(3000); 1235 msleep(3000);
1230 1236
1231 /* 1237 /*
1232 When timer is enabled, counter is decreased every internal 1238 When timer is enabled, counter is decreased every internal
1233 clock cycle. 1239 clock cycle.
1234 */ 1240 */
@@ -1236,24 +1242,24 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
1236 tcount = readl(mmio + PDC_TIME_COUNTER); 1242 tcount = readl(mmio + PDC_TIME_COUNTER);
1237 VPRINTK("Time Counter Register (0x44): 0x%x\n", tcount); 1243 VPRINTK("Time Counter Register (0x44): 0x%x\n", tcount);
1238 1244
1239 /* 1245 /*
1240 If SX4 is on PCI-X bus, after 3 seconds, the timer counter 1246 If SX4 is on PCI-X bus, after 3 seconds, the timer counter
1241 register should be >= (0xffffffff - 3x10^8). 1247 register should be >= (0xffffffff - 3x10^8).
1242 */ 1248 */
1243 if(tcount >= PCI_X_TCOUNT) { 1249 if(tcount >= PCI_X_TCOUNT) {
1244 ticks = (time_period - tcount); 1250 ticks = (time_period - tcount);
1245 VPRINTK("Num counters 0x%x (%d)\n", ticks, ticks); 1251 VPRINTK("Num counters 0x%x (%d)\n", ticks, ticks);
1246 1252
1247 clock = (ticks / 300000); 1253 clock = (ticks / 300000);
1248 VPRINTK("10 * Internal clk = 0x%x (%d)\n", clock, clock); 1254 VPRINTK("10 * Internal clk = 0x%x (%d)\n", clock, clock);
1249 1255
1250 clock = (clock * 33); 1256 clock = (clock * 33);
1251 VPRINTK("10 * Internal clk * 33 = 0x%x (%d)\n", clock, clock); 1257 VPRINTK("10 * Internal clk * 33 = 0x%x (%d)\n", clock, clock);
1252 1258
1253 /* PLL F Param (bit 22:16) */ 1259 /* PLL F Param (bit 22:16) */
1254 fparam = (1400000 / clock) - 2; 1260 fparam = (1400000 / clock) - 2;
1255 VPRINTK("PLL F Param: 0x%x (%d)\n", fparam, fparam); 1261 VPRINTK("PLL F Param: 0x%x (%d)\n", fparam, fparam);
1256 1262
1257 /* OD param = 0x2 (bit 31:30), R param = 0x5 (bit 29:25) */ 1263 /* OD param = 0x2 (bit 31:30), R param = 0x5 (bit 29:25) */
1258 pci_status = (0x8a001824 | (fparam << 16)); 1264 pci_status = (0x8a001824 | (fparam << 16));
1259 } else 1265 } else
@@ -1264,21 +1270,21 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
1264 writel(pci_status, mmio + PDC_CTL_STATUS); 1270 writel(pci_status, mmio + PDC_CTL_STATUS);
1265 readl(mmio + PDC_CTL_STATUS); 1271 readl(mmio + PDC_CTL_STATUS);
1266 1272
1267 /* 1273 /*
1268 Read SPD of DIMM by I2C interface, 1274 Read SPD of DIMM by I2C interface,
1269 and program the DIMM Module Controller. 1275 and program the DIMM Module Controller.
1270 */ 1276 */
1271 if (!(speed = pdc20621_detect_dimm(pe))) { 1277 if (!(speed = pdc20621_detect_dimm(pe))) {
1272 printk(KERN_ERR "Detect Local DIMM Fail\n"); 1278 printk(KERN_ERR "Detect Local DIMM Fail\n");
1273 return 1; /* DIMM error */ 1279 return 1; /* DIMM error */
1274 } 1280 }
1275 VPRINTK("Local DIMM Speed = %d\n", speed); 1281 VPRINTK("Local DIMM Speed = %d\n", speed);
1276 1282
1277 /* Programming DIMM0 Module Control Register (index_CID0:80h) */ 1283 /* Programming DIMM0 Module Control Register (index_CID0:80h) */
1278 size = pdc20621_prog_dimm0(pe); 1284 size = pdc20621_prog_dimm0(pe);
1279 VPRINTK("Local DIMM Size = %dMB\n",size); 1285 VPRINTK("Local DIMM Size = %dMB\n",size);
1280 1286
1281 /* Programming DIMM Module Global Control Register (index_CID0:88h) */ 1287 /* Programming DIMM Module Global Control Register (index_CID0:88h) */
1282 if (pdc20621_prog_dimm_global(pe)) { 1288 if (pdc20621_prog_dimm_global(pe)) {
1283 printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n"); 1289 printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n");
1284 return 1; 1290 return 1;
@@ -1297,30 +1303,30 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
1297 1303
1298 pdc20621_put_to_dimm(pe, (void *) test_parttern1, 0x10040, 40); 1304 pdc20621_put_to_dimm(pe, (void *) test_parttern1, 0x10040, 40);
1299 pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x40, 40); 1305 pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x40, 40);
1300 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 1306 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
1301 test_parttern2[1], &(test_parttern2[2])); 1307 test_parttern2[1], &(test_parttern2[2]));
1302 pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x10040, 1308 pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x10040,
1303 40); 1309 40);
1304 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 1310 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
1305 test_parttern2[1], &(test_parttern2[2])); 1311 test_parttern2[1], &(test_parttern2[2]));
1306 1312
1307 pdc20621_put_to_dimm(pe, (void *) test_parttern1, 0x40, 40); 1313 pdc20621_put_to_dimm(pe, (void *) test_parttern1, 0x40, 40);
1308 pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x40, 40); 1314 pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x40, 40);
1309 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 1315 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
1310 test_parttern2[1], &(test_parttern2[2])); 1316 test_parttern2[1], &(test_parttern2[2]));
1311 } 1317 }
1312#endif 1318#endif
1313 1319
1314 /* ECC initiliazation. */ 1320 /* ECC initiliazation. */
1315 1321
1316 pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 1322 pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS,
1317 PDC_DIMM_SPD_TYPE, &spd0); 1323 PDC_DIMM_SPD_TYPE, &spd0);
1318 if (spd0 == 0x02) { 1324 if (spd0 == 0x02) {
1319 VPRINTK("Start ECC initialization\n"); 1325 VPRINTK("Start ECC initialization\n");
1320 addr = 0; 1326 addr = 0;
1321 length = size * 1024 * 1024; 1327 length = size * 1024 * 1024;
1322 while (addr < length) { 1328 while (addr < length) {
1323 pdc20621_put_to_dimm(pe, (void *) &tmp, addr, 1329 pdc20621_put_to_dimm(pe, (void *) &tmp, addr,
1324 sizeof(u32)); 1330 sizeof(u32));
1325 addr += sizeof(u32); 1331 addr += sizeof(u32);
1326 } 1332 }
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
index a71fb54eebd3..eb202a73bc0e 100644
--- a/drivers/scsi/sata_uli.c
+++ b/drivers/scsi/sata_uli.c
@@ -214,7 +214,7 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
214 rc = -ENOMEM; 214 rc = -ENOMEM;
215 goto err_out_regions; 215 goto err_out_regions;
216 } 216 }
217 217
218 switch (board_idx) { 218 switch (board_idx) {
219 case uli_5287: 219 case uli_5287:
220 probe_ent->port[0].scr_addr = ULI5287_BASE; 220 probe_ent->port[0].scr_addr = ULI5287_BASE;
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index f43183c19a12..feff10980487 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -347,7 +347,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
347 probe_ent = vt6420_init_probe_ent(pdev); 347 probe_ent = vt6420_init_probe_ent(pdev);
348 else 348 else
349 probe_ent = vt6421_init_probe_ent(pdev); 349 probe_ent = vt6421_init_probe_ent(pdev);
350 350
351 if (!probe_ent) { 351 if (!probe_ent) {
352 printk(KERN_ERR DRV_NAME "(%s): out of memory\n", 352 printk(KERN_ERR DRV_NAME "(%s): out of memory\n",
353 pci_name(pdev)); 353 pci_name(pdev));
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index c5e09dc6f3de..6f2562171be0 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -173,7 +173,8 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance,
173 struct ata_port *ap; 173 struct ata_port *ap;
174 174
175 ap = host_set->ports[i]; 175 ap = host_set->ports[i];
176 if (ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) { 176 if (ap && !(ap->flags &
177 (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) {
177 struct ata_queued_cmd *qc; 178 struct ata_queued_cmd *qc;
178 179
179 qc = ata_qc_from_tag(ap, ap->active_tag); 180 qc = ata_qc_from_tag(ap, ap->active_tag);
@@ -342,7 +343,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
342 343
343 pci_set_master(pdev); 344 pci_set_master(pdev);
344 345
345 /* 346 /*
346 * Config offset 0x98 is "Extended Control and Status Register 0" 347 * Config offset 0x98 is "Extended Control and Status Register 0"
347 * Default value is (1 << 28). All bits except bit 28 are reserved in 348 * Default value is (1 << 28). All bits except bit 28 are reserved in
348 * DPA mode. If bit 28 is set, LED 0 reflects all ports' activity. 349 * DPA mode. If bit 28 is set, LED 0 reflects all ports' activity.
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 51292f269ce5..e822ca0e97cf 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2971,23 +2971,22 @@ static void * dev_seq_start(struct seq_file *s, loff_t *pos)
2971{ 2971{
2972 struct sg_proc_deviter * it = kmalloc(sizeof(*it), GFP_KERNEL); 2972 struct sg_proc_deviter * it = kmalloc(sizeof(*it), GFP_KERNEL);
2973 2973
2974 s->private = it;
2974 if (! it) 2975 if (! it)
2975 return NULL; 2976 return NULL;
2977
2976 if (NULL == sg_dev_arr) 2978 if (NULL == sg_dev_arr)
2977 goto err1; 2979 return NULL;
2978 it->index = *pos; 2980 it->index = *pos;
2979 it->max = sg_last_dev(); 2981 it->max = sg_last_dev();
2980 if (it->index >= it->max) 2982 if (it->index >= it->max)
2981 goto err1; 2983 return NULL;
2982 return it; 2984 return it;
2983err1:
2984 kfree(it);
2985 return NULL;
2986} 2985}
2987 2986
2988static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos) 2987static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos)
2989{ 2988{
2990 struct sg_proc_deviter * it = (struct sg_proc_deviter *) v; 2989 struct sg_proc_deviter * it = s->private;
2991 2990
2992 *pos = ++it->index; 2991 *pos = ++it->index;
2993 return (it->index < it->max) ? it : NULL; 2992 return (it->index < it->max) ? it : NULL;
@@ -2995,7 +2994,7 @@ static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos)
2995 2994
2996static void dev_seq_stop(struct seq_file *s, void *v) 2995static void dev_seq_stop(struct seq_file *s, void *v)
2997{ 2996{
2998 kfree (v); 2997 kfree(s->private);
2999} 2998}
3000 2999
3001static int sg_proc_open_dev(struct inode *inode, struct file *file) 3000static int sg_proc_open_dev(struct inode *inode, struct file *file)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 30ab70ce5547..3497125189df 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -643,7 +643,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
643 netfid, length, 643 netfid, length,
644 pfLock->fl_start, numUnlock, numLock, lockType, 644 pfLock->fl_start, numUnlock, numLock, lockType,
645 wait_flag); 645 wait_flag);
646 if (rc == 0 && (pfLock->fl_flags & FL_POSIX)) 646 if (pfLock->fl_flags & FL_POSIX)
647 posix_lock_file_wait(file, pfLock); 647 posix_lock_file_wait(file, pfLock);
648 FreeXid(xid); 648 FreeXid(xid);
649 return rc; 649 return rc;
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c
index ff150fedb981..52930915bad8 100644
--- a/fs/hppfs/hppfs_kern.c
+++ b/fs/hppfs/hppfs_kern.c
@@ -38,7 +38,7 @@ struct hppfs_inode_info {
38 38
39static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode) 39static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode)
40{ 40{
41 return(list_entry(inode, struct hppfs_inode_info, vfs_inode)); 41 return container_of(inode, struct hppfs_inode_info, vfs_inode);
42} 42}
43 43
44#define HPPFS_SUPER_MAGIC 0xb00000ee 44#define HPPFS_SUPER_MAGIC 0xb00000ee
@@ -662,42 +662,36 @@ static int hppfs_readlink(struct dentry *dentry, char *buffer, int buflen)
662{ 662{
663 struct file *proc_file; 663 struct file *proc_file;
664 struct dentry *proc_dentry; 664 struct dentry *proc_dentry;
665 int (*readlink)(struct dentry *, char *, int); 665 int ret;
666 int err, n;
667 666
668 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 667 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
669 proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY); 668 proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
670 err = PTR_ERR(proc_dentry); 669 if (IS_ERR(proc_file))
671 if(IS_ERR(proc_dentry)) 670 return PTR_ERR(proc_file);
672 return(err);
673 671
674 readlink = proc_dentry->d_inode->i_op->readlink; 672 ret = proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer, buflen);
675 n = (*readlink)(proc_dentry, buffer, buflen);
676 673
677 fput(proc_file); 674 fput(proc_file);
678 675
679 return(n); 676 return ret;
680} 677}
681 678
682static int hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) 679static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
683{ 680{
684 struct file *proc_file; 681 struct file *proc_file;
685 struct dentry *proc_dentry; 682 struct dentry *proc_dentry;
686 int (*follow_link)(struct dentry *, struct nameidata *); 683 void *ret;
687 int err, n;
688 684
689 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 685 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
690 proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY); 686 proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
691 err = PTR_ERR(proc_dentry); 687 if (IS_ERR(proc_file))
692 if(IS_ERR(proc_dentry)) 688 return proc_file;
693 return(err);
694 689
695 follow_link = proc_dentry->d_inode->i_op->follow_link; 690 ret = proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd);
696 n = (*follow_link)(proc_dentry, nd);
697 691
698 fput(proc_file); 692 fput(proc_file);
699 693
700 return(n); 694 return ret;
701} 695}
702 696
703static struct inode_operations hppfs_dir_iops = { 697static struct inode_operations hppfs_dir_iops = {
diff --git a/fs/inotify.c b/fs/inotify.c
index 868901b1e779..2e4e2a57708c 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -353,7 +353,7 @@ static int inotify_dev_get_wd(struct inotify_device *dev,
353 do { 353 do {
354 if (unlikely(!idr_pre_get(&dev->idr, GFP_KERNEL))) 354 if (unlikely(!idr_pre_get(&dev->idr, GFP_KERNEL)))
355 return -ENOSPC; 355 return -ENOSPC;
356 ret = idr_get_new_above(&dev->idr, watch, dev->last_wd, &watch->wd); 356 ret = idr_get_new_above(&dev->idr, watch, dev->last_wd+1, &watch->wd);
357 } while (ret == -EAGAIN); 357 } while (ret == -EAGAIN);
358 358
359 return ret; 359 return ret;
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index d727dc960634..970a33f03299 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -228,6 +228,10 @@ void sysfs_hash_and_remove(struct dentry * dir, const char * name)
228 struct sysfs_dirent * sd; 228 struct sysfs_dirent * sd;
229 struct sysfs_dirent * parent_sd = dir->d_fsdata; 229 struct sysfs_dirent * parent_sd = dir->d_fsdata;
230 230
231 if (dir->d_inode == NULL)
232 /* no inode means this hasn't been made visible yet */
233 return;
234
231 down(&dir->d_inode->i_sem); 235 down(&dir->d_inode->i_sem);
232 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { 236 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
233 if (!sd->s_element) 237 if (!sd->s_element)
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index 99a516709210..206313e2a817 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -138,13 +138,13 @@ extern unsigned long m68k_memoffset;
138#define __pa(vaddr) ((unsigned long)(vaddr)+m68k_memoffset) 138#define __pa(vaddr) ((unsigned long)(vaddr)+m68k_memoffset)
139#define __va(paddr) ((void *)((unsigned long)(paddr)-m68k_memoffset)) 139#define __va(paddr) ((void *)((unsigned long)(paddr)-m68k_memoffset))
140#else 140#else
141#define __pa(vaddr) virt_to_phys((void *)vaddr) 141#define __pa(vaddr) virt_to_phys((void *)(vaddr))
142#define __va(paddr) phys_to_virt((unsigned long)paddr) 142#define __va(paddr) phys_to_virt((unsigned long)(paddr))
143#endif 143#endif
144 144
145#else /* !CONFIG_SUN3 */ 145#else /* !CONFIG_SUN3 */
146/* This #define is a horrible hack to suppress lots of warnings. --m */ 146/* This #define is a horrible hack to suppress lots of warnings. --m */
147#define __pa(x) ___pa((unsigned long)x) 147#define __pa(x) ___pa((unsigned long)(x))
148static inline unsigned long ___pa(unsigned long x) 148static inline unsigned long ___pa(unsigned long x)
149{ 149{
150 if(x == 0) 150 if(x == 0)
diff --git a/include/asm-ppc64/bug.h b/include/asm-ppc64/bug.h
index 169868fa307d..160178278861 100644
--- a/include/asm-ppc64/bug.h
+++ b/include/asm-ppc64/bug.h
@@ -43,8 +43,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
43 ".section __bug_table,\"a\"\n\t" \ 43 ".section __bug_table,\"a\"\n\t" \
44 " .llong 1b,%1,%2,%3\n" \ 44 " .llong 1b,%1,%2,%3\n" \
45 ".previous" \ 45 ".previous" \
46 : : "r" (x), "i" (__LINE__), "i" (__FILE__), \ 46 : : "r" ((long long)(x)), "i" (__LINE__), \
47 "i" (__FUNCTION__)); \ 47 "i" (__FILE__), "i" (__FUNCTION__)); \
48} while (0) 48} while (0)
49 49
50#define WARN_ON(x) do { \ 50#define WARN_ON(x) do { \
@@ -53,7 +53,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
53 ".section __bug_table,\"a\"\n\t" \ 53 ".section __bug_table,\"a\"\n\t" \
54 " .llong 1b,%1,%2,%3\n" \ 54 " .llong 1b,%1,%2,%3\n" \
55 ".previous" \ 55 ".previous" \
56 : : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \ 56 : : "r" ((long long)(x)), \
57 "i" (__LINE__ + BUG_WARNING_TRAP), \
57 "i" (__FILE__), "i" (__FUNCTION__)); \ 58 "i" (__FILE__), "i" (__FUNCTION__)); \
58} while (0) 59} while (0)
59 60
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h
index 8e94edf0b984..e682edc24a68 100644
--- a/include/asm-x86_64/e820.h
+++ b/include/asm-x86_64/e820.h
@@ -51,6 +51,8 @@ extern int e820_mapped(unsigned long start, unsigned long end, unsigned type);
51 51
52extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end); 52extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end);
53extern void e820_setup_gap(void); 53extern void e820_setup_gap(void);
54extern unsigned long e820_hole_size(unsigned long start_pfn,
55 unsigned long end_pfn);
54 56
55extern void __init parse_memopt(char *p, char **end); 57extern void __init parse_memopt(char *p, char **end);
56 58
diff --git a/include/linux/ata.h b/include/linux/ata.h
index ca5fcadf9981..9d25e9886d60 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -108,6 +108,8 @@ enum {
108 108
109 /* ATA device commands */ 109 /* ATA device commands */
110 ATA_CMD_CHK_POWER = 0xE5, /* check power mode */ 110 ATA_CMD_CHK_POWER = 0xE5, /* check power mode */
111 ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */
112 ATA_CMD_IDLE = 0xE3, /* place in idle power mode */
111 ATA_CMD_EDD = 0x90, /* execute device diagnostic */ 113 ATA_CMD_EDD = 0x90, /* execute device diagnostic */
112 ATA_CMD_FLUSH = 0xE7, 114 ATA_CMD_FLUSH = 0xE7,
113 ATA_CMD_FLUSH_EXT = 0xEA, 115 ATA_CMD_FLUSH_EXT = 0xEA,
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6cd9ba63563b..7c09540c52bc 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -113,6 +113,8 @@ enum {
113 ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ 113 ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */
114 ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */ 114 ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */
115 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ 115 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */
116 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once
117 * proper HSM is in place. */
116 118
117 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 119 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
118 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 120 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
@@ -363,7 +365,7 @@ struct ata_port_operations {
363 365
364 void (*host_stop) (struct ata_host_set *host_set); 366 void (*host_stop) (struct ata_host_set *host_set);
365 367
366 void (*bmdma_stop) (struct ata_port *ap); 368 void (*bmdma_stop) (struct ata_queued_cmd *qc);
367 u8 (*bmdma_status) (struct ata_port *ap); 369 u8 (*bmdma_status) (struct ata_port *ap);
368}; 370};
369 371
@@ -424,7 +426,7 @@ extern void ata_dev_id_string(u16 *id, unsigned char *s,
424extern void ata_dev_config(struct ata_port *ap, unsigned int i); 426extern void ata_dev_config(struct ata_port *ap, unsigned int i);
425extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 427extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
426extern void ata_bmdma_start (struct ata_queued_cmd *qc); 428extern void ata_bmdma_start (struct ata_queued_cmd *qc);
427extern void ata_bmdma_stop(struct ata_port *ap); 429extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
428extern u8 ata_bmdma_status(struct ata_port *ap); 430extern u8 ata_bmdma_status(struct ata_port *ap);
429extern void ata_bmdma_irq_clear(struct ata_port *ap); 431extern void ata_bmdma_irq_clear(struct ata_port *ap);
430extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); 432extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat);
@@ -644,7 +646,7 @@ static inline void scr_write(struct ata_port *ap, unsigned int reg, u32 val)
644 ap->ops->scr_write(ap, reg, val); 646 ap->ops->scr_write(ap, reg, val);
645} 647}
646 648
647static inline void scr_write_flush(struct ata_port *ap, unsigned int reg, 649static inline void scr_write_flush(struct ata_port *ap, unsigned int reg,
648 u32 val) 650 u32 val)
649{ 651{
650 ap->ops->scr_write(ap, reg, val); 652 ap->ops->scr_write(ap, reg, val);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 927ed487630d..499a5325f67f 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1249,6 +1249,7 @@
1249#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 1249#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
1250#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 1250#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267
1251#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E 1251#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E
1252#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x036F
1252#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 1253#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268
1253#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 1254#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269
1254#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B 1255#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index e0d296c5b302..8ab1b4e518b8 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -627,6 +627,14 @@ static int validate_change(const struct cpuset *cur, const struct cpuset *trial)
627 * Call with cpuset_sem held. May nest a call to the 627 * Call with cpuset_sem held. May nest a call to the
628 * lock_cpu_hotplug()/unlock_cpu_hotplug() pair. 628 * lock_cpu_hotplug()/unlock_cpu_hotplug() pair.
629 */ 629 */
630
631/*
632 * Hack to avoid 2.6.13 partial node dynamic sched domain bug.
633 * Disable letting 'cpu_exclusive' cpusets define dynamic sched
634 * domains, until the sched domain can handle partial nodes.
635 * Remove this #if hackery when sched domains fixed.
636 */
637#if 0
630static void update_cpu_domains(struct cpuset *cur) 638static void update_cpu_domains(struct cpuset *cur)
631{ 639{
632 struct cpuset *c, *par = cur->parent; 640 struct cpuset *c, *par = cur->parent;
@@ -636,23 +644,6 @@ static void update_cpu_domains(struct cpuset *cur)
636 return; 644 return;
637 645
638 /* 646 /*
639 * Hack to avoid 2.6.13 partial node dynamic sched domain bug.
640 * Require the 'cpu_exclusive' cpuset to include all (or none)
641 * of the CPUs on each node, or return w/o changing sched domains.
642 * Remove this hack when dynamic sched domains fixed.
643 */
644 {
645 int i, j;
646
647 for_each_cpu_mask(i, cur->cpus_allowed) {
648 for_each_cpu_mask(j, node_to_cpumask(cpu_to_node(i))) {
649 if (!cpu_isset(j, cur->cpus_allowed))
650 return;
651 }
652 }
653 }
654
655 /*
656 * Get all cpus from parent's cpus_allowed not part of exclusive 647 * Get all cpus from parent's cpus_allowed not part of exclusive
657 * children 648 * children
658 */ 649 */
@@ -684,6 +675,11 @@ static void update_cpu_domains(struct cpuset *cur)
684 partition_sched_domains(&pspan, &cspan); 675 partition_sched_domains(&pspan, &cspan);
685 unlock_cpu_hotplug(); 676 unlock_cpu_hotplug();
686} 677}
678#else
679static void update_cpu_domains(struct cpuset *cur)
680{
681}
682#endif
687 683
688static int update_cpumask(struct cpuset *cs, char *buf) 684static int update_cpumask(struct cpuset *cs, char *buf)
689{ 685{
diff --git a/lib/idr.c b/lib/idr.c
index c5be889de449..6415d053e2bf 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -207,7 +207,7 @@ build_up:
207} 207}
208 208
209/** 209/**
210 * idr_get_new_above - allocate new idr entry above a start id 210 * idr_get_new_above - allocate new idr entry above or equal to a start id
211 * @idp: idr handle 211 * @idp: idr handle
212 * @ptr: pointer you want associated with the ide 212 * @ptr: pointer you want associated with the ide
213 * @start_id: id to start search at 213 * @start_id: id to start search at
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index a701405fab0b..45efd5f4741b 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1333,9 +1333,9 @@ err:;
1333} 1333}
1334 1334
1335static inline int check_leaf(struct trie *t, struct leaf *l, t_key key, int *plen, const struct flowi *flp, 1335static inline int check_leaf(struct trie *t, struct leaf *l, t_key key, int *plen, const struct flowi *flp,
1336 struct fib_result *res, int *err) 1336 struct fib_result *res)
1337{ 1337{
1338 int i; 1338 int err, i;
1339 t_key mask; 1339 t_key mask;
1340 struct leaf_info *li; 1340 struct leaf_info *li;
1341 struct hlist_head *hhead = &l->list; 1341 struct hlist_head *hhead = &l->list;
@@ -1348,18 +1348,18 @@ static inline int check_leaf(struct trie *t, struct leaf *l, t_key key, int *pl
1348 if (l->key != (key & mask)) 1348 if (l->key != (key & mask))
1349 continue; 1349 continue;
1350 1350
1351 if (((*err) = fib_semantic_match(&li->falh, flp, res, l->key, mask, i)) == 0) { 1351 if ((err = fib_semantic_match(&li->falh, flp, res, l->key, mask, i)) <= 0) {
1352 *plen = i; 1352 *plen = i;
1353#ifdef CONFIG_IP_FIB_TRIE_STATS 1353#ifdef CONFIG_IP_FIB_TRIE_STATS
1354 t->stats.semantic_match_passed++; 1354 t->stats.semantic_match_passed++;
1355#endif 1355#endif
1356 return 1; 1356 return err;
1357 } 1357 }
1358#ifdef CONFIG_IP_FIB_TRIE_STATS 1358#ifdef CONFIG_IP_FIB_TRIE_STATS
1359 t->stats.semantic_match_miss++; 1359 t->stats.semantic_match_miss++;
1360#endif 1360#endif
1361 } 1361 }
1362 return 0; 1362 return 1;
1363} 1363}
1364 1364
1365static int 1365static int
@@ -1386,7 +1386,7 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
1386 1386
1387 /* Just a leaf? */ 1387 /* Just a leaf? */
1388 if (IS_LEAF(n)) { 1388 if (IS_LEAF(n)) {
1389 if (check_leaf(t, (struct leaf *)n, key, &plen, flp, res, &ret)) 1389 if ((ret = check_leaf(t, (struct leaf *)n, key, &plen, flp, res)) <= 0)
1390 goto found; 1390 goto found;
1391 goto failed; 1391 goto failed;
1392 } 1392 }
@@ -1508,7 +1508,7 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
1508 continue; 1508 continue;
1509 } 1509 }
1510 if (IS_LEAF(n)) { 1510 if (IS_LEAF(n)) {
1511 if (check_leaf(t, (struct leaf *)n, key, &plen, flp, res, &ret)) 1511 if ((ret = check_leaf(t, (struct leaf *)n, key, &plen, flp, res)) <= 0)
1512 goto found; 1512 goto found;
1513 } 1513 }
1514backtrace: 1514backtrace: