aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS4
-rw-r--r--arch/arm/common/uengine.c6
-rw-r--r--arch/arm/kernel/entry-armv.S96
-rw-r--r--arch/arm/kernel/traps.c5
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c41
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c43
-rw-r--r--arch/arm/mach-at91/board-carmeva.c2
-rw-r--r--arch/arm/mach-at91/board-csb337.c11
-rw-r--r--arch/arm/mach-at91/board-csb637.c2
-rw-r--r--arch/arm/mach-at91/board-dk.c15
-rw-r--r--arch/arm/mach-at91/board-eb9200.c10
-rw-r--r--arch/arm/mach-at91/board-ek.c2
-rw-r--r--arch/arm/mach-at91/board-kafa.c2
-rw-r--r--arch/arm/mach-at91/board-kb9202.c2
-rw-r--r--arch/arm/mach-at91/board-picotux200.c2
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c18
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c2
-rw-r--r--arch/arm/mach-at91/clock.c9
-rw-r--r--arch/arm/mach-imx/irq.c51
-rw-r--r--arch/arm/mach-pxa/pxa27x.c2
-rw-r--r--arch/arm/mach-pxa/pxa320.c7
-rw-r--r--arch/arm/mach-pxa/ssp.c1
-rw-r--r--arch/mips/kernel/csrc-r4k.c6
-rw-r--r--arch/mips/pci/pci-bcm1480.c3
-rw-r--r--arch/powerpc/kernel/rtas.c12
-rw-r--r--arch/powerpc/platforms/pseries/setup.c3
-rw-r--r--arch/ppc/configs/ml300_defconfig2
-rw-r--r--arch/ppc/configs/ml403_defconfig2
-rw-r--r--arch/um/Kconfig.i3867
-rw-r--r--arch/um/drivers/chan_user.c11
-rw-r--r--arch/um/os-Linux/time.c1
-rw-r--r--arch/x86/kernel/crash.c4
-rw-r--r--arch/x86/kernel/head_32.S12
-rw-r--r--arch/x86/kernel/hpet.c14
-rw-r--r--arch/x86/kernel/reboot_32.c4
-rw-r--r--arch/x86/kernel/reboot_64.c4
-rw-r--r--drivers/acpi/dispatcher/dsobject.c91
-rw-r--r--drivers/acpi/processor_throttling.c36
-rw-r--r--drivers/ata/ata_piix.c28
-rw-r--r--drivers/ata/libata-core.c8
-rw-r--r--drivers/ata/libata-eh.c42
-rw-r--r--drivers/ata/pata_at32.c61
-rw-r--r--drivers/ata/pata_bf54x.c7
-rw-r--r--drivers/ata/sata_mv.c64
-rw-r--r--drivers/crypto/Kconfig2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_av.c8
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c3
-rw-r--r--drivers/isdn/i4l/isdn_common.c5
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/amd8111e.c6
-rw-r--r--drivers/net/bfin_mac.c2
-rwxr-xr-x[-rw-r--r--]drivers/net/chelsio/cxgb2.c70
-rwxr-xr-x[-rw-r--r--]drivers/net/chelsio/pm3393.c112
-rwxr-xr-x[-rw-r--r--]drivers/net/chelsio/sge.c44
-rwxr-xr-x[-rw-r--r--]drivers/net/chelsio/sge.h3
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c20
-rw-r--r--drivers/net/ehea/ehea_qmr.h4
-rw-r--r--drivers/net/fec_mpc52xx.c2
-rw-r--r--drivers/net/forcedeth.c38
-rw-r--r--drivers/net/ibm_newemac/core.c31
-rw-r--r--drivers/net/ibm_newemac/core.h1
-rw-r--r--drivers/net/lib82596.c50
-rw-r--r--drivers/net/phy/marvell.c26
-rw-r--r--drivers/net/phy/phy.c3
-rw-r--r--drivers/net/s2io.c32
-rw-r--r--drivers/net/skge.c108
-rw-r--r--drivers/net/sky2.c121
-rw-r--r--drivers/net/sky2.h21
-rw-r--r--drivers/net/smc911x.c19
-rw-r--r--drivers/net/smc911x.h2
-rw-r--r--drivers/net/smc91x.h2
-rw-r--r--drivers/net/sungem.c11
-rw-r--r--drivers/net/tulip/dmfe.c4
-rw-r--r--drivers/net/ucc_geth.c10
-rw-r--r--drivers/net/usb/dm9601.c2
-rw-r--r--drivers/net/via-velocity.c11
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43/phy.c2
-rw-r--r--drivers/net/wireless/b43legacy/dma.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/phy.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c13
-rw-r--r--drivers/net/wireless/libertas/if_cs.c3
-rw-r--r--drivers/net/wireless/libertas/main.c4
-rw-r--r--drivers/net/wireless/libertas/wext.c2
-rw-r--r--drivers/net/wireless/netwave_cs.c2
-rw-r--r--drivers/net/wireless/p54usb.c2
-rw-r--r--drivers/s390/net/ctcmain.c45
-rw-r--r--drivers/s390/scsi/zfcp_erp.c18
-rw-r--r--drivers/scsi/aacraid/commsup.c8
-rw-r--r--drivers/scsi/aacraid/linit.c7
-rw-r--r--drivers/scsi/atari_scsi.c10
-rw-r--r--drivers/scsi/dtc.c5
-rw-r--r--drivers/scsi/g_NCR5380.c5
-rw-r--r--drivers/scsi/iscsi_tcp.c139
-rw-r--r--drivers/scsi/iscsi_tcp.h34
-rw-r--r--drivers/scsi/libiscsi.c3
-rw-r--r--drivers/scsi/mac_scsi.c4
-rw-r--r--drivers/scsi/pas16.c5
-rw-r--r--drivers/scsi/qla1280.c387
-rw-r--r--drivers/scsi/sun3_scsi.c4
-rw-r--r--drivers/scsi/sun3_scsi_vme.c4
-rw-r--r--drivers/scsi/t128.c5
-rw-r--r--drivers/serial/pxa.c4
-rw-r--r--fs/proc/generic.c12
-rw-r--r--fs/proc/proc_net.c86
-rw-r--r--include/asm-arm/arch-at91/board.h3
-rw-r--r--include/asm-arm/arch-ixp23xx/irqs.h2
-rw-r--r--include/asm-arm/arch-omap/board-innovator.h2
-rw-r--r--include/asm-arm/arch-pxa/irqs.h20
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa300.h2
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa320.h2
-rw-r--r--include/asm-arm/arch-pxa/mfp.h18
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h5
-rw-r--r--include/asm-mips/cpu-features.h6
-rw-r--r--include/asm-powerpc/rtas.h3
-rw-r--r--include/asm-x86/hpet.h1
-rw-r--r--include/linux/cgroup_subsys.h7
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/phy.h2
-rw-r--r--include/linux/proc_fs.h3
-rw-r--r--include/net/sctp/constants.h9
-rw-r--r--init/Kconfig7
-rw-r--r--kernel/Kconfig.instrumentation4
-rw-r--r--kernel/sched.c155
-rw-r--r--kernel/sched_fair.c6
-rw-r--r--kernel/sched_rt.c1
-rw-r--r--lib/textsearch.c8
-rw-r--r--mm/slab.c4
-rw-r--r--net/8021q/vlan_dev.c3
-rw-r--r--net/bridge/br.c4
-rw-r--r--net/bridge/br_input.c7
-rw-r--r--net/bridge/netfilter/ebtable_broute.c4
-rw-r--r--net/decnet/dn_dev.c4
-rw-r--r--net/ieee80211/ieee80211_tx.c3
-rw-r--r--net/ipv4/inet_diag.c69
-rw-r--r--net/ipv4/tcp_illinois.c2
-rw-r--r--net/ipv6/addrconf.c11
-rw-r--r--net/mac80211/ieee80211.c10
-rw-r--r--net/mac80211/rx.c2
-rw-r--r--net/mac80211/wep.c3
-rw-r--r--net/netfilter/xt_CONNMARK.c10
-rw-r--r--net/netfilter/xt_CONNSECMARK.c10
-rw-r--r--net/netfilter/xt_TCPMSS.c4
-rw-r--r--net/rfkill/rfkill.c14
-rw-r--r--net/rxrpc/Kconfig1
-rw-r--r--net/sctp/Kconfig6
-rw-r--r--net/sctp/auth.c4
-rw-r--r--net/sctp/sm_make_chunk.c25
-rw-r--r--net/sctp/sm_statefuns.c2
-rw-r--r--net/unix/af_unix.c9
-rw-r--r--net/xfrm/xfrm_policy.c1
161 files changed, 1799 insertions, 1188 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index ac425b5b4a40..2bbe40ea4d10 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -439,7 +439,7 @@ S: Maintained
439 439
440ARM/ATMEL AT91RM9200 ARM ARCHITECTURE 440ARM/ATMEL AT91RM9200 ARM ARCHITECTURE
441P: Andrew Victor 441P: Andrew Victor
442M: andrew@sanpeople.com 442M: linux@maxim.org.za
443L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 443L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
444W: http://maxim.org.za/at91_26.html 444W: http://maxim.org.za/at91_26.html
445S: Maintained 445S: Maintained
@@ -2173,7 +2173,7 @@ S: Maintained
2173 2173
2174KDUMP 2174KDUMP
2175P: Vivek Goyal 2175P: Vivek Goyal
2176M: vgoyal@in.ibm.com 2176M: vgoyal@redhat.com
2177P: Haren Myneni 2177P: Haren Myneni
2178M: hbabu@us.ibm.com 2178M: hbabu@us.ibm.com
2179L: kexec@lists.infradead.org 2179L: kexec@lists.infradead.org
diff --git a/arch/arm/common/uengine.c b/arch/arm/common/uengine.c
index 95c8508c29b7..117cab30bd36 100644
--- a/arch/arm/common/uengine.c
+++ b/arch/arm/common/uengine.c
@@ -374,8 +374,8 @@ static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c)
374 u8 *ucode; 374 u8 *ucode;
375 int i; 375 int i;
376 376
377 gpr_a = kmalloc(128 * sizeof(u32), GFP_KERNEL); 377 gpr_a = kzalloc(128 * sizeof(u32), GFP_KERNEL);
378 gpr_b = kmalloc(128 * sizeof(u32), GFP_KERNEL); 378 gpr_b = kzalloc(128 * sizeof(u32), GFP_KERNEL);
379 ucode = kmalloc(513 * 5, GFP_KERNEL); 379 ucode = kmalloc(513 * 5, GFP_KERNEL);
380 if (gpr_a == NULL || gpr_b == NULL || ucode == NULL) { 380 if (gpr_a == NULL || gpr_b == NULL || ucode == NULL) {
381 kfree(ucode); 381 kfree(ucode);
@@ -388,8 +388,6 @@ static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c)
388 if (c->uengine_parameters & IXP2000_UENGINE_4_CONTEXTS) 388 if (c->uengine_parameters & IXP2000_UENGINE_4_CONTEXTS)
389 per_ctx_regs = 32; 389 per_ctx_regs = 32;
390 390
391 memset(gpr_a, 0, sizeof(gpr_a));
392 memset(gpr_b, 0, sizeof(gpr_b));
393 for (i = 0; i < 256; i++) { 391 for (i = 0; i < 256; i++) {
394 struct ixp2000_reg_value *r = c->initial_reg_values + i; 392 struct ixp2000_reg_value *r = c->initial_reg_values + i;
395 u32 *bank; 393 u32 *bank;
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index d645897652c2..29dec080a604 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -339,16 +339,6 @@ __pabt_svc:
339 str r1, [sp] @ save the "real" r0 copied 339 str r1, [sp] @ save the "real" r0 copied
340 @ from the exception stack 340 @ from the exception stack
341 341
342#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
343#ifndef CONFIG_MMU
344#warning "NPTL on non MMU needs fixing"
345#else
346 @ make sure our user space atomic helper is aborted
347 cmp r2, #TASK_SIZE
348 bichs r3, r3, #PSR_Z_BIT
349#endif
350#endif
351
352 @ 342 @
353 @ We are now ready to fill in the remaining blanks on the stack: 343 @ We are now ready to fill in the remaining blanks on the stack:
354 @ 344 @
@@ -372,9 +362,25 @@ __pabt_svc:
372 zero_fp 362 zero_fp
373 .endm 363 .endm
374 364
365 .macro kuser_cmpxchg_check
366#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
367#ifndef CONFIG_MMU
368#warning "NPTL on non MMU needs fixing"
369#else
370 @ Make sure our user space atomic helper is restarted
371 @ if it was interrupted in a critical region. Here we
372 @ perform a quick test inline since it should be false
373 @ 99.9999% of the time. The rest is done out of line.
374 cmp r2, #TASK_SIZE
375 blhs kuser_cmpxchg_fixup
376#endif
377#endif
378 .endm
379
375 .align 5 380 .align 5
376__dabt_usr: 381__dabt_usr:
377 usr_entry 382 usr_entry
383 kuser_cmpxchg_check
378 384
379 @ 385 @
380 @ Call the processor-specific abort handler: 386 @ Call the processor-specific abort handler:
@@ -404,6 +410,7 @@ __dabt_usr:
404 .align 5 410 .align 5
405__irq_usr: 411__irq_usr:
406 usr_entry 412 usr_entry
413 kuser_cmpxchg_check
407 414
408#ifdef CONFIG_TRACE_IRQFLAGS 415#ifdef CONFIG_TRACE_IRQFLAGS
409 bl trace_hardirqs_off 416 bl trace_hardirqs_off
@@ -446,9 +453,9 @@ __und_usr:
446 @ 453 @
447 @ r0 - instruction 454 @ r0 - instruction
448 @ 455 @
4491: ldrt r0, [r4]
450 adr r9, ret_from_exception 456 adr r9, ret_from_exception
451 adr lr, __und_usr_unknown 457 adr lr, __und_usr_unknown
4581: ldrt r0, [r4]
452 @ 459 @
453 @ fallthrough to call_fpe 460 @ fallthrough to call_fpe
454 @ 461 @
@@ -669,7 +676,7 @@ __kuser_helper_start:
669 * 676 *
670 * Clobbered: 677 * Clobbered:
671 * 678 *
672 * the Z flag might be lost 679 * none
673 * 680 *
674 * Definition and user space usage example: 681 * Definition and user space usage example:
675 * 682 *
@@ -730,9 +737,6 @@ __kuser_memory_barrier: @ 0xffff0fa0
730 * 737 *
731 * - This routine already includes memory barriers as needed. 738 * - This routine already includes memory barriers as needed.
732 * 739 *
733 * - A failure might be transient, i.e. it is possible, although unlikely,
734 * that "failure" be returned even if *ptr == oldval.
735 *
736 * For example, a user space atomic_add implementation could look like this: 740 * For example, a user space atomic_add implementation could look like this:
737 * 741 *
738 * #define atomic_add(ptr, val) \ 742 * #define atomic_add(ptr, val) \
@@ -769,46 +773,62 @@ __kuser_cmpxchg: @ 0xffff0fc0
769 773
770#elif __LINUX_ARM_ARCH__ < 6 774#elif __LINUX_ARM_ARCH__ < 6
771 775
776#ifdef CONFIG_MMU
777
772 /* 778 /*
773 * Theory of operation: 779 * The only thing that can break atomicity in this cmpxchg
774 * 780 * implementation is either an IRQ or a data abort exception
775 * We set the Z flag before loading oldval. If ever an exception 781 * causing another process/thread to be scheduled in the middle
776 * occurs we can not be sure the loaded value will still be the same 782 * of the critical sequence. To prevent this, code is added to
777 * when the exception returns, therefore the user exception handler 783 * the IRQ and data abort exception handlers to set the pc back
778 * will clear the Z flag whenever the interrupted user code was 784 * to the beginning of the critical section if it is found to be
779 * actually from the kernel address space (see the usr_entry macro). 785 * within that critical section (see kuser_cmpxchg_fixup).
780 *
781 * The post-increment on the str is used to prevent a race with an
782 * exception happening just after the str instruction which would
783 * clear the Z flag although the exchange was done.
784 */ 786 */
785#ifdef CONFIG_MMU 7871: ldr r3, [r2] @ load current val
786 teq ip, ip @ set Z flag 788 subs r3, r3, r0 @ compare with oldval
787 ldr ip, [r2] @ load current val 7892: streq r1, [r2] @ store newval if eq
788 add r3, r2, #1 @ prepare store ptr 790 rsbs r0, r3, #0 @ set return val and C flag
789 teqeq ip, r0 @ compare with oldval if still allowed 791 usr_ret lr
790 streq r1, [r3, #-1]! @ store newval if still allowed 792
791 subs r0, r2, r3 @ if r2 == r3 the str occured 793 .text
794kuser_cmpxchg_fixup:
795 @ Called from kuser_cmpxchg_check macro.
796 @ r2 = address of interrupted insn (must be preserved).
797 @ sp = saved regs. r7 and r8 are clobbered.
798 @ 1b = first critical insn, 2b = last critical insn.
799 @ If r2 >= 1b and r2 <= 2b then saved pc_usr is set to 1b.
800 mov r7, #0xffff0fff
801 sub r7, r7, #(0xffff0fff - (0xffff0fc0 + (1b - __kuser_cmpxchg)))
802 subs r8, r2, r7
803 rsbcss r8, r8, #(2b - 1b)
804 strcs r7, [sp, #S_PC]
805 mov pc, lr
806 .previous
807
792#else 808#else
793#warning "NPTL on non MMU needs fixing" 809#warning "NPTL on non MMU needs fixing"
794 mov r0, #-1 810 mov r0, #-1
795 adds r0, r0, #0 811 adds r0, r0, #0
796#endif
797 usr_ret lr 812 usr_ret lr
813#endif
798 814
799#else 815#else
800 816
801#ifdef CONFIG_SMP 817#ifdef CONFIG_SMP
802 mcr p15, 0, r0, c7, c10, 5 @ dmb 818 mcr p15, 0, r0, c7, c10, 5 @ dmb
803#endif 819#endif
804 ldrex r3, [r2] 8201: ldrex r3, [r2]
805 subs r3, r3, r0 821 subs r3, r3, r0
806 strexeq r3, r1, [r2] 822 strexeq r3, r1, [r2]
823 teqeq r3, #1
824 beq 1b
807 rsbs r0, r3, #0 825 rsbs r0, r3, #0
826 /* beware -- each __kuser slot must be 8 instructions max */
808#ifdef CONFIG_SMP 827#ifdef CONFIG_SMP
809 mcr p15, 0, r0, c7, c10, 5 @ dmb 828 b __kuser_memory_barrier
810#endif 829#else
811 usr_ret lr 830 usr_ret lr
831#endif
812 832
813#endif 833#endif
814 834
@@ -829,7 +849,7 @@ __kuser_cmpxchg: @ 0xffff0fc0
829 * 849 *
830 * Clobbered: 850 * Clobbered:
831 * 851 *
832 * the Z flag might be lost 852 * none
833 * 853 *
834 * Definition and user space usage example: 854 * Definition and user space usage example:
835 * 855 *
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 4764bd9ccee8..c34db4e868fa 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -327,7 +327,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
327 if ((instr & hook->instr_mask) == hook->instr_val && 327 if ((instr & hook->instr_mask) == hook->instr_val &&
328 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) { 328 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) {
329 if (hook->fn(regs, instr) == 0) { 329 if (hook->fn(regs, instr) == 0) {
330 spin_unlock_irq(&undef_lock); 330 spin_unlock_irqrestore(&undef_lock, flags);
331 return; 331 return;
332 } 332 }
333 } 333 }
@@ -509,7 +509,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
509 * existence. Don't ever use this from user code. 509 * existence. Don't ever use this from user code.
510 */ 510 */
511 case 0xfff0: 511 case 0xfff0:
512 { 512 for (;;) {
513 extern void do_DataAbort(unsigned long addr, unsigned int fsr, 513 extern void do_DataAbort(unsigned long addr, unsigned int fsr,
514 struct pt_regs *regs); 514 struct pt_regs *regs);
515 unsigned long val; 515 unsigned long val;
@@ -545,7 +545,6 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
545 up_read(&mm->mmap_sem); 545 up_read(&mm->mmap_sem);
546 /* simulate a write access fault */ 546 /* simulate a write access fault */
547 do_DataAbort(addr, 15 + (1 << 11), regs); 547 do_DataAbort(addr, 15 + (1 << 11), regs);
548 return -1;
549 } 548 }
550#endif 549#endif
551 550
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 0417c165d50d..9296833f91cc 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -14,6 +14,7 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h>
17 18
18#include <asm/arch/board.h> 19#include <asm/arch/board.h>
19#include <asm/arch/gpio.h> 20#include <asm/arch/gpio.h>
@@ -435,7 +436,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
435 * TWI (i2c) 436 * TWI (i2c)
436 * -------------------------------------------------------------------- */ 437 * -------------------------------------------------------------------- */
437 438
438#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 439/*
440 * Prefer the GPIO code since the TWI controller isn't robust
441 * (gets overruns and underruns under load) and can only issue
442 * repeated STARTs in one scenario (the driver doesn't yet handle them).
443 */
444#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
445
446static struct i2c_gpio_platform_data pdata = {
447 .sda_pin = AT91_PIN_PA25,
448 .sda_is_open_drain = 1,
449 .scl_pin = AT91_PIN_PA26,
450 .scl_is_open_drain = 1,
451 .udelay = 2, /* ~100 kHz */
452};
453
454static struct platform_device at91rm9200_twi_device = {
455 .name = "i2c-gpio",
456 .id = -1,
457 .dev.platform_data = &pdata,
458};
459
460void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
461{
462 at91_set_GPIO_periph(AT91_PIN_PA25, 1); /* TWD (SDA) */
463 at91_set_multi_drive(AT91_PIN_PA25, 1);
464
465 at91_set_GPIO_periph(AT91_PIN_PA26, 1); /* TWCK (SCL) */
466 at91_set_multi_drive(AT91_PIN_PA26, 1);
467
468 i2c_register_board_info(0, devices, nr_devices);
469 platform_device_register(&at91rm9200_twi_device);
470}
471
472#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
439 473
440static struct resource twi_resources[] = { 474static struct resource twi_resources[] = {
441 [0] = { 475 [0] = {
@@ -457,7 +491,7 @@ static struct platform_device at91rm9200_twi_device = {
457 .num_resources = ARRAY_SIZE(twi_resources), 491 .num_resources = ARRAY_SIZE(twi_resources),
458}; 492};
459 493
460void __init at91_add_device_i2c(void) 494void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
461{ 495{
462 /* pins used for TWI interface */ 496 /* pins used for TWI interface */
463 at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */ 497 at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */
@@ -466,10 +500,11 @@ void __init at91_add_device_i2c(void)
466 at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */ 500 at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */
467 at91_set_multi_drive(AT91_PIN_PA26, 1); 501 at91_set_multi_drive(AT91_PIN_PA26, 1);
468 502
503 i2c_register_board_info(0, devices, nr_devices);
469 platform_device_register(&at91rm9200_twi_device); 504 platform_device_register(&at91rm9200_twi_device);
470} 505}
471#else 506#else
472void __init at91_add_device_i2c(void) {} 507void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
473#endif 508#endif
474 509
475 510
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index ffd3154c1e54..3091bf47d8c9 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -13,6 +13,7 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h>
16 17
17#include <asm/arch/board.h> 18#include <asm/arch/board.h>
18#include <asm/arch/gpio.h> 19#include <asm/arch/gpio.h>
@@ -352,7 +353,41 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
352 * TWI (i2c) 353 * TWI (i2c)
353 * -------------------------------------------------------------------- */ 354 * -------------------------------------------------------------------- */
354 355
355#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 356/*
357 * Prefer the GPIO code since the TWI controller isn't robust
358 * (gets overruns and underruns under load) and can only issue
359 * repeated STARTs in one scenario (the driver doesn't yet handle them).
360 */
361
362#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
363
364static struct i2c_gpio_platform_data pdata = {
365 .sda_pin = AT91_PIN_PA23,
366 .sda_is_open_drain = 1,
367 .scl_pin = AT91_PIN_PA24,
368 .scl_is_open_drain = 1,
369 .udelay = 2, /* ~100 kHz */
370};
371
372static struct platform_device at91sam9260_twi_device = {
373 .name = "i2c-gpio",
374 .id = -1,
375 .dev.platform_data = &pdata,
376};
377
378void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
379{
380 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
381 at91_set_multi_drive(AT91_PIN_PA23, 1);
382
383 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
384 at91_set_multi_drive(AT91_PIN_PA24, 1);
385
386 i2c_register_board_info(0, devices, nr_devices);
387 platform_device_register(&at91sam9260_twi_device);
388}
389
390#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
356 391
357static struct resource twi_resources[] = { 392static struct resource twi_resources[] = {
358 [0] = { 393 [0] = {
@@ -374,7 +409,7 @@ static struct platform_device at91sam9260_twi_device = {
374 .num_resources = ARRAY_SIZE(twi_resources), 409 .num_resources = ARRAY_SIZE(twi_resources),
375}; 410};
376 411
377void __init at91_add_device_i2c(void) 412void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
378{ 413{
379 /* pins used for TWI interface */ 414 /* pins used for TWI interface */
380 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ 415 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
@@ -383,10 +418,11 @@ void __init at91_add_device_i2c(void)
383 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */ 418 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
384 at91_set_multi_drive(AT91_PIN_PA24, 1); 419 at91_set_multi_drive(AT91_PIN_PA24, 1);
385 420
421 i2c_register_board_info(0, devices, nr_devices);
386 platform_device_register(&at91sam9260_twi_device); 422 platform_device_register(&at91sam9260_twi_device);
387} 423}
388#else 424#else
389void __init at91_add_device_i2c(void) {} 425void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
390#endif 426#endif
391 427
392 428
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 3576595b4941..64979a9023c2 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -14,7 +14,9 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h>
17 18
19#include <linux/fb.h>
18#include <video/atmel_lcdc.h> 20#include <video/atmel_lcdc.h>
19 21
20#include <asm/arch/board.h> 22#include <asm/arch/board.h>
@@ -275,7 +277,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
275 * TWI (i2c) 277 * TWI (i2c)
276 * -------------------------------------------------------------------- */ 278 * -------------------------------------------------------------------- */
277 279
278#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 280/*
281 * Prefer the GPIO code since the TWI controller isn't robust
282 * (gets overruns and underruns under load) and can only issue
283 * repeated STARTs in one scenario (the driver doesn't yet handle them).
284 */
285#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
286
287static struct i2c_gpio_platform_data pdata = {
288 .sda_pin = AT91_PIN_PA7,
289 .sda_is_open_drain = 1,
290 .scl_pin = AT91_PIN_PA8,
291 .scl_is_open_drain = 1,
292 .udelay = 2, /* ~100 kHz */
293};
294
295static struct platform_device at91sam9261_twi_device = {
296 .name = "i2c-gpio",
297 .id = -1,
298 .dev.platform_data = &pdata,
299};
300
301void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
302{
303 at91_set_GPIO_periph(AT91_PIN_PA7, 1); /* TWD (SDA) */
304 at91_set_multi_drive(AT91_PIN_PA7, 1);
305
306 at91_set_GPIO_periph(AT91_PIN_PA8, 1); /* TWCK (SCL) */
307 at91_set_multi_drive(AT91_PIN_PA8, 1);
308
309 i2c_register_board_info(0, devices, nr_devices);
310 platform_device_register(&at91sam9261_twi_device);
311}
312
313#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
279 314
280static struct resource twi_resources[] = { 315static struct resource twi_resources[] = {
281 [0] = { 316 [0] = {
@@ -297,7 +332,7 @@ static struct platform_device at91sam9261_twi_device = {
297 .num_resources = ARRAY_SIZE(twi_resources), 332 .num_resources = ARRAY_SIZE(twi_resources),
298}; 333};
299 334
300void __init at91_add_device_i2c(void) 335void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
301{ 336{
302 /* pins used for TWI interface */ 337 /* pins used for TWI interface */
303 at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */ 338 at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */
@@ -306,10 +341,11 @@ void __init at91_add_device_i2c(void)
306 at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */ 341 at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */
307 at91_set_multi_drive(AT91_PIN_PA8, 1); 342 at91_set_multi_drive(AT91_PIN_PA8, 1);
308 343
344 i2c_register_board_info(0, devices, nr_devices);
309 platform_device_register(&at91sam9261_twi_device); 345 platform_device_register(&at91sam9261_twi_device);
310} 346}
311#else 347#else
312void __init at91_add_device_i2c(void) {} 348void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
313#endif 349#endif
314 350
315 351
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index f924bd5017de..ac329a98e959 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -13,7 +13,9 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h>
16 17
18#include <linux/fb.h>
17#include <video/atmel_lcdc.h> 19#include <video/atmel_lcdc.h>
18 20
19#include <asm/arch/board.h> 21#include <asm/arch/board.h>
@@ -421,7 +423,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
421 * TWI (i2c) 423 * TWI (i2c)
422 * -------------------------------------------------------------------- */ 424 * -------------------------------------------------------------------- */
423 425
424#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 426/*
427 * Prefer the GPIO code since the TWI controller isn't robust
428 * (gets overruns and underruns under load) and can only issue
429 * repeated STARTs in one scenario (the driver doesn't yet handle them).
430 */
431#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
432
433static struct i2c_gpio_platform_data pdata = {
434 .sda_pin = AT91_PIN_PB4,
435 .sda_is_open_drain = 1,
436 .scl_pin = AT91_PIN_PB5,
437 .scl_is_open_drain = 1,
438 .udelay = 2, /* ~100 kHz */
439};
440
441static struct platform_device at91sam9263_twi_device = {
442 .name = "i2c-gpio",
443 .id = -1,
444 .dev.platform_data = &pdata,
445};
446
447void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
448{
449 at91_set_GPIO_periph(AT91_PIN_PB4, 1); /* TWD (SDA) */
450 at91_set_multi_drive(AT91_PIN_PB4, 1);
451
452 at91_set_GPIO_periph(AT91_PIN_PB5, 1); /* TWCK (SCL) */
453 at91_set_multi_drive(AT91_PIN_PB5, 1);
454
455 i2c_register_board_info(0, devices, nr_devices);
456 platform_device_register(&at91sam9263_twi_device);
457}
458
459#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
425 460
426static struct resource twi_resources[] = { 461static struct resource twi_resources[] = {
427 [0] = { 462 [0] = {
@@ -443,7 +478,7 @@ static struct platform_device at91sam9263_twi_device = {
443 .num_resources = ARRAY_SIZE(twi_resources), 478 .num_resources = ARRAY_SIZE(twi_resources),
444}; 479};
445 480
446void __init at91_add_device_i2c(void) 481void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
447{ 482{
448 /* pins used for TWI interface */ 483 /* pins used for TWI interface */
449 at91_set_A_periph(AT91_PIN_PB4, 0); /* TWD */ 484 at91_set_A_periph(AT91_PIN_PB4, 0); /* TWD */
@@ -452,10 +487,11 @@ void __init at91_add_device_i2c(void)
452 at91_set_A_periph(AT91_PIN_PB5, 0); /* TWCK */ 487 at91_set_A_periph(AT91_PIN_PB5, 0); /* TWCK */
453 at91_set_multi_drive(AT91_PIN_PB5, 1); 488 at91_set_multi_drive(AT91_PIN_PB5, 1);
454 489
490 i2c_register_board_info(0, devices, nr_devices);
455 platform_device_register(&at91sam9263_twi_device); 491 platform_device_register(&at91sam9263_twi_device);
456} 492}
457#else 493#else
458void __init at91_add_device_i2c(void) {} 494void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
459#endif 495#endif
460 496
461 497
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index cd7532bcd4e5..2bd60a3dc623 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -10,8 +10,9 @@
10#include <asm/mach/map.h> 10#include <asm/mach/map.h>
11 11
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/fb.h> 13#include <linux/i2c-gpio.h>
14 14
15#include <linux/fb.h>
15#include <video/atmel_lcdc.h> 16#include <video/atmel_lcdc.h>
16 17
17#include <asm/arch/board.h> 18#include <asm/arch/board.h>
@@ -169,7 +170,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
169 * TWI (i2c) 170 * TWI (i2c)
170 * -------------------------------------------------------------------- */ 171 * -------------------------------------------------------------------- */
171 172
172#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 173/*
174 * Prefer the GPIO code since the TWI controller isn't robust
175 * (gets overruns and underruns under load) and can only issue
176 * repeated STARTs in one scenario (the driver doesn't yet handle them).
177 */
178#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
179
180static struct i2c_gpio_platform_data pdata = {
181 .sda_pin = AT91_PIN_PA23,
182 .sda_is_open_drain = 1,
183 .scl_pin = AT91_PIN_PA24,
184 .scl_is_open_drain = 1,
185 .udelay = 2, /* ~100 kHz */
186};
187
188static struct platform_device at91sam9rl_twi_device = {
189 .name = "i2c-gpio",
190 .id = -1,
191 .dev.platform_data = &pdata,
192};
193
194void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
195{
196 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
197 at91_set_multi_drive(AT91_PIN_PA23, 1);
198
199 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
200 at91_set_multi_drive(AT91_PIN_PA24, 1);
201
202 i2c_register_board_info(0, devices, nr_devices);
203 platform_device_register(&at91sam9rl_twi_device);
204}
205
206#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
173 207
174static struct resource twi_resources[] = { 208static struct resource twi_resources[] = {
175 [0] = { 209 [0] = {
@@ -191,7 +225,7 @@ static struct platform_device at91sam9rl_twi_device = {
191 .num_resources = ARRAY_SIZE(twi_resources), 225 .num_resources = ARRAY_SIZE(twi_resources),
192}; 226};
193 227
194void __init at91_add_device_i2c(void) 228void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
195{ 229{
196 /* pins used for TWI interface */ 230 /* pins used for TWI interface */
197 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ 231 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
@@ -200,10 +234,11 @@ void __init at91_add_device_i2c(void)
200 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */ 234 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
201 at91_set_multi_drive(AT91_PIN_PA24, 1); 235 at91_set_multi_drive(AT91_PIN_PA24, 1);
202 236
237 i2c_register_board_info(0, devices, nr_devices);
203 platform_device_register(&at91sam9rl_twi_device); 238 platform_device_register(&at91sam9rl_twi_device);
204} 239}
205#else 240#else
206void __init at91_add_device_i2c(void) {} 241void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
207#endif 242#endif
208 243
209 244
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 76ec856cd4f9..0f0878294a67 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -128,7 +128,7 @@ static void __init carmeva_board_init(void)
128 /* USB Device */ 128 /* USB Device */
129 at91_add_device_udc(&carmeva_udc_data); 129 at91_add_device_udc(&carmeva_udc_data);
130 /* I2C */ 130 /* I2C */
131 at91_add_device_i2c(); 131 at91_add_device_i2c(NULL, 0);
132 /* SPI */ 132 /* SPI */
133 at91_add_device_spi(carmeva_spi_devices, ARRAY_SIZE(carmeva_spi_devices)); 133 at91_add_device_spi(carmeva_spi_devices, ARRAY_SIZE(carmeva_spi_devices));
134 /* Compact Flash */ 134 /* Compact Flash */
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index dde089922e3b..d0aa20c9383e 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -23,7 +23,6 @@
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/i2c.h>
27#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
28#include <linux/mtd/physmap.h> 27#include <linux/mtd/physmap.h>
29 28
@@ -85,12 +84,12 @@ static struct at91_udc_data __initdata csb337_udc_data = {
85}; 84};
86 85
87static struct i2c_board_info __initdata csb337_i2c_devices[] = { 86static struct i2c_board_info __initdata csb337_i2c_devices[] = {
88 { I2C_BOARD_INFO("rtc-ds1307", 0x68), 87 {
89 .type = "ds1307", 88 I2C_BOARD_INFO("rtc-ds1307", 0x68),
89 .type = "ds1307",
90 }, 90 },
91}; 91};
92 92
93
94static struct at91_cf_data __initdata csb337_cf_data = { 93static struct at91_cf_data __initdata csb337_cf_data = {
95 /* 94 /*
96 * connector P4 on the CSB 337 mates to 95 * connector P4 on the CSB 337 mates to
@@ -168,9 +167,7 @@ static void __init csb337_board_init(void)
168 /* USB Device */ 167 /* USB Device */
169 at91_add_device_udc(&csb337_udc_data); 168 at91_add_device_udc(&csb337_udc_data);
170 /* I2C */ 169 /* I2C */
171 at91_add_device_i2c(); 170 at91_add_device_i2c(csb337_i2c_devices, ARRAY_SIZE(csb337_i2c_devices));
172 i2c_register_board_info(0, csb337_i2c_devices,
173 ARRAY_SIZE(csb337_i2c_devices));
174 /* Compact Flash */ 171 /* Compact Flash */
175 at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */ 172 at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */
176 at91_add_device_cf(&csb337_cf_data); 173 at91_add_device_cf(&csb337_cf_data);
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 77f04b935b3a..c5c721d27f42 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -129,7 +129,7 @@ static void __init csb637_board_init(void)
129 /* USB Device */ 129 /* USB Device */
130 at91_add_device_udc(&csb637_udc_data); 130 at91_add_device_udc(&csb637_udc_data);
131 /* I2C */ 131 /* I2C */
132 at91_add_device_i2c(); 132 at91_add_device_i2c(NULL, 0);
133 /* SPI */ 133 /* SPI */
134 at91_add_device_spi(NULL, 0); 134 at91_add_device_spi(NULL, 0);
135 /* NOR flash */ 135 /* NOR flash */
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c
index af497896a96c..40c9e4331706 100644
--- a/arch/arm/mach-at91/board-dk.c
+++ b/arch/arm/mach-at91/board-dk.c
@@ -124,6 +124,19 @@ static struct spi_board_info dk_spi_devices[] = {
124#endif 124#endif
125}; 125};
126 126
127static struct i2c_board_info __initdata dk_i2c_devices[] = {
128 {
129 I2C_BOARD_INFO("ics1523", 0x26),
130 },
131 {
132 I2C_BOARD_INFO("x9429", 0x28),
133 },
134 {
135 I2C_BOARD_INFO("at24c", 0x50),
136 .type = "24c1024",
137 }
138};
139
127static struct mtd_partition __initdata dk_nand_partition[] = { 140static struct mtd_partition __initdata dk_nand_partition[] = {
128 { 141 {
129 .name = "NAND Partition 1", 142 .name = "NAND Partition 1",
@@ -185,7 +198,7 @@ static void __init dk_board_init(void)
185 /* Compact Flash */ 198 /* Compact Flash */
186 at91_add_device_cf(&dk_cf_data); 199 at91_add_device_cf(&dk_cf_data);
187 /* I2C */ 200 /* I2C */
188 at91_add_device_i2c(); 201 at91_add_device_i2c(dk_i2c_devices, ARRAY_SIZE(dk_i2c_devices));
189 /* SPI */ 202 /* SPI */
190 at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices)); 203 at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices));
191#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 204#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 20458b5548f0..b7b79bb9d6c4 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -91,6 +91,14 @@ static struct at91_mmc_data __initdata eb9200_mmc_data = {
91 .wire4 = 1, 91 .wire4 = 1,
92}; 92};
93 93
94static struct i2c_board_info __initdata eb9200_i2c_devices[] = {
95 {
96 I2C_BOARD_INFO("at24c", 0x50),
97 .type = "24c512",
98 },
99};
100
101
94static void __init eb9200_board_init(void) 102static void __init eb9200_board_init(void)
95{ 103{
96 /* Serial */ 104 /* Serial */
@@ -102,7 +110,7 @@ static void __init eb9200_board_init(void)
102 /* USB Device */ 110 /* USB Device */
103 at91_add_device_udc(&eb9200_udc_data); 111 at91_add_device_udc(&eb9200_udc_data);
104 /* I2C */ 112 /* I2C */
105 at91_add_device_i2c(); 113 at91_add_device_i2c(eb9200_i2c_devices, ARRAY_SIZE(eb9200_i2c_devices));
106 /* Compact Flash */ 114 /* Compact Flash */
107 at91_add_device_cf(&eb9200_cf_data); 115 at91_add_device_cf(&eb9200_cf_data);
108 /* SPI */ 116 /* SPI */
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c
index 322fdd75a1e4..d05b1b2be9fb 100644
--- a/arch/arm/mach-at91/board-ek.c
+++ b/arch/arm/mach-at91/board-ek.c
@@ -145,7 +145,7 @@ static void __init ek_board_init(void)
145 at91_add_device_udc(&ek_udc_data); 145 at91_add_device_udc(&ek_udc_data);
146 at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */ 146 at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
147 /* I2C */ 147 /* I2C */
148 at91_add_device_i2c(); 148 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
149 /* SPI */ 149 /* SPI */
150 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 150 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
151#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 151#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index c77d84ce9cae..cf1b7b2f76fb 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -92,7 +92,7 @@ static void __init kafa_board_init(void)
92 /* USB Device */ 92 /* USB Device */
93 at91_add_device_udc(&kafa_udc_data); 93 at91_add_device_udc(&kafa_udc_data);
94 /* I2C */ 94 /* I2C */
95 at91_add_device_i2c(); 95 at91_add_device_i2c(NULL, 0);
96 /* SPI */ 96 /* SPI */
97 at91_add_device_spi(NULL, 0); 97 at91_add_device_spi(NULL, 0);
98} 98}
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 7d9b1a278fd6..4b39b9cda75b 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -124,7 +124,7 @@ static void __init kb9202_board_init(void)
124 /* MMC */ 124 /* MMC */
125 at91_add_device_mmc(0, &kb9202_mmc_data); 125 at91_add_device_mmc(0, &kb9202_mmc_data);
126 /* I2C */ 126 /* I2C */
127 at91_add_device_i2c(); 127 at91_add_device_i2c(NULL, 0);
128 /* SPI */ 128 /* SPI */
129 at91_add_device_spi(NULL, 0); 129 at91_add_device_spi(NULL, 0);
130 /* NAND */ 130 /* NAND */
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 49cfe7ab4a85..6acb55c09ae5 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -139,7 +139,7 @@ static void __init picotux200_board_init(void)
139 // at91_add_device_udc(&picotux200_udc_data); 139 // at91_add_device_udc(&picotux200_udc_data);
140 // at91_set_multi_drive(picotux200_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */ 140 // at91_set_multi_drive(picotux200_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
141 /* I2C */ 141 /* I2C */
142 at91_add_device_i2c(); 142 at91_add_device_i2c(NULL, 0);
143 /* SPI */ 143 /* SPI */
144 // at91_add_device_spi(picotux200_spi_devices, ARRAY_SIZE(picotux200_spi_devices)); 144 // at91_add_device_spi(picotux200_spi_devices, ARRAY_SIZE(picotux200_spi_devices));
145#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 145#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 65fa532bb4ac..b343a6c28120 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -189,7 +189,7 @@ static void __init ek_board_init(void)
189 /* MMC */ 189 /* MMC */
190 at91_add_device_mmc(0, &ek_mmc_data); 190 at91_add_device_mmc(0, &ek_mmc_data);
191 /* I2C */ 191 /* I2C */
192 at91_add_device_i2c(); 192 at91_add_device_i2c(NULL, 0);
193} 193}
194 194
195MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK") 195MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 42e172cb0f49..550ae59a3aca 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -382,14 +382,14 @@ static struct platform_device ek_button_device = {
382 382
383static void __init ek_add_device_buttons(void) 383static void __init ek_add_device_buttons(void)
384{ 384{
385 at91_set_gpio_input(AT91_PIN_PB27, 0); /* btn0 */ 385 at91_set_gpio_input(AT91_PIN_PA27, 0); /* btn0 */
386 at91_set_deglitch(AT91_PIN_PB27, 1); 386 at91_set_deglitch(AT91_PIN_PA27, 1);
387 at91_set_gpio_input(AT91_PIN_PB26, 0); /* btn1 */ 387 at91_set_gpio_input(AT91_PIN_PA26, 0); /* btn1 */
388 at91_set_deglitch(AT91_PIN_PB26, 1); 388 at91_set_deglitch(AT91_PIN_PA26, 1);
389 at91_set_gpio_input(AT91_PIN_PB25, 0); /* btn2 */ 389 at91_set_gpio_input(AT91_PIN_PA25, 0); /* btn2 */
390 at91_set_deglitch(AT91_PIN_PB25, 1); 390 at91_set_deglitch(AT91_PIN_PA25, 1);
391 at91_set_gpio_input(AT91_PIN_PB24, 0); /* btn3 */ 391 at91_set_gpio_input(AT91_PIN_PA24, 0); /* btn3 */
392 at91_set_deglitch(AT91_PIN_PB24, 1); 392 at91_set_deglitch(AT91_PIN_PA24, 1);
393 393
394 platform_device_register(&ek_button_device); 394 platform_device_register(&ek_button_device);
395} 395}
@@ -406,7 +406,7 @@ static void __init ek_board_init(void)
406 /* USB Device */ 406 /* USB Device */
407 at91_add_device_udc(&ek_udc_data); 407 at91_add_device_udc(&ek_udc_data);
408 /* I2C */ 408 /* I2C */
409 at91_add_device_i2c(); 409 at91_add_device_i2c(NULL, 0);
410 /* NAND */ 410 /* NAND */
411 at91_add_device_nand(&ek_nand_data); 411 at91_add_device_nand(&ek_nand_data);
412 /* DM9000 ethernet */ 412 /* DM9000 ethernet */
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 2a1cc73390b7..ab9dcc075454 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -291,7 +291,7 @@ static void __init ek_board_init(void)
291 /* NAND */ 291 /* NAND */
292 at91_add_device_nand(&ek_nand_data); 292 at91_add_device_nand(&ek_nand_data);
293 /* I2C */ 293 /* I2C */
294 at91_add_device_i2c(); 294 at91_add_device_i2c(NULL, 0);
295 /* LCD Controller */ 295 /* LCD Controller */
296 at91_add_device_lcdc(&ek_lcdc_data); 296 at91_add_device_lcdc(&ek_lcdc_data);
297 /* AC97 */ 297 /* AC97 */
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 9b61320f295a..bc0546d7245f 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -181,7 +181,7 @@ static void __init ek_board_init(void)
181 /* Serial */ 181 /* Serial */
182 at91_add_device_serial(); 182 at91_add_device_serial();
183 /* I2C */ 183 /* I2C */
184 at91_add_device_i2c(); 184 at91_add_device_i2c(NULL, 0);
185 /* NAND */ 185 /* NAND */
186 at91_add_device_nand(&ek_nand_data); 186 at91_add_device_nand(&ek_nand_data);
187 /* SPI */ 187 /* SPI */
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 848efb2a4ebf..57c3b647ce83 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -351,7 +351,7 @@ static void init_programmable_clock(struct clk *clk)
351 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id)); 351 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id));
352 parent = at91_css_to_clk(pckr & AT91_PMC_CSS); 352 parent = at91_css_to_clk(pckr & AT91_PMC_CSS);
353 clk->parent = parent; 353 clk->parent = parent;
354 clk->rate_hz = parent->rate_hz / (1 << ((pckr >> 2) & 3)); 354 clk->rate_hz = parent->rate_hz / (1 << ((pckr & AT91_PMC_PRES) >> 2));
355} 355}
356 356
357#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */ 357#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
@@ -587,8 +587,11 @@ int __init at91_clock_init(unsigned long main_clock)
587 mckr = at91_sys_read(AT91_PMC_MCKR); 587 mckr = at91_sys_read(AT91_PMC_MCKR);
588 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS); 588 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS);
589 freq = mck.parent->rate_hz; 589 freq = mck.parent->rate_hz;
590 freq /= (1 << ((mckr >> 2) & 3)); /* prescale */ 590 freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */
591 mck.rate_hz = freq / (1 + ((mckr >> 8) & 3)); /* mdiv */ 591 if (cpu_is_at91rm9200())
592 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
593 else
594 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
592 595
593 /* Register the PMC's standard clocks */ 596 /* Register the PMC's standard clocks */
594 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++) 597 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++)
diff --git a/arch/arm/mach-imx/irq.c b/arch/arm/mach-imx/irq.c
index 0791b56caecc..a7465db84893 100644
--- a/arch/arm/mach-imx/irq.c
+++ b/arch/arm/mach-imx/irq.c
@@ -43,12 +43,46 @@
43 * 43 *
44 */ 44 */
45 45
46#define INTENNUM_OFF 0x8 46#define INTCNTL_OFF 0x00
47#define INTDISNUM_OFF 0xC 47#define NIMASK_OFF 0x04
48#define INTENNUM_OFF 0x08
49#define INTDISNUM_OFF 0x0C
50#define INTENABLEH_OFF 0x10
51#define INTENABLEL_OFF 0x14
52#define INTTYPEH_OFF 0x18
53#define INTTYPEL_OFF 0x1C
54#define NIPRIORITY_OFF(x) (0x20+4*(7-(x)))
55#define NIVECSR_OFF 0x40
56#define FIVECSR_OFF 0x44
57#define INTSRCH_OFF 0x48
58#define INTSRCL_OFF 0x4C
59#define INTFRCH_OFF 0x50
60#define INTFRCL_OFF 0x54
61#define NIPNDH_OFF 0x58
62#define NIPNDL_OFF 0x5C
63#define FIPNDH_OFF 0x60
64#define FIPNDL_OFF 0x64
48 65
49#define VA_AITC_BASE IO_ADDRESS(IMX_AITC_BASE) 66#define VA_AITC_BASE IO_ADDRESS(IMX_AITC_BASE)
50#define IMX_AITC_INTDISNUM (VA_AITC_BASE + INTDISNUM_OFF) 67#define IMX_AITC_INTCNTL (VA_AITC_BASE + INTCNTL_OFF)
68#define IMX_AITC_NIMASK (VA_AITC_BASE + NIMASK_OFF)
51#define IMX_AITC_INTENNUM (VA_AITC_BASE + INTENNUM_OFF) 69#define IMX_AITC_INTENNUM (VA_AITC_BASE + INTENNUM_OFF)
70#define IMX_AITC_INTDISNUM (VA_AITC_BASE + INTDISNUM_OFF)
71#define IMX_AITC_INTENABLEH (VA_AITC_BASE + INTENABLEH_OFF)
72#define IMX_AITC_INTENABLEL (VA_AITC_BASE + INTENABLEL_OFF)
73#define IMX_AITC_INTTYPEH (VA_AITC_BASE + INTTYPEH_OFF)
74#define IMX_AITC_INTTYPEL (VA_AITC_BASE + INTTYPEL_OFF)
75#define IMX_AITC_NIPRIORITY(x) (VA_AITC_BASE + NIPRIORITY_OFF(x))
76#define IMX_AITC_NIVECSR (VA_AITC_BASE + NIVECSR_OFF)
77#define IMX_AITC_FIVECSR (VA_AITC_BASE + FIVECSR_OFF)
78#define IMX_AITC_INTSRCH (VA_AITC_BASE + INTSRCH_OFF)
79#define IMX_AITC_INTSRCL (VA_AITC_BASE + INTSRCL_OFF)
80#define IMX_AITC_INTFRCH (VA_AITC_BASE + INTFRCH_OFF)
81#define IMX_AITC_INTFRCL (VA_AITC_BASE + INTFRCL_OFF)
82#define IMX_AITC_NIPNDH (VA_AITC_BASE + NIPNDH_OFF)
83#define IMX_AITC_NIPNDL (VA_AITC_BASE + NIPNDL_OFF)
84#define IMX_AITC_FIPNDH (VA_AITC_BASE + FIPNDH_OFF)
85#define IMX_AITC_FIPNDL (VA_AITC_BASE + FIPNDL_OFF)
52 86
53#if 0 87#if 0
54#define DEBUG_IRQ(fmt...) printk(fmt) 88#define DEBUG_IRQ(fmt...) printk(fmt)
@@ -222,7 +256,12 @@ imx_init_irq(void)
222 256
223 DEBUG_IRQ("Initializing imx interrupts\n"); 257 DEBUG_IRQ("Initializing imx interrupts\n");
224 258
225 /* Mask all interrupts initially */ 259 /* Disable all interrupts initially. */
260 /* Do not rely on the bootloader. */
261 __raw_writel(0, IMX_AITC_INTENABLEH);
262 __raw_writel(0, IMX_AITC_INTENABLEL);
263
264 /* Mask all GPIO interrupts as well */
226 IMR(0) = 0; 265 IMR(0) = 0;
227 IMR(1) = 0; 266 IMR(1) = 0;
228 IMR(2) = 0; 267 IMR(2) = 0;
@@ -245,6 +284,6 @@ imx_init_irq(void)
245 set_irq_chained_handler(GPIO_INT_PORTC, imx_gpioc_demux_handler); 284 set_irq_chained_handler(GPIO_INT_PORTC, imx_gpioc_demux_handler);
246 set_irq_chained_handler(GPIO_INT_PORTD, imx_gpiod_demux_handler); 285 set_irq_chained_handler(GPIO_INT_PORTD, imx_gpiod_demux_handler);
247 286
248 /* Disable all interrupts initially. */ 287 /* Release masking of interrupts according to priority */
249 /* In IMX this is done in the bootloader. */ 288 __raw_writel(-1, IMX_AITC_NIMASK);
250} 289}
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index d0f2b597db12..8e126e6b74c3 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -146,7 +146,7 @@ static struct clk pxa27x_clks[] = {
146 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev), 146 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev),
147 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev), 147 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev),
148 148
149 INIT_CKEN("USBCLK", USB, 48000000, 0, &pxa27x_device_ohci.dev), 149 INIT_CKEN("USBCLK", USBHOST, 48000000, 0, &pxa27x_device_ohci.dev),
150 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev), 150 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev),
151 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL), 151 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL),
152 152
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index 1010f77d977a..74128eb8f8d0 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -23,8 +23,11 @@
23static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = { 23static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
24 24
25 MFP_ADDR_X(GPIO0, GPIO4, 0x0124), 25 MFP_ADDR_X(GPIO0, GPIO4, 0x0124),
26 MFP_ADDR_X(GPIO5, GPIO26, 0x028C), 26 MFP_ADDR_X(GPIO5, GPIO9, 0x028C),
27 MFP_ADDR_X(GPIO27, GPIO62, 0x0400), 27 MFP_ADDR(GPIO10, 0x0458),
28 MFP_ADDR_X(GPIO11, GPIO26, 0x02A0),
29 MFP_ADDR_X(GPIO27, GPIO48, 0x0400),
30 MFP_ADDR_X(GPIO49, GPIO62, 0x045C),
28 MFP_ADDR_X(GPIO63, GPIO73, 0x04B4), 31 MFP_ADDR_X(GPIO63, GPIO73, 0x04B4),
29 MFP_ADDR_X(GPIO74, GPIO98, 0x04F0), 32 MFP_ADDR_X(GPIO74, GPIO98, 0x04F0),
30 MFP_ADDR_X(GPIO99, GPIO127, 0x0600), 33 MFP_ADDR_X(GPIO99, GPIO127, 0x0600),
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 71766ac0328b..422afee88169 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -309,6 +309,7 @@ void ssp_exit(struct ssp_dev *dev)
309 309
310 if (dev->port > PXA_SSP_PORTS || dev->port == 0) { 310 if (dev->port > PXA_SSP_PORTS || dev->port == 0) {
311 printk(KERN_WARNING "SSP: tried to close invalid port\n"); 311 printk(KERN_WARNING "SSP: tried to close invalid port\n");
312 mutex_unlock(&mutex);
312 return; 313 return;
313 } 314 }
314 315
diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
index 74c5c62365a8..0e2b5cd81f67 100644
--- a/arch/mips/kernel/csrc-r4k.c
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -5,6 +5,10 @@
5 * 5 *
6 * Copyright (C) 2007 by Ralf Baechle 6 * Copyright (C) 2007 by Ralf Baechle
7 */ 7 */
8#include <linux/clocksource.h>
9#include <linux/init.h>
10
11#include <asm/time.h>
8 12
9static cycle_t c0_hpt_read(void) 13static cycle_t c0_hpt_read(void)
10{ 14{
@@ -18,7 +22,7 @@ static struct clocksource clocksource_mips = {
18 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 22 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
19}; 23};
20 24
21static void __init init_mips_clocksource(void) 25void __init init_mips_clocksource(void)
22{ 26{
23 /* Calclate a somewhat reasonable rating value */ 27 /* Calclate a somewhat reasonable rating value */
24 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000; 28 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c
index 5443ea3596f8..bc647cb77298 100644
--- a/arch/mips/pci/pci-bcm1480.c
+++ b/arch/mips/pci/pci-bcm1480.c
@@ -76,8 +76,7 @@ static inline void WRITECFG32(u32 addr, u32 data)
76 76
77int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 77int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
78{ 78{
79 This is b0rked. 79 return K_BCM1480_INT_PCI_INTA + pin;
80 return dev->irq;
81} 80}
82 81
83/* Do platform specific device initialization at pci_enable_device() time */ 82/* Do platform specific device initialization at pci_enable_device() time */
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 053cac19f714..52e95c2158c0 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -638,18 +638,18 @@ void rtas_halt(void)
638/* Must be in the RMO region, so we place it here */ 638/* Must be in the RMO region, so we place it here */
639static char rtas_os_term_buf[2048]; 639static char rtas_os_term_buf[2048];
640 640
641void rtas_panic_msg(char *str) 641void rtas_os_term(char *str)
642{
643 snprintf(rtas_os_term_buf, 2048, "OS panic: %s", str);
644}
645
646void rtas_os_term(void)
647{ 642{
648 int status; 643 int status;
649 644
645 if (panic_timeout)
646 return;
647
650 if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term")) 648 if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term"))
651 return; 649 return;
652 650
651 snprintf(rtas_os_term_buf, 2048, "OS panic: %s", str);
652
653 do { 653 do {
654 status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL, 654 status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL,
655 __pa(rtas_os_term_buf)); 655 __pa(rtas_os_term_buf));
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index fdeefe54ea91..fdb9b1c8f977 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -507,8 +507,7 @@ define_machine(pseries) {
507 .restart = rtas_restart, 507 .restart = rtas_restart,
508 .power_off = pSeries_power_off, 508 .power_off = pSeries_power_off,
509 .halt = rtas_halt, 509 .halt = rtas_halt,
510 .panic = rtas_panic_msg, 510 .panic = rtas_os_term,
511 .machine_shutdown = rtas_os_term,
512 .get_boot_time = rtas_get_boot_time, 511 .get_boot_time = rtas_get_boot_time,
513 .get_rtc_time = rtas_get_rtc_time, 512 .get_rtc_time = rtas_get_rtc_time,
514 .set_rtc_time = rtas_set_rtc_time, 513 .set_rtc_time = rtas_set_rtc_time,
diff --git a/arch/ppc/configs/ml300_defconfig b/arch/ppc/configs/ml300_defconfig
index 69bad91a6b65..d66cacdb95be 100644
--- a/arch/ppc/configs/ml300_defconfig
+++ b/arch/ppc/configs/ml300_defconfig
@@ -719,7 +719,7 @@ CONFIG_DEBUG_INFO=y
719CONFIG_FORCED_INLINING=y 719CONFIG_FORCED_INLINING=y
720# CONFIG_RCU_TORTURE_TEST is not set 720# CONFIG_RCU_TORTURE_TEST is not set
721# CONFIG_KGDB is not set 721# CONFIG_KGDB is not set
722CONFIG_XMON=y 722# CONFIG_XMON is not set
723# CONFIG_BDI_SWITCH is not set 723# CONFIG_BDI_SWITCH is not set
724# CONFIG_SERIAL_TEXT_DEBUG is not set 724# CONFIG_SERIAL_TEXT_DEBUG is not set
725 725
diff --git a/arch/ppc/configs/ml403_defconfig b/arch/ppc/configs/ml403_defconfig
index a78896ea4560..71bcfa7ab7f7 100644
--- a/arch/ppc/configs/ml403_defconfig
+++ b/arch/ppc/configs/ml403_defconfig
@@ -720,7 +720,7 @@ CONFIG_DEBUG_INFO=y
720CONFIG_FORCED_INLINING=y 720CONFIG_FORCED_INLINING=y
721# CONFIG_RCU_TORTURE_TEST is not set 721# CONFIG_RCU_TORTURE_TEST is not set
722# CONFIG_KGDB is not set 722# CONFIG_KGDB is not set
723CONFIG_XMON=y 723# CONFIG_XMON is not set
724# CONFIG_BDI_SWITCH is not set 724# CONFIG_BDI_SWITCH is not set
725# CONFIG_SERIAL_TEXT_DEBUG is not set 725# CONFIG_SERIAL_TEXT_DEBUG is not set
726 726
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index e0ac74e5d4c4..717f5d3440e3 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -8,6 +8,13 @@ config UML_X86
8 bool 8 bool
9 default y 9 default y
10 10
11config X86_32
12 bool
13 default y
14
15config RWSEM_XCHGADD_ALGORITHM
16 def_bool y
17
11config 64BIT 18config 64BIT
12 bool 19 bool
13 default n 20 default n
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index b88e93b3a39f..025764089ac8 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -74,10 +74,16 @@ void generic_free(void *data)
74 74
75int generic_console_write(int fd, const char *buf, int n) 75int generic_console_write(int fd, const char *buf, int n)
76{ 76{
77 sigset_t old, no_sigio;
77 struct termios save, new; 78 struct termios save, new;
78 int err; 79 int err;
79 80
80 if (isatty(fd)) { 81 if (isatty(fd)) {
82 sigemptyset(&no_sigio);
83 sigaddset(&no_sigio, SIGIO);
84 if (sigprocmask(SIG_BLOCK, &no_sigio, &old))
85 goto error;
86
81 CATCH_EINTR(err = tcgetattr(fd, &save)); 87 CATCH_EINTR(err = tcgetattr(fd, &save));
82 if (err) 88 if (err)
83 goto error; 89 goto error;
@@ -97,8 +103,11 @@ int generic_console_write(int fd, const char *buf, int n)
97 * Restore raw mode, in any case; we *must* ignore any error apart 103 * Restore raw mode, in any case; we *must* ignore any error apart
98 * EINTR, except for debug. 104 * EINTR, except for debug.
99 */ 105 */
100 if (isatty(fd)) 106 if (isatty(fd)) {
101 CATCH_EINTR(tcsetattr(fd, TCSAFLUSH, &save)); 107 CATCH_EINTR(tcsetattr(fd, TCSAFLUSH, &save));
108 sigprocmask(SIG_SETMASK, &old, NULL);
109 }
110
102 return err; 111 return err;
103error: 112error:
104 return -errno; 113 return -errno;
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index ef02d941c2ad..e49280599465 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -77,6 +77,7 @@ long long os_nsecs(void)
77#ifdef UML_CONFIG_NO_HZ 77#ifdef UML_CONFIG_NO_HZ
78static int after_sleep_interval(struct timespec *ts) 78static int after_sleep_interval(struct timespec *ts)
79{ 79{
80 return 0;
80} 81}
81#else 82#else
82static inline long long timespec_to_us(const struct timespec *ts) 83static inline long long timespec_to_us(const struct timespec *ts)
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 8bb482ff091b..9a5fa0abfcc7 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -22,6 +22,7 @@
22#include <asm/nmi.h> 22#include <asm/nmi.h>
23#include <asm/hw_irq.h> 23#include <asm/hw_irq.h>
24#include <asm/apic.h> 24#include <asm/apic.h>
25#include <asm/hpet.h>
25#include <linux/kdebug.h> 26#include <linux/kdebug.h>
26#include <asm/smp.h> 27#include <asm/smp.h>
27 28
@@ -140,5 +141,8 @@ void machine_crash_shutdown(struct pt_regs *regs)
140#if defined(CONFIG_X86_IO_APIC) 141#if defined(CONFIG_X86_IO_APIC)
141 disable_IO_APIC(); 142 disable_IO_APIC();
142#endif 143#endif
144#ifdef CONFIG_HPET_TIMER
145 hpet_disable();
146#endif
143 crash_save_cpu(regs, safe_smp_processor_id()); 147 crash_save_cpu(regs, safe_smp_processor_id());
144} 148}
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 374b7ece8961..ac0637a6d71c 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -193,6 +193,12 @@ default_entry:
193 jb 10b 193 jb 10b
194 movl %edi,(init_pg_tables_end - __PAGE_OFFSET) 194 movl %edi,(init_pg_tables_end - __PAGE_OFFSET)
195 195
196 /* Do an early initialization of the fixmap area */
197 movl $(swapper_pg_dir - __PAGE_OFFSET), %edx
198 movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax
199 addl $0x007, %eax /* 0x007 = PRESENT+RW+USER */
200 movl %eax, 4092(%edx)
201
196 xorl %ebx,%ebx /* This is the boot CPU (BSP) */ 202 xorl %ebx,%ebx /* This is the boot CPU (BSP) */
197 jmp 3f 203 jmp 3f
198/* 204/*
@@ -208,12 +214,6 @@ default_entry:
208.section .init.text,"ax",@progbits 214.section .init.text,"ax",@progbits
209#endif 215#endif
210 216
211 /* Do an early initialization of the fixmap area */
212 movl $(swapper_pg_dir - __PAGE_OFFSET), %edx
213 movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax
214 addl $0x007, %eax /* 0x007 = PRESENT+RW+USER */
215 movl %eax, 4092(%edx)
216
217#ifdef CONFIG_SMP 217#ifdef CONFIG_SMP
218ENTRY(startup_32_smp) 218ENTRY(startup_32_smp)
219 cld 219 cld
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 53303f2e5475..4a86ffd67ec5 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -446,6 +446,20 @@ static __init int hpet_late_init(void)
446} 446}
447fs_initcall(hpet_late_init); 447fs_initcall(hpet_late_init);
448 448
449void hpet_disable(void)
450{
451 if (is_hpet_capable()) {
452 unsigned long cfg = hpet_readl(HPET_CFG);
453
454 if (hpet_legacy_int_enabled) {
455 cfg &= ~HPET_CFG_LEGACY;
456 hpet_legacy_int_enabled = 0;
457 }
458 cfg &= ~HPET_CFG_ENABLE;
459 hpet_writel(cfg, HPET_CFG);
460 }
461}
462
449#ifdef CONFIG_HPET_EMULATE_RTC 463#ifdef CONFIG_HPET_EMULATE_RTC
450 464
451/* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET 465/* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET
diff --git a/arch/x86/kernel/reboot_32.c b/arch/x86/kernel/reboot_32.c
index 9e2269d00918..bb1a0f889c5e 100644
--- a/arch/x86/kernel/reboot_32.c
+++ b/arch/x86/kernel/reboot_32.c
@@ -11,6 +11,7 @@
11#include <linux/reboot.h> 11#include <linux/reboot.h>
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13#include <asm/apic.h> 13#include <asm/apic.h>
14#include <asm/hpet.h>
14#include <asm/desc.h> 15#include <asm/desc.h>
15#include "mach_reboot.h" 16#include "mach_reboot.h"
16#include <asm/reboot_fixups.h> 17#include <asm/reboot_fixups.h>
@@ -326,6 +327,9 @@ static void native_machine_shutdown(void)
326#ifdef CONFIG_X86_IO_APIC 327#ifdef CONFIG_X86_IO_APIC
327 disable_IO_APIC(); 328 disable_IO_APIC();
328#endif 329#endif
330#ifdef CONFIG_HPET_TIMER
331 hpet_disable();
332#endif
329} 333}
330 334
331void __attribute__((weak)) mach_reboot_fixups(void) 335void __attribute__((weak)) mach_reboot_fixups(void)
diff --git a/arch/x86/kernel/reboot_64.c b/arch/x86/kernel/reboot_64.c
index 71b13c5f5817..53620a92a8fd 100644
--- a/arch/x86/kernel/reboot_64.c
+++ b/arch/x86/kernel/reboot_64.c
@@ -17,6 +17,7 @@
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
19#include <asm/apic.h> 19#include <asm/apic.h>
20#include <asm/hpet.h>
20#include <asm/gart.h> 21#include <asm/gart.h>
21 22
22/* 23/*
@@ -113,6 +114,9 @@ void machine_shutdown(void)
113 114
114 disable_IO_APIC(); 115 disable_IO_APIC();
115 116
117#ifdef CONFIG_HPET_TIMER
118 hpet_disable();
119#endif
116 local_irq_restore(flags); 120 local_irq_restore(flags);
117 121
118 pci_iommu_shutdown(); 122 pci_iommu_shutdown();
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
index a474ca2334d5..954ac8ce958a 100644
--- a/drivers/acpi/dispatcher/dsobject.c
+++ b/drivers/acpi/dispatcher/dsobject.c
@@ -137,6 +137,71 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
137 return_ACPI_STATUS(status); 137 return_ACPI_STATUS(status);
138 } 138 }
139 } 139 }
140
141 /* Special object resolution for elements of a package */
142
143 if ((op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
144 (op->common.parent->common.aml_opcode ==
145 AML_VAR_PACKAGE_OP)) {
146 /*
147 * Attempt to resolve the node to a value before we insert it into
148 * the package. If this is a reference to a common data type,
149 * resolve it immediately. According to the ACPI spec, package
150 * elements can only be "data objects" or method references.
151 * Attempt to resolve to an Integer, Buffer, String or Package.
152 * If cannot, return the named reference (for things like Devices,
153 * Methods, etc.) Buffer Fields and Fields will resolve to simple
154 * objects (int/buf/str/pkg).
155 *
156 * NOTE: References to things like Devices, Methods, Mutexes, etc.
157 * will remain as named references. This behavior is not described
158 * in the ACPI spec, but it appears to be an oversight.
159 */
160 obj_desc = (union acpi_operand_object *)op->common.node;
161
162 status =
163 acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
164 (struct
165 acpi_namespace_node,
166 &obj_desc),
167 walk_state);
168 if (ACPI_FAILURE(status)) {
169 return_ACPI_STATUS(status);
170 }
171
172 switch (op->common.node->type) {
173 /*
174 * For these types, we need the actual node, not the subobject.
175 * However, the subobject got an extra reference count above.
176 */
177 case ACPI_TYPE_MUTEX:
178 case ACPI_TYPE_METHOD:
179 case ACPI_TYPE_POWER:
180 case ACPI_TYPE_PROCESSOR:
181 case ACPI_TYPE_EVENT:
182 case ACPI_TYPE_REGION:
183 case ACPI_TYPE_DEVICE:
184 case ACPI_TYPE_THERMAL:
185
186 obj_desc =
187 (union acpi_operand_object *)op->common.
188 node;
189 break;
190
191 default:
192 break;
193 }
194
195 /*
196 * If above resolved to an operand object, we are done. Otherwise,
197 * we have a NS node, we must create the package entry as a named
198 * reference.
199 */
200 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) !=
201 ACPI_DESC_TYPE_NAMED) {
202 goto exit;
203 }
204 }
140 } 205 }
141 206
142 /* Create and init a new internal ACPI object */ 207 /* Create and init a new internal ACPI object */
@@ -156,6 +221,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
156 return_ACPI_STATUS(status); 221 return_ACPI_STATUS(status);
157 } 222 }
158 223
224 exit:
159 *obj_desc_ptr = obj_desc; 225 *obj_desc_ptr = obj_desc;
160 return_ACPI_STATUS(AE_OK); 226 return_ACPI_STATUS(AE_OK);
161} 227}
@@ -356,12 +422,25 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
356 arg = arg->common.next; 422 arg = arg->common.next;
357 for (i = 0; arg && (i < element_count); i++) { 423 for (i = 0; arg && (i < element_count); i++) {
358 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { 424 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
359 425 if (arg->common.node->type == ACPI_TYPE_METHOD) {
360 /* This package element is already built, just get it */ 426 /*
361 427 * A method reference "looks" to the parser to be a method
362 obj_desc->package.elements[i] = 428 * invocation, so we special case it here
363 ACPI_CAST_PTR(union acpi_operand_object, 429 */
364 arg->common.node); 430 arg->common.aml_opcode = AML_INT_NAMEPATH_OP;
431 status =
432 acpi_ds_build_internal_object(walk_state,
433 arg,
434 &obj_desc->
435 package.
436 elements[i]);
437 } else {
438 /* This package element is already built, just get it */
439
440 obj_desc->package.elements[i] =
441 ACPI_CAST_PTR(union acpi_operand_object,
442 arg->common.node);
443 }
365 } else { 444 } else {
366 status = acpi_ds_build_internal_object(walk_state, arg, 445 status = acpi_ds_build_internal_object(walk_state, arg,
367 &obj_desc-> 446 &obj_desc->
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index c26c61fb36c3..6742d7bc4777 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -29,6 +29,7 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/sched.h>
32#include <linux/cpufreq.h> 33#include <linux/cpufreq.h>
33#include <linux/proc_fs.h> 34#include <linux/proc_fs.h>
34#include <linux/seq_file.h> 35#include <linux/seq_file.h>
@@ -413,7 +414,7 @@ static int acpi_throttling_rdmsr(struct acpi_processor *pr,
413 } else { 414 } else {
414 msr_low = 0; 415 msr_low = 0;
415 msr_high = 0; 416 msr_high = 0;
416 rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, 417 rdmsr_safe(MSR_IA32_THERM_CONTROL,
417 (u32 *)&msr_low , (u32 *) &msr_high); 418 (u32 *)&msr_low , (u32 *) &msr_high);
418 msr = (msr_high << 32) | msr_low; 419 msr = (msr_high << 32) | msr_low;
419 *value = (acpi_integer) msr; 420 *value = (acpi_integer) msr;
@@ -438,7 +439,7 @@ static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
438 "HARDWARE addr space,NOT supported yet\n"); 439 "HARDWARE addr space,NOT supported yet\n");
439 } else { 440 } else {
440 msr = value; 441 msr = value;
441 wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, 442 wrmsr_safe(MSR_IA32_THERM_CONTROL,
442 msr & 0xffffffff, msr >> 32); 443 msr & 0xffffffff, msr >> 32);
443 ret = 0; 444 ret = 0;
444 } 445 }
@@ -572,21 +573,32 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
572 return -ENODEV; 573 return -ENODEV;
573 574
574 pr->throttling.state = 0; 575 pr->throttling.state = 0;
575 local_irq_disable(); 576
576 value = 0; 577 value = 0;
577 ret = acpi_read_throttling_status(pr, &value); 578 ret = acpi_read_throttling_status(pr, &value);
578 if (ret >= 0) { 579 if (ret >= 0) {
579 state = acpi_get_throttling_state(pr, value); 580 state = acpi_get_throttling_state(pr, value);
580 pr->throttling.state = state; 581 pr->throttling.state = state;
581 } 582 }
582 local_irq_enable();
583 583
584 return 0; 584 return 0;
585} 585}
586 586
587static int acpi_processor_get_throttling(struct acpi_processor *pr) 587static int acpi_processor_get_throttling(struct acpi_processor *pr)
588{ 588{
589 return pr->throttling.acpi_processor_get_throttling(pr); 589 cpumask_t saved_mask;
590 int ret;
591
592 /*
593 * Migrate task to the cpu pointed by pr.
594 */
595 saved_mask = current->cpus_allowed;
596 set_cpus_allowed(current, cpumask_of_cpu(pr->id));
597 ret = pr->throttling.acpi_processor_get_throttling(pr);
598 /* restore the previous state */
599 set_cpus_allowed(current, saved_mask);
600
601 return ret;
590} 602}
591 603
592static int acpi_processor_get_fadt_info(struct acpi_processor *pr) 604static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
@@ -717,21 +729,29 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
717 if (state < pr->throttling_platform_limit) 729 if (state < pr->throttling_platform_limit)
718 return -EPERM; 730 return -EPERM;
719 731
720 local_irq_disable();
721 value = 0; 732 value = 0;
722 ret = acpi_get_throttling_value(pr, state, &value); 733 ret = acpi_get_throttling_value(pr, state, &value);
723 if (ret >= 0) { 734 if (ret >= 0) {
724 acpi_write_throttling_state(pr, value); 735 acpi_write_throttling_state(pr, value);
725 pr->throttling.state = state; 736 pr->throttling.state = state;
726 } 737 }
727 local_irq_enable();
728 738
729 return 0; 739 return 0;
730} 740}
731 741
732int acpi_processor_set_throttling(struct acpi_processor *pr, int state) 742int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
733{ 743{
734 return pr->throttling.acpi_processor_set_throttling(pr, state); 744 cpumask_t saved_mask;
745 int ret;
746 /*
747 * Migrate task to the cpu pointed by pr.
748 */
749 saved_mask = current->cpus_allowed;
750 set_cpus_allowed(current, cpumask_of_cpu(pr->id));
751 ret = pr->throttling.acpi_processor_set_throttling(pr, state);
752 /* restore the previous state */
753 set_cpus_allowed(current, saved_mask);
754 return ret;
735} 755}
736 756
737int acpi_processor_get_throttling_info(struct acpi_processor *pr) 757int acpi_processor_get_throttling_info(struct acpi_processor *pr)
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 483269db2c7d..b538e1d22bf2 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -967,6 +967,13 @@ static int piix_broken_suspend(void)
967 }, 967 },
968 }, 968 },
969 { 969 {
970 .ident = "TECRA M3",
971 .matches = {
972 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
973 DMI_MATCH(DMI_PRODUCT_NAME, "Tecra M3"),
974 },
975 },
976 {
970 .ident = "TECRA M5", 977 .ident = "TECRA M5",
971 .matches = { 978 .matches = {
972 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 979 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
@@ -981,6 +988,20 @@ static int piix_broken_suspend(void)
981 }, 988 },
982 }, 989 },
983 { 990 {
991 .ident = "TECRA A8",
992 .matches = {
993 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
994 DMI_MATCH(DMI_PRODUCT_NAME, "TECRA A8"),
995 },
996 },
997 {
998 .ident = "Satellite R25",
999 .matches = {
1000 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1001 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite R25"),
1002 },
1003 },
1004 {
984 .ident = "Satellite U200", 1005 .ident = "Satellite U200",
985 .matches = { 1006 .matches = {
986 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 1007 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
@@ -988,6 +1009,13 @@ static int piix_broken_suspend(void)
988 }, 1009 },
989 }, 1010 },
990 { 1011 {
1012 .ident = "Satellite U200",
1013 .matches = {
1014 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1015 DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE U200"),
1016 },
1017 },
1018 {
991 .ident = "Satellite Pro U200", 1019 .ident = "Satellite Pro U200",
992 .matches = { 1020 .matches = {
993 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 1021 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 33f06277b3be..b514a80f1370 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4185,6 +4185,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4185 /* Devices which get the IVB wrong */ 4185 /* Devices which get the IVB wrong */
4186 { "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB, }, 4186 { "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB, },
4187 { "TSSTcorp CDDVDW SH-S202J", "SB00", ATA_HORKAGE_IVB, }, 4187 { "TSSTcorp CDDVDW SH-S202J", "SB00", ATA_HORKAGE_IVB, },
4188 { "TSSTcorp CDDVDW SH-S202J", "SB01", ATA_HORKAGE_IVB, },
4189 { "TSSTcorp CDDVDW SH-S202N", "SB00", ATA_HORKAGE_IVB, },
4190 { "TSSTcorp CDDVDW SH-S202N", "SB01", ATA_HORKAGE_IVB, },
4188 4191
4189 /* End Marker */ 4192 /* End Marker */
4190 { } 4193 { }
@@ -6964,12 +6967,11 @@ int ata_host_start(struct ata_host *host)
6964 if (ap->ops->port_start) { 6967 if (ap->ops->port_start) {
6965 rc = ap->ops->port_start(ap); 6968 rc = ap->ops->port_start(ap);
6966 if (rc) { 6969 if (rc) {
6967 ata_port_printk(ap, KERN_ERR, "failed to " 6970 if (rc != -ENODEV)
6968 "start port (errno=%d)\n", rc); 6971 dev_printk(KERN_ERR, host->dev, "failed to start port %d (errno=%d)\n", i, rc);
6969 goto err_out; 6972 goto err_out;
6970 } 6973 }
6971 } 6974 }
6972
6973 ata_eh_freeze_port(ap); 6975 ata_eh_freeze_port(ap);
6974 } 6976 }
6975 6977
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 0dac69db1fdf..e6605f038647 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1850,30 +1850,54 @@ static void ata_eh_link_report(struct ata_link *link)
1850 ehc->i.serror & SERR_DEV_XCHG ? "DevExch " : ""); 1850 ehc->i.serror & SERR_DEV_XCHG ? "DevExch " : "");
1851 1851
1852 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { 1852 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
1853 static const char *dma_str[] = {
1854 [DMA_BIDIRECTIONAL] = "bidi",
1855 [DMA_TO_DEVICE] = "out",
1856 [DMA_FROM_DEVICE] = "in",
1857 [DMA_NONE] = "",
1858 };
1859 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); 1853 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
1860 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; 1854 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf;
1855 const u8 *cdb = qc->cdb;
1856 char data_buf[20] = "";
1857 char cdb_buf[70] = "";
1861 1858
1862 if (!(qc->flags & ATA_QCFLAG_FAILED) || 1859 if (!(qc->flags & ATA_QCFLAG_FAILED) ||
1863 qc->dev->link != link || !qc->err_mask) 1860 qc->dev->link != link || !qc->err_mask)
1864 continue; 1861 continue;
1865 1862
1863 if (qc->dma_dir != DMA_NONE) {
1864 static const char *dma_str[] = {
1865 [DMA_BIDIRECTIONAL] = "bidi",
1866 [DMA_TO_DEVICE] = "out",
1867 [DMA_FROM_DEVICE] = "in",
1868 };
1869 static const char *prot_str[] = {
1870 [ATA_PROT_PIO] = "pio",
1871 [ATA_PROT_DMA] = "dma",
1872 [ATA_PROT_NCQ] = "ncq",
1873 [ATA_PROT_ATAPI] = "pio",
1874 [ATA_PROT_ATAPI_DMA] = "dma",
1875 };
1876
1877 snprintf(data_buf, sizeof(data_buf), " %s %u %s",
1878 prot_str[qc->tf.protocol], qc->nbytes,
1879 dma_str[qc->dma_dir]);
1880 }
1881
1882 if (is_atapi_taskfile(&qc->tf))
1883 snprintf(cdb_buf, sizeof(cdb_buf),
1884 "cdb %02x %02x %02x %02x %02x %02x %02x %02x "
1885 "%02x %02x %02x %02x %02x %02x %02x %02x\n ",
1886 cdb[0], cdb[1], cdb[2], cdb[3],
1887 cdb[4], cdb[5], cdb[6], cdb[7],
1888 cdb[8], cdb[9], cdb[10], cdb[11],
1889 cdb[12], cdb[13], cdb[14], cdb[15]);
1890
1866 ata_dev_printk(qc->dev, KERN_ERR, 1891 ata_dev_printk(qc->dev, KERN_ERR,
1867 "cmd %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x " 1892 "cmd %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x "
1868 "tag %d cdb 0x%x data %u %s\n " 1893 "tag %d%s\n %s"
1869 "res %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x " 1894 "res %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x "
1870 "Emask 0x%x (%s)%s\n", 1895 "Emask 0x%x (%s)%s\n",
1871 cmd->command, cmd->feature, cmd->nsect, 1896 cmd->command, cmd->feature, cmd->nsect,
1872 cmd->lbal, cmd->lbam, cmd->lbah, 1897 cmd->lbal, cmd->lbam, cmd->lbah,
1873 cmd->hob_feature, cmd->hob_nsect, 1898 cmd->hob_feature, cmd->hob_nsect,
1874 cmd->hob_lbal, cmd->hob_lbam, cmd->hob_lbah, 1899 cmd->hob_lbal, cmd->hob_lbam, cmd->hob_lbah,
1875 cmd->device, qc->tag, qc->cdb[0], qc->nbytes, 1900 cmd->device, qc->tag, data_buf, cdb_buf,
1876 dma_str[qc->dma_dir],
1877 res->command, res->feature, res->nsect, 1901 res->command, res->feature, res->nsect,
1878 res->lbal, res->lbam, res->lbah, 1902 res->lbal, res->lbam, res->lbah,
1879 res->hob_feature, res->hob_nsect, 1903 res->hob_feature, res->hob_nsect,
diff --git a/drivers/ata/pata_at32.c b/drivers/ata/pata_at32.c
index bb250a48e27c..67e574de31e8 100644
--- a/drivers/ata/pata_at32.c
+++ b/drivers/ata/pata_at32.c
@@ -28,7 +28,7 @@
28#include <asm/arch/smc.h> 28#include <asm/arch/smc.h>
29 29
30#define DRV_NAME "pata_at32" 30#define DRV_NAME "pata_at32"
31#define DRV_VERSION "0.0.2" 31#define DRV_VERSION "0.0.3"
32 32
33/* 33/*
34 * CompactFlash controller memory layout relative to the base address: 34 * CompactFlash controller memory layout relative to the base address:
@@ -64,6 +64,8 @@
64 * Mode 2 | 8.3 | 240 ns | 0x07 64 * Mode 2 | 8.3 | 240 ns | 0x07
65 * Mode 3 | 11.1 | 180 ns | 0x0f 65 * Mode 3 | 11.1 | 180 ns | 0x0f
66 * Mode 4 | 16.7 | 120 ns | 0x1f 66 * Mode 4 | 16.7 | 120 ns | 0x1f
67 *
68 * Alter PIO_MASK below according to table to set maximal PIO mode.
67 */ 69 */
68#define PIO_MASK (0x1f) 70#define PIO_MASK (0x1f)
69 71
@@ -85,36 +87,40 @@ struct at32_ide_info {
85 */ 87 */
86static int pata_at32_setup_timing(struct device *dev, 88static int pata_at32_setup_timing(struct device *dev,
87 struct at32_ide_info *info, 89 struct at32_ide_info *info,
88 const struct ata_timing *timing) 90 const struct ata_timing *ata)
89{ 91{
90 /* These two values are found through testing */
91 const int min_recover = 25;
92 const int ncs_hold = 15;
93
94 struct smc_config *smc = &info->smc; 92 struct smc_config *smc = &info->smc;
93 struct smc_timing timing;
95 94
96 int active; 95 int active;
97 int recover; 96 int recover;
98 97
98 memset(&timing, 0, sizeof(struct smc_timing));
99
99 /* Total cycle time */ 100 /* Total cycle time */
100 smc->read_cycle = timing->cyc8b; 101 timing.read_cycle = ata->cyc8b;
101 102
102 /* DIOR <= CFIOR timings */ 103 /* DIOR <= CFIOR timings */
103 smc->nrd_setup = timing->setup; 104 timing.nrd_setup = ata->setup;
104 smc->nrd_pulse = timing->act8b; 105 timing.nrd_pulse = ata->act8b;
106 timing.nrd_recover = ata->rec8b;
107
108 /* Convert nanosecond timing to clock cycles */
109 smc_set_timing(smc, &timing);
105 110
106 /* Compute recover, extend total cycle if needed */ 111 /* Add one extra cycle setup due to signal ring */
107 active = smc->nrd_setup + smc->nrd_pulse; 112 smc->nrd_setup = smc->nrd_setup + 1;
113
114 active = smc->nrd_setup + smc->nrd_pulse;
108 recover = smc->read_cycle - active; 115 recover = smc->read_cycle - active;
109 116
110 if (recover < min_recover) { 117 /* Need at least two cycles recovery */
111 smc->read_cycle = active + min_recover; 118 if (recover < 2)
112 recover = min_recover; 119 smc->read_cycle = active + 2;
113 }
114 120
115 /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */ 121 /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */
116 smc->ncs_read_setup = 0; 122 smc->ncs_read_setup = 1;
117 smc->ncs_read_pulse = active + ncs_hold; 123 smc->ncs_read_pulse = smc->read_cycle - 2;
118 124
119 /* Write timings same as read timings */ 125 /* Write timings same as read timings */
120 smc->write_cycle = smc->read_cycle; 126 smc->write_cycle = smc->read_cycle;
@@ -123,11 +129,13 @@ static int pata_at32_setup_timing(struct device *dev,
123 smc->ncs_write_setup = smc->ncs_read_setup; 129 smc->ncs_write_setup = smc->ncs_read_setup;
124 smc->ncs_write_pulse = smc->ncs_read_pulse; 130 smc->ncs_write_pulse = smc->ncs_read_pulse;
125 131
126 /* Do some debugging output */ 132 /* Do some debugging output of ATA and SMC timings */
127 dev_dbg(dev, "SMC: C=%d S=%d P=%d R=%d NCSS=%d NCSP=%d NCSR=%d\n", 133 dev_dbg(dev, "ATA: C=%d S=%d P=%d R=%d\n",
134 ata->cyc8b, ata->setup, ata->act8b, ata->rec8b);
135
136 dev_dbg(dev, "SMC: C=%d S=%d P=%d NS=%d NP=%d\n",
128 smc->read_cycle, smc->nrd_setup, smc->nrd_pulse, 137 smc->read_cycle, smc->nrd_setup, smc->nrd_pulse,
129 recover, smc->ncs_read_setup, smc->ncs_read_pulse, 138 smc->ncs_read_setup, smc->ncs_read_pulse);
130 smc->read_cycle - smc->ncs_read_pulse);
131 139
132 /* Finally, configure the SMC */ 140 /* Finally, configure the SMC */
133 return smc_set_configuration(info->cs, smc); 141 return smc_set_configuration(info->cs, smc);
@@ -182,7 +190,6 @@ static struct scsi_host_template at32_sht = {
182}; 190};
183 191
184static struct ata_port_operations at32_port_ops = { 192static struct ata_port_operations at32_port_ops = {
185 .port_disable = ata_port_disable,
186 .set_piomode = pata_at32_set_piomode, 193 .set_piomode = pata_at32_set_piomode,
187 .tf_load = ata_tf_load, 194 .tf_load = ata_tf_load,
188 .tf_read = ata_tf_read, 195 .tf_read = ata_tf_read,
@@ -203,7 +210,6 @@ static struct ata_port_operations at32_port_ops = {
203 210
204 .irq_clear = pata_at32_irq_clear, 211 .irq_clear = pata_at32_irq_clear,
205 .irq_on = ata_irq_on, 212 .irq_on = ata_irq_on,
206 .irq_ack = ata_irq_ack,
207 213
208 .port_start = ata_sff_port_start, 214 .port_start = ata_sff_port_start,
209}; 215};
@@ -223,8 +229,7 @@ static int __init pata_at32_init_one(struct device *dev,
223 /* Setup ATA bindings */ 229 /* Setup ATA bindings */
224 ap->ops = &at32_port_ops; 230 ap->ops = &at32_port_ops;
225 ap->pio_mask = PIO_MASK; 231 ap->pio_mask = PIO_MASK;
226 ap->flags = ATA_FLAG_MMIO | ATA_FLAG_SLAVE_POSS 232 ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_SLAVE_POSS;
227 | ATA_FLAG_PIO_POLLING;
228 233
229 /* 234 /*
230 * Since all 8-bit taskfile transfers has to go on the lower 235 * Since all 8-bit taskfile transfers has to go on the lower
@@ -357,12 +362,12 @@ static int __init pata_at32_probe(struct platform_device *pdev)
357 info->smc.tdf_mode = 0; /* TDF optimization disabled */ 362 info->smc.tdf_mode = 0; /* TDF optimization disabled */
358 info->smc.tdf_cycles = 0; /* No TDF wait cycles */ 363 info->smc.tdf_cycles = 0; /* No TDF wait cycles */
359 364
360 /* Setup ATA timing */ 365 /* Setup SMC to ATA timing */
361 ret = pata_at32_setup_timing(dev, info, &initial_timing); 366 ret = pata_at32_setup_timing(dev, info, &initial_timing);
362 if (ret) 367 if (ret)
363 goto err_setup_timing; 368 goto err_setup_timing;
364 369
365 /* Setup ATA addresses */ 370 /* Map ATA address space */
366 ret = -ENOMEM; 371 ret = -ENOMEM;
367 info->ide_addr = devm_ioremap(dev, info->res_ide.start, 16); 372 info->ide_addr = devm_ioremap(dev, info->res_ide.start, 16);
368 info->alt_addr = devm_ioremap(dev, info->res_alt.start, 16); 373 info->alt_addr = devm_ioremap(dev, info->res_alt.start, 16);
@@ -373,7 +378,7 @@ static int __init pata_at32_probe(struct platform_device *pdev)
373 pata_at32_debug_bus(dev, info); 378 pata_at32_debug_bus(dev, info);
374#endif 379#endif
375 380
376 /* Register ATA device */ 381 /* Setup and register ATA device */
377 ret = pata_at32_init_one(dev, info); 382 ret = pata_at32_init_one(dev, info);
378 if (ret) 383 if (ret)
379 goto err_ata_device; 384 goto err_ata_device;
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 81db405a5445..088a41f4e656 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1489,6 +1489,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
1489 int board_idx = 0; 1489 int board_idx = 0;
1490 struct resource *res; 1490 struct resource *res;
1491 struct ata_host *host; 1491 struct ata_host *host;
1492 unsigned int fsclk = get_sclk();
1493 int udma_mode = 5;
1492 const struct ata_port_info *ppi[] = 1494 const struct ata_port_info *ppi[] =
1493 { &bfin_port_info[board_idx], NULL }; 1495 { &bfin_port_info[board_idx], NULL };
1494 1496
@@ -1507,6 +1509,11 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
1507 if (res == NULL) 1509 if (res == NULL)
1508 return -EINVAL; 1510 return -EINVAL;
1509 1511
1512 while (bfin_port_info[board_idx].udma_mask>0 && udma_fsclk[udma_mode] > fsclk) {
1513 udma_mode--;
1514 bfin_port_info[board_idx].udma_mask >>= 1;
1515 }
1516
1510 /* 1517 /*
1511 * Now that that's out of the way, wire up the port.. 1518 * Now that that's out of the way, wire up the port..
1512 */ 1519 */
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index a43f64d2775b..8d864e5e97ed 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -164,10 +164,14 @@ enum {
164 MV_PCI_ERR_ATTRIBUTE = 0x1d48, 164 MV_PCI_ERR_ATTRIBUTE = 0x1d48,
165 MV_PCI_ERR_COMMAND = 0x1d50, 165 MV_PCI_ERR_COMMAND = 0x1d50,
166 166
167 PCI_IRQ_CAUSE_OFS = 0x1d58, 167 PCI_IRQ_CAUSE_OFS = 0x1d58,
168 PCI_IRQ_MASK_OFS = 0x1d5c, 168 PCI_IRQ_MASK_OFS = 0x1d5c,
169 PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */ 169 PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */
170 170
171 PCIE_IRQ_CAUSE_OFS = 0x1900,
172 PCIE_IRQ_MASK_OFS = 0x1910,
173 PCIE_UNMASK_ALL_IRQS = 0x70a, /* assorted bits */
174
171 HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, 175 HC_MAIN_IRQ_CAUSE_OFS = 0x1d60,
172 HC_MAIN_IRQ_MASK_OFS = 0x1d64, 176 HC_MAIN_IRQ_MASK_OFS = 0x1d64,
173 PORT0_ERR = (1 << 0), /* shift by port # */ 177 PORT0_ERR = (1 << 0), /* shift by port # */
@@ -303,6 +307,7 @@ enum {
303 MV_HP_GEN_I = (1 << 6), /* Generation I: 50xx */ 307 MV_HP_GEN_I = (1 << 6), /* Generation I: 50xx */
304 MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */ 308 MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */
305 MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */ 309 MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */
310 MV_HP_PCIE = (1 << 9), /* PCIe bus/regs: 7042 */
306 311
307 /* Port private flags (pp_flags) */ 312 /* Port private flags (pp_flags) */
308 MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ 313 MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */
@@ -388,7 +393,15 @@ struct mv_port_signal {
388 u32 pre; 393 u32 pre;
389}; 394};
390 395
391struct mv_host_priv; 396struct mv_host_priv {
397 u32 hp_flags;
398 struct mv_port_signal signal[8];
399 const struct mv_hw_ops *ops;
400 u32 irq_cause_ofs;
401 u32 irq_mask_ofs;
402 u32 unmask_all_irqs;
403};
404
392struct mv_hw_ops { 405struct mv_hw_ops {
393 void (*phy_errata)(struct mv_host_priv *hpriv, void __iomem *mmio, 406 void (*phy_errata)(struct mv_host_priv *hpriv, void __iomem *mmio,
394 unsigned int port); 407 unsigned int port);
@@ -401,12 +414,6 @@ struct mv_hw_ops {
401 void (*reset_bus)(struct pci_dev *pdev, void __iomem *mmio); 414 void (*reset_bus)(struct pci_dev *pdev, void __iomem *mmio);
402}; 415};
403 416
404struct mv_host_priv {
405 u32 hp_flags;
406 struct mv_port_signal signal[8];
407 const struct mv_hw_ops *ops;
408};
409
410static void mv_irq_clear(struct ata_port *ap); 417static void mv_irq_clear(struct ata_port *ap);
411static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val); 418static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val);
412static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); 419static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val);
@@ -631,11 +638,13 @@ static const struct pci_device_id mv_pci_tbl[] = {
631 /* Adaptec 1430SA */ 638 /* Adaptec 1430SA */
632 { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 }, 639 { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 },
633 640
634 { PCI_VDEVICE(TTI, 0x2310), chip_7042 }, 641 /* Marvell 7042 support */
635
636 /* add Marvell 7042 support */
637 { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 }, 642 { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 },
638 643
644 /* Highpoint RocketRAID PCIe series */
645 { PCI_VDEVICE(TTI, 0x2300), chip_7042 },
646 { PCI_VDEVICE(TTI, 0x2310), chip_7042 },
647
639 { } /* terminate list */ 648 { } /* terminate list */
640}; 649};
641 650
@@ -1648,13 +1657,14 @@ static void mv_host_intr(struct ata_host *host, u32 relevant, unsigned int hc)
1648 1657
1649static void mv_pci_error(struct ata_host *host, void __iomem *mmio) 1658static void mv_pci_error(struct ata_host *host, void __iomem *mmio)
1650{ 1659{
1660 struct mv_host_priv *hpriv = host->private_data;
1651 struct ata_port *ap; 1661 struct ata_port *ap;
1652 struct ata_queued_cmd *qc; 1662 struct ata_queued_cmd *qc;
1653 struct ata_eh_info *ehi; 1663 struct ata_eh_info *ehi;
1654 unsigned int i, err_mask, printed = 0; 1664 unsigned int i, err_mask, printed = 0;
1655 u32 err_cause; 1665 u32 err_cause;
1656 1666
1657 err_cause = readl(mmio + PCI_IRQ_CAUSE_OFS); 1667 err_cause = readl(mmio + hpriv->irq_cause_ofs);
1658 1668
1659 dev_printk(KERN_ERR, host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n", 1669 dev_printk(KERN_ERR, host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n",
1660 err_cause); 1670 err_cause);
@@ -1662,7 +1672,7 @@ static void mv_pci_error(struct ata_host *host, void __iomem *mmio)
1662 DPRINTK("All regs @ PCI error\n"); 1672 DPRINTK("All regs @ PCI error\n");
1663 mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev)); 1673 mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
1664 1674
1665 writelfl(0, mmio + PCI_IRQ_CAUSE_OFS); 1675 writelfl(0, mmio + hpriv->irq_cause_ofs);
1666 1676
1667 for (i = 0; i < host->n_ports; i++) { 1677 for (i = 0; i < host->n_ports; i++) {
1668 ap = host->ports[i]; 1678 ap = host->ports[i];
@@ -1926,6 +1936,8 @@ static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
1926#define ZERO(reg) writel(0, mmio + (reg)) 1936#define ZERO(reg) writel(0, mmio + (reg))
1927static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio) 1937static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio)
1928{ 1938{
1939 struct ata_host *host = dev_get_drvdata(&pdev->dev);
1940 struct mv_host_priv *hpriv = host->private_data;
1929 u32 tmp; 1941 u32 tmp;
1930 1942
1931 tmp = readl(mmio + MV_PCI_MODE); 1943 tmp = readl(mmio + MV_PCI_MODE);
@@ -1937,8 +1949,8 @@ static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio)
1937 writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); 1949 writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT);
1938 ZERO(HC_MAIN_IRQ_MASK_OFS); 1950 ZERO(HC_MAIN_IRQ_MASK_OFS);
1939 ZERO(MV_PCI_SERR_MASK); 1951 ZERO(MV_PCI_SERR_MASK);
1940 ZERO(PCI_IRQ_CAUSE_OFS); 1952 ZERO(hpriv->irq_cause_ofs);
1941 ZERO(PCI_IRQ_MASK_OFS); 1953 ZERO(hpriv->irq_mask_ofs);
1942 ZERO(MV_PCI_ERR_LOW_ADDRESS); 1954 ZERO(MV_PCI_ERR_LOW_ADDRESS);
1943 ZERO(MV_PCI_ERR_HIGH_ADDRESS); 1955 ZERO(MV_PCI_ERR_HIGH_ADDRESS);
1944 ZERO(MV_PCI_ERR_ATTRIBUTE); 1956 ZERO(MV_PCI_ERR_ATTRIBUTE);
@@ -2170,7 +2182,7 @@ static void mv_phy_reset(struct ata_port *ap, unsigned int *class,
2170 mv_scr_read(ap, SCR_ERROR, &serror); 2182 mv_scr_read(ap, SCR_ERROR, &serror);
2171 mv_scr_read(ap, SCR_CONTROL, &scontrol); 2183 mv_scr_read(ap, SCR_CONTROL, &scontrol);
2172 DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " 2184 DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x "
2173 "SCtrl 0x%08x\n", status, serror, scontrol); 2185 "SCtrl 0x%08x\n", sstatus, serror, scontrol);
2174 } 2186 }
2175#endif 2187#endif
2176 2188
@@ -2490,6 +2502,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2490 break; 2502 break;
2491 2503
2492 case chip_7042: 2504 case chip_7042:
2505 hp_flags |= MV_HP_PCIE;
2493 case chip_6042: 2506 case chip_6042:
2494 hpriv->ops = &mv6xxx_ops; 2507 hpriv->ops = &mv6xxx_ops;
2495 hp_flags |= MV_HP_GEN_IIE; 2508 hp_flags |= MV_HP_GEN_IIE;
@@ -2516,6 +2529,15 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2516 } 2529 }
2517 2530
2518 hpriv->hp_flags = hp_flags; 2531 hpriv->hp_flags = hp_flags;
2532 if (hp_flags & MV_HP_PCIE) {
2533 hpriv->irq_cause_ofs = PCIE_IRQ_CAUSE_OFS;
2534 hpriv->irq_mask_ofs = PCIE_IRQ_MASK_OFS;
2535 hpriv->unmask_all_irqs = PCIE_UNMASK_ALL_IRQS;
2536 } else {
2537 hpriv->irq_cause_ofs = PCI_IRQ_CAUSE_OFS;
2538 hpriv->irq_mask_ofs = PCI_IRQ_MASK_OFS;
2539 hpriv->unmask_all_irqs = PCI_UNMASK_ALL_IRQS;
2540 }
2519 2541
2520 return 0; 2542 return 0;
2521} 2543}
@@ -2595,10 +2617,10 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
2595 } 2617 }
2596 2618
2597 /* Clear any currently outstanding host interrupt conditions */ 2619 /* Clear any currently outstanding host interrupt conditions */
2598 writelfl(0, mmio + PCI_IRQ_CAUSE_OFS); 2620 writelfl(0, mmio + hpriv->irq_cause_ofs);
2599 2621
2600 /* and unmask interrupt generation for host regs */ 2622 /* and unmask interrupt generation for host regs */
2601 writelfl(PCI_UNMASK_ALL_IRQS, mmio + PCI_IRQ_MASK_OFS); 2623 writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs);
2602 2624
2603 if (IS_GEN_I(hpriv)) 2625 if (IS_GEN_I(hpriv))
2604 writelfl(~HC_MAIN_MASKED_IRQS_5, mmio + HC_MAIN_IRQ_MASK_OFS); 2626 writelfl(~HC_MAIN_MASKED_IRQS_5, mmio + HC_MAIN_IRQ_MASK_OFS);
@@ -2609,8 +2631,8 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
2609 "PCI int cause/mask=0x%08x/0x%08x\n", 2631 "PCI int cause/mask=0x%08x/0x%08x\n",
2610 readl(mmio + HC_MAIN_IRQ_CAUSE_OFS), 2632 readl(mmio + HC_MAIN_IRQ_CAUSE_OFS),
2611 readl(mmio + HC_MAIN_IRQ_MASK_OFS), 2633 readl(mmio + HC_MAIN_IRQ_MASK_OFS),
2612 readl(mmio + PCI_IRQ_CAUSE_OFS), 2634 readl(mmio + hpriv->irq_cause_ofs),
2613 readl(mmio + PCI_IRQ_MASK_OFS)); 2635 readl(mmio + hpriv->irq_mask_ofs));
2614 2636
2615done: 2637done:
2616 return rc; 2638 return rc;
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 5fd6688a444a..ddd3a259cea1 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -12,7 +12,7 @@ if CRYPTO_HW
12 12
13config CRYPTO_DEV_PADLOCK 13config CRYPTO_DEV_PADLOCK
14 tristate "Support for VIA PadLock ACE" 14 tristate "Support for VIA PadLock ACE"
15 depends on X86_32 15 depends on X86_32 && !UML
16 select CRYPTO_ALGAPI 16 select CRYPTO_ALGAPI
17 help 17 help
18 Some VIA processors come with an integrated crypto engine 18 Some VIA processors come with an integrated crypto engine
diff --git a/drivers/infiniband/hw/ehca/ehca_av.c b/drivers/infiniband/hw/ehca/ehca_av.c
index 453eb995c1d4..f7782c882ab4 100644
--- a/drivers/infiniband/hw/ehca/ehca_av.c
+++ b/drivers/infiniband/hw/ehca/ehca_av.c
@@ -76,8 +76,12 @@ int ehca_calc_ipd(struct ehca_shca *shca, int port,
76 76
77 link = ib_width_enum_to_int(pa.active_width) * pa.active_speed; 77 link = ib_width_enum_to_int(pa.active_width) * pa.active_speed;
78 78
79 /* IPD = round((link / path) - 1) */ 79 if (path >= link)
80 *ipd = ((link + (path >> 1)) / path) - 1; 80 /* no need to throttle if path faster than link */
81 *ipd = 0;
82 else
83 /* IPD = round((link / path) - 1) */
84 *ipd = ((link + (path >> 1)) / path) - 1;
81 85
82 return 0; 86 return 0;
83} 87}
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index a03a65ebcf0c..c9f6077b615e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -460,6 +460,9 @@ static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid)
460 struct ipoib_dev_priv *priv = netdev_priv(dev); 460 struct ipoib_dev_priv *priv = netdev_priv(dev);
461 struct ipoib_path *path; 461 struct ipoib_path *path;
462 462
463 if (!priv->broadcast)
464 return NULL;
465
463 path = kzalloc(sizeof *path, GFP_ATOMIC); 466 path = kzalloc(sizeof *path, GFP_ATOMIC);
464 if (!path) 467 if (!path)
465 return NULL; 468 return NULL;
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index c6df2925ebd0..d6952959d72a 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -1515,6 +1515,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1515 if (copy_from_user(&iocts, argp, 1515 if (copy_from_user(&iocts, argp,
1516 sizeof(isdn_ioctl_struct))) 1516 sizeof(isdn_ioctl_struct)))
1517 return -EFAULT; 1517 return -EFAULT;
1518 iocts.drvid[sizeof(iocts.drvid)-1] = 0;
1518 if (strlen(iocts.drvid)) { 1519 if (strlen(iocts.drvid)) {
1519 if ((p = strchr(iocts.drvid, ','))) 1520 if ((p = strchr(iocts.drvid, ',')))
1520 *p = 0; 1521 *p = 0;
@@ -1599,6 +1600,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1599 if (copy_from_user(&iocts, argp, 1600 if (copy_from_user(&iocts, argp,
1600 sizeof(isdn_ioctl_struct))) 1601 sizeof(isdn_ioctl_struct)))
1601 return -EFAULT; 1602 return -EFAULT;
1603 iocts.drvid[sizeof(iocts.drvid)-1] = 0;
1602 if (strlen(iocts.drvid)) { 1604 if (strlen(iocts.drvid)) {
1603 drvidx = -1; 1605 drvidx = -1;
1604 for (i = 0; i < ISDN_MAX_DRIVERS; i++) 1606 for (i = 0; i < ISDN_MAX_DRIVERS; i++)
@@ -1643,7 +1645,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1643 } else { 1645 } else {
1644 p = (char __user *) iocts.arg; 1646 p = (char __user *) iocts.arg;
1645 for (i = 0; i < 10; i++) { 1647 for (i = 0; i < 10; i++) {
1646 sprintf(bname, "%s%s", 1648 snprintf(bname, sizeof(bname), "%s%s",
1647 strlen(dev->drv[drvidx]->msn2eaz[i]) ? 1649 strlen(dev->drv[drvidx]->msn2eaz[i]) ?
1648 dev->drv[drvidx]->msn2eaz[i] : "_", 1650 dev->drv[drvidx]->msn2eaz[i] : "_",
1649 (i < 9) ? "," : "\0"); 1651 (i < 9) ? "," : "\0");
@@ -1673,6 +1675,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1673 char *p; 1675 char *p;
1674 if (copy_from_user(&iocts, argp, sizeof(isdn_ioctl_struct))) 1676 if (copy_from_user(&iocts, argp, sizeof(isdn_ioctl_struct)))
1675 return -EFAULT; 1677 return -EFAULT;
1678 iocts.drvid[sizeof(iocts.drvid)-1] = 0;
1676 if (strlen(iocts.drvid)) { 1679 if (strlen(iocts.drvid)) {
1677 if ((p = strchr(iocts.drvid, ','))) 1680 if ((p = strchr(iocts.drvid, ',')))
1678 *p = 0; 1681 *p = 0;
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e8d69b0adf90..d9107e542dfa 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -888,7 +888,7 @@ config SMC91X
888 tristate "SMC 91C9x/91C1xxx support" 888 tristate "SMC 91C9x/91C1xxx support"
889 select CRC32 889 select CRC32
890 select MII 890 select MII
891 depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00 || BFIN 891 depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00 || BLACKFIN
892 help 892 help
893 This is a driver for SMC's 91x series of Ethernet chipsets, 893 This is a driver for SMC's 91x series of Ethernet chipsets,
894 including the SMC91C94 and the SMC91C111. Say Y if you want it 894 including the SMC91C94 and the SMC91C111. Say Y if you want it
@@ -926,7 +926,7 @@ config SMC911X
926 tristate "SMSC LAN911[5678] support" 926 tristate "SMSC LAN911[5678] support"
927 select CRC32 927 select CRC32
928 select MII 928 select MII
929 depends on ARCH_PXA || SUPERH 929 depends on ARCH_PXA || SH_MAGIC_PANEL_R2
930 help 930 help
931 This is a driver for SMSC's LAN911x series of Ethernet chipsets 931 This is a driver for SMSC's LAN911x series of Ethernet chipsets
932 including the new LAN9115, LAN9116, LAN9117, and LAN9118. 932 including the new LAN9115, LAN9116, LAN9117, and LAN9118.
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index eebf5bb2b03a..e7fdd81919bd 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1340,7 +1340,9 @@ static int amd8111e_close(struct net_device * dev)
1340 struct amd8111e_priv *lp = netdev_priv(dev); 1340 struct amd8111e_priv *lp = netdev_priv(dev);
1341 netif_stop_queue(dev); 1341 netif_stop_queue(dev);
1342 1342
1343#ifdef CONFIG_AMD8111E_NAPI
1343 napi_disable(&lp->napi); 1344 napi_disable(&lp->napi);
1345#endif
1344 1346
1345 spin_lock_irq(&lp->lock); 1347 spin_lock_irq(&lp->lock);
1346 1348
@@ -1372,7 +1374,9 @@ static int amd8111e_open(struct net_device * dev )
1372 dev->name, dev)) 1374 dev->name, dev))
1373 return -EAGAIN; 1375 return -EAGAIN;
1374 1376
1377#ifdef CONFIG_AMD8111E_NAPI
1375 napi_enable(&lp->napi); 1378 napi_enable(&lp->napi);
1379#endif
1376 1380
1377 spin_lock_irq(&lp->lock); 1381 spin_lock_irq(&lp->lock);
1378 1382
@@ -1380,7 +1384,9 @@ static int amd8111e_open(struct net_device * dev )
1380 1384
1381 if(amd8111e_restart(dev)){ 1385 if(amd8111e_restart(dev)){
1382 spin_unlock_irq(&lp->lock); 1386 spin_unlock_irq(&lp->lock);
1387#ifdef CONFIG_AMD8111E_NAPI
1383 napi_disable(&lp->napi); 1388 napi_disable(&lp->napi);
1389#endif
1384 if (dev->irq) 1390 if (dev->irq)
1385 free_irq(dev->irq, dev); 1391 free_irq(dev->irq, dev);
1386 return -ENOMEM; 1392 return -ENOMEM;
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 0b99b5549295..eb971755a3ff 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -676,7 +676,7 @@ static void bf537mac_rx(struct net_device *dev)
676 skb->protocol = eth_type_trans(skb, dev); 676 skb->protocol = eth_type_trans(skb, dev);
677#if defined(BFIN_MAC_CSUM_OFFLOAD) 677#if defined(BFIN_MAC_CSUM_OFFLOAD)
678 skb->csum = current_rx_ptr->status.ip_payload_csum; 678 skb->csum = current_rx_ptr->status.ip_payload_csum;
679 skb->ip_summed = CHECKSUM_PARTIAL; 679 skb->ip_summed = CHECKSUM_COMPLETE;
680#endif 680#endif
681 681
682 netif_rx(skb); 682 netif_rx(skb);
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 2dbf8dc116c6..c5975047c89b 100644..100755
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -374,7 +374,9 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
374 "TxInternalMACXmitError", 374 "TxInternalMACXmitError",
375 "TxFramesWithExcessiveDeferral", 375 "TxFramesWithExcessiveDeferral",
376 "TxFCSErrors", 376 "TxFCSErrors",
377 377 "TxJumboFramesOk",
378 "TxJumboOctetsOk",
379
378 "RxOctetsOK", 380 "RxOctetsOK",
379 "RxOctetsBad", 381 "RxOctetsBad",
380 "RxUnicastFramesOK", 382 "RxUnicastFramesOK",
@@ -392,16 +394,17 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
392 "RxInRangeLengthErrors", 394 "RxInRangeLengthErrors",
393 "RxOutOfRangeLengthField", 395 "RxOutOfRangeLengthField",
394 "RxFrameTooLongErrors", 396 "RxFrameTooLongErrors",
397 "RxJumboFramesOk",
398 "RxJumboOctetsOk",
395 399
396 /* Port stats */ 400 /* Port stats */
397 "RxPackets",
398 "RxCsumGood", 401 "RxCsumGood",
399 "TxPackets",
400 "TxCsumOffload", 402 "TxCsumOffload",
401 "TxTso", 403 "TxTso",
402 "RxVlan", 404 "RxVlan",
403 "TxVlan", 405 "TxVlan",
404 406 "TxNeedHeadroom",
407
405 /* Interrupt stats */ 408 /* Interrupt stats */
406 "rx drops", 409 "rx drops",
407 "pure_rsps", 410 "pure_rsps",
@@ -463,23 +466,56 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
463 const struct cmac_statistics *s; 466 const struct cmac_statistics *s;
464 const struct sge_intr_counts *t; 467 const struct sge_intr_counts *t;
465 struct sge_port_stats ss; 468 struct sge_port_stats ss;
466 unsigned int len;
467 469
468 s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL); 470 s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL);
469 471 t = t1_sge_get_intr_counts(adapter->sge);
470 len = sizeof(u64)*(&s->TxFCSErrors + 1 - &s->TxOctetsOK);
471 memcpy(data, &s->TxOctetsOK, len);
472 data += len;
473
474 len = sizeof(u64)*(&s->RxFrameTooLongErrors + 1 - &s->RxOctetsOK);
475 memcpy(data, &s->RxOctetsOK, len);
476 data += len;
477
478 t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss); 472 t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss);
479 memcpy(data, &ss, sizeof(ss));
480 data += sizeof(ss);
481 473
482 t = t1_sge_get_intr_counts(adapter->sge); 474 *data++ = s->TxOctetsOK;
475 *data++ = s->TxOctetsBad;
476 *data++ = s->TxUnicastFramesOK;
477 *data++ = s->TxMulticastFramesOK;
478 *data++ = s->TxBroadcastFramesOK;
479 *data++ = s->TxPauseFrames;
480 *data++ = s->TxFramesWithDeferredXmissions;
481 *data++ = s->TxLateCollisions;
482 *data++ = s->TxTotalCollisions;
483 *data++ = s->TxFramesAbortedDueToXSCollisions;
484 *data++ = s->TxUnderrun;
485 *data++ = s->TxLengthErrors;
486 *data++ = s->TxInternalMACXmitError;
487 *data++ = s->TxFramesWithExcessiveDeferral;
488 *data++ = s->TxFCSErrors;
489 *data++ = s->TxJumboFramesOK;
490 *data++ = s->TxJumboOctetsOK;
491
492 *data++ = s->RxOctetsOK;
493 *data++ = s->RxOctetsBad;
494 *data++ = s->RxUnicastFramesOK;
495 *data++ = s->RxMulticastFramesOK;
496 *data++ = s->RxBroadcastFramesOK;
497 *data++ = s->RxPauseFrames;
498 *data++ = s->RxFCSErrors;
499 *data++ = s->RxAlignErrors;
500 *data++ = s->RxSymbolErrors;
501 *data++ = s->RxDataErrors;
502 *data++ = s->RxSequenceErrors;
503 *data++ = s->RxRuntErrors;
504 *data++ = s->RxJabberErrors;
505 *data++ = s->RxInternalMACRcvError;
506 *data++ = s->RxInRangeLengthErrors;
507 *data++ = s->RxOutOfRangeLengthField;
508 *data++ = s->RxFrameTooLongErrors;
509 *data++ = s->RxJumboFramesOK;
510 *data++ = s->RxJumboOctetsOK;
511
512 *data++ = ss.rx_cso_good;
513 *data++ = ss.tx_cso;
514 *data++ = ss.tx_tso;
515 *data++ = ss.vlan_xtract;
516 *data++ = ss.vlan_insert;
517 *data++ = ss.tx_need_hdrroom;
518
483 *data++ = t->rx_drops; 519 *data++ = t->rx_drops;
484 *data++ = t->pure_rsps; 520 *data++ = t->pure_rsps;
485 *data++ = t->unhandled_irqs; 521 *data++ = t->unhandled_irqs;
diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c
index 678778a8d133..2117c4fbb107 100644..100755
--- a/drivers/net/chelsio/pm3393.c
+++ b/drivers/net/chelsio/pm3393.c
@@ -45,7 +45,7 @@
45 45
46#include <linux/crc32.h> 46#include <linux/crc32.h>
47 47
48#define OFFSET(REG_ADDR) (REG_ADDR << 2) 48#define OFFSET(REG_ADDR) ((REG_ADDR) << 2)
49 49
50/* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */ 50/* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */
51#define MAX_FRAME_SIZE 9600 51#define MAX_FRAME_SIZE 9600
@@ -428,69 +428,26 @@ static int pm3393_set_speed_duplex_fc(struct cmac *cmac, int speed, int duplex,
428 return 0; 428 return 0;
429} 429}
430 430
431static void pm3393_rmon_update(struct adapter *adapter, u32 offs, u64 *val, 431#define RMON_UPDATE(mac, name, stat_name) \
432 int over) 432{ \
433{ 433 t1_tpi_read((mac)->adapter, OFFSET(name), &val0); \
434 u32 val0, val1, val2; 434 t1_tpi_read((mac)->adapter, OFFSET((name)+1), &val1); \
435 435 t1_tpi_read((mac)->adapter, OFFSET((name)+2), &val2); \
436 t1_tpi_read(adapter, offs, &val0); 436 (mac)->stats.stat_name = (u64)(val0 & 0xffff) | \
437 t1_tpi_read(adapter, offs + 4, &val1); 437 ((u64)(val1 & 0xffff) << 16) | \
438 t1_tpi_read(adapter, offs + 8, &val2); 438 ((u64)(val2 & 0xff) << 32) | \
439 439 ((mac)->stats.stat_name & \
440 *val &= ~0ull << 40; 440 0xffffff0000000000ULL); \
441 *val |= val0 & 0xffff; 441 if (ro & \
442 *val |= (val1 & 0xffff) << 16; 442 (1ULL << ((name - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW) >> 2))) \
443 *val |= (u64)(val2 & 0xff) << 32; 443 (mac)->stats.stat_name += 1ULL << 40; \
444
445 if (over)
446 *val += 1ull << 40;
447} 444}
448 445
449static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, 446static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac,
450 int flag) 447 int flag)
451{ 448{
452 static struct { 449 u64 ro;
453 unsigned int reg; 450 u32 val0, val1, val2, val3;
454 unsigned int offset;
455 } hw_stats [] = {
456
457#define HW_STAT(name, stat_name) \
458 { name, (&((struct cmac_statistics *)NULL)->stat_name) - (u64 *)NULL }
459
460 /* Rx stats */
461 HW_STAT(RxOctetsReceivedOK, RxOctetsOK),
462 HW_STAT(RxUnicastFramesReceivedOK, RxUnicastFramesOK),
463 HW_STAT(RxMulticastFramesReceivedOK, RxMulticastFramesOK),
464 HW_STAT(RxBroadcastFramesReceivedOK, RxBroadcastFramesOK),
465 HW_STAT(RxPAUSEMACCtrlFramesReceived, RxPauseFrames),
466 HW_STAT(RxFrameCheckSequenceErrors, RxFCSErrors),
467 HW_STAT(RxFramesLostDueToInternalMACErrors,
468 RxInternalMACRcvError),
469 HW_STAT(RxSymbolErrors, RxSymbolErrors),
470 HW_STAT(RxInRangeLengthErrors, RxInRangeLengthErrors),
471 HW_STAT(RxFramesTooLongErrors , RxFrameTooLongErrors),
472 HW_STAT(RxJabbers, RxJabberErrors),
473 HW_STAT(RxFragments, RxRuntErrors),
474 HW_STAT(RxUndersizedFrames, RxRuntErrors),
475 HW_STAT(RxJumboFramesReceivedOK, RxJumboFramesOK),
476 HW_STAT(RxJumboOctetsReceivedOK, RxJumboOctetsOK),
477
478 /* Tx stats */
479 HW_STAT(TxOctetsTransmittedOK, TxOctetsOK),
480 HW_STAT(TxFramesLostDueToInternalMACTransmissionError,
481 TxInternalMACXmitError),
482 HW_STAT(TxTransmitSystemError, TxFCSErrors),
483 HW_STAT(TxUnicastFramesTransmittedOK, TxUnicastFramesOK),
484 HW_STAT(TxMulticastFramesTransmittedOK, TxMulticastFramesOK),
485 HW_STAT(TxBroadcastFramesTransmittedOK, TxBroadcastFramesOK),
486 HW_STAT(TxPAUSEMACCtrlFramesTransmitted, TxPauseFrames),
487 HW_STAT(TxJumboFramesReceivedOK, TxJumboFramesOK),
488 HW_STAT(TxJumboOctetsReceivedOK, TxJumboOctetsOK)
489 }, *p = hw_stats;
490 u64 ro;
491 u32 val0, val1, val2, val3;
492 u64 *stats = (u64 *) &mac->stats;
493 unsigned int i;
494 451
495 /* Snap the counters */ 452 /* Snap the counters */
496 pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL, 453 pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL,
@@ -504,14 +461,35 @@ static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac,
504 ro = ((u64)val0 & 0xffff) | (((u64)val1 & 0xffff) << 16) | 461 ro = ((u64)val0 & 0xffff) | (((u64)val1 & 0xffff) << 16) |
505 (((u64)val2 & 0xffff) << 32) | (((u64)val3 & 0xffff) << 48); 462 (((u64)val2 & 0xffff) << 32) | (((u64)val3 & 0xffff) << 48);
506 463
507 for (i = 0; i < ARRAY_SIZE(hw_stats); i++) { 464 /* Rx stats */
508 unsigned reg = p->reg - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW; 465 RMON_UPDATE(mac, RxOctetsReceivedOK, RxOctetsOK);
509 466 RMON_UPDATE(mac, RxUnicastFramesReceivedOK, RxUnicastFramesOK);
510 pm3393_rmon_update((mac)->adapter, OFFSET(p->reg), 467 RMON_UPDATE(mac, RxMulticastFramesReceivedOK, RxMulticastFramesOK);
511 stats + p->offset, ro & (reg >> 2)); 468 RMON_UPDATE(mac, RxBroadcastFramesReceivedOK, RxBroadcastFramesOK);
512 } 469 RMON_UPDATE(mac, RxPAUSEMACCtrlFramesReceived, RxPauseFrames);
513 470 RMON_UPDATE(mac, RxFrameCheckSequenceErrors, RxFCSErrors);
514 471 RMON_UPDATE(mac, RxFramesLostDueToInternalMACErrors,
472 RxInternalMACRcvError);
473 RMON_UPDATE(mac, RxSymbolErrors, RxSymbolErrors);
474 RMON_UPDATE(mac, RxInRangeLengthErrors, RxInRangeLengthErrors);
475 RMON_UPDATE(mac, RxFramesTooLongErrors , RxFrameTooLongErrors);
476 RMON_UPDATE(mac, RxJabbers, RxJabberErrors);
477 RMON_UPDATE(mac, RxFragments, RxRuntErrors);
478 RMON_UPDATE(mac, RxUndersizedFrames, RxRuntErrors);
479 RMON_UPDATE(mac, RxJumboFramesReceivedOK, RxJumboFramesOK);
480 RMON_UPDATE(mac, RxJumboOctetsReceivedOK, RxJumboOctetsOK);
481
482 /* Tx stats */
483 RMON_UPDATE(mac, TxOctetsTransmittedOK, TxOctetsOK);
484 RMON_UPDATE(mac, TxFramesLostDueToInternalMACTransmissionError,
485 TxInternalMACXmitError);
486 RMON_UPDATE(mac, TxTransmitSystemError, TxFCSErrors);
487 RMON_UPDATE(mac, TxUnicastFramesTransmittedOK, TxUnicastFramesOK);
488 RMON_UPDATE(mac, TxMulticastFramesTransmittedOK, TxMulticastFramesOK);
489 RMON_UPDATE(mac, TxBroadcastFramesTransmittedOK, TxBroadcastFramesOK);
490 RMON_UPDATE(mac, TxPAUSEMACCtrlFramesTransmitted, TxPauseFrames);
491 RMON_UPDATE(mac, TxJumboFramesReceivedOK, TxJumboFramesOK);
492 RMON_UPDATE(mac, TxJumboOctetsReceivedOK, TxJumboOctetsOK);
515 493
516 return &mac->stats; 494 return &mac->stats;
517} 495}
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index 443666292a5c..b301c0428ae0 100644..100755
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -986,11 +986,10 @@ void t1_sge_get_port_stats(const struct sge *sge, int port,
986 for_each_possible_cpu(cpu) { 986 for_each_possible_cpu(cpu) {
987 struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu); 987 struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu);
988 988
989 ss->rx_packets += st->rx_packets;
990 ss->rx_cso_good += st->rx_cso_good; 989 ss->rx_cso_good += st->rx_cso_good;
991 ss->tx_packets += st->tx_packets;
992 ss->tx_cso += st->tx_cso; 990 ss->tx_cso += st->tx_cso;
993 ss->tx_tso += st->tx_tso; 991 ss->tx_tso += st->tx_tso;
992 ss->tx_need_hdrroom += st->tx_need_hdrroom;
994 ss->vlan_xtract += st->vlan_xtract; 993 ss->vlan_xtract += st->vlan_xtract;
995 ss->vlan_insert += st->vlan_insert; 994 ss->vlan_insert += st->vlan_insert;
996 } 995 }
@@ -1380,7 +1379,6 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
1380 __skb_pull(skb, sizeof(*p)); 1379 __skb_pull(skb, sizeof(*p));
1381 1380
1382 st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); 1381 st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id());
1383 st->rx_packets++;
1384 1382
1385 skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); 1383 skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev);
1386 skb->dev->last_rx = jiffies; 1384 skb->dev->last_rx = jiffies;
@@ -1624,11 +1622,9 @@ int t1_poll(struct napi_struct *napi, int budget)
1624{ 1622{
1625 struct adapter *adapter = container_of(napi, struct adapter, napi); 1623 struct adapter *adapter = container_of(napi, struct adapter, napi);
1626 struct net_device *dev = adapter->port[0].dev; 1624 struct net_device *dev = adapter->port[0].dev;
1627 int work_done; 1625 int work_done = process_responses(adapter, budget);
1628
1629 work_done = process_responses(adapter, budget);
1630 1626
1631 if (likely(!responses_pending(adapter))) { 1627 if (likely(work_done < budget)) {
1632 netif_rx_complete(dev, napi); 1628 netif_rx_complete(dev, napi);
1633 writel(adapter->sge->respQ.cidx, 1629 writel(adapter->sge->respQ.cidx,
1634 adapter->regs + A_SG_SLEEPING); 1630 adapter->regs + A_SG_SLEEPING);
@@ -1848,7 +1844,8 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1848{ 1844{
1849 struct adapter *adapter = dev->priv; 1845 struct adapter *adapter = dev->priv;
1850 struct sge *sge = adapter->sge; 1846 struct sge *sge = adapter->sge;
1851 struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port], smp_processor_id()); 1847 struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port],
1848 smp_processor_id());
1852 struct cpl_tx_pkt *cpl; 1849 struct cpl_tx_pkt *cpl;
1853 struct sk_buff *orig_skb = skb; 1850 struct sk_buff *orig_skb = skb;
1854 int ret; 1851 int ret;
@@ -1856,6 +1853,18 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1856 if (skb->protocol == htons(ETH_P_CPL5)) 1853 if (skb->protocol == htons(ETH_P_CPL5))
1857 goto send; 1854 goto send;
1858 1855
1856 /*
1857 * We are using a non-standard hard_header_len.
1858 * Allocate more header room in the rare cases it is not big enough.
1859 */
1860 if (unlikely(skb_headroom(skb) < dev->hard_header_len - ETH_HLEN)) {
1861 skb = skb_realloc_headroom(skb, sizeof(struct cpl_tx_pkt_lso));
1862 ++st->tx_need_hdrroom;
1863 dev_kfree_skb_any(orig_skb);
1864 if (!skb)
1865 return NETDEV_TX_OK;
1866 }
1867
1859 if (skb_shinfo(skb)->gso_size) { 1868 if (skb_shinfo(skb)->gso_size) {
1860 int eth_type; 1869 int eth_type;
1861 struct cpl_tx_pkt_lso *hdr; 1870 struct cpl_tx_pkt_lso *hdr;
@@ -1889,24 +1898,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1889 return NETDEV_TX_OK; 1898 return NETDEV_TX_OK;
1890 } 1899 }
1891 1900
1892 /*
1893 * We are using a non-standard hard_header_len and some kernel
1894 * components, such as pktgen, do not handle it right.
1895 * Complain when this happens but try to fix things up.
1896 */
1897 if (unlikely(skb_headroom(skb) < dev->hard_header_len - ETH_HLEN)) {
1898 pr_debug("%s: headroom %d header_len %d\n", dev->name,
1899 skb_headroom(skb), dev->hard_header_len);
1900
1901 if (net_ratelimit())
1902 printk(KERN_ERR "%s: inadequate headroom in "
1903 "Tx packet\n", dev->name);
1904 skb = skb_realloc_headroom(skb, sizeof(*cpl));
1905 dev_kfree_skb_any(orig_skb);
1906 if (!skb)
1907 return NETDEV_TX_OK;
1908 }
1909
1910 if (!(adapter->flags & UDP_CSUM_CAPABLE) && 1901 if (!(adapter->flags & UDP_CSUM_CAPABLE) &&
1911 skb->ip_summed == CHECKSUM_PARTIAL && 1902 skb->ip_summed == CHECKSUM_PARTIAL &&
1912 ip_hdr(skb)->protocol == IPPROTO_UDP) { 1903 ip_hdr(skb)->protocol == IPPROTO_UDP) {
@@ -1952,7 +1943,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1952 cpl->vlan_valid = 0; 1943 cpl->vlan_valid = 0;
1953 1944
1954send: 1945send:
1955 st->tx_packets++;
1956 dev->trans_start = jiffies; 1946 dev->trans_start = jiffies;
1957 ret = t1_sge_tx(skb, adapter, 0, dev); 1947 ret = t1_sge_tx(skb, adapter, 0, dev);
1958 1948
diff --git a/drivers/net/chelsio/sge.h b/drivers/net/chelsio/sge.h
index 713d9c55f24d..cced9dff91c5 100644..100755
--- a/drivers/net/chelsio/sge.h
+++ b/drivers/net/chelsio/sge.h
@@ -57,13 +57,12 @@ struct sge_intr_counts {
57}; 57};
58 58
59struct sge_port_stats { 59struct sge_port_stats {
60 u64 rx_packets; /* # of Ethernet packets received */
61 u64 rx_cso_good; /* # of successful RX csum offloads */ 60 u64 rx_cso_good; /* # of successful RX csum offloads */
62 u64 tx_packets; /* # of TX packets */
63 u64 tx_cso; /* # of TX checksum offloads */ 61 u64 tx_cso; /* # of TX checksum offloads */
64 u64 tx_tso; /* # of TSO requests */ 62 u64 tx_tso; /* # of TSO requests */
65 u64 vlan_xtract; /* # of VLAN tag extractions */ 63 u64 vlan_xtract; /* # of VLAN tag extractions */
66 u64 vlan_insert; /* # of VLAN tag insertions */ 64 u64 vlan_insert; /* # of VLAN tag insertions */
65 u64 tx_need_hdrroom; /* # of TX skbs in need of more header room */
67}; 66};
68 67
69struct sk_buff; 68struct sk_buff;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index cf39473ef90a..4f37506ad374 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3942,7 +3942,7 @@ e1000_clean(struct napi_struct *napi, int budget)
3942 &work_done, budget); 3942 &work_done, budget);
3943 3943
3944 /* If no Tx and not enough Rx work done, exit the polling mode */ 3944 /* If no Tx and not enough Rx work done, exit the polling mode */
3945 if ((!tx_cleaned && (work_done < budget)) || 3945 if ((!tx_cleaned && (work_done == 0)) ||
3946 !netif_running(poll_dev)) { 3946 !netif_running(poll_dev)) {
3947quit_polling: 3947quit_polling:
3948 if (likely(adapter->itr_setting & 3)) 3948 if (likely(adapter->itr_setting & 3))
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index f78e5bf7cb33..5f82a4647eee 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0080" 43#define DRV_VERSION "EHEA_0083"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index f0319f1e8e05..869e1604b16e 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -136,7 +136,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
136 struct ehea_port *port = netdev_priv(dev); 136 struct ehea_port *port = netdev_priv(dev);
137 struct net_device_stats *stats = &port->stats; 137 struct net_device_stats *stats = &port->stats;
138 struct hcp_ehea_port_cb2 *cb2; 138 struct hcp_ehea_port_cb2 *cb2;
139 u64 hret, rx_packets; 139 u64 hret, rx_packets, tx_packets;
140 int i; 140 int i;
141 141
142 memset(stats, 0, sizeof(*stats)); 142 memset(stats, 0, sizeof(*stats));
@@ -162,7 +162,11 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
162 for (i = 0; i < port->num_def_qps; i++) 162 for (i = 0; i < port->num_def_qps; i++)
163 rx_packets += port->port_res[i].rx_packets; 163 rx_packets += port->port_res[i].rx_packets;
164 164
165 stats->tx_packets = cb2->txucp + cb2->txmcp + cb2->txbcp; 165 tx_packets = 0;
166 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++)
167 tx_packets += port->port_res[i].tx_packets;
168
169 stats->tx_packets = tx_packets;
166 stats->multicast = cb2->rxmcp; 170 stats->multicast = cb2->rxmcp;
167 stats->rx_errors = cb2->rxuerr; 171 stats->rx_errors = cb2->rxuerr;
168 stats->rx_bytes = cb2->rxo; 172 stats->rx_bytes = cb2->rxo;
@@ -406,11 +410,6 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq,
406 if (cqe->status & EHEA_CQE_STAT_ERR_CRC) 410 if (cqe->status & EHEA_CQE_STAT_ERR_CRC)
407 pr->p_stats.err_frame_crc++; 411 pr->p_stats.err_frame_crc++;
408 412
409 if (netif_msg_rx_err(pr->port)) {
410 ehea_error("CQE Error for QP %d", pr->qp->init_attr.qp_nr);
411 ehea_dump(cqe, sizeof(*cqe), "CQE");
412 }
413
414 if (rq == 2) { 413 if (rq == 2) {
415 *processed_rq2 += 1; 414 *processed_rq2 += 1;
416 skb = get_skb_by_index(pr->rq2_skba.arr, pr->rq2_skba.len, cqe); 415 skb = get_skb_by_index(pr->rq2_skba.arr, pr->rq2_skba.len, cqe);
@@ -422,7 +421,11 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq,
422 } 421 }
423 422
424 if (cqe->status & EHEA_CQE_STAT_FAT_ERR_MASK) { 423 if (cqe->status & EHEA_CQE_STAT_FAT_ERR_MASK) {
425 ehea_error("Critical receive error. Resetting port."); 424 if (netif_msg_rx_err(pr->port)) {
425 ehea_error("Critical receive error for QP %d. "
426 "Resetting port.", pr->qp->init_attr.qp_nr);
427 ehea_dump(cqe, sizeof(*cqe), "CQE");
428 }
426 schedule_work(&pr->port->reset_task); 429 schedule_work(&pr->port->reset_task);
427 return 1; 430 return 1;
428 } 431 }
@@ -2000,6 +2003,7 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
2000 } 2003 }
2001 2004
2002 ehea_post_swqe(pr->qp, swqe); 2005 ehea_post_swqe(pr->qp, swqe);
2006 pr->tx_packets++;
2003 2007
2004 if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) { 2008 if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
2005 spin_lock_irqsave(&pr->netif_queue, flags); 2009 spin_lock_irqsave(&pr->netif_queue, flags);
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h
index 562de0ebdd85..bc62d389c166 100644
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -145,8 +145,8 @@ struct ehea_rwqe {
145#define EHEA_CQE_VLAN_TAG_XTRACT 0x0400 145#define EHEA_CQE_VLAN_TAG_XTRACT 0x0400
146 146
147#define EHEA_CQE_TYPE_RQ 0x60 147#define EHEA_CQE_TYPE_RQ 0x60
148#define EHEA_CQE_STAT_ERR_MASK 0x720F 148#define EHEA_CQE_STAT_ERR_MASK 0x700F
149#define EHEA_CQE_STAT_FAT_ERR_MASK 0x1F 149#define EHEA_CQE_STAT_FAT_ERR_MASK 0xF
150#define EHEA_CQE_STAT_ERR_TCP 0x4000 150#define EHEA_CQE_STAT_ERR_TCP 0x4000
151#define EHEA_CQE_STAT_ERR_IP 0x2000 151#define EHEA_CQE_STAT_ERR_IP 0x2000
152#define EHEA_CQE_STAT_ERR_CRC 0x1000 152#define EHEA_CQE_STAT_ERR_CRC 0x1000
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index a8a0ee220da6..bf5a7caa5b52 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -971,6 +971,8 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match)
971 971
972 mpc52xx_fec_reset_stats(ndev); 972 mpc52xx_fec_reset_stats(ndev);
973 973
974 SET_NETDEV_DEV(ndev, &op->dev);
975
974 /* Register the new network device */ 976 /* Register the new network device */
975 rv = register_netdev(ndev); 977 rv = register_netdev(ndev);
976 if (rv < 0) 978 if (rv < 0)
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 92ce2e38f0d5..a96583cceb5e 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5286,19 +5286,15 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5286 if (readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_PHY_INIT) { 5286 if (readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_PHY_INIT) {
5287 np->mac_in_use = readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_MGMT_ST; 5287 np->mac_in_use = readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_MGMT_ST;
5288 dprintk(KERN_INFO "%s: mgmt unit is running. mac in use %x.\n", pci_name(pci_dev), np->mac_in_use); 5288 dprintk(KERN_INFO "%s: mgmt unit is running. mac in use %x.\n", pci_name(pci_dev), np->mac_in_use);
5289 for (i = 0; i < 5000; i++) { 5289 if (nv_mgmt_acquire_sema(dev)) {
5290 msleep(1); 5290 /* management unit setup the phy already? */
5291 if (nv_mgmt_acquire_sema(dev)) { 5291 if ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_MASK) ==
5292 /* management unit setup the phy already? */ 5292 NVREG_XMITCTL_SYNC_PHY_INIT) {
5293 if ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_MASK) == 5293 /* phy is inited by mgmt unit */
5294 NVREG_XMITCTL_SYNC_PHY_INIT) { 5294 phyinitialized = 1;
5295 /* phy is inited by mgmt unit */ 5295 dprintk(KERN_INFO "%s: Phy already initialized by mgmt unit.\n", pci_name(pci_dev));
5296 phyinitialized = 1; 5296 } else {
5297 dprintk(KERN_INFO "%s: Phy already initialized by mgmt unit.\n", pci_name(pci_dev)); 5297 /* we need to init the phy */
5298 } else {
5299 /* we need to init the phy */
5300 }
5301 break;
5302 } 5298 }
5303 } 5299 }
5304 } 5300 }
@@ -5613,6 +5609,22 @@ static struct pci_device_id pci_tbl[] = {
5613 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), 5609 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35),
5614 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5610 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5615 }, 5611 },
5612 { /* MCP79 Ethernet Controller */
5613 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36),
5614 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5615 },
5616 { /* MCP79 Ethernet Controller */
5617 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37),
5618 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5619 },
5620 { /* MCP79 Ethernet Controller */
5621 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38),
5622 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5623 },
5624 { /* MCP79 Ethernet Controller */
5625 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39),
5626 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5627 },
5616 {0,}, 5628 {0,},
5617}; 5629};
5618 5630
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 0de3aa2a2e44..eb0718b441bb 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -642,9 +642,11 @@ static void emac_reset_work(struct work_struct *work)
642 DBG(dev, "reset_work" NL); 642 DBG(dev, "reset_work" NL);
643 643
644 mutex_lock(&dev->link_lock); 644 mutex_lock(&dev->link_lock);
645 emac_netif_stop(dev); 645 if (dev->opened) {
646 emac_full_tx_reset(dev); 646 emac_netif_stop(dev);
647 emac_netif_start(dev); 647 emac_full_tx_reset(dev);
648 emac_netif_start(dev);
649 }
648 mutex_unlock(&dev->link_lock); 650 mutex_unlock(&dev->link_lock);
649} 651}
650 652
@@ -1063,10 +1065,9 @@ static int emac_open(struct net_device *ndev)
1063 dev->rx_sg_skb = NULL; 1065 dev->rx_sg_skb = NULL;
1064 1066
1065 mutex_lock(&dev->link_lock); 1067 mutex_lock(&dev->link_lock);
1068 dev->opened = 1;
1066 1069
1067 /* XXX Start PHY polling now. Shouldn't wr do like sungem instead and 1070 /* Start PHY polling now.
1068 * always poll the PHY even when the iface is down ? That would allow
1069 * things like laptop-net to work. --BenH
1070 */ 1071 */
1071 if (dev->phy.address >= 0) { 1072 if (dev->phy.address >= 0) {
1072 int link_poll_interval; 1073 int link_poll_interval;
@@ -1145,9 +1146,11 @@ static void emac_link_timer(struct work_struct *work)
1145 int link_poll_interval; 1146 int link_poll_interval;
1146 1147
1147 mutex_lock(&dev->link_lock); 1148 mutex_lock(&dev->link_lock);
1148
1149 DBG2(dev, "link timer" NL); 1149 DBG2(dev, "link timer" NL);
1150 1150
1151 if (!dev->opened)
1152 goto bail;
1153
1151 if (dev->phy.def->ops->poll_link(&dev->phy)) { 1154 if (dev->phy.def->ops->poll_link(&dev->phy)) {
1152 if (!netif_carrier_ok(dev->ndev)) { 1155 if (!netif_carrier_ok(dev->ndev)) {
1153 /* Get new link parameters */ 1156 /* Get new link parameters */
@@ -1170,13 +1173,14 @@ static void emac_link_timer(struct work_struct *work)
1170 link_poll_interval = PHY_POLL_LINK_OFF; 1173 link_poll_interval = PHY_POLL_LINK_OFF;
1171 } 1174 }
1172 schedule_delayed_work(&dev->link_work, link_poll_interval); 1175 schedule_delayed_work(&dev->link_work, link_poll_interval);
1173 1176 bail:
1174 mutex_unlock(&dev->link_lock); 1177 mutex_unlock(&dev->link_lock);
1175} 1178}
1176 1179
1177static void emac_force_link_update(struct emac_instance *dev) 1180static void emac_force_link_update(struct emac_instance *dev)
1178{ 1181{
1179 netif_carrier_off(dev->ndev); 1182 netif_carrier_off(dev->ndev);
1183 smp_rmb();
1180 if (dev->link_polling) { 1184 if (dev->link_polling) {
1181 cancel_rearming_delayed_work(&dev->link_work); 1185 cancel_rearming_delayed_work(&dev->link_work);
1182 if (dev->link_polling) 1186 if (dev->link_polling)
@@ -1191,11 +1195,14 @@ static int emac_close(struct net_device *ndev)
1191 1195
1192 DBG(dev, "close" NL); 1196 DBG(dev, "close" NL);
1193 1197
1194 if (dev->phy.address >= 0) 1198 if (dev->phy.address >= 0) {
1199 dev->link_polling = 0;
1195 cancel_rearming_delayed_work(&dev->link_work); 1200 cancel_rearming_delayed_work(&dev->link_work);
1196 1201 }
1202 mutex_lock(&dev->link_lock);
1197 emac_netif_stop(dev); 1203 emac_netif_stop(dev);
1198 flush_scheduled_work(); 1204 dev->opened = 0;
1205 mutex_unlock(&dev->link_lock);
1199 1206
1200 emac_rx_disable(dev); 1207 emac_rx_disable(dev);
1201 emac_tx_disable(dev); 1208 emac_tx_disable(dev);
@@ -2756,6 +2763,8 @@ static int __devexit emac_remove(struct of_device *ofdev)
2756 2763
2757 unregister_netdev(dev->ndev); 2764 unregister_netdev(dev->ndev);
2758 2765
2766 flush_scheduled_work();
2767
2759 if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) 2768 if (emac_has_feature(dev, EMAC_FTR_HAS_TAH))
2760 tah_detach(dev->tah_dev, dev->tah_port); 2769 tah_detach(dev->tah_dev, dev->tah_port);
2761 if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII)) 2770 if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII))
diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h
index 4011803117ca..a010b2463fd9 100644
--- a/drivers/net/ibm_newemac/core.h
+++ b/drivers/net/ibm_newemac/core.h
@@ -258,6 +258,7 @@ struct emac_instance {
258 int stop_timeout; /* in us */ 258 int stop_timeout; /* in us */
259 int no_mcast; 259 int no_mcast;
260 int mcast_pending; 260 int mcast_pending;
261 int opened;
261 struct work_struct reset_work; 262 struct work_struct reset_work;
262 spinlock_t lock; 263 spinlock_t lock;
263}; 264};
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index 9a855e512147..b59f442bbf36 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -176,8 +176,8 @@ struct i596_reg {
176struct i596_tbd { 176struct i596_tbd {
177 unsigned short size; 177 unsigned short size;
178 unsigned short pad; 178 unsigned short pad;
179 dma_addr_t next; 179 u32 next;
180 dma_addr_t data; 180 u32 data;
181 u32 cache_pad[5]; /* Total 32 bytes... */ 181 u32 cache_pad[5]; /* Total 32 bytes... */
182}; 182};
183 183
@@ -195,12 +195,12 @@ struct i596_cmd {
195 struct i596_cmd *v_next; /* Address from CPUs viewpoint */ 195 struct i596_cmd *v_next; /* Address from CPUs viewpoint */
196 unsigned short status; 196 unsigned short status;
197 unsigned short command; 197 unsigned short command;
198 dma_addr_t b_next; /* Address from i596 viewpoint */ 198 u32 b_next; /* Address from i596 viewpoint */
199}; 199};
200 200
201struct tx_cmd { 201struct tx_cmd {
202 struct i596_cmd cmd; 202 struct i596_cmd cmd;
203 dma_addr_t tbd; 203 u32 tbd;
204 unsigned short size; 204 unsigned short size;
205 unsigned short pad; 205 unsigned short pad;
206 struct sk_buff *skb; /* So we can free it after tx */ 206 struct sk_buff *skb; /* So we can free it after tx */
@@ -237,8 +237,8 @@ struct cf_cmd {
237struct i596_rfd { 237struct i596_rfd {
238 unsigned short stat; 238 unsigned short stat;
239 unsigned short cmd; 239 unsigned short cmd;
240 dma_addr_t b_next; /* Address from i596 viewpoint */ 240 u32 b_next; /* Address from i596 viewpoint */
241 dma_addr_t rbd; 241 u32 rbd;
242 unsigned short count; 242 unsigned short count;
243 unsigned short size; 243 unsigned short size;
244 struct i596_rfd *v_next; /* Address from CPUs viewpoint */ 244 struct i596_rfd *v_next; /* Address from CPUs viewpoint */
@@ -249,18 +249,18 @@ struct i596_rfd {
249}; 249};
250 250
251struct i596_rbd { 251struct i596_rbd {
252 /* hardware data */ 252 /* hardware data */
253 unsigned short count; 253 unsigned short count;
254 unsigned short zero1; 254 unsigned short zero1;
255 dma_addr_t b_next; 255 u32 b_next;
256 dma_addr_t b_data; /* Address from i596 viewpoint */ 256 u32 b_data; /* Address from i596 viewpoint */
257 unsigned short size; 257 unsigned short size;
258 unsigned short zero2; 258 unsigned short zero2;
259 /* driver data */ 259 /* driver data */
260 struct sk_buff *skb; 260 struct sk_buff *skb;
261 struct i596_rbd *v_next; 261 struct i596_rbd *v_next;
262 dma_addr_t b_addr; /* This rbd addr from i596 view */ 262 u32 b_addr; /* This rbd addr from i596 view */
263 unsigned char *v_data; /* Address from CPUs viewpoint */ 263 unsigned char *v_data; /* Address from CPUs viewpoint */
264 /* Total 32 bytes... */ 264 /* Total 32 bytes... */
265#ifdef __LP64__ 265#ifdef __LP64__
266 u32 cache_pad[4]; 266 u32 cache_pad[4];
@@ -275,8 +275,8 @@ struct i596_rbd {
275struct i596_scb { 275struct i596_scb {
276 unsigned short status; 276 unsigned short status;
277 unsigned short command; 277 unsigned short command;
278 dma_addr_t cmd; 278 u32 cmd;
279 dma_addr_t rfd; 279 u32 rfd;
280 u32 crc_err; 280 u32 crc_err;
281 u32 align_err; 281 u32 align_err;
282 u32 resource_err; 282 u32 resource_err;
@@ -288,14 +288,14 @@ struct i596_scb {
288}; 288};
289 289
290struct i596_iscp { 290struct i596_iscp {
291 u32 stat; 291 u32 stat;
292 dma_addr_t scb; 292 u32 scb;
293}; 293};
294 294
295struct i596_scp { 295struct i596_scp {
296 u32 sysbus; 296 u32 sysbus;
297 u32 pad; 297 u32 pad;
298 dma_addr_t iscp; 298 u32 iscp;
299}; 299};
300 300
301struct i596_dma { 301struct i596_dma {
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 035fd41fb61f..f0574073a2a3 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -143,21 +143,29 @@ static int m88e1111_config_init(struct phy_device *phydev)
143 int err; 143 int err;
144 144
145 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || 145 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
146 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) { 146 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
147 (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
148 (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
147 int temp; 149 int temp;
148 150
149 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { 151 temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
150 temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); 152 if (temp < 0)
151 if (temp < 0) 153 return temp;
152 return temp;
153 154
155 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
154 temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY); 156 temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
155 157 } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
156 err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp); 158 temp &= ~MII_M1111_TX_DELAY;
157 if (err < 0) 159 temp |= MII_M1111_RX_DELAY;
158 return err; 160 } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
161 temp &= ~MII_M1111_RX_DELAY;
162 temp |= MII_M1111_TX_DELAY;
159 } 163 }
160 164
165 err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
166 if (err < 0)
167 return err;
168
161 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); 169 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
162 if (temp < 0) 170 if (temp < 0)
163 return temp; 171 return temp;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 9bc11773705b..7c9e6e349503 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -406,6 +406,9 @@ int phy_mii_ioctl(struct phy_device *phydev,
406 && phydev->drv->config_init) 406 && phydev->drv->config_init)
407 phydev->drv->config_init(phydev); 407 phydev->drv->config_init(phydev);
408 break; 408 break;
409
410 default:
411 return -ENOTTY;
409 } 412 }
410 413
411 return 0; 414 return 0;
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 632666706247..d5113dd712c2 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -1081,7 +1081,7 @@ static int init_nic(struct s2io_nic *nic)
1081 /* to set the swapper controle on the card */ 1081 /* to set the swapper controle on the card */
1082 if(s2io_set_swapper(nic)) { 1082 if(s2io_set_swapper(nic)) {
1083 DBG_PRINT(ERR_DBG,"ERROR: Setting Swapper failed\n"); 1083 DBG_PRINT(ERR_DBG,"ERROR: Setting Swapper failed\n");
1084 return -1; 1084 return -EIO;
1085 } 1085 }
1086 1086
1087 /* 1087 /*
@@ -1503,7 +1503,7 @@ static int init_nic(struct s2io_nic *nic)
1503 DBG_PRINT(ERR_DBG, "%s: failed rts ds steering", 1503 DBG_PRINT(ERR_DBG, "%s: failed rts ds steering",
1504 dev->name); 1504 dev->name);
1505 DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i); 1505 DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i);
1506 return FAILURE; 1506 return -ENODEV;
1507 } 1507 }
1508 } 1508 }
1509 1509
@@ -1570,7 +1570,7 @@ static int init_nic(struct s2io_nic *nic)
1570 if (time > 10) { 1570 if (time > 10) {
1571 DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n", 1571 DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n",
1572 dev->name); 1572 dev->name);
1573 return -1; 1573 return -ENODEV;
1574 } 1574 }
1575 msleep(50); 1575 msleep(50);
1576 time++; 1576 time++;
@@ -1623,7 +1623,7 @@ static int init_nic(struct s2io_nic *nic)
1623 if (time > 10) { 1623 if (time > 10) {
1624 DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n", 1624 DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n",
1625 dev->name); 1625 dev->name);
1626 return -1; 1626 return -ENODEV;
1627 } 1627 }
1628 time++; 1628 time++;
1629 msleep(50); 1629 msleep(50);
@@ -3914,6 +3914,12 @@ static int s2io_close(struct net_device *dev)
3914{ 3914{
3915 struct s2io_nic *sp = dev->priv; 3915 struct s2io_nic *sp = dev->priv;
3916 3916
3917 /* Return if the device is already closed *
3918 * Can happen when s2io_card_up failed in change_mtu *
3919 */
3920 if (!is_s2io_card_up(sp))
3921 return 0;
3922
3917 netif_stop_queue(dev); 3923 netif_stop_queue(dev);
3918 napi_disable(&sp->napi); 3924 napi_disable(&sp->napi);
3919 /* Reset card, kill tasklet and free Tx and Rx buffers. */ 3925 /* Reset card, kill tasklet and free Tx and Rx buffers. */
@@ -6355,6 +6361,7 @@ static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
6355static int s2io_change_mtu(struct net_device *dev, int new_mtu) 6361static int s2io_change_mtu(struct net_device *dev, int new_mtu)
6356{ 6362{
6357 struct s2io_nic *sp = dev->priv; 6363 struct s2io_nic *sp = dev->priv;
6364 int ret = 0;
6358 6365
6359 if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { 6366 if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) {
6360 DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", 6367 DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n",
@@ -6366,9 +6373,11 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu)
6366 if (netif_running(dev)) { 6373 if (netif_running(dev)) {
6367 s2io_card_down(sp); 6374 s2io_card_down(sp);
6368 netif_stop_queue(dev); 6375 netif_stop_queue(dev);
6369 if (s2io_card_up(sp)) { 6376 ret = s2io_card_up(sp);
6377 if (ret) {
6370 DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", 6378 DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n",
6371 __FUNCTION__); 6379 __FUNCTION__);
6380 return ret;
6372 } 6381 }
6373 if (netif_queue_stopped(dev)) 6382 if (netif_queue_stopped(dev))
6374 netif_wake_queue(dev); 6383 netif_wake_queue(dev);
@@ -6379,7 +6388,7 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu)
6379 writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); 6388 writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len);
6380 } 6389 }
6381 6390
6382 return 0; 6391 return ret;
6383} 6392}
6384 6393
6385/** 6394/**
@@ -6777,6 +6786,9 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
6777 unsigned long flags; 6786 unsigned long flags;
6778 register u64 val64 = 0; 6787 register u64 val64 = 0;
6779 6788
6789 if (!is_s2io_card_up(sp))
6790 return;
6791
6780 del_timer_sync(&sp->alarm_timer); 6792 del_timer_sync(&sp->alarm_timer);
6781 /* If s2io_set_link task is executing, wait till it completes. */ 6793 /* If s2io_set_link task is executing, wait till it completes. */
6782 while (test_and_set_bit(__S2IO_STATE_LINK_TASK, &(sp->state))) { 6794 while (test_and_set_bit(__S2IO_STATE_LINK_TASK, &(sp->state))) {
@@ -6850,11 +6862,13 @@ static int s2io_card_up(struct s2io_nic * sp)
6850 u16 interruptible; 6862 u16 interruptible;
6851 6863
6852 /* Initialize the H/W I/O registers */ 6864 /* Initialize the H/W I/O registers */
6853 if (init_nic(sp) != 0) { 6865 ret = init_nic(sp);
6866 if (ret != 0) {
6854 DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", 6867 DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n",
6855 dev->name); 6868 dev->name);
6856 s2io_reset(sp); 6869 if (ret != -EIO)
6857 return -ENODEV; 6870 s2io_reset(sp);
6871 return ret;
6858 } 6872 }
6859 6873
6860 /* 6874 /*
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 6d62250fba07..186eb8ebfda6 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -44,7 +44,7 @@
44#include "skge.h" 44#include "skge.h"
45 45
46#define DRV_NAME "skge" 46#define DRV_NAME "skge"
47#define DRV_VERSION "1.12" 47#define DRV_VERSION "1.13"
48#define PFX DRV_NAME " " 48#define PFX DRV_NAME " "
49 49
50#define DEFAULT_TX_RING_SIZE 128 50#define DEFAULT_TX_RING_SIZE 128
@@ -1095,16 +1095,9 @@ static void xm_link_down(struct skge_hw *hw, int port)
1095{ 1095{
1096 struct net_device *dev = hw->dev[port]; 1096 struct net_device *dev = hw->dev[port];
1097 struct skge_port *skge = netdev_priv(dev); 1097 struct skge_port *skge = netdev_priv(dev);
1098 u16 cmd = xm_read16(hw, port, XM_MMU_CMD);
1099 1098
1100 xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE); 1099 xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE);
1101 1100
1102 cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
1103 xm_write16(hw, port, XM_MMU_CMD, cmd);
1104
1105 /* dummy read to ensure writing */
1106 xm_read16(hw, port, XM_MMU_CMD);
1107
1108 if (netif_carrier_ok(dev)) 1101 if (netif_carrier_ok(dev))
1109 skge_link_down(skge); 1102 skge_link_down(skge);
1110} 1103}
@@ -1194,6 +1187,7 @@ static void genesis_init(struct skge_hw *hw)
1194static void genesis_reset(struct skge_hw *hw, int port) 1187static void genesis_reset(struct skge_hw *hw, int port)
1195{ 1188{
1196 const u8 zero[8] = { 0 }; 1189 const u8 zero[8] = { 0 };
1190 u32 reg;
1197 1191
1198 skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); 1192 skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0);
1199 1193
@@ -1209,6 +1203,11 @@ static void genesis_reset(struct skge_hw *hw, int port)
1209 xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff); 1203 xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff);
1210 1204
1211 xm_outhash(hw, port, XM_HSM, zero); 1205 xm_outhash(hw, port, XM_HSM, zero);
1206
1207 /* Flush TX and RX fifo */
1208 reg = xm_read32(hw, port, XM_MODE);
1209 xm_write32(hw, port, XM_MODE, reg | XM_MD_FTF);
1210 xm_write32(hw, port, XM_MODE, reg | XM_MD_FRF);
1212} 1211}
1213 1212
1214 1213
@@ -1634,15 +1633,14 @@ static void genesis_mac_init(struct skge_hw *hw, int port)
1634 } 1633 }
1635 xm_write16(hw, port, XM_RX_CMD, r); 1634 xm_write16(hw, port, XM_RX_CMD, r);
1636 1635
1637
1638 /* We want short frames padded to 60 bytes. */ 1636 /* We want short frames padded to 60 bytes. */
1639 xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD); 1637 xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD);
1640 1638
1641 /* 1639 /* Increase threshold for jumbo frames on dual port */
1642 * Bump up the transmit threshold. This helps hold off transmit 1640 if (hw->ports > 1 && jumbo)
1643 * underruns when we're blasting traffic from both ports at once. 1641 xm_write16(hw, port, XM_TX_THR, 1020);
1644 */ 1642 else
1645 xm_write16(hw, port, XM_TX_THR, 512); 1643 xm_write16(hw, port, XM_TX_THR, 512);
1646 1644
1647 /* 1645 /*
1648 * Enable the reception of all error frames. This is is 1646 * Enable the reception of all error frames. This is is
@@ -1713,7 +1711,13 @@ static void genesis_stop(struct skge_port *skge)
1713{ 1711{
1714 struct skge_hw *hw = skge->hw; 1712 struct skge_hw *hw = skge->hw;
1715 int port = skge->port; 1713 int port = skge->port;
1716 u32 reg; 1714 unsigned retries = 1000;
1715 u16 cmd;
1716
1717 /* Disable Tx and Rx */
1718 cmd = xm_read16(hw, port, XM_MMU_CMD);
1719 cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
1720 xm_write16(hw, port, XM_MMU_CMD, cmd);
1717 1721
1718 genesis_reset(hw, port); 1722 genesis_reset(hw, port);
1719 1723
@@ -1721,20 +1725,17 @@ static void genesis_stop(struct skge_port *skge)
1721 skge_write16(hw, B3_PA_CTRL, 1725 skge_write16(hw, B3_PA_CTRL,
1722 port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); 1726 port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2);
1723 1727
1724 /*
1725 * If the transfer sticks at the MAC the STOP command will not
1726 * terminate if we don't flush the XMAC's transmit FIFO !
1727 */
1728 xm_write32(hw, port, XM_MODE,
1729 xm_read32(hw, port, XM_MODE)|XM_MD_FTF);
1730
1731
1732 /* Reset the MAC */ 1728 /* Reset the MAC */
1733 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); 1729 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST);
1730 do {
1731 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST);
1732 if (!(skge_read16(hw, SK_REG(port, TX_MFF_CTRL1)) & MFF_SET_MAC_RST))
1733 break;
1734 } while (--retries > 0);
1734 1735
1735 /* For external PHYs there must be special handling */ 1736 /* For external PHYs there must be special handling */
1736 if (hw->phy_type != SK_PHY_XMAC) { 1737 if (hw->phy_type != SK_PHY_XMAC) {
1737 reg = skge_read32(hw, B2_GP_IO); 1738 u32 reg = skge_read32(hw, B2_GP_IO);
1738 if (port == 0) { 1739 if (port == 0) {
1739 reg |= GP_DIR_0; 1740 reg |= GP_DIR_0;
1740 reg &= ~GP_IO_0; 1741 reg &= ~GP_IO_0;
@@ -1801,11 +1802,6 @@ static void genesis_mac_intr(struct skge_hw *hw, int port)
1801 xm_write32(hw, port, XM_MODE, XM_MD_FTF); 1802 xm_write32(hw, port, XM_MODE, XM_MD_FTF);
1802 ++dev->stats.tx_fifo_errors; 1803 ++dev->stats.tx_fifo_errors;
1803 } 1804 }
1804
1805 if (status & XM_IS_RXF_OV) {
1806 xm_write32(hw, port, XM_MODE, XM_MD_FRF);
1807 ++dev->stats.rx_fifo_errors;
1808 }
1809} 1805}
1810 1806
1811static void genesis_link_up(struct skge_port *skge) 1807static void genesis_link_up(struct skge_port *skge)
@@ -1862,9 +1858,9 @@ static void genesis_link_up(struct skge_port *skge)
1862 1858
1863 xm_write32(hw, port, XM_MODE, mode); 1859 xm_write32(hw, port, XM_MODE, mode);
1864 1860
1865 /* Turn on detection of Tx underrun, Rx overrun */ 1861 /* Turn on detection of Tx underrun */
1866 msk = xm_read16(hw, port, XM_IMSK); 1862 msk = xm_read16(hw, port, XM_IMSK);
1867 msk &= ~(XM_IS_RXF_OV | XM_IS_TXF_UR); 1863 msk &= ~XM_IS_TXF_UR;
1868 xm_write16(hw, port, XM_IMSK, msk); 1864 xm_write16(hw, port, XM_IMSK, msk);
1869 1865
1870 xm_read16(hw, port, XM_ISRC); 1866 xm_read16(hw, port, XM_ISRC);
@@ -2194,9 +2190,12 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
2194 TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) | 2190 TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) |
2195 TX_IPG_JAM_DATA(TX_IPG_JAM_DEF)); 2191 TX_IPG_JAM_DATA(TX_IPG_JAM_DEF));
2196 2192
2197 /* serial mode register */ 2193 /* configure the Serial Mode Register */
2198 reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); 2194 reg = DATA_BLIND_VAL(DATA_BLIND_DEF)
2199 if (hw->dev[port]->mtu > 1500) 2195 | GM_SMOD_VLAN_ENA
2196 | IPG_DATA_VAL(IPG_DATA_DEF);
2197
2198 if (hw->dev[port]->mtu > ETH_DATA_LEN)
2200 reg |= GM_SMOD_JUMBO_ENA; 2199 reg |= GM_SMOD_JUMBO_ENA;
2201 2200
2202 gma_write16(hw, port, GM_SERIAL_MODE, reg); 2201 gma_write16(hw, port, GM_SERIAL_MODE, reg);
@@ -2619,8 +2618,8 @@ static int skge_up(struct net_device *dev)
2619 yukon_mac_init(hw, port); 2618 yukon_mac_init(hw, port);
2620 spin_unlock_bh(&hw->phy_lock); 2619 spin_unlock_bh(&hw->phy_lock);
2621 2620
2622 /* Configure RAMbuffers */ 2621 /* Configure RAMbuffers - equally between ports and tx/rx */
2623 chunk = hw->ram_size / ((hw->ports + 1)*2); 2622 chunk = (hw->ram_size - hw->ram_offset) / (hw->ports * 2);
2624 ram_addr = hw->ram_offset + 2 * chunk * port; 2623 ram_addr = hw->ram_offset + 2 * chunk * port;
2625 2624
2626 skge_ramset(hw, rxqaddr[port], ram_addr, chunk); 2625 skge_ramset(hw, rxqaddr[port], ram_addr, chunk);
@@ -2897,11 +2896,7 @@ static void skge_tx_timeout(struct net_device *dev)
2897 2896
2898static int skge_change_mtu(struct net_device *dev, int new_mtu) 2897static int skge_change_mtu(struct net_device *dev, int new_mtu)
2899{ 2898{
2900 struct skge_port *skge = netdev_priv(dev);
2901 struct skge_hw *hw = skge->hw;
2902 int port = skge->port;
2903 int err; 2899 int err;
2904 u16 ctl, reg;
2905 2900
2906 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) 2901 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
2907 return -EINVAL; 2902 return -EINVAL;
@@ -2911,40 +2906,13 @@ static int skge_change_mtu(struct net_device *dev, int new_mtu)
2911 return 0; 2906 return 0;
2912 } 2907 }
2913 2908
2914 skge_write32(hw, B0_IMSK, 0); 2909 skge_down(dev);
2915 dev->trans_start = jiffies; /* prevent tx timeout */
2916 netif_stop_queue(dev);
2917 napi_disable(&skge->napi);
2918
2919 ctl = gma_read16(hw, port, GM_GP_CTRL);
2920 gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA);
2921
2922 skge_rx_clean(skge);
2923 skge_rx_stop(hw, port);
2924 2910
2925 dev->mtu = new_mtu; 2911 dev->mtu = new_mtu;
2926 2912
2927 reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); 2913 err = skge_up(dev);
2928 if (new_mtu > 1500)
2929 reg |= GM_SMOD_JUMBO_ENA;
2930 gma_write16(hw, port, GM_SERIAL_MODE, reg);
2931
2932 skge_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD);
2933
2934 err = skge_rx_fill(dev);
2935 wmb();
2936 if (!err)
2937 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
2938 skge_write32(hw, B0_IMSK, hw->intr_mask);
2939
2940 if (err) 2914 if (err)
2941 dev_close(dev); 2915 dev_close(dev);
2942 else {
2943 gma_write16(hw, port, GM_GP_CTRL, ctl);
2944
2945 napi_enable(&skge->napi);
2946 netif_wake_queue(dev);
2947 }
2948 2916
2949 return err; 2917 return err;
2950} 2918}
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index a2070db725c9..3d1dfc948405 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -31,7 +31,6 @@
31#include <linux/etherdevice.h> 31#include <linux/etherdevice.h>
32#include <linux/ethtool.h> 32#include <linux/ethtool.h>
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/aer.h>
35#include <linux/ip.h> 34#include <linux/ip.h>
36#include <net/ip.h> 35#include <net/ip.h>
37#include <linux/tcp.h> 36#include <linux/tcp.h>
@@ -240,22 +239,21 @@ static void sky2_power_on(struct sky2_hw *hw)
240 sky2_write8(hw, B2_Y2_CLK_GATE, 0); 239 sky2_write8(hw, B2_Y2_CLK_GATE, 0);
241 240
242 if (hw->flags & SKY2_HW_ADV_POWER_CTL) { 241 if (hw->flags & SKY2_HW_ADV_POWER_CTL) {
243 struct pci_dev *pdev = hw->pdev;
244 u32 reg; 242 u32 reg;
245 243
246 pci_write_config_dword(pdev, PCI_DEV_REG3, 0); 244 sky2_pci_write32(hw, PCI_DEV_REG3, 0);
247 245
248 pci_read_config_dword(pdev, PCI_DEV_REG4, &reg); 246 reg = sky2_pci_read32(hw, PCI_DEV_REG4);
249 /* set all bits to 0 except bits 15..12 and 8 */ 247 /* set all bits to 0 except bits 15..12 and 8 */
250 reg &= P_ASPM_CONTROL_MSK; 248 reg &= P_ASPM_CONTROL_MSK;
251 pci_write_config_dword(pdev, PCI_DEV_REG4, reg); 249 sky2_pci_write32(hw, PCI_DEV_REG4, reg);
252 250
253 pci_read_config_dword(pdev, PCI_DEV_REG5, &reg); 251 reg = sky2_pci_read32(hw, PCI_DEV_REG5);
254 /* set all bits to 0 except bits 28 & 27 */ 252 /* set all bits to 0 except bits 28 & 27 */
255 reg &= P_CTL_TIM_VMAIN_AV_MSK; 253 reg &= P_CTL_TIM_VMAIN_AV_MSK;
256 pci_write_config_dword(pdev, PCI_DEV_REG5, reg); 254 sky2_pci_write32(hw, PCI_DEV_REG5, reg);
257 255
258 pci_write_config_dword(pdev, PCI_CFG_REG_1, 0); 256 sky2_pci_write32(hw, PCI_CFG_REG_1, 0);
259 257
260 /* Enable workaround for dev 4.107 on Yukon-Ultra & Extreme */ 258 /* Enable workaround for dev 4.107 on Yukon-Ultra & Extreme */
261 reg = sky2_read32(hw, B2_GP_IO); 259 reg = sky2_read32(hw, B2_GP_IO);
@@ -619,12 +617,11 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
619 617
620static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) 618static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
621{ 619{
622 struct pci_dev *pdev = hw->pdev;
623 u32 reg1; 620 u32 reg1;
624 static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD }; 621 static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD };
625 static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA }; 622 static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA };
626 623
627 pci_read_config_dword(pdev, PCI_DEV_REG1, &reg1); 624 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
628 /* Turn on/off phy power saving */ 625 /* Turn on/off phy power saving */
629 if (onoff) 626 if (onoff)
630 reg1 &= ~phy_power[port]; 627 reg1 &= ~phy_power[port];
@@ -634,8 +631,8 @@ static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
634 if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) 631 if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
635 reg1 |= coma_mode[port]; 632 reg1 |= coma_mode[port];
636 633
637 pci_write_config_dword(pdev, PCI_DEV_REG1, reg1); 634 sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
638 pci_read_config_dword(pdev, PCI_DEV_REG1, &reg1); 635 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
639 636
640 udelay(100); 637 udelay(100);
641} 638}
@@ -704,9 +701,9 @@ static void sky2_wol_init(struct sky2_port *sky2)
704 sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl); 701 sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl);
705 702
706 /* Turn on legacy PCI-Express PME mode */ 703 /* Turn on legacy PCI-Express PME mode */
707 pci_read_config_dword(hw->pdev, PCI_DEV_REG1, &reg1); 704 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
708 reg1 |= PCI_Y2_PME_LEGACY; 705 reg1 |= PCI_Y2_PME_LEGACY;
709 pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg1); 706 sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
710 707
711 /* block receiver */ 708 /* block receiver */
712 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); 709 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
@@ -848,6 +845,13 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
848 sky2_set_tx_stfwd(hw, port); 845 sky2_set_tx_stfwd(hw, port);
849 } 846 }
850 847
848 if (hw->chip_id == CHIP_ID_YUKON_FE_P &&
849 hw->chip_rev == CHIP_REV_YU_FE2_A0) {
850 /* disable dynamic watermark */
851 reg = sky2_read16(hw, SK_REG(port, TX_GMF_EA));
852 reg &= ~TX_DYN_WM_ENA;
853 sky2_write16(hw, SK_REG(port, TX_GMF_EA), reg);
854 }
851} 855}
852 856
853/* Assign Ram Buffer allocation to queue */ 857/* Assign Ram Buffer allocation to queue */
@@ -1320,15 +1324,12 @@ static int sky2_up(struct net_device *dev)
1320 */ 1324 */
1321 if (otherdev && netif_running(otherdev) && 1325 if (otherdev && netif_running(otherdev) &&
1322 (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) { 1326 (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) {
1323 struct sky2_port *osky2 = netdev_priv(otherdev);
1324 u16 cmd; 1327 u16 cmd;
1325 1328
1326 pci_read_config_word(hw->pdev, cap + PCI_X_CMD, &cmd); 1329 cmd = sky2_pci_read16(hw, cap + PCI_X_CMD);
1327 cmd &= ~PCI_X_CMD_MAX_SPLIT; 1330 cmd &= ~PCI_X_CMD_MAX_SPLIT;
1328 pci_write_config_word(hw->pdev, cap + PCI_X_CMD, cmd); 1331 sky2_pci_write16(hw, cap + PCI_X_CMD, cmd);
1329 1332
1330 sky2->rx_csum = 0;
1331 osky2->rx_csum = 0;
1332 } 1333 }
1333 1334
1334 if (netif_msg_ifup(sky2)) 1335 if (netif_msg_ifup(sky2))
@@ -2426,37 +2427,26 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2426 if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { 2427 if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) {
2427 u16 pci_err; 2428 u16 pci_err;
2428 2429
2429 pci_read_config_word(pdev, PCI_STATUS, &pci_err); 2430 pci_err = sky2_pci_read16(hw, PCI_STATUS);
2430 if (net_ratelimit()) 2431 if (net_ratelimit())
2431 dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", 2432 dev_err(&pdev->dev, "PCI hardware error (0x%x)\n",
2432 pci_err); 2433 pci_err);
2433 2434
2434 pci_write_config_word(pdev, PCI_STATUS, 2435 sky2_pci_write16(hw, PCI_STATUS,
2435 pci_err | PCI_STATUS_ERROR_BITS); 2436 pci_err | PCI_STATUS_ERROR_BITS);
2436 } 2437 }
2437 2438
2438 if (status & Y2_IS_PCI_EXP) { 2439 if (status & Y2_IS_PCI_EXP) {
2439 /* PCI-Express uncorrectable Error occurred */ 2440 /* PCI-Express uncorrectable Error occurred */
2440 int aer = pci_find_aer_capability(hw->pdev);
2441 u32 err; 2441 u32 err;
2442 2442
2443 if (aer) { 2443 err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2444 pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS, 2444 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2445 &err); 2445 0xfffffffful);
2446 pci_cleanup_aer_uncorrect_error_status(pdev);
2447 } else {
2448 /* Either AER not configured, or not working
2449 * because of bad MMCONFIG, so just do recover
2450 * manually.
2451 */
2452 err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2453 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2454 0xfffffffful);
2455 }
2456
2457 if (net_ratelimit()) 2446 if (net_ratelimit())
2458 dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); 2447 dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err);
2459 2448
2449 sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2460 } 2450 }
2461 2451
2462 if (status & Y2_HWE_L1_MASK) 2452 if (status & Y2_HWE_L1_MASK)
@@ -2703,13 +2693,10 @@ static inline u32 sky2_clk2us(const struct sky2_hw *hw, u32 clk)
2703 2693
2704static int __devinit sky2_init(struct sky2_hw *hw) 2694static int __devinit sky2_init(struct sky2_hw *hw)
2705{ 2695{
2706 int rc;
2707 u8 t8; 2696 u8 t8;
2708 2697
2709 /* Enable all clocks and check for bad PCI access */ 2698 /* Enable all clocks and check for bad PCI access */
2710 rc = pci_write_config_dword(hw->pdev, PCI_DEV_REG3, 0); 2699 sky2_pci_write32(hw, PCI_DEV_REG3, 0);
2711 if (rc)
2712 return rc;
2713 2700
2714 sky2_write8(hw, B0_CTST, CS_RST_CLR); 2701 sky2_write8(hw, B0_CTST, CS_RST_CLR);
2715 2702
@@ -2806,32 +2793,21 @@ static void sky2_reset(struct sky2_hw *hw)
2806 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 2793 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2807 2794
2808 /* clear PCI errors, if any */ 2795 /* clear PCI errors, if any */
2809 pci_read_config_word(pdev, PCI_STATUS, &status); 2796 status = sky2_pci_read16(hw, PCI_STATUS);
2810 status |= PCI_STATUS_ERROR_BITS; 2797 status |= PCI_STATUS_ERROR_BITS;
2811 pci_write_config_word(pdev, PCI_STATUS, status); 2798 sky2_pci_write16(hw, PCI_STATUS, status);
2812 2799
2813 sky2_write8(hw, B0_CTST, CS_MRST_CLR); 2800 sky2_write8(hw, B0_CTST, CS_MRST_CLR);
2814 2801
2815 cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); 2802 cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
2816 if (cap) { 2803 if (cap) {
2817 if (pci_find_aer_capability(pdev)) { 2804 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2818 /* Check for advanced error reporting */ 2805 0xfffffffful);
2819 pci_cleanup_aer_uncorrect_error_status(pdev);
2820 pci_cleanup_aer_correct_error_status(pdev);
2821 } else {
2822 dev_warn(&pdev->dev,
2823 "PCI Express Advanced Error Reporting"
2824 " not configured or MMCONFIG problem?\n");
2825
2826 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2827 0xfffffffful);
2828 }
2829 2806
2830 /* If error bit is stuck on ignore it */ 2807 /* If error bit is stuck on ignore it */
2831 if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP) 2808 if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP)
2832 dev_info(&pdev->dev, "ignoring stuck error report bit\n"); 2809 dev_info(&pdev->dev, "ignoring stuck error report bit\n");
2833 2810 else
2834 else if (pci_enable_pcie_error_reporting(pdev))
2835 hwe_mask |= Y2_IS_PCI_EXP; 2811 hwe_mask |= Y2_IS_PCI_EXP;
2836 } 2812 }
2837 2813
@@ -3672,32 +3648,33 @@ static int sky2_set_tso(struct net_device *dev, u32 data)
3672static int sky2_get_eeprom_len(struct net_device *dev) 3648static int sky2_get_eeprom_len(struct net_device *dev)
3673{ 3649{
3674 struct sky2_port *sky2 = netdev_priv(dev); 3650 struct sky2_port *sky2 = netdev_priv(dev);
3651 struct sky2_hw *hw = sky2->hw;
3675 u16 reg2; 3652 u16 reg2;
3676 3653
3677 pci_read_config_word(sky2->hw->pdev, PCI_DEV_REG2, &reg2); 3654 reg2 = sky2_pci_read16(hw, PCI_DEV_REG2);
3678 return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8); 3655 return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8);
3679} 3656}
3680 3657
3681static u32 sky2_vpd_read(struct pci_dev *pdev, int cap, u16 offset) 3658static u32 sky2_vpd_read(struct sky2_hw *hw, int cap, u16 offset)
3682{ 3659{
3683 u32 val; 3660 u32 val;
3684 3661
3685 pci_write_config_word(pdev, cap + PCI_VPD_ADDR, offset); 3662 sky2_pci_write16(hw, cap + PCI_VPD_ADDR, offset);
3686 3663
3687 do { 3664 do {
3688 pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset); 3665 offset = sky2_pci_read16(hw, cap + PCI_VPD_ADDR);
3689 } while (!(offset & PCI_VPD_ADDR_F)); 3666 } while (!(offset & PCI_VPD_ADDR_F));
3690 3667
3691 pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &val); 3668 val = sky2_pci_read32(hw, cap + PCI_VPD_DATA);
3692 return val; 3669 return val;
3693} 3670}
3694 3671
3695static void sky2_vpd_write(struct pci_dev *pdev, int cap, u16 offset, u32 val) 3672static void sky2_vpd_write(struct sky2_hw *hw, int cap, u16 offset, u32 val)
3696{ 3673{
3697 pci_write_config_word(pdev, cap + PCI_VPD_DATA, val); 3674 sky2_pci_write16(hw, cap + PCI_VPD_DATA, val);
3698 pci_write_config_dword(pdev, cap + PCI_VPD_ADDR, offset | PCI_VPD_ADDR_F); 3675 sky2_pci_write32(hw, cap + PCI_VPD_ADDR, offset | PCI_VPD_ADDR_F);
3699 do { 3676 do {
3700 pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset); 3677 offset = sky2_pci_read16(hw, cap + PCI_VPD_ADDR);
3701 } while (offset & PCI_VPD_ADDR_F); 3678 } while (offset & PCI_VPD_ADDR_F);
3702} 3679}
3703 3680
@@ -3715,7 +3692,7 @@ static int sky2_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom
3715 eeprom->magic = SKY2_EEPROM_MAGIC; 3692 eeprom->magic = SKY2_EEPROM_MAGIC;
3716 3693
3717 while (length > 0) { 3694 while (length > 0) {
3718 u32 val = sky2_vpd_read(sky2->hw->pdev, cap, offset); 3695 u32 val = sky2_vpd_read(sky2->hw, cap, offset);
3719 int n = min_t(int, length, sizeof(val)); 3696 int n = min_t(int, length, sizeof(val));
3720 3697
3721 memcpy(data, &val, n); 3698 memcpy(data, &val, n);
@@ -3745,10 +3722,10 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom
3745 int n = min_t(int, length, sizeof(val)); 3722 int n = min_t(int, length, sizeof(val));
3746 3723
3747 if (n < sizeof(val)) 3724 if (n < sizeof(val))
3748 val = sky2_vpd_read(sky2->hw->pdev, cap, offset); 3725 val = sky2_vpd_read(sky2->hw, cap, offset);
3749 memcpy(&val, data, n); 3726 memcpy(&val, data, n);
3750 3727
3751 sky2_vpd_write(sky2->hw->pdev, cap, offset, val); 3728 sky2_vpd_write(sky2->hw, cap, offset, val);
3752 3729
3753 length -= n; 3730 length -= n;
3754 data += n; 3731 data += n;
@@ -4013,7 +3990,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
4013 sky2->duplex = -1; 3990 sky2->duplex = -1;
4014 sky2->speed = -1; 3991 sky2->speed = -1;
4015 sky2->advertising = sky2_supported_modes(hw); 3992 sky2->advertising = sky2_supported_modes(hw);
4016 sky2->rx_csum = 1; 3993 sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL);
4017 sky2->wol = wol; 3994 sky2->wol = wol;
4018 3995
4019 spin_lock_init(&sky2->phy_lock); 3996 spin_lock_init(&sky2->phy_lock);
@@ -4184,9 +4161,9 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4184 */ 4161 */
4185 { 4162 {
4186 u32 reg; 4163 u32 reg;
4187 pci_read_config_dword(pdev,PCI_DEV_REG2, &reg); 4164 reg = sky2_pci_read32(hw, PCI_DEV_REG2);
4188 reg &= ~PCI_REV_DESC; 4165 reg &= ~PCI_REV_DESC;
4189 pci_write_config_dword(pdev, PCI_DEV_REG2, reg); 4166 sky2_pci_write32(hw, PCI_DEV_REG2, reg);
4190 } 4167 }
4191#endif 4168#endif
4192 4169
@@ -4377,7 +4354,7 @@ static int sky2_resume(struct pci_dev *pdev)
4377 if (hw->chip_id == CHIP_ID_YUKON_EX || 4354 if (hw->chip_id == CHIP_ID_YUKON_EX ||
4378 hw->chip_id == CHIP_ID_YUKON_EC_U || 4355 hw->chip_id == CHIP_ID_YUKON_EC_U ||
4379 hw->chip_id == CHIP_ID_YUKON_FE_P) 4356 hw->chip_id == CHIP_ID_YUKON_FE_P)
4380 pci_write_config_dword(pdev, PCI_DEV_REG3, 0); 4357 sky2_pci_write32(hw, PCI_DEV_REG3, 0);
4381 4358
4382 sky2_reset(hw); 4359 sky2_reset(hw);
4383 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 4360 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 69525fd7908d..bc646a47edd2 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -2128,4 +2128,25 @@ static inline void gma_set_addr(struct sky2_hw *hw, unsigned port, unsigned reg,
2128 gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8)); 2128 gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8));
2129 gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8)); 2129 gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8));
2130} 2130}
2131
2132/* PCI config space access */
2133static inline u32 sky2_pci_read32(const struct sky2_hw *hw, unsigned reg)
2134{
2135 return sky2_read32(hw, Y2_CFG_SPC + reg);
2136}
2137
2138static inline u16 sky2_pci_read16(const struct sky2_hw *hw, unsigned reg)
2139{
2140 return sky2_read16(hw, Y2_CFG_SPC + reg);
2141}
2142
2143static inline void sky2_pci_write32(struct sky2_hw *hw, unsigned reg, u32 val)
2144{
2145 sky2_write32(hw, Y2_CFG_SPC + reg, val);
2146}
2147
2148static inline void sky2_pci_write16(struct sky2_hw *hw, unsigned reg, u16 val)
2149{
2150 sky2_write16(hw, Y2_CFG_SPC + reg, val);
2151}
2131#endif 2152#endif
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index dd18af0ce676..1a3d80bfe9ea 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -428,7 +428,6 @@ static inline void smc911x_drop_pkt(struct net_device *dev)
428 */ 428 */
429static inline void smc911x_rcv(struct net_device *dev) 429static inline void smc911x_rcv(struct net_device *dev)
430{ 430{
431 struct smc911x_local *lp = netdev_priv(dev);
432 unsigned long ioaddr = dev->base_addr; 431 unsigned long ioaddr = dev->base_addr;
433 unsigned int pkt_len, status; 432 unsigned int pkt_len, status;
434 struct sk_buff *skb; 433 struct sk_buff *skb;
@@ -473,6 +472,7 @@ static inline void smc911x_rcv(struct net_device *dev)
473 skb_put(skb,pkt_len-4); 472 skb_put(skb,pkt_len-4);
474#ifdef SMC_USE_DMA 473#ifdef SMC_USE_DMA
475 { 474 {
475 struct smc911x_local *lp = netdev_priv(dev);
476 unsigned int fifo; 476 unsigned int fifo;
477 /* Lower the FIFO threshold if possible */ 477 /* Lower the FIFO threshold if possible */
478 fifo = SMC_GET_FIFO_INT(); 478 fifo = SMC_GET_FIFO_INT();
@@ -1379,13 +1379,6 @@ static void smc911x_set_multicast_list(struct net_device *dev)
1379 unsigned int multicast_table[2]; 1379 unsigned int multicast_table[2];
1380 unsigned int mcr, update_multicast = 0; 1380 unsigned int mcr, update_multicast = 0;
1381 unsigned long flags; 1381 unsigned long flags;
1382 /* table for flipping the order of 5 bits */
1383 static const unsigned char invert5[] =
1384 {0x00, 0x10, 0x08, 0x18, 0x04, 0x14, 0x0C, 0x1C,
1385 0x02, 0x12, 0x0A, 0x1A, 0x06, 0x16, 0x0E, 0x1E,
1386 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0D, 0x1D,
1387 0x03, 0x13, 0x0B, 0x1B, 0x07, 0x17, 0x0F, 0x1F};
1388
1389 1382
1390 DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); 1383 DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__);
1391 1384
@@ -1432,7 +1425,7 @@ static void smc911x_set_multicast_list(struct net_device *dev)
1432 1425
1433 cur_addr = dev->mc_list; 1426 cur_addr = dev->mc_list;
1434 for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) { 1427 for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) {
1435 int position; 1428 u32 position;
1436 1429
1437 /* do we have a pointer here? */ 1430 /* do we have a pointer here? */
1438 if (!cur_addr) 1431 if (!cur_addr)
@@ -1442,12 +1435,10 @@ static void smc911x_set_multicast_list(struct net_device *dev)
1442 if (!(*cur_addr->dmi_addr & 1)) 1435 if (!(*cur_addr->dmi_addr & 1))
1443 continue; 1436 continue;
1444 1437
1445 /* only use the low order bits */ 1438 /* upper 6 bits are used as hash index */
1446 position = crc32_le(~0, cur_addr->dmi_addr, 6) & 0x3f; 1439 position = ether_crc(ETH_ALEN, cur_addr->dmi_addr)>>26;
1447 1440
1448 /* do some messy swapping to put the bit in the right spot */ 1441 multicast_table[position>>5] |= 1 << (position&0x1f);
1449 multicast_table[invert5[position&0x1F]&0x1] |=
1450 (1<<invert5[(position>>1)&0x1F]);
1451 } 1442 }
1452 1443
1453 /* be sure I get rid of flags I might have set */ 1444 /* be sure I get rid of flags I might have set */
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index 16a0edc078fd..d04e4fa35206 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -37,7 +37,7 @@
37 #define SMC_USE_16BIT 0 37 #define SMC_USE_16BIT 0
38 #define SMC_USE_32BIT 1 38 #define SMC_USE_32BIT 1
39 #define SMC_IRQ_SENSE IRQF_TRIGGER_FALLING 39 #define SMC_IRQ_SENSE IRQF_TRIGGER_FALLING
40#elif CONFIG_SH_MAGIC_PANEL_R2 40#elif defined(CONFIG_SH_MAGIC_PANEL_R2)
41 #define SMC_USE_SH_DMA 0 41 #define SMC_USE_SH_DMA 0
42 #define SMC_USE_16BIT 0 42 #define SMC_USE_16BIT 0
43 #define SMC_USE_32BIT 1 43 #define SMC_USE_32BIT 1
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index db34e1eb67e9..07b7f7120e37 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -55,7 +55,7 @@
55#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) 55#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l)
56#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) 56#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l)
57 57
58#elif defined(CONFIG_BFIN) 58#elif defined(CONFIG_BLACKFIN)
59 59
60#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH 60#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH
61#define RPC_LSA_DEFAULT RPC_LED_100_10 61#define RPC_LSA_DEFAULT RPC_LED_100_10
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index f6fedcc32de1..68872142530b 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2281,14 +2281,12 @@ static void gem_reset_task(struct work_struct *work)
2281 2281
2282 mutex_lock(&gp->pm_mutex); 2282 mutex_lock(&gp->pm_mutex);
2283 2283
2284 napi_disable(&gp->napi); 2284 if (gp->opened)
2285 napi_disable(&gp->napi);
2285 2286
2286 spin_lock_irq(&gp->lock); 2287 spin_lock_irq(&gp->lock);
2287 spin_lock(&gp->tx_lock); 2288 spin_lock(&gp->tx_lock);
2288 2289
2289 if (gp->running == 0)
2290 goto not_running;
2291
2292 if (gp->running) { 2290 if (gp->running) {
2293 netif_stop_queue(gp->dev); 2291 netif_stop_queue(gp->dev);
2294 2292
@@ -2298,13 +2296,14 @@ static void gem_reset_task(struct work_struct *work)
2298 gem_set_link_modes(gp); 2296 gem_set_link_modes(gp);
2299 netif_wake_queue(gp->dev); 2297 netif_wake_queue(gp->dev);
2300 } 2298 }
2301 not_running: 2299
2302 gp->reset_task_pending = 0; 2300 gp->reset_task_pending = 0;
2303 2301
2304 spin_unlock(&gp->tx_lock); 2302 spin_unlock(&gp->tx_lock);
2305 spin_unlock_irq(&gp->lock); 2303 spin_unlock_irq(&gp->lock);
2306 2304
2307 napi_enable(&gp->napi); 2305 if (gp->opened)
2306 napi_enable(&gp->napi);
2308 2307
2309 mutex_unlock(&gp->pm_mutex); 2308 mutex_unlock(&gp->pm_mutex);
2310} 2309}
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index ca90566d5bcd..b4891caeae5a 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -2118,8 +2118,8 @@ static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state)
2118 pci_enable_wake(pci_dev, PCI_D3cold, 1); 2118 pci_enable_wake(pci_dev, PCI_D3cold, 1);
2119 2119
2120 /* Power down device*/ 2120 /* Power down device*/
2121 pci_set_power_state(pci_dev, pci_choose_state (pci_dev,state));
2122 pci_save_state(pci_dev); 2121 pci_save_state(pci_dev);
2122 pci_set_power_state(pci_dev, pci_choose_state (pci_dev, state));
2123 2123
2124 return 0; 2124 return 0;
2125} 2125}
@@ -2129,8 +2129,8 @@ static int dmfe_resume(struct pci_dev *pci_dev)
2129 struct net_device *dev = pci_get_drvdata(pci_dev); 2129 struct net_device *dev = pci_get_drvdata(pci_dev);
2130 u32 tmp; 2130 u32 tmp;
2131 2131
2132 pci_restore_state(pci_dev);
2133 pci_set_power_state(pci_dev, PCI_D0); 2132 pci_set_power_state(pci_dev, PCI_D0);
2133 pci_restore_state(pci_dev);
2134 2134
2135 /* Re-initilize DM910X board */ 2135 /* Re-initilize DM910X board */
2136 dmfe_init_dm910x(dev); 2136 dmfe_init_dm910x(dev);
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index a3ff270593f1..7f689907ac28 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1460,6 +1460,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
1460 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || 1460 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) ||
1461 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || 1461 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) ||
1462 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || 1462 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ||
1463 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
1464 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
1463 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { 1465 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
1464 upsmr |= UPSMR_RPM; 1466 upsmr |= UPSMR_RPM;
1465 switch (ugeth->max_speed) { 1467 switch (ugeth->max_speed) {
@@ -1557,6 +1559,8 @@ static void adjust_link(struct net_device *dev)
1557 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || 1559 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) ||
1558 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || 1560 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) ||
1559 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || 1561 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ||
1562 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
1563 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
1560 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { 1564 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
1561 if (phydev->speed == SPEED_10) 1565 if (phydev->speed == SPEED_10)
1562 upsmr |= UPSMR_R10M; 1566 upsmr |= UPSMR_R10M;
@@ -3795,6 +3799,10 @@ static phy_interface_t to_phy_interface(const char *phy_connection_type)
3795 return PHY_INTERFACE_MODE_RGMII; 3799 return PHY_INTERFACE_MODE_RGMII;
3796 if (strcasecmp(phy_connection_type, "rgmii-id") == 0) 3800 if (strcasecmp(phy_connection_type, "rgmii-id") == 0)
3797 return PHY_INTERFACE_MODE_RGMII_ID; 3801 return PHY_INTERFACE_MODE_RGMII_ID;
3802 if (strcasecmp(phy_connection_type, "rgmii-txid") == 0)
3803 return PHY_INTERFACE_MODE_RGMII_TXID;
3804 if (strcasecmp(phy_connection_type, "rgmii-rxid") == 0)
3805 return PHY_INTERFACE_MODE_RGMII_RXID;
3798 if (strcasecmp(phy_connection_type, "rtbi") == 0) 3806 if (strcasecmp(phy_connection_type, "rtbi") == 0)
3799 return PHY_INTERFACE_MODE_RTBI; 3807 return PHY_INTERFACE_MODE_RTBI;
3800 3808
@@ -3889,6 +3897,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3889 case PHY_INTERFACE_MODE_GMII: 3897 case PHY_INTERFACE_MODE_GMII:
3890 case PHY_INTERFACE_MODE_RGMII: 3898 case PHY_INTERFACE_MODE_RGMII:
3891 case PHY_INTERFACE_MODE_RGMII_ID: 3899 case PHY_INTERFACE_MODE_RGMII_ID:
3900 case PHY_INTERFACE_MODE_RGMII_RXID:
3901 case PHY_INTERFACE_MODE_RGMII_TXID:
3892 case PHY_INTERFACE_MODE_TBI: 3902 case PHY_INTERFACE_MODE_TBI:
3893 case PHY_INTERFACE_MODE_RTBI: 3903 case PHY_INTERFACE_MODE_RTBI:
3894 max_speed = SPEED_1000; 3904 max_speed = SPEED_1000;
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 2c685734b7a4..1ffdd106f4c4 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -94,7 +94,7 @@ static void dm_write_async_callback(struct urb *urb)
94 struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; 94 struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
95 95
96 if (urb->status < 0) 96 if (urb->status < 0)
97 printk(KERN_DEBUG "dm_write_async_callback() failed with %d", 97 printk(KERN_DEBUG "dm_write_async_callback() failed with %d\n",
98 urb->status); 98 urb->status);
99 99
100 kfree(req); 100 kfree(req);
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 450e29d7a9f3..35cd65d6b9ed 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1242,6 +1242,9 @@ static int velocity_rx_refill(struct velocity_info *vptr)
1242static int velocity_init_rd_ring(struct velocity_info *vptr) 1242static int velocity_init_rd_ring(struct velocity_info *vptr)
1243{ 1243{
1244 int ret; 1244 int ret;
1245 int mtu = vptr->dev->mtu;
1246
1247 vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;
1245 1248
1246 vptr->rd_info = kcalloc(vptr->options.numrx, 1249 vptr->rd_info = kcalloc(vptr->options.numrx,
1247 sizeof(struct velocity_rd_info), GFP_KERNEL); 1250 sizeof(struct velocity_rd_info), GFP_KERNEL);
@@ -1898,8 +1901,6 @@ static int velocity_open(struct net_device *dev)
1898 struct velocity_info *vptr = netdev_priv(dev); 1901 struct velocity_info *vptr = netdev_priv(dev);
1899 int ret; 1902 int ret;
1900 1903
1901 vptr->rx_buf_sz = (dev->mtu <= 1504 ? PKT_BUF_SZ : dev->mtu + 32);
1902
1903 ret = velocity_init_rings(vptr); 1904 ret = velocity_init_rings(vptr);
1904 if (ret < 0) 1905 if (ret < 0)
1905 goto out; 1906 goto out;
@@ -1978,12 +1979,6 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
1978 velocity_free_rd_ring(vptr); 1979 velocity_free_rd_ring(vptr);
1979 1980
1980 dev->mtu = new_mtu; 1981 dev->mtu = new_mtu;
1981 if (new_mtu > 8192)
1982 vptr->rx_buf_sz = 9 * 1024;
1983 else if (new_mtu > 4096)
1984 vptr->rx_buf_sz = 8192;
1985 else
1986 vptr->rx_buf_sz = 4 * 1024;
1987 1982
1988 ret = velocity_init_rd_ring(vptr); 1983 ret = velocity_init_rd_ring(vptr);
1989 if (ret < 0) 1984 if (ret < 0)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 2b17c1dc46f1..b45eecc53c4a 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1566,7 +1566,7 @@ static void b43_release_firmware(struct b43_wldev *dev)
1566static void b43_print_fw_helptext(struct b43_wl *wl) 1566static void b43_print_fw_helptext(struct b43_wl *wl)
1567{ 1567{
1568 b43err(wl, "You must go to " 1568 b43err(wl, "You must go to "
1569 "http://linuxwireless.org/en/users/Drivers/bcm43xx#devicefirmware " 1569 "http://linuxwireless.org/en/users/Drivers/b43#devicefirmware "
1570 "and download the correct firmware (version 4).\n"); 1570 "and download the correct firmware (version 4).\n");
1571} 1571}
1572 1572
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c
index 3d4ed647c311..7ff091e69f05 100644
--- a/drivers/net/wireless/b43/phy.c
+++ b/drivers/net/wireless/b43/phy.c
@@ -2214,7 +2214,7 @@ int b43_phy_init_tssi2dbm_table(struct b43_wldev *dev)
2214 } 2214 }
2215 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); 2215 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);
2216 if (dyn_tssi2dbm == NULL) { 2216 if (dyn_tssi2dbm == NULL) {
2217 b43err(dev->wl, "Could not allocate memory" 2217 b43err(dev->wl, "Could not allocate memory "
2218 "for tssi2dbm table\n"); 2218 "for tssi2dbm table\n");
2219 return -ENOMEM; 2219 return -ENOMEM;
2220 } 2220 }
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index 8cb3dc4c4745..83161d9af813 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -996,7 +996,7 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
996 996
997 err = ssb_dma_set_mask(dev->dev, dmamask); 997 err = ssb_dma_set_mask(dev->dev, dmamask);
998 if (err) { 998 if (err) {
999#ifdef BCM43XX_PIO 999#ifdef CONFIG_B43LEGACY_PIO
1000 b43legacywarn(dev->wl, "DMA for this device not supported. " 1000 b43legacywarn(dev->wl, "DMA for this device not supported. "
1001 "Falling back to PIO\n"); 1001 "Falling back to PIO\n");
1002 dev->__using_pio = 1; 1002 dev->__using_pio = 1;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 3bde1e9ab428..32d5e1785bda 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -1419,7 +1419,7 @@ static void b43legacy_release_firmware(struct b43legacy_wldev *dev)
1419static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl) 1419static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl)
1420{ 1420{
1421 b43legacyerr(wl, "You must go to http://linuxwireless.org/en/users/" 1421 b43legacyerr(wl, "You must go to http://linuxwireless.org/en/users/"
1422 "Drivers/bcm43xx#devicefirmware " 1422 "Drivers/b43#devicefirmware "
1423 "and download the correct firmware (version 3).\n"); 1423 "and download the correct firmware (version 3).\n");
1424} 1424}
1425 1425
diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c
index 22a4b3d0186d..491e518e4aeb 100644
--- a/drivers/net/wireless/b43legacy/phy.c
+++ b/drivers/net/wireless/b43legacy/phy.c
@@ -2020,7 +2020,7 @@ int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev)
2020 phy->idle_tssi = 62; 2020 phy->idle_tssi = 62;
2021 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); 2021 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);
2022 if (dyn_tssi2dbm == NULL) { 2022 if (dyn_tssi2dbm == NULL) {
2023 b43legacyerr(dev->wl, "Could not allocate memory" 2023 b43legacyerr(dev->wl, "Could not allocate memory "
2024 "for tssi2dbm table\n"); 2024 "for tssi2dbm table\n");
2025 return -ENOMEM; 2025 return -ENOMEM;
2026 } 2026 }
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index b37f1e348700..af3de3343650 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -2149,7 +2149,7 @@ int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm)
2149 } 2149 }
2150 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); 2150 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);
2151 if (dyn_tssi2dbm == NULL) { 2151 if (dyn_tssi2dbm == NULL) {
2152 printk(KERN_ERR PFX "Could not allocate memory" 2152 printk(KERN_ERR PFX "Could not allocate memory "
2153 "for tssi2dbm table\n"); 2153 "for tssi2dbm table\n");
2154 return -ENOMEM; 2154 return -ENOMEM;
2155 } 2155 }
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 465da4f67ce7..4bdf237f6adc 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2915,6 +2915,10 @@ static void iwl_set_rate(struct iwl_priv *priv)
2915 int i; 2915 int i;
2916 2916
2917 hw = iwl_get_hw_mode(priv, priv->phymode); 2917 hw = iwl_get_hw_mode(priv, priv->phymode);
2918 if (!hw) {
2919 IWL_ERROR("Failed to set rate: unable to get hw mode\n");
2920 return;
2921 }
2918 2922
2919 priv->active_rate = 0; 2923 priv->active_rate = 0;
2920 priv->active_rate_basic = 0; 2924 priv->active_rate_basic = 0;
@@ -6936,13 +6940,10 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
6936 DECLARE_MAC_BUF(mac); 6940 DECLARE_MAC_BUF(mac);
6937 6941
6938 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); 6942 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type);
6939 if (conf->mac_addr)
6940 IWL_DEBUG_MAC80211("enter: MAC %s\n",
6941 print_mac(mac, conf->mac_addr));
6942 6943
6943 if (priv->interface_id) { 6944 if (priv->interface_id) {
6944 IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); 6945 IWL_DEBUG_MAC80211("leave - interface_id != 0\n");
6945 return 0; 6946 return -EOPNOTSUPP;
6946 } 6947 }
6947 6948
6948 spin_lock_irqsave(&priv->lock, flags); 6949 spin_lock_irqsave(&priv->lock, flags);
@@ -6951,6 +6952,12 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
6951 spin_unlock_irqrestore(&priv->lock, flags); 6952 spin_unlock_irqrestore(&priv->lock, flags);
6952 6953
6953 mutex_lock(&priv->mutex); 6954 mutex_lock(&priv->mutex);
6955
6956 if (conf->mac_addr) {
6957 IWL_DEBUG_MAC80211("Set: %s\n", print_mac(mac, conf->mac_addr));
6958 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
6959 }
6960
6954 iwl_set_mode(priv, conf->type); 6961 iwl_set_mode(priv, conf->type);
6955 6962
6956 IWL_DEBUG_MAC80211("leave\n"); 6963 IWL_DEBUG_MAC80211("leave\n");
@@ -8270,6 +8277,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
8270{ 8277{
8271 iwl_hw_cancel_deferred_work(priv); 8278 iwl_hw_cancel_deferred_work(priv);
8272 8279
8280 cancel_delayed_work_sync(&priv->init_alive_start);
8273 cancel_delayed_work(&priv->scan_check); 8281 cancel_delayed_work(&priv->scan_check);
8274 cancel_delayed_work(&priv->alive_start); 8282 cancel_delayed_work(&priv->alive_start);
8275 cancel_delayed_work(&priv->post_associate); 8283 cancel_delayed_work(&priv->post_associate);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 9918780f5e86..8f85564ec6fa 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -3003,6 +3003,10 @@ static void iwl_set_rate(struct iwl_priv *priv)
3003 int i; 3003 int i;
3004 3004
3005 hw = iwl_get_hw_mode(priv, priv->phymode); 3005 hw = iwl_get_hw_mode(priv, priv->phymode);
3006 if (!hw) {
3007 IWL_ERROR("Failed to set rate: unable to get hw mode\n");
3008 return;
3009 }
3006 3010
3007 priv->active_rate = 0; 3011 priv->active_rate = 0;
3008 priv->active_rate_basic = 0; 3012 priv->active_rate_basic = 0;
@@ -7326,9 +7330,6 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
7326 DECLARE_MAC_BUF(mac); 7330 DECLARE_MAC_BUF(mac);
7327 7331
7328 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); 7332 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type);
7329 if (conf->mac_addr)
7330 IWL_DEBUG_MAC80211("enter: MAC %s\n",
7331 print_mac(mac, conf->mac_addr));
7332 7333
7333 if (priv->interface_id) { 7334 if (priv->interface_id) {
7334 IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); 7335 IWL_DEBUG_MAC80211("leave - interface_id != 0\n");
@@ -7341,6 +7342,11 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
7341 spin_unlock_irqrestore(&priv->lock, flags); 7342 spin_unlock_irqrestore(&priv->lock, flags);
7342 7343
7343 mutex_lock(&priv->mutex); 7344 mutex_lock(&priv->mutex);
7345
7346 if (conf->mac_addr) {
7347 IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr));
7348 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
7349 }
7344 iwl_set_mode(priv, conf->type); 7350 iwl_set_mode(priv, conf->type);
7345 7351
7346 IWL_DEBUG_MAC80211("leave\n"); 7352 IWL_DEBUG_MAC80211("leave\n");
@@ -8864,6 +8870,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
8864{ 8870{
8865 iwl_hw_cancel_deferred_work(priv); 8871 iwl_hw_cancel_deferred_work(priv);
8866 8872
8873 cancel_delayed_work_sync(&priv->init_alive_start);
8867 cancel_delayed_work(&priv->scan_check); 8874 cancel_delayed_work(&priv->scan_check);
8868 cancel_delayed_work(&priv->alive_start); 8875 cancel_delayed_work(&priv->alive_start);
8869 cancel_delayed_work(&priv->post_associate); 8876 cancel_delayed_work(&priv->post_associate);
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index ec89dabc412c..ba4fc2b3bf0a 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -170,7 +170,8 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r
170#define IF_CS_H_IC_TX_OVER 0x0001 170#define IF_CS_H_IC_TX_OVER 0x0001
171#define IF_CS_H_IC_RX_OVER 0x0002 171#define IF_CS_H_IC_RX_OVER 0x0002
172#define IF_CS_H_IC_DNLD_OVER 0x0004 172#define IF_CS_H_IC_DNLD_OVER 0x0004
173#define IF_CS_H_IC_HOST_EVENT 0x0008 173#define IF_CS_H_IC_POWER_DOWN 0x0008
174#define IF_CS_H_IC_HOST_EVENT 0x0010
174#define IF_CS_H_IC_MASK 0x001f 175#define IF_CS_H_IC_MASK 0x001f
175 176
176#define IF_CS_H_INT_MASK 0x00000004 177#define IF_CS_H_INT_MASK 0x00000004
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 5ead08312e1e..1823b48a8ba7 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -1165,8 +1165,6 @@ wlan_private *libertas_add_card(void *card, struct device *dmdev)
1165#ifdef WIRELESS_EXT 1165#ifdef WIRELESS_EXT
1166 dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; 1166 dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
1167#endif 1167#endif
1168#define NETIF_F_DYNALLOC 16
1169 dev->features |= NETIF_F_DYNALLOC;
1170 dev->flags |= IFF_BROADCAST | IFF_MULTICAST; 1168 dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
1171 dev->set_multicast_list = libertas_set_multicast_list; 1169 dev->set_multicast_list = libertas_set_multicast_list;
1172 1170
@@ -1348,8 +1346,6 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev)
1348#ifdef WIRELESS_EXT 1346#ifdef WIRELESS_EXT
1349 mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def; 1347 mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def;
1350#endif 1348#endif
1351#define NETIF_F_DYNALLOC 16
1352
1353 /* Register virtual mesh interface */ 1349 /* Register virtual mesh interface */
1354 ret = register_netdev(mesh_dev); 1350 ret = register_netdev(mesh_dev);
1355 if (ret) { 1351 if (ret) {
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index c6f5aa3cb465..395b7882d4d6 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -1528,7 +1528,7 @@ static int wlan_set_encodeext(struct net_device *dev,
1528 && (ext->key_len != KEY_LEN_WPA_TKIP)) 1528 && (ext->key_len != KEY_LEN_WPA_TKIP))
1529 || ((alg == IW_ENCODE_ALG_CCMP) 1529 || ((alg == IW_ENCODE_ALG_CCMP)
1530 && (ext->key_len != KEY_LEN_WPA_AES))) { 1530 && (ext->key_len != KEY_LEN_WPA_AES))) {
1531 lbs_deb_wext("invalid size %d for key of alg" 1531 lbs_deb_wext("invalid size %d for key of alg "
1532 "type %d\n", 1532 "type %d\n",
1533 ext->key_len, 1533 ext->key_len,
1534 alg); 1534 alg);
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 2402cb8dd328..d2fa079fbc4c 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -806,7 +806,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
806 for (i = 0; i < 6; i++) 806 for (i = 0; i < 6; i++)
807 dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i); 807 dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i);
808 808
809 printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx" 809 printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx, "
810 "id %c%c, hw_addr %s\n", 810 "id %c%c, hw_addr %s\n",
811 dev->name, dev->base_addr, dev->irq, 811 dev->name, dev->base_addr, dev->irq,
812 (u_long) ramBase, 812 (u_long) ramBase,
diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c
index 755482a5a938..60d286eb0b8b 100644
--- a/drivers/net/wireless/p54usb.c
+++ b/drivers/net/wireless/p54usb.c
@@ -308,7 +308,7 @@ static int p54u_read_eeprom(struct ieee80211_hw *dev)
308 308
309 buf = kmalloc(0x2020, GFP_KERNEL); 309 buf = kmalloc(0x2020, GFP_KERNEL);
310 if (!buf) { 310 if (!buf) {
311 printk(KERN_ERR "prism54usb: cannot allocate memory for" 311 printk(KERN_ERR "prism54usb: cannot allocate memory for "
312 "eeprom readback!\n"); 312 "eeprom readback!\n");
313 return -ENOMEM; 313 return -ENOMEM;
314 } 314 }
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c
index 6bf3ebbe985a..b3b6f654365c 100644
--- a/drivers/s390/net/ctcmain.c
+++ b/drivers/s390/net/ctcmain.c
@@ -2782,35 +2782,14 @@ ctc_probe_device(struct ccwgroup_device *cgdev)
2782} 2782}
2783 2783
2784/** 2784/**
2785 * Initialize everything of the net device except the name and the 2785 * Device setup function called by alloc_netdev().
2786 * channel structs. 2786 *
2787 * @param dev Device to be setup.
2787 */ 2788 */
2788static struct net_device * 2789void ctc_init_netdevice(struct net_device * dev)
2789ctc_init_netdevice(struct net_device * dev, int alloc_device,
2790 struct ctc_priv *privptr)
2791{ 2790{
2792 if (!privptr)
2793 return NULL;
2794
2795 DBF_TEXT(setup, 3, __FUNCTION__); 2791 DBF_TEXT(setup, 3, __FUNCTION__);
2796 2792
2797 if (alloc_device) {
2798 dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
2799 if (!dev)
2800 return NULL;
2801 }
2802
2803 dev->priv = privptr;
2804 privptr->fsm = init_fsm("ctcdev", dev_state_names,
2805 dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
2806 dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
2807 if (privptr->fsm == NULL) {
2808 if (alloc_device)
2809 kfree(dev);
2810 return NULL;
2811 }
2812 fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
2813 fsm_settimer(privptr->fsm, &privptr->restart_timer);
2814 if (dev->mtu == 0) 2793 if (dev->mtu == 0)
2815 dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2; 2794 dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2;
2816 dev->hard_start_xmit = ctc_tx; 2795 dev->hard_start_xmit = ctc_tx;
@@ -2823,7 +2802,7 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device,
2823 dev->type = ARPHRD_SLIP; 2802 dev->type = ARPHRD_SLIP;
2824 dev->tx_queue_len = 100; 2803 dev->tx_queue_len = 100;
2825 dev->flags = IFF_POINTOPOINT | IFF_NOARP; 2804 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
2826 return dev; 2805 SET_MODULE_OWNER(dev);
2827} 2806}
2828 2807
2829 2808
@@ -2879,14 +2858,22 @@ ctc_new_device(struct ccwgroup_device *cgdev)
2879 "ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret); 2858 "ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret);
2880 } 2859 }
2881 2860
2882 dev = ctc_init_netdevice(NULL, 1, privptr); 2861 dev = alloc_netdev(0, "ctc%d", ctc_init_netdevice);
2883
2884 if (!dev) { 2862 if (!dev) {
2885 ctc_pr_warn("ctc_init_netdevice failed\n"); 2863 ctc_pr_warn("ctc_init_netdevice failed\n");
2886 goto out; 2864 goto out;
2887 } 2865 }
2866 dev->priv = privptr;
2888 2867
2889 strlcpy(dev->name, "ctc%d", IFNAMSIZ); 2868 privptr->fsm = init_fsm("ctcdev", dev_state_names,
2869 dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
2870 dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
2871 if (privptr->fsm == NULL) {
2872 free_netdev(dev);
2873 goto out;
2874 }
2875 fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
2876 fsm_settimer(privptr->fsm, &privptr->restart_timer);
2890 2877
2891 for (direction = READ; direction <= WRITE; direction++) { 2878 for (direction = READ; direction <= WRITE; direction++) {
2892 privptr->channel[direction] = 2879 privptr->channel[direction] =
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 5552b755c08a..07fa824d179f 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -977,7 +977,9 @@ static void zfcp_erp_action_dismiss(struct zfcp_erp_action *erp_action)
977 debug_text_event(adapter->erp_dbf, 2, "a_adis"); 977 debug_text_event(adapter->erp_dbf, 2, "a_adis");
978 debug_event(adapter->erp_dbf, 2, &erp_action->action, sizeof (int)); 978 debug_event(adapter->erp_dbf, 2, &erp_action->action, sizeof (int));
979 979
980 zfcp_erp_async_handler_nolock(erp_action, ZFCP_STATUS_ERP_DISMISSED); 980 erp_action->status |= ZFCP_STATUS_ERP_DISMISSED;
981 if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING)
982 zfcp_erp_action_ready(erp_action);
981} 983}
982 984
983int 985int
@@ -1063,7 +1065,7 @@ zfcp_erp_thread(void *data)
1063 &adapter->status)) { 1065 &adapter->status)) {
1064 1066
1065 write_lock_irqsave(&adapter->erp_lock, flags); 1067 write_lock_irqsave(&adapter->erp_lock, flags);
1066 next = adapter->erp_ready_head.prev; 1068 next = adapter->erp_ready_head.next;
1067 write_unlock_irqrestore(&adapter->erp_lock, flags); 1069 write_unlock_irqrestore(&adapter->erp_lock, flags);
1068 1070
1069 if (next != &adapter->erp_ready_head) { 1071 if (next != &adapter->erp_ready_head) {
@@ -1153,15 +1155,13 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action)
1153 1155
1154 /* 1156 /*
1155 * check for dismissed status again to avoid follow-up actions, 1157 * check for dismissed status again to avoid follow-up actions,
1156 * failing of targets and so on for dismissed actions 1158 * failing of targets and so on for dismissed actions,
1159 * we go through down() here because there has been an up()
1157 */ 1160 */
1158 retval = zfcp_erp_strategy_check_action(erp_action, retval); 1161 if (erp_action->status & ZFCP_STATUS_ERP_DISMISSED)
1162 retval = ZFCP_ERP_CONTINUES;
1159 1163
1160 switch (retval) { 1164 switch (retval) {
1161 case ZFCP_ERP_DISMISSED:
1162 /* leave since this action has ridden to its ancestors */
1163 debug_text_event(adapter->erp_dbf, 6, "a_st_dis2");
1164 goto unlock;
1165 case ZFCP_ERP_NOMEM: 1165 case ZFCP_ERP_NOMEM:
1166 /* no memory to continue immediately, let it sleep */ 1166 /* no memory to continue immediately, let it sleep */
1167 if (!(erp_action->status & ZFCP_STATUS_ERP_LOWMEM)) { 1167 if (!(erp_action->status & ZFCP_STATUS_ERP_LOWMEM)) {
@@ -3089,7 +3089,7 @@ zfcp_erp_action_enqueue(int action,
3089 ++adapter->erp_total_count; 3089 ++adapter->erp_total_count;
3090 3090
3091 /* finally put it into 'ready' queue and kick erp thread */ 3091 /* finally put it into 'ready' queue and kick erp thread */
3092 list_add(&erp_action->list, &adapter->erp_ready_head); 3092 list_add_tail(&erp_action->list, &adapter->erp_ready_head);
3093 up(&adapter->erp_ready_sem); 3093 up(&adapter->erp_ready_sem);
3094 retval = 0; 3094 retval = 0;
3095 out: 3095 out:
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 240a0bb8986f..abce48ccc85b 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1339,10 +1339,10 @@ int aac_check_health(struct aac_dev * aac)
1339 aif = (struct aac_aifcmd *)hw_fib->data; 1339 aif = (struct aac_aifcmd *)hw_fib->data;
1340 aif->command = cpu_to_le32(AifCmdEventNotify); 1340 aif->command = cpu_to_le32(AifCmdEventNotify);
1341 aif->seqnum = cpu_to_le32(0xFFFFFFFF); 1341 aif->seqnum = cpu_to_le32(0xFFFFFFFF);
1342 aif->data[0] = cpu_to_le32(AifEnExpEvent); 1342 aif->data[0] = AifEnExpEvent;
1343 aif->data[1] = cpu_to_le32(AifExeFirmwarePanic); 1343 aif->data[1] = AifExeFirmwarePanic;
1344 aif->data[2] = cpu_to_le32(AifHighPriority); 1344 aif->data[2] = AifHighPriority;
1345 aif->data[3] = cpu_to_le32(BlinkLED); 1345 aif->data[3] = BlinkLED;
1346 1346
1347 /* 1347 /*
1348 * Put the FIB onto the 1348 * Put the FIB onto the
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 038980be763d..9dd331bc29b0 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -636,7 +636,7 @@ static int aac_cfg_open(struct inode *inode, struct file *file)
636static int aac_cfg_ioctl(struct inode *inode, struct file *file, 636static int aac_cfg_ioctl(struct inode *inode, struct file *file,
637 unsigned int cmd, unsigned long arg) 637 unsigned int cmd, unsigned long arg)
638{ 638{
639 if (!capable(CAP_SYS_ADMIN)) 639 if (!capable(CAP_SYS_RAWIO))
640 return -EPERM; 640 return -EPERM;
641 return aac_do_ioctl(file->private_data, cmd, (void __user *)arg); 641 return aac_do_ioctl(file->private_data, cmd, (void __user *)arg);
642} 642}
@@ -691,7 +691,7 @@ static int aac_compat_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
691 691
692static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long arg) 692static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long arg)
693{ 693{
694 if (!capable(CAP_SYS_ADMIN)) 694 if (!capable(CAP_SYS_RAWIO))
695 return -EPERM; 695 return -EPERM;
696 return aac_compat_do_ioctl((struct aac_dev *)file->private_data, cmd, arg); 696 return aac_compat_do_ioctl((struct aac_dev *)file->private_data, cmd, arg);
697} 697}
@@ -950,7 +950,8 @@ static struct scsi_host_template aac_driver_template = {
950 950
951static void __aac_shutdown(struct aac_dev * aac) 951static void __aac_shutdown(struct aac_dev * aac)
952{ 952{
953 kthread_stop(aac->thread); 953 if (aac->aif_thread)
954 kthread_stop(aac->thread);
954 aac_send_shutdown(aac); 955 aac_send_shutdown(aac);
955 aac_adapter_disable_int(aac); 956 aac_adapter_disable_int(aac);
956 free_irq(aac->pdev->irq, aac); 957 free_irq(aac->pdev->irq, aac);
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index 6f8403b82ba1..f5732d8f67fe 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -393,7 +393,7 @@ static irqreturn_t scsi_tt_intr(int irq, void *dummy)
393 393
394#endif /* REAL_DMA */ 394#endif /* REAL_DMA */
395 395
396 NCR5380_intr(0, 0); 396 NCR5380_intr(irq, dummy);
397 397
398#if 0 398#if 0
399 /* To be sure the int is not masked */ 399 /* To be sure the int is not masked */
@@ -458,7 +458,7 @@ static irqreturn_t scsi_falcon_intr(int irq, void *dummy)
458 458
459#endif /* REAL_DMA */ 459#endif /* REAL_DMA */
460 460
461 NCR5380_intr(0, 0); 461 NCR5380_intr(irq, dummy);
462 return IRQ_HANDLED; 462 return IRQ_HANDLED;
463} 463}
464 464
@@ -684,7 +684,7 @@ int atari_scsi_detect(struct scsi_host_template *host)
684 * interrupt after having cleared the pending flag for the DMA 684 * interrupt after having cleared the pending flag for the DMA
685 * interrupt. */ 685 * interrupt. */
686 if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW, 686 if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW,
687 "SCSI NCR5380", scsi_tt_intr)) { 687 "SCSI NCR5380", instance)) {
688 printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI); 688 printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI);
689 scsi_unregister(atari_scsi_host); 689 scsi_unregister(atari_scsi_host);
690 atari_stram_free(atari_dma_buffer); 690 atari_stram_free(atari_dma_buffer);
@@ -701,7 +701,7 @@ int atari_scsi_detect(struct scsi_host_template *host)
701 IRQ_TYPE_PRIO, "Hades DMA emulator", 701 IRQ_TYPE_PRIO, "Hades DMA emulator",
702 hades_dma_emulator)) { 702 hades_dma_emulator)) {
703 printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2); 703 printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2);
704 free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); 704 free_irq(IRQ_TT_MFP_SCSI, instance);
705 scsi_unregister(atari_scsi_host); 705 scsi_unregister(atari_scsi_host);
706 atari_stram_free(atari_dma_buffer); 706 atari_stram_free(atari_dma_buffer);
707 atari_dma_buffer = 0; 707 atari_dma_buffer = 0;
@@ -761,7 +761,7 @@ int atari_scsi_detect(struct scsi_host_template *host)
761int atari_scsi_release(struct Scsi_Host *sh) 761int atari_scsi_release(struct Scsi_Host *sh)
762{ 762{
763 if (IS_A_TT()) 763 if (IS_A_TT())
764 free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); 764 free_irq(IRQ_TT_MFP_SCSI, sh);
765 if (atari_dma_buffer) 765 if (atari_dma_buffer)
766 atari_stram_free(atari_dma_buffer); 766 atari_stram_free(atari_dma_buffer);
767 return 1; 767 return 1;
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c
index 2596165096d3..c2677ba29c74 100644
--- a/drivers/scsi/dtc.c
+++ b/drivers/scsi/dtc.c
@@ -277,7 +277,8 @@ found:
277 /* With interrupts enabled, it will sometimes hang when doing heavy 277 /* With interrupts enabled, it will sometimes hang when doing heavy
278 * reads. So better not enable them until I finger it out. */ 278 * reads. So better not enable them until I finger it out. */
279 if (instance->irq != SCSI_IRQ_NONE) 279 if (instance->irq != SCSI_IRQ_NONE)
280 if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED, "dtc", instance)) { 280 if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED,
281 "dtc", instance)) {
281 printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); 282 printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
282 instance->irq = SCSI_IRQ_NONE; 283 instance->irq = SCSI_IRQ_NONE;
283 } 284 }
@@ -459,7 +460,7 @@ static int dtc_release(struct Scsi_Host *shost)
459 NCR5380_local_declare(); 460 NCR5380_local_declare();
460 NCR5380_setup(shost); 461 NCR5380_setup(shost);
461 if (shost->irq) 462 if (shost->irq)
462 free_irq(shost->irq, NULL); 463 free_irq(shost->irq, shost);
463 NCR5380_exit(shost); 464 NCR5380_exit(shost);
464 if (shost->io_port && shost->n_io_port) 465 if (shost->io_port && shost->n_io_port)
465 release_region(shost->io_port, shost->n_io_port); 466 release_region(shost->io_port, shost->n_io_port);
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 607336f56d55..75585a52c88b 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -460,7 +460,8 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt)
460 instance->irq = NCR5380_probe_irq(instance, 0xffff); 460 instance->irq = NCR5380_probe_irq(instance, 0xffff);
461 461
462 if (instance->irq != SCSI_IRQ_NONE) 462 if (instance->irq != SCSI_IRQ_NONE)
463 if (request_irq(instance->irq, generic_NCR5380_intr, IRQF_DISABLED, "NCR5380", instance)) { 463 if (request_irq(instance->irq, generic_NCR5380_intr,
464 IRQF_DISABLED, "NCR5380", instance)) {
464 printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); 465 printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
465 instance->irq = SCSI_IRQ_NONE; 466 instance->irq = SCSI_IRQ_NONE;
466 } 467 }
@@ -513,7 +514,7 @@ int generic_NCR5380_release_resources(struct Scsi_Host *instance)
513 NCR5380_setup(instance); 514 NCR5380_setup(instance);
514 515
515 if (instance->irq != SCSI_IRQ_NONE) 516 if (instance->irq != SCSI_IRQ_NONE)
516 free_irq(instance->irq, NULL); 517 free_irq(instance->irq, instance);
517 NCR5380_exit(instance); 518 NCR5380_exit(instance);
518 519
519#ifndef CONFIG_SCSI_G_NCR5380_MEM 520#ifndef CONFIG_SCSI_G_NCR5380_MEM
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 4bcf916c21a7..57ce2251abc8 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -197,7 +197,7 @@ iscsi_tcp_cleanup_ctask(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
197 if (unlikely(!sc)) 197 if (unlikely(!sc))
198 return; 198 return;
199 199
200 tcp_ctask->xmstate = XMSTATE_IDLE; 200 tcp_ctask->xmstate = XMSTATE_VALUE_IDLE;
201 tcp_ctask->r2t = NULL; 201 tcp_ctask->r2t = NULL;
202} 202}
203 203
@@ -409,7 +409,7 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
409 409
410 tcp_ctask->exp_datasn = r2tsn + 1; 410 tcp_ctask->exp_datasn = r2tsn + 1;
411 __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*)); 411 __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*));
412 tcp_ctask->xmstate |= XMSTATE_SOL_HDR_INIT; 412 set_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate);
413 list_move_tail(&ctask->running, &conn->xmitqueue); 413 list_move_tail(&ctask->running, &conn->xmitqueue);
414 414
415 scsi_queue_work(session->host, &conn->xmitwork); 415 scsi_queue_work(session->host, &conn->xmitwork);
@@ -1254,7 +1254,7 @@ static void iscsi_set_padding(struct iscsi_tcp_cmd_task *tcp_ctask,
1254 1254
1255 tcp_ctask->pad_count = ISCSI_PAD_LEN - tcp_ctask->pad_count; 1255 tcp_ctask->pad_count = ISCSI_PAD_LEN - tcp_ctask->pad_count;
1256 debug_scsi("write padding %d bytes\n", tcp_ctask->pad_count); 1256 debug_scsi("write padding %d bytes\n", tcp_ctask->pad_count);
1257 tcp_ctask->xmstate |= XMSTATE_W_PAD; 1257 set_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate);
1258} 1258}
1259 1259
1260/** 1260/**
@@ -1269,7 +1269,7 @@ iscsi_tcp_cmd_init(struct iscsi_cmd_task *ctask)
1269 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1269 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data;
1270 1270
1271 BUG_ON(__kfifo_len(tcp_ctask->r2tqueue)); 1271 BUG_ON(__kfifo_len(tcp_ctask->r2tqueue));
1272 tcp_ctask->xmstate = XMSTATE_CMD_HDR_INIT; 1272 tcp_ctask->xmstate = 1 << XMSTATE_BIT_CMD_HDR_INIT;
1273} 1273}
1274 1274
1275/** 1275/**
@@ -1283,10 +1283,10 @@ iscsi_tcp_cmd_init(struct iscsi_cmd_task *ctask)
1283 * xmit. 1283 * xmit.
1284 * 1284 *
1285 * Management xmit state machine consists of these states: 1285 * Management xmit state machine consists of these states:
1286 * XMSTATE_IMM_HDR_INIT - calculate digest of PDU Header 1286 * XMSTATE_BIT_IMM_HDR_INIT - calculate digest of PDU Header
1287 * XMSTATE_IMM_HDR - PDU Header xmit in progress 1287 * XMSTATE_BIT_IMM_HDR - PDU Header xmit in progress
1288 * XMSTATE_IMM_DATA - PDU Data xmit in progress 1288 * XMSTATE_BIT_IMM_DATA - PDU Data xmit in progress
1289 * XMSTATE_IDLE - management PDU is done 1289 * XMSTATE_VALUE_IDLE - management PDU is done
1290 **/ 1290 **/
1291static int 1291static int
1292iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) 1292iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
@@ -1297,12 +1297,12 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
1297 debug_scsi("mtask deq [cid %d state %x itt 0x%x]\n", 1297 debug_scsi("mtask deq [cid %d state %x itt 0x%x]\n",
1298 conn->id, tcp_mtask->xmstate, mtask->itt); 1298 conn->id, tcp_mtask->xmstate, mtask->itt);
1299 1299
1300 if (tcp_mtask->xmstate & XMSTATE_IMM_HDR_INIT) { 1300 if (test_bit(XMSTATE_BIT_IMM_HDR_INIT, &tcp_mtask->xmstate)) {
1301 iscsi_buf_init_iov(&tcp_mtask->headbuf, (char*)mtask->hdr, 1301 iscsi_buf_init_iov(&tcp_mtask->headbuf, (char*)mtask->hdr,
1302 sizeof(struct iscsi_hdr)); 1302 sizeof(struct iscsi_hdr));
1303 1303
1304 if (mtask->data_count) { 1304 if (mtask->data_count) {
1305 tcp_mtask->xmstate |= XMSTATE_IMM_DATA; 1305 set_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate);
1306 iscsi_buf_init_iov(&tcp_mtask->sendbuf, 1306 iscsi_buf_init_iov(&tcp_mtask->sendbuf,
1307 (char*)mtask->data, 1307 (char*)mtask->data,
1308 mtask->data_count); 1308 mtask->data_count);
@@ -1315,21 +1315,20 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
1315 (u8*)tcp_mtask->hdrext); 1315 (u8*)tcp_mtask->hdrext);
1316 1316
1317 tcp_mtask->sent = 0; 1317 tcp_mtask->sent = 0;
1318 tcp_mtask->xmstate &= ~XMSTATE_IMM_HDR_INIT; 1318 clear_bit(XMSTATE_BIT_IMM_HDR_INIT, &tcp_mtask->xmstate);
1319 tcp_mtask->xmstate |= XMSTATE_IMM_HDR; 1319 set_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate);
1320 } 1320 }
1321 1321
1322 if (tcp_mtask->xmstate & XMSTATE_IMM_HDR) { 1322 if (test_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate)) {
1323 rc = iscsi_sendhdr(conn, &tcp_mtask->headbuf, 1323 rc = iscsi_sendhdr(conn, &tcp_mtask->headbuf,
1324 mtask->data_count); 1324 mtask->data_count);
1325 if (rc) 1325 if (rc)
1326 return rc; 1326 return rc;
1327 tcp_mtask->xmstate &= ~XMSTATE_IMM_HDR; 1327 clear_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate);
1328 } 1328 }
1329 1329
1330 if (tcp_mtask->xmstate & XMSTATE_IMM_DATA) { 1330 if (test_and_clear_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate)) {
1331 BUG_ON(!mtask->data_count); 1331 BUG_ON(!mtask->data_count);
1332 tcp_mtask->xmstate &= ~XMSTATE_IMM_DATA;
1333 /* FIXME: implement. 1332 /* FIXME: implement.
1334 * Virtual buffer could be spreaded across multiple pages... 1333 * Virtual buffer could be spreaded across multiple pages...
1335 */ 1334 */
@@ -1339,13 +1338,13 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
1339 rc = iscsi_sendpage(conn, &tcp_mtask->sendbuf, 1338 rc = iscsi_sendpage(conn, &tcp_mtask->sendbuf,
1340 &mtask->data_count, &tcp_mtask->sent); 1339 &mtask->data_count, &tcp_mtask->sent);
1341 if (rc) { 1340 if (rc) {
1342 tcp_mtask->xmstate |= XMSTATE_IMM_DATA; 1341 set_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate);
1343 return rc; 1342 return rc;
1344 } 1343 }
1345 } while (mtask->data_count); 1344 } while (mtask->data_count);
1346 } 1345 }
1347 1346
1348 BUG_ON(tcp_mtask->xmstate != XMSTATE_IDLE); 1347 BUG_ON(tcp_mtask->xmstate != XMSTATE_VALUE_IDLE);
1349 if (mtask->hdr->itt == RESERVED_ITT) { 1348 if (mtask->hdr->itt == RESERVED_ITT) {
1350 struct iscsi_session *session = conn->session; 1349 struct iscsi_session *session = conn->session;
1351 1350
@@ -1365,7 +1364,7 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1365 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1364 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data;
1366 int rc = 0; 1365 int rc = 0;
1367 1366
1368 if (tcp_ctask->xmstate & XMSTATE_CMD_HDR_INIT) { 1367 if (test_bit(XMSTATE_BIT_CMD_HDR_INIT, &tcp_ctask->xmstate)) {
1369 tcp_ctask->sent = 0; 1368 tcp_ctask->sent = 0;
1370 tcp_ctask->sg_count = 0; 1369 tcp_ctask->sg_count = 0;
1371 tcp_ctask->exp_datasn = 0; 1370 tcp_ctask->exp_datasn = 0;
@@ -1390,21 +1389,21 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1390 if (conn->hdrdgst_en) 1389 if (conn->hdrdgst_en)
1391 iscsi_hdr_digest(conn, &tcp_ctask->headbuf, 1390 iscsi_hdr_digest(conn, &tcp_ctask->headbuf,
1392 (u8*)tcp_ctask->hdrext); 1391 (u8*)tcp_ctask->hdrext);
1393 tcp_ctask->xmstate &= ~XMSTATE_CMD_HDR_INIT; 1392 clear_bit(XMSTATE_BIT_CMD_HDR_INIT, &tcp_ctask->xmstate);
1394 tcp_ctask->xmstate |= XMSTATE_CMD_HDR_XMIT; 1393 set_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate);
1395 } 1394 }
1396 1395
1397 if (tcp_ctask->xmstate & XMSTATE_CMD_HDR_XMIT) { 1396 if (test_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate)) {
1398 rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->imm_count); 1397 rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->imm_count);
1399 if (rc) 1398 if (rc)
1400 return rc; 1399 return rc;
1401 tcp_ctask->xmstate &= ~XMSTATE_CMD_HDR_XMIT; 1400 clear_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate);
1402 1401
1403 if (sc->sc_data_direction != DMA_TO_DEVICE) 1402 if (sc->sc_data_direction != DMA_TO_DEVICE)
1404 return 0; 1403 return 0;
1405 1404
1406 if (ctask->imm_count) { 1405 if (ctask->imm_count) {
1407 tcp_ctask->xmstate |= XMSTATE_IMM_DATA; 1406 set_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate);
1408 iscsi_set_padding(tcp_ctask, ctask->imm_count); 1407 iscsi_set_padding(tcp_ctask, ctask->imm_count);
1409 1408
1410 if (ctask->conn->datadgst_en) { 1409 if (ctask->conn->datadgst_en) {
@@ -1414,9 +1413,10 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1414 } 1413 }
1415 } 1414 }
1416 1415
1417 if (ctask->unsol_count) 1416 if (ctask->unsol_count) {
1418 tcp_ctask->xmstate |= 1417 set_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate);
1419 XMSTATE_UNS_HDR | XMSTATE_UNS_INIT; 1418 set_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate);
1419 }
1420 } 1420 }
1421 return rc; 1421 return rc;
1422} 1422}
@@ -1428,25 +1428,25 @@ iscsi_send_padding(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1428 struct iscsi_tcp_conn *tcp_conn = conn->dd_data; 1428 struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
1429 int sent = 0, rc; 1429 int sent = 0, rc;
1430 1430
1431 if (tcp_ctask->xmstate & XMSTATE_W_PAD) { 1431 if (test_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate)) {
1432 iscsi_buf_init_iov(&tcp_ctask->sendbuf, (char*)&tcp_ctask->pad, 1432 iscsi_buf_init_iov(&tcp_ctask->sendbuf, (char*)&tcp_ctask->pad,
1433 tcp_ctask->pad_count); 1433 tcp_ctask->pad_count);
1434 if (conn->datadgst_en) 1434 if (conn->datadgst_en)
1435 crypto_hash_update(&tcp_conn->tx_hash, 1435 crypto_hash_update(&tcp_conn->tx_hash,
1436 &tcp_ctask->sendbuf.sg, 1436 &tcp_ctask->sendbuf.sg,
1437 tcp_ctask->sendbuf.sg.length); 1437 tcp_ctask->sendbuf.sg.length);
1438 } else if (!(tcp_ctask->xmstate & XMSTATE_W_RESEND_PAD)) 1438 } else if (!test_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate))
1439 return 0; 1439 return 0;
1440 1440
1441 tcp_ctask->xmstate &= ~XMSTATE_W_PAD; 1441 clear_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate);
1442 tcp_ctask->xmstate &= ~XMSTATE_W_RESEND_PAD; 1442 clear_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate);
1443 debug_scsi("sending %d pad bytes for itt 0x%x\n", 1443 debug_scsi("sending %d pad bytes for itt 0x%x\n",
1444 tcp_ctask->pad_count, ctask->itt); 1444 tcp_ctask->pad_count, ctask->itt);
1445 rc = iscsi_sendpage(conn, &tcp_ctask->sendbuf, &tcp_ctask->pad_count, 1445 rc = iscsi_sendpage(conn, &tcp_ctask->sendbuf, &tcp_ctask->pad_count,
1446 &sent); 1446 &sent);
1447 if (rc) { 1447 if (rc) {
1448 debug_scsi("padding send failed %d\n", rc); 1448 debug_scsi("padding send failed %d\n", rc);
1449 tcp_ctask->xmstate |= XMSTATE_W_RESEND_PAD; 1449 set_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate);
1450 } 1450 }
1451 return rc; 1451 return rc;
1452} 1452}
@@ -1465,11 +1465,11 @@ iscsi_send_digest(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
1465 tcp_ctask = ctask->dd_data; 1465 tcp_ctask = ctask->dd_data;
1466 tcp_conn = conn->dd_data; 1466 tcp_conn = conn->dd_data;
1467 1467
1468 if (!(tcp_ctask->xmstate & XMSTATE_W_RESEND_DATA_DIGEST)) { 1468 if (!test_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate)) {
1469 crypto_hash_final(&tcp_conn->tx_hash, (u8*)digest); 1469 crypto_hash_final(&tcp_conn->tx_hash, (u8*)digest);
1470 iscsi_buf_init_iov(buf, (char*)digest, 4); 1470 iscsi_buf_init_iov(buf, (char*)digest, 4);
1471 } 1471 }
1472 tcp_ctask->xmstate &= ~XMSTATE_W_RESEND_DATA_DIGEST; 1472 clear_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate);
1473 1473
1474 rc = iscsi_sendpage(conn, buf, &tcp_ctask->digest_count, &sent); 1474 rc = iscsi_sendpage(conn, buf, &tcp_ctask->digest_count, &sent);
1475 if (!rc) 1475 if (!rc)
@@ -1478,7 +1478,7 @@ iscsi_send_digest(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
1478 else { 1478 else {
1479 debug_scsi("sending digest 0x%x failed for itt 0x%x!\n", 1479 debug_scsi("sending digest 0x%x failed for itt 0x%x!\n",
1480 *digest, ctask->itt); 1480 *digest, ctask->itt);
1481 tcp_ctask->xmstate |= XMSTATE_W_RESEND_DATA_DIGEST; 1481 set_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate);
1482 } 1482 }
1483 return rc; 1483 return rc;
1484} 1484}
@@ -1526,8 +1526,8 @@ iscsi_send_unsol_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1526 struct iscsi_data_task *dtask; 1526 struct iscsi_data_task *dtask;
1527 int rc; 1527 int rc;
1528 1528
1529 tcp_ctask->xmstate |= XMSTATE_UNS_DATA; 1529 set_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate);
1530 if (tcp_ctask->xmstate & XMSTATE_UNS_INIT) { 1530 if (test_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate)) {
1531 dtask = &tcp_ctask->unsol_dtask; 1531 dtask = &tcp_ctask->unsol_dtask;
1532 1532
1533 iscsi_prep_unsolicit_data_pdu(ctask, &dtask->hdr); 1533 iscsi_prep_unsolicit_data_pdu(ctask, &dtask->hdr);
@@ -1537,14 +1537,14 @@ iscsi_send_unsol_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1537 iscsi_hdr_digest(conn, &tcp_ctask->headbuf, 1537 iscsi_hdr_digest(conn, &tcp_ctask->headbuf,
1538 (u8*)dtask->hdrext); 1538 (u8*)dtask->hdrext);
1539 1539
1540 tcp_ctask->xmstate &= ~XMSTATE_UNS_INIT; 1540 clear_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate);
1541 iscsi_set_padding(tcp_ctask, ctask->data_count); 1541 iscsi_set_padding(tcp_ctask, ctask->data_count);
1542 } 1542 }
1543 1543
1544 rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->data_count); 1544 rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->data_count);
1545 if (rc) { 1545 if (rc) {
1546 tcp_ctask->xmstate &= ~XMSTATE_UNS_DATA; 1546 clear_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate);
1547 tcp_ctask->xmstate |= XMSTATE_UNS_HDR; 1547 set_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate);
1548 return rc; 1548 return rc;
1549 } 1549 }
1550 1550
@@ -1565,16 +1565,15 @@ iscsi_send_unsol_pdu(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1565 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1565 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data;
1566 int rc; 1566 int rc;
1567 1567
1568 if (tcp_ctask->xmstate & XMSTATE_UNS_HDR) { 1568 if (test_and_clear_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate)) {
1569 BUG_ON(!ctask->unsol_count); 1569 BUG_ON(!ctask->unsol_count);
1570 tcp_ctask->xmstate &= ~XMSTATE_UNS_HDR;
1571send_hdr: 1570send_hdr:
1572 rc = iscsi_send_unsol_hdr(conn, ctask); 1571 rc = iscsi_send_unsol_hdr(conn, ctask);
1573 if (rc) 1572 if (rc)
1574 return rc; 1573 return rc;
1575 } 1574 }
1576 1575
1577 if (tcp_ctask->xmstate & XMSTATE_UNS_DATA) { 1576 if (test_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate)) {
1578 struct iscsi_data_task *dtask = &tcp_ctask->unsol_dtask; 1577 struct iscsi_data_task *dtask = &tcp_ctask->unsol_dtask;
1579 int start = tcp_ctask->sent; 1578 int start = tcp_ctask->sent;
1580 1579
@@ -1584,14 +1583,14 @@ send_hdr:
1584 ctask->unsol_count -= tcp_ctask->sent - start; 1583 ctask->unsol_count -= tcp_ctask->sent - start;
1585 if (rc) 1584 if (rc)
1586 return rc; 1585 return rc;
1587 tcp_ctask->xmstate &= ~XMSTATE_UNS_DATA; 1586 clear_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate);
1588 /* 1587 /*
1589 * Done with the Data-Out. Next, check if we need 1588 * Done with the Data-Out. Next, check if we need
1590 * to send another unsolicited Data-Out. 1589 * to send another unsolicited Data-Out.
1591 */ 1590 */
1592 if (ctask->unsol_count) { 1591 if (ctask->unsol_count) {
1593 debug_scsi("sending more uns\n"); 1592 debug_scsi("sending more uns\n");
1594 tcp_ctask->xmstate |= XMSTATE_UNS_INIT; 1593 set_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate);
1595 goto send_hdr; 1594 goto send_hdr;
1596 } 1595 }
1597 } 1596 }
@@ -1607,7 +1606,7 @@ static int iscsi_send_sol_pdu(struct iscsi_conn *conn,
1607 struct iscsi_data_task *dtask; 1606 struct iscsi_data_task *dtask;
1608 int left, rc; 1607 int left, rc;
1609 1608
1610 if (tcp_ctask->xmstate & XMSTATE_SOL_HDR_INIT) { 1609 if (test_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate)) {
1611 if (!tcp_ctask->r2t) { 1610 if (!tcp_ctask->r2t) {
1612 spin_lock_bh(&session->lock); 1611 spin_lock_bh(&session->lock);
1613 __kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t, 1612 __kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t,
@@ -1621,19 +1620,19 @@ send_hdr:
1621 if (conn->hdrdgst_en) 1620 if (conn->hdrdgst_en)
1622 iscsi_hdr_digest(conn, &r2t->headbuf, 1621 iscsi_hdr_digest(conn, &r2t->headbuf,
1623 (u8*)dtask->hdrext); 1622 (u8*)dtask->hdrext);
1624 tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR_INIT; 1623 clear_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate);
1625 tcp_ctask->xmstate |= XMSTATE_SOL_HDR; 1624 set_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate);
1626 } 1625 }
1627 1626
1628 if (tcp_ctask->xmstate & XMSTATE_SOL_HDR) { 1627 if (test_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate)) {
1629 r2t = tcp_ctask->r2t; 1628 r2t = tcp_ctask->r2t;
1630 dtask = &r2t->dtask; 1629 dtask = &r2t->dtask;
1631 1630
1632 rc = iscsi_sendhdr(conn, &r2t->headbuf, r2t->data_count); 1631 rc = iscsi_sendhdr(conn, &r2t->headbuf, r2t->data_count);
1633 if (rc) 1632 if (rc)
1634 return rc; 1633 return rc;
1635 tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR; 1634 clear_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate);
1636 tcp_ctask->xmstate |= XMSTATE_SOL_DATA; 1635 set_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate);
1637 1636
1638 if (conn->datadgst_en) { 1637 if (conn->datadgst_en) {
1639 iscsi_data_digest_init(conn->dd_data, tcp_ctask); 1638 iscsi_data_digest_init(conn->dd_data, tcp_ctask);
@@ -1646,7 +1645,7 @@ send_hdr:
1646 r2t->sent); 1645 r2t->sent);
1647 } 1646 }
1648 1647
1649 if (tcp_ctask->xmstate & XMSTATE_SOL_DATA) { 1648 if (test_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate)) {
1650 r2t = tcp_ctask->r2t; 1649 r2t = tcp_ctask->r2t;
1651 dtask = &r2t->dtask; 1650 dtask = &r2t->dtask;
1652 1651
@@ -1655,7 +1654,7 @@ send_hdr:
1655 &dtask->digestbuf, &dtask->digest); 1654 &dtask->digestbuf, &dtask->digest);
1656 if (rc) 1655 if (rc)
1657 return rc; 1656 return rc;
1658 tcp_ctask->xmstate &= ~XMSTATE_SOL_DATA; 1657 clear_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate);
1659 1658
1660 /* 1659 /*
1661 * Done with this Data-Out. Next, check if we have 1660 * Done with this Data-Out. Next, check if we have
@@ -1700,32 +1699,32 @@ send_hdr:
1700 * xmit stages. 1699 * xmit stages.
1701 * 1700 *
1702 *iscsi_send_cmd_hdr() 1701 *iscsi_send_cmd_hdr()
1703 * XMSTATE_CMD_HDR_INIT - prepare Header and Data buffers Calculate 1702 * XMSTATE_BIT_CMD_HDR_INIT - prepare Header and Data buffers Calculate
1704 * Header Digest 1703 * Header Digest
1705 * XMSTATE_CMD_HDR_XMIT - Transmit header in progress 1704 * XMSTATE_BIT_CMD_HDR_XMIT - Transmit header in progress
1706 * 1705 *
1707 *iscsi_send_padding 1706 *iscsi_send_padding
1708 * XMSTATE_W_PAD - Prepare and send pading 1707 * XMSTATE_BIT_W_PAD - Prepare and send pading
1709 * XMSTATE_W_RESEND_PAD - retry send pading 1708 * XMSTATE_BIT_W_RESEND_PAD - retry send pading
1710 * 1709 *
1711 *iscsi_send_digest 1710 *iscsi_send_digest
1712 * XMSTATE_W_RESEND_DATA_DIGEST - Finalize and send Data Digest 1711 * XMSTATE_BIT_W_RESEND_DATA_DIGEST - Finalize and send Data Digest
1713 * XMSTATE_W_RESEND_DATA_DIGEST - retry sending digest 1712 * XMSTATE_BIT_W_RESEND_DATA_DIGEST - retry sending digest
1714 * 1713 *
1715 *iscsi_send_unsol_hdr 1714 *iscsi_send_unsol_hdr
1716 * XMSTATE_UNS_INIT - prepare un-solicit data header and digest 1715 * XMSTATE_BIT_UNS_INIT - prepare un-solicit data header and digest
1717 * XMSTATE_UNS_HDR - send un-solicit header 1716 * XMSTATE_BIT_UNS_HDR - send un-solicit header
1718 * 1717 *
1719 *iscsi_send_unsol_pdu 1718 *iscsi_send_unsol_pdu
1720 * XMSTATE_UNS_DATA - send un-solicit data in progress 1719 * XMSTATE_BIT_UNS_DATA - send un-solicit data in progress
1721 * 1720 *
1722 *iscsi_send_sol_pdu 1721 *iscsi_send_sol_pdu
1723 * XMSTATE_SOL_HDR_INIT - solicit data header and digest initialize 1722 * XMSTATE_BIT_SOL_HDR_INIT - solicit data header and digest initialize
1724 * XMSTATE_SOL_HDR - send solicit header 1723 * XMSTATE_BIT_SOL_HDR - send solicit header
1725 * XMSTATE_SOL_DATA - send solicit data 1724 * XMSTATE_BIT_SOL_DATA - send solicit data
1726 * 1725 *
1727 *iscsi_tcp_ctask_xmit 1726 *iscsi_tcp_ctask_xmit
1728 * XMSTATE_IMM_DATA - xmit managment data (??) 1727 * XMSTATE_BIT_IMM_DATA - xmit managment data (??)
1729 **/ 1728 **/
1730static int 1729static int
1731iscsi_tcp_ctask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) 1730iscsi_tcp_ctask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
@@ -1742,13 +1741,13 @@ iscsi_tcp_ctask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1742 if (ctask->sc->sc_data_direction != DMA_TO_DEVICE) 1741 if (ctask->sc->sc_data_direction != DMA_TO_DEVICE)
1743 return 0; 1742 return 0;
1744 1743
1745 if (tcp_ctask->xmstate & XMSTATE_IMM_DATA) { 1744 if (test_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate)) {
1746 rc = iscsi_send_data(ctask, &tcp_ctask->sendbuf, &tcp_ctask->sg, 1745 rc = iscsi_send_data(ctask, &tcp_ctask->sendbuf, &tcp_ctask->sg,
1747 &tcp_ctask->sent, &ctask->imm_count, 1746 &tcp_ctask->sent, &ctask->imm_count,
1748 &tcp_ctask->immbuf, &tcp_ctask->immdigest); 1747 &tcp_ctask->immbuf, &tcp_ctask->immdigest);
1749 if (rc) 1748 if (rc)
1750 return rc; 1749 return rc;
1751 tcp_ctask->xmstate &= ~XMSTATE_IMM_DATA; 1750 clear_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate);
1752 } 1751 }
1753 1752
1754 rc = iscsi_send_unsol_pdu(conn, ctask); 1753 rc = iscsi_send_unsol_pdu(conn, ctask);
@@ -1981,7 +1980,7 @@ static void
1981iscsi_tcp_mgmt_init(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) 1980iscsi_tcp_mgmt_init(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
1982{ 1981{
1983 struct iscsi_tcp_mgmt_task *tcp_mtask = mtask->dd_data; 1982 struct iscsi_tcp_mgmt_task *tcp_mtask = mtask->dd_data;
1984 tcp_mtask->xmstate = XMSTATE_IMM_HDR_INIT; 1983 tcp_mtask->xmstate = 1 << XMSTATE_BIT_IMM_HDR_INIT;
1985} 1984}
1986 1985
1987static int 1986static int
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
index 7eba44df0a7f..68c36cc8997e 100644
--- a/drivers/scsi/iscsi_tcp.h
+++ b/drivers/scsi/iscsi_tcp.h
@@ -32,21 +32,21 @@
32#define IN_PROGRESS_PAD_RECV 0x4 32#define IN_PROGRESS_PAD_RECV 0x4
33 33
34/* xmit state machine */ 34/* xmit state machine */
35#define XMSTATE_IDLE 0x0 35#define XMSTATE_VALUE_IDLE 0
36#define XMSTATE_CMD_HDR_INIT 0x1 36#define XMSTATE_BIT_CMD_HDR_INIT 0
37#define XMSTATE_CMD_HDR_XMIT 0x2 37#define XMSTATE_BIT_CMD_HDR_XMIT 1
38#define XMSTATE_IMM_HDR 0x4 38#define XMSTATE_BIT_IMM_HDR 2
39#define XMSTATE_IMM_DATA 0x8 39#define XMSTATE_BIT_IMM_DATA 3
40#define XMSTATE_UNS_INIT 0x10 40#define XMSTATE_BIT_UNS_INIT 4
41#define XMSTATE_UNS_HDR 0x20 41#define XMSTATE_BIT_UNS_HDR 5
42#define XMSTATE_UNS_DATA 0x40 42#define XMSTATE_BIT_UNS_DATA 6
43#define XMSTATE_SOL_HDR 0x80 43#define XMSTATE_BIT_SOL_HDR 7
44#define XMSTATE_SOL_DATA 0x100 44#define XMSTATE_BIT_SOL_DATA 8
45#define XMSTATE_W_PAD 0x200 45#define XMSTATE_BIT_W_PAD 9
46#define XMSTATE_W_RESEND_PAD 0x400 46#define XMSTATE_BIT_W_RESEND_PAD 10
47#define XMSTATE_W_RESEND_DATA_DIGEST 0x800 47#define XMSTATE_BIT_W_RESEND_DATA_DIGEST 11
48#define XMSTATE_IMM_HDR_INIT 0x1000 48#define XMSTATE_BIT_IMM_HDR_INIT 12
49#define XMSTATE_SOL_HDR_INIT 0x2000 49#define XMSTATE_BIT_SOL_HDR_INIT 13
50 50
51#define ISCSI_PAD_LEN 4 51#define ISCSI_PAD_LEN 4
52#define ISCSI_SG_TABLESIZE SG_ALL 52#define ISCSI_SG_TABLESIZE SG_ALL
@@ -122,7 +122,7 @@ struct iscsi_data_task {
122struct iscsi_tcp_mgmt_task { 122struct iscsi_tcp_mgmt_task {
123 struct iscsi_hdr hdr; 123 struct iscsi_hdr hdr;
124 char hdrext[sizeof(__u32)]; /* Header-Digest */ 124 char hdrext[sizeof(__u32)]; /* Header-Digest */
125 int xmstate; /* mgmt xmit progress */ 125 unsigned long xmstate; /* mgmt xmit progress */
126 struct iscsi_buf headbuf; /* header buffer */ 126 struct iscsi_buf headbuf; /* header buffer */
127 struct iscsi_buf sendbuf; /* in progress buffer */ 127 struct iscsi_buf sendbuf; /* in progress buffer */
128 int sent; 128 int sent;
@@ -150,7 +150,7 @@ struct iscsi_tcp_cmd_task {
150 int pad_count; /* padded bytes */ 150 int pad_count; /* padded bytes */
151 struct iscsi_buf headbuf; /* header buf (xmit) */ 151 struct iscsi_buf headbuf; /* header buf (xmit) */
152 struct iscsi_buf sendbuf; /* in progress buffer*/ 152 struct iscsi_buf sendbuf; /* in progress buffer*/
153 int xmstate; /* xmit xtate machine */ 153 unsigned long xmstate; /* xmit xtate machine */
154 int sent; 154 int sent;
155 struct scatterlist *sg; /* per-cmd SG list */ 155 struct scatterlist *sg; /* per-cmd SG list */
156 struct scatterlist *bad_sg; /* assert statement */ 156 struct scatterlist *bad_sg; /* assert statement */
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index efceed451b46..8b57af5baaec 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -291,9 +291,6 @@ invalid_datalen:
291 min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); 291 min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE));
292 } 292 }
293 293
294 if (sc->sc_data_direction == DMA_TO_DEVICE)
295 goto out;
296
297 if (rhdr->flags & ISCSI_FLAG_CMD_UNDERFLOW) { 294 if (rhdr->flags & ISCSI_FLAG_CMD_UNDERFLOW) {
298 int res_count = be32_to_cpu(rhdr->residual_count); 295 int res_count = be32_to_cpu(rhdr->residual_count);
299 296
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c
index abe2bda6ac37..3b09ab21d701 100644
--- a/drivers/scsi/mac_scsi.c
+++ b/drivers/scsi/mac_scsi.c
@@ -303,7 +303,7 @@ int macscsi_detect(struct scsi_host_template * tpnt)
303 303
304 if (instance->irq != SCSI_IRQ_NONE) 304 if (instance->irq != SCSI_IRQ_NONE)
305 if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW, 305 if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW,
306 "ncr5380", instance)) { 306 "ncr5380", instance)) {
307 printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n", 307 printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n",
308 instance->host_no, instance->irq); 308 instance->host_no, instance->irq);
309 instance->irq = SCSI_IRQ_NONE; 309 instance->irq = SCSI_IRQ_NONE;
@@ -326,7 +326,7 @@ int macscsi_detect(struct scsi_host_template * tpnt)
326int macscsi_release (struct Scsi_Host *shpnt) 326int macscsi_release (struct Scsi_Host *shpnt)
327{ 327{
328 if (shpnt->irq != SCSI_IRQ_NONE) 328 if (shpnt->irq != SCSI_IRQ_NONE)
329 free_irq (shpnt->irq, NCR5380_intr); 329 free_irq(shpnt->irq, shpnt);
330 NCR5380_exit(shpnt); 330 NCR5380_exit(shpnt);
331 331
332 return 0; 332 return 0;
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c
index ee5965659971..f2018b46f494 100644
--- a/drivers/scsi/pas16.c
+++ b/drivers/scsi/pas16.c
@@ -453,7 +453,8 @@ int __init pas16_detect(struct scsi_host_template * tpnt)
453 instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS); 453 instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS);
454 454
455 if (instance->irq != SCSI_IRQ_NONE) 455 if (instance->irq != SCSI_IRQ_NONE)
456 if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED, "pas16", instance)) { 456 if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED,
457 "pas16", instance)) {
457 printk("scsi%d : IRQ%d not free, interrupts disabled\n", 458 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
458 instance->host_no, instance->irq); 459 instance->host_no, instance->irq);
459 instance->irq = SCSI_IRQ_NONE; 460 instance->irq = SCSI_IRQ_NONE;
@@ -604,7 +605,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src
604static int pas16_release(struct Scsi_Host *shost) 605static int pas16_release(struct Scsi_Host *shost)
605{ 606{
606 if (shost->irq) 607 if (shost->irq)
607 free_irq(shost->irq, NULL); 608 free_irq(shost->irq, shost);
608 NCR5380_exit(shost); 609 NCR5380_exit(shost);
609 if (shost->dma_channel != 0xff) 610 if (shost->dma_channel != 0xff)
610 free_dma(shost->dma_channel); 611 free_dma(shost->dma_channel);
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 3aeb68bcb7ac..146d540f6281 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -1310,14 +1310,7 @@ qla1280_done(struct scsi_qla_host *ha)
1310 } 1310 }
1311 1311
1312 /* Release memory used for this I/O */ 1312 /* Release memory used for this I/O */
1313 if (cmd->use_sg) { 1313 scsi_dma_unmap(cmd);
1314 pci_unmap_sg(ha->pdev, cmd->request_buffer,
1315 cmd->use_sg, cmd->sc_data_direction);
1316 } else if (cmd->request_bufflen) {
1317 pci_unmap_single(ha->pdev, sp->saved_dma_handle,
1318 cmd->request_bufflen,
1319 cmd->sc_data_direction);
1320 }
1321 1314
1322 /* Call the mid-level driver interrupt handler */ 1315 /* Call the mid-level driver interrupt handler */
1323 CMD_HANDLE(sp->cmd) = (unsigned char *)INVALID_HANDLE; 1316 CMD_HANDLE(sp->cmd) = (unsigned char *)INVALID_HANDLE;
@@ -1406,14 +1399,14 @@ qla1280_return_status(struct response * sts, struct scsi_cmnd *cp)
1406 break; 1399 break;
1407 1400
1408 case CS_DATA_UNDERRUN: 1401 case CS_DATA_UNDERRUN:
1409 if ((cp->request_bufflen - residual_length) < 1402 if ((scsi_bufflen(cp) - residual_length) <
1410 cp->underflow) { 1403 cp->underflow) {
1411 printk(KERN_WARNING 1404 printk(KERN_WARNING
1412 "scsi: Underflow detected - retrying " 1405 "scsi: Underflow detected - retrying "
1413 "command.\n"); 1406 "command.\n");
1414 host_status = DID_ERROR; 1407 host_status = DID_ERROR;
1415 } else { 1408 } else {
1416 cp->resid = residual_length; 1409 scsi_set_resid(cp, residual_length);
1417 host_status = DID_OK; 1410 host_status = DID_OK;
1418 } 1411 }
1419 break; 1412 break;
@@ -2775,33 +2768,28 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
2775 struct device_reg __iomem *reg = ha->iobase; 2768 struct device_reg __iomem *reg = ha->iobase;
2776 struct scsi_cmnd *cmd = sp->cmd; 2769 struct scsi_cmnd *cmd = sp->cmd;
2777 cmd_a64_entry_t *pkt; 2770 cmd_a64_entry_t *pkt;
2778 struct scatterlist *sg = NULL, *s;
2779 __le32 *dword_ptr; 2771 __le32 *dword_ptr;
2780 dma_addr_t dma_handle; 2772 dma_addr_t dma_handle;
2781 int status = 0; 2773 int status = 0;
2782 int cnt; 2774 int cnt;
2783 int req_cnt; 2775 int req_cnt;
2784 u16 seg_cnt; 2776 int seg_cnt;
2785 u8 dir; 2777 u8 dir;
2786 2778
2787 ENTER("qla1280_64bit_start_scsi:"); 2779 ENTER("qla1280_64bit_start_scsi:");
2788 2780
2789 /* Calculate number of entries and segments required. */ 2781 /* Calculate number of entries and segments required. */
2790 req_cnt = 1; 2782 req_cnt = 1;
2791 if (cmd->use_sg) { 2783 seg_cnt = scsi_dma_map(cmd);
2792 sg = (struct scatterlist *) cmd->request_buffer; 2784 if (seg_cnt > 0) {
2793 seg_cnt = pci_map_sg(ha->pdev, sg, cmd->use_sg,
2794 cmd->sc_data_direction);
2795
2796 if (seg_cnt > 2) { 2785 if (seg_cnt > 2) {
2797 req_cnt += (seg_cnt - 2) / 5; 2786 req_cnt += (seg_cnt - 2) / 5;
2798 if ((seg_cnt - 2) % 5) 2787 if ((seg_cnt - 2) % 5)
2799 req_cnt++; 2788 req_cnt++;
2800 } 2789 }
2801 } else if (cmd->request_bufflen) { /* If data transfer. */ 2790 } else if (seg_cnt < 0) {
2802 seg_cnt = 1; 2791 status = 1;
2803 } else { 2792 goto out;
2804 seg_cnt = 0;
2805 } 2793 }
2806 2794
2807 if ((req_cnt + 2) >= ha->req_q_cnt) { 2795 if ((req_cnt + 2) >= ha->req_q_cnt) {
@@ -2889,124 +2877,104 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
2889 * Load data segments. 2877 * Load data segments.
2890 */ 2878 */
2891 if (seg_cnt) { /* If data transfer. */ 2879 if (seg_cnt) { /* If data transfer. */
2880 struct scatterlist *sg, *s;
2892 int remseg = seg_cnt; 2881 int remseg = seg_cnt;
2882
2883 sg = scsi_sglist(cmd);
2884
2893 /* Setup packet address segment pointer. */ 2885 /* Setup packet address segment pointer. */
2894 dword_ptr = (u32 *)&pkt->dseg_0_address; 2886 dword_ptr = (u32 *)&pkt->dseg_0_address;
2895 2887
2896 if (cmd->use_sg) { /* If scatter gather */ 2888 /* Load command entry data segments. */
2897 /* Load command entry data segments. */ 2889 for_each_sg(sg, s, seg_cnt, cnt) {
2898 for_each_sg(sg, s, seg_cnt, cnt) { 2890 if (cnt == 2)
2899 if (cnt == 2) 2891 break;
2892
2893 dma_handle = sg_dma_address(s);
2894#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2)
2895 if (ha->flags.use_pci_vchannel)
2896 sn_pci_set_vchan(ha->pdev,
2897 (unsigned long *)&dma_handle,
2898 SCSI_BUS_32(cmd));
2899#endif
2900 *dword_ptr++ =
2901 cpu_to_le32(pci_dma_lo32(dma_handle));
2902 *dword_ptr++ =
2903 cpu_to_le32(pci_dma_hi32(dma_handle));
2904 *dword_ptr++ = cpu_to_le32(sg_dma_len(s));
2905 dprintk(3, "S/G Segment phys_addr=%x %x, len=0x%x\n",
2906 cpu_to_le32(pci_dma_hi32(dma_handle)),
2907 cpu_to_le32(pci_dma_lo32(dma_handle)),
2908 cpu_to_le32(sg_dma_len(sg_next(s))));
2909 remseg--;
2910 }
2911 dprintk(5, "qla1280_64bit_start_scsi: Scatter/gather "
2912 "command packet data - b %i, t %i, l %i \n",
2913 SCSI_BUS_32(cmd), SCSI_TCN_32(cmd),
2914 SCSI_LUN_32(cmd));
2915 qla1280_dump_buffer(5, (char *)pkt,
2916 REQUEST_ENTRY_SIZE);
2917
2918 /*
2919 * Build continuation packets.
2920 */
2921 dprintk(3, "S/G Building Continuation...seg_cnt=0x%x "
2922 "remains\n", seg_cnt);
2923
2924 while (remseg > 0) {
2925 /* Update sg start */
2926 sg = s;
2927 /* Adjust ring index. */
2928 ha->req_ring_index++;
2929 if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
2930 ha->req_ring_index = 0;
2931 ha->request_ring_ptr =
2932 ha->request_ring;
2933 } else
2934 ha->request_ring_ptr++;
2935
2936 pkt = (cmd_a64_entry_t *)ha->request_ring_ptr;
2937
2938 /* Zero out packet. */
2939 memset(pkt, 0, REQUEST_ENTRY_SIZE);
2940
2941 /* Load packet defaults. */
2942 ((struct cont_a64_entry *) pkt)->entry_type =
2943 CONTINUE_A64_TYPE;
2944 ((struct cont_a64_entry *) pkt)->entry_count = 1;
2945 ((struct cont_a64_entry *) pkt)->sys_define =
2946 (uint8_t)ha->req_ring_index;
2947 /* Setup packet address segment pointer. */
2948 dword_ptr =
2949 (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address;
2950
2951 /* Load continuation entry data segments. */
2952 for_each_sg(sg, s, remseg, cnt) {
2953 if (cnt == 5)
2900 break; 2954 break;
2901 dma_handle = sg_dma_address(s); 2955 dma_handle = sg_dma_address(s);
2902#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) 2956#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2)
2903 if (ha->flags.use_pci_vchannel) 2957 if (ha->flags.use_pci_vchannel)
2904 sn_pci_set_vchan(ha->pdev, 2958 sn_pci_set_vchan(ha->pdev,
2905 (unsigned long *)&dma_handle, 2959 (unsigned long *)&dma_handle,
2906 SCSI_BUS_32(cmd)); 2960 SCSI_BUS_32(cmd));
2907#endif 2961#endif
2908 *dword_ptr++ = 2962 *dword_ptr++ =
2909 cpu_to_le32(pci_dma_lo32(dma_handle)); 2963 cpu_to_le32(pci_dma_lo32(dma_handle));
2910 *dword_ptr++ = 2964 *dword_ptr++ =
2911 cpu_to_le32(pci_dma_hi32(dma_handle)); 2965 cpu_to_le32(pci_dma_hi32(dma_handle));
2912 *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); 2966 *dword_ptr++ =
2913 dprintk(3, "S/G Segment phys_addr=%x %x, len=0x%x\n", 2967 cpu_to_le32(sg_dma_len(s));
2968 dprintk(3, "S/G Segment Cont. phys_addr=%x %x, len=0x%x\n",
2914 cpu_to_le32(pci_dma_hi32(dma_handle)), 2969 cpu_to_le32(pci_dma_hi32(dma_handle)),
2915 cpu_to_le32(pci_dma_lo32(dma_handle)), 2970 cpu_to_le32(pci_dma_lo32(dma_handle)),
2916 cpu_to_le32(sg_dma_len(sg_next(s)))); 2971 cpu_to_le32(sg_dma_len(s)));
2917 remseg--;
2918 } 2972 }
2919 dprintk(5, "qla1280_64bit_start_scsi: Scatter/gather " 2973 remseg -= cnt;
2920 "command packet data - b %i, t %i, l %i \n", 2974 dprintk(5, "qla1280_64bit_start_scsi: "
2921 SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), 2975 "continuation packet data - b %i, t "
2922 SCSI_LUN_32(cmd)); 2976 "%i, l %i \n", SCSI_BUS_32(cmd),
2923 qla1280_dump_buffer(5, (char *)pkt, 2977 SCSI_TCN_32(cmd), SCSI_LUN_32(cmd));
2924 REQUEST_ENTRY_SIZE);
2925
2926 /*
2927 * Build continuation packets.
2928 */
2929 dprintk(3, "S/G Building Continuation...seg_cnt=0x%x "
2930 "remains\n", seg_cnt);
2931
2932 while (remseg > 0) {
2933 /* Update sg start */
2934 sg = s;
2935 /* Adjust ring index. */
2936 ha->req_ring_index++;
2937 if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
2938 ha->req_ring_index = 0;
2939 ha->request_ring_ptr =
2940 ha->request_ring;
2941 } else
2942 ha->request_ring_ptr++;
2943
2944 pkt = (cmd_a64_entry_t *)ha->request_ring_ptr;
2945
2946 /* Zero out packet. */
2947 memset(pkt, 0, REQUEST_ENTRY_SIZE);
2948
2949 /* Load packet defaults. */
2950 ((struct cont_a64_entry *) pkt)->entry_type =
2951 CONTINUE_A64_TYPE;
2952 ((struct cont_a64_entry *) pkt)->entry_count = 1;
2953 ((struct cont_a64_entry *) pkt)->sys_define =
2954 (uint8_t)ha->req_ring_index;
2955 /* Setup packet address segment pointer. */
2956 dword_ptr =
2957 (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address;
2958
2959 /* Load continuation entry data segments. */
2960 for_each_sg(sg, s, remseg, cnt) {
2961 if (cnt == 5)
2962 break;
2963 dma_handle = sg_dma_address(s);
2964#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2)
2965 if (ha->flags.use_pci_vchannel)
2966 sn_pci_set_vchan(ha->pdev,
2967 (unsigned long *)&dma_handle,
2968 SCSI_BUS_32(cmd));
2969#endif
2970 *dword_ptr++ =
2971 cpu_to_le32(pci_dma_lo32(dma_handle));
2972 *dword_ptr++ =
2973 cpu_to_le32(pci_dma_hi32(dma_handle));
2974 *dword_ptr++ =
2975 cpu_to_le32(sg_dma_len(s));
2976 dprintk(3, "S/G Segment Cont. phys_addr=%x %x, len=0x%x\n",
2977 cpu_to_le32(pci_dma_hi32(dma_handle)),
2978 cpu_to_le32(pci_dma_lo32(dma_handle)),
2979 cpu_to_le32(sg_dma_len(s)));
2980 }
2981 remseg -= cnt;
2982 dprintk(5, "qla1280_64bit_start_scsi: "
2983 "continuation packet data - b %i, t "
2984 "%i, l %i \n", SCSI_BUS_32(cmd),
2985 SCSI_TCN_32(cmd), SCSI_LUN_32(cmd));
2986 qla1280_dump_buffer(5, (char *)pkt,
2987 REQUEST_ENTRY_SIZE);
2988 }
2989 } else { /* No scatter gather data transfer */
2990 dma_handle = pci_map_single(ha->pdev,
2991 cmd->request_buffer,
2992 cmd->request_bufflen,
2993 cmd->sc_data_direction);
2994
2995 sp->saved_dma_handle = dma_handle;
2996#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2)
2997 if (ha->flags.use_pci_vchannel)
2998 sn_pci_set_vchan(ha->pdev,
2999 (unsigned long *)&dma_handle,
3000 SCSI_BUS_32(cmd));
3001#endif
3002 *dword_ptr++ = cpu_to_le32(pci_dma_lo32(dma_handle));
3003 *dword_ptr++ = cpu_to_le32(pci_dma_hi32(dma_handle));
3004 *dword_ptr = cpu_to_le32(cmd->request_bufflen);
3005
3006 dprintk(5, "qla1280_64bit_start_scsi: No scatter/"
3007 "gather command packet data - b %i, t %i, "
3008 "l %i \n", SCSI_BUS_32(cmd), SCSI_TCN_32(cmd),
3009 SCSI_LUN_32(cmd));
3010 qla1280_dump_buffer(5, (char *)pkt, 2978 qla1280_dump_buffer(5, (char *)pkt,
3011 REQUEST_ENTRY_SIZE); 2979 REQUEST_ENTRY_SIZE);
3012 } 2980 }
@@ -3068,12 +3036,11 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3068 struct device_reg __iomem *reg = ha->iobase; 3036 struct device_reg __iomem *reg = ha->iobase;
3069 struct scsi_cmnd *cmd = sp->cmd; 3037 struct scsi_cmnd *cmd = sp->cmd;
3070 struct cmd_entry *pkt; 3038 struct cmd_entry *pkt;
3071 struct scatterlist *sg = NULL, *s;
3072 __le32 *dword_ptr; 3039 __le32 *dword_ptr;
3073 int status = 0; 3040 int status = 0;
3074 int cnt; 3041 int cnt;
3075 int req_cnt; 3042 int req_cnt;
3076 uint16_t seg_cnt; 3043 int seg_cnt;
3077 dma_addr_t dma_handle; 3044 dma_addr_t dma_handle;
3078 u8 dir; 3045 u8 dir;
3079 3046
@@ -3083,18 +3050,8 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3083 cmd->cmnd[0]); 3050 cmd->cmnd[0]);
3084 3051
3085 /* Calculate number of entries and segments required. */ 3052 /* Calculate number of entries and segments required. */
3086 req_cnt = 1; 3053 seg_cnt = scsi_dma_map(cmd);
3087 if (cmd->use_sg) { 3054 if (seg_cnt) {
3088 /*
3089 * We must build an SG list in adapter format, as the kernel's
3090 * SG list cannot be used directly because of data field size
3091 * (__alpha__) differences and the kernel SG list uses virtual
3092 * addresses where we need physical addresses.
3093 */
3094 sg = (struct scatterlist *) cmd->request_buffer;
3095 seg_cnt = pci_map_sg(ha->pdev, sg, cmd->use_sg,
3096 cmd->sc_data_direction);
3097
3098 /* 3055 /*
3099 * if greater than four sg entries then we need to allocate 3056 * if greater than four sg entries then we need to allocate
3100 * continuation entries 3057 * continuation entries
@@ -3106,14 +3063,9 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3106 } 3063 }
3107 dprintk(3, "S/G Transfer cmd=%p seg_cnt=0x%x, req_cnt=%x\n", 3064 dprintk(3, "S/G Transfer cmd=%p seg_cnt=0x%x, req_cnt=%x\n",
3108 cmd, seg_cnt, req_cnt); 3065 cmd, seg_cnt, req_cnt);
3109 } else if (cmd->request_bufflen) { /* If data transfer. */ 3066 } else if (seg_cnt < 0) {
3110 dprintk(3, "No S/G transfer t=%x cmd=%p len=%x CDB=%x\n", 3067 status = 1;
3111 SCSI_TCN_32(cmd), cmd, cmd->request_bufflen, 3068 goto out;
3112 cmd->cmnd[0]);
3113 seg_cnt = 1;
3114 } else {
3115 /* dprintk(1, "No data transfer \n"); */
3116 seg_cnt = 0;
3117 } 3069 }
3118 3070
3119 if ((req_cnt + 2) >= ha->req_q_cnt) { 3071 if ((req_cnt + 2) >= ha->req_q_cnt) {
@@ -3194,91 +3146,84 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3194 * Load data segments. 3146 * Load data segments.
3195 */ 3147 */
3196 if (seg_cnt) { 3148 if (seg_cnt) {
3149 struct scatterlist *sg, *s;
3197 int remseg = seg_cnt; 3150 int remseg = seg_cnt;
3151
3152 sg = scsi_sglist(cmd);
3153
3198 /* Setup packet address segment pointer. */ 3154 /* Setup packet address segment pointer. */
3199 dword_ptr = &pkt->dseg_0_address; 3155 dword_ptr = &pkt->dseg_0_address;
3200 3156
3201 if (cmd->use_sg) { /* If scatter gather */ 3157 dprintk(3, "Building S/G data segments..\n");
3202 dprintk(3, "Building S/G data segments..\n"); 3158 qla1280_dump_buffer(1, (char *)sg, 4 * 16);
3203 qla1280_dump_buffer(1, (char *)sg, 4 * 16); 3159
3160 /* Load command entry data segments. */
3161 for_each_sg(sg, s, seg_cnt, cnt) {
3162 if (cnt == 4)
3163 break;
3164 *dword_ptr++ =
3165 cpu_to_le32(pci_dma_lo32(sg_dma_address(s)));
3166 *dword_ptr++ = cpu_to_le32(sg_dma_len(s));
3167 dprintk(3, "S/G Segment phys_addr=0x%lx, len=0x%x\n",
3168 (pci_dma_lo32(sg_dma_address(s))),
3169 (sg_dma_len(s)));
3170 remseg--;
3171 }
3172 /*
3173 * Build continuation packets.
3174 */
3175 dprintk(3, "S/G Building Continuation"
3176 "...seg_cnt=0x%x remains\n", seg_cnt);
3177 while (remseg > 0) {
3178 /* Continue from end point */
3179 sg = s;
3180 /* Adjust ring index. */
3181 ha->req_ring_index++;
3182 if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
3183 ha->req_ring_index = 0;
3184 ha->request_ring_ptr =
3185 ha->request_ring;
3186 } else
3187 ha->request_ring_ptr++;
3188
3189 pkt = (struct cmd_entry *)ha->request_ring_ptr;
3190
3191 /* Zero out packet. */
3192 memset(pkt, 0, REQUEST_ENTRY_SIZE);
3193
3194 /* Load packet defaults. */
3195 ((struct cont_entry *) pkt)->
3196 entry_type = CONTINUE_TYPE;
3197 ((struct cont_entry *) pkt)->entry_count = 1;
3204 3198
3205 /* Load command entry data segments. */ 3199 ((struct cont_entry *) pkt)->sys_define =
3206 for_each_sg(sg, s, seg_cnt, cnt) { 3200 (uint8_t) ha->req_ring_index;
3207 if (cnt == 4) 3201
3202 /* Setup packet address segment pointer. */
3203 dword_ptr =
3204 &((struct cont_entry *) pkt)->dseg_0_address;
3205
3206 /* Load continuation entry data segments. */
3207 for_each_sg(sg, s, remseg, cnt) {
3208 if (cnt == 7)
3208 break; 3209 break;
3209 *dword_ptr++ = 3210 *dword_ptr++ =
3210 cpu_to_le32(pci_dma_lo32(sg_dma_address(s))); 3211 cpu_to_le32(pci_dma_lo32(sg_dma_address(s)));
3211 *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); 3212 *dword_ptr++ =
3212 dprintk(3, "S/G Segment phys_addr=0x%lx, len=0x%x\n", 3213 cpu_to_le32(sg_dma_len(s));
3213 (pci_dma_lo32(sg_dma_address(s))), 3214 dprintk(1,
3214 (sg_dma_len(s))); 3215 "S/G Segment Cont. phys_addr=0x%x, "
3215 remseg--; 3216 "len=0x%x\n",
3216 } 3217 cpu_to_le32(pci_dma_lo32(sg_dma_address(s))),
3217 /* 3218 cpu_to_le32(sg_dma_len(s)));
3218 * Build continuation packets.
3219 */
3220 dprintk(3, "S/G Building Continuation"
3221 "...seg_cnt=0x%x remains\n", seg_cnt);
3222 while (remseg > 0) {
3223 /* Continue from end point */
3224 sg = s;
3225 /* Adjust ring index. */
3226 ha->req_ring_index++;
3227 if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
3228 ha->req_ring_index = 0;
3229 ha->request_ring_ptr =
3230 ha->request_ring;
3231 } else
3232 ha->request_ring_ptr++;
3233
3234 pkt = (struct cmd_entry *)ha->request_ring_ptr;
3235
3236 /* Zero out packet. */
3237 memset(pkt, 0, REQUEST_ENTRY_SIZE);
3238
3239 /* Load packet defaults. */
3240 ((struct cont_entry *) pkt)->
3241 entry_type = CONTINUE_TYPE;
3242 ((struct cont_entry *) pkt)->entry_count = 1;
3243
3244 ((struct cont_entry *) pkt)->sys_define =
3245 (uint8_t) ha->req_ring_index;
3246
3247 /* Setup packet address segment pointer. */
3248 dword_ptr =
3249 &((struct cont_entry *) pkt)->dseg_0_address;
3250
3251 /* Load continuation entry data segments. */
3252 for_each_sg(sg, s, remseg, cnt) {
3253 if (cnt == 7)
3254 break;
3255 *dword_ptr++ =
3256 cpu_to_le32(pci_dma_lo32(sg_dma_address(s)));
3257 *dword_ptr++ =
3258 cpu_to_le32(sg_dma_len(s));
3259 dprintk(1,
3260 "S/G Segment Cont. phys_addr=0x%x, "
3261 "len=0x%x\n",
3262 cpu_to_le32(pci_dma_lo32(sg_dma_address(s))),
3263 cpu_to_le32(sg_dma_len(s)));
3264 }
3265 remseg -= cnt;
3266 dprintk(5, "qla1280_32bit_start_scsi: "
3267 "continuation packet data - "
3268 "scsi(%i:%i:%i)\n", SCSI_BUS_32(cmd),
3269 SCSI_TCN_32(cmd), SCSI_LUN_32(cmd));
3270 qla1280_dump_buffer(5, (char *)pkt,
3271 REQUEST_ENTRY_SIZE);
3272 } 3219 }
3273 } else { /* No S/G data transfer */ 3220 remseg -= cnt;
3274 dma_handle = pci_map_single(ha->pdev, 3221 dprintk(5, "qla1280_32bit_start_scsi: "
3275 cmd->request_buffer, 3222 "continuation packet data - "
3276 cmd->request_bufflen, 3223 "scsi(%i:%i:%i)\n", SCSI_BUS_32(cmd),
3277 cmd->sc_data_direction); 3224 SCSI_TCN_32(cmd), SCSI_LUN_32(cmd));
3278 sp->saved_dma_handle = dma_handle; 3225 qla1280_dump_buffer(5, (char *)pkt,
3279 3226 REQUEST_ENTRY_SIZE);
3280 *dword_ptr++ = cpu_to_le32(pci_dma_lo32(dma_handle));
3281 *dword_ptr = cpu_to_le32(cmd->request_bufflen);
3282 } 3227 }
3283 } else { /* No data transfer at all */ 3228 } else { /* No data transfer at all */
3284 dprintk(5, "qla1280_32bit_start_scsi: No data, command " 3229 dprintk(5, "qla1280_32bit_start_scsi: No data, command "
@@ -4086,9 +4031,9 @@ __qla1280_print_scsi_cmd(struct scsi_cmnd *cmd)
4086 for (i = 0; i < cmd->cmd_len; i++) { 4031 for (i = 0; i < cmd->cmd_len; i++) {
4087 printk("0x%02x ", cmd->cmnd[i]); 4032 printk("0x%02x ", cmd->cmnd[i]);
4088 } 4033 }
4089 printk(" seg_cnt =%d\n", cmd->use_sg); 4034 printk(" seg_cnt =%d\n", scsi_sg_count(cmd));
4090 printk(" request buffer=0x%p, request buffer len=0x%x\n", 4035 printk(" request buffer=0x%p, request buffer len=0x%x\n",
4091 cmd->request_buffer, cmd->request_bufflen); 4036 scsi_sglist(cmd), scsi_bufflen(cmd));
4092 /* if (cmd->use_sg) 4037 /* if (cmd->use_sg)
4093 { 4038 {
4094 sg = (struct scatterlist *) cmd->request_buffer; 4039 sg = (struct scatterlist *) cmd->request_buffer;
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c
index 5e46d842c6f9..e606cf0a2eb7 100644
--- a/drivers/scsi/sun3_scsi.c
+++ b/drivers/scsi/sun3_scsi.c
@@ -268,7 +268,7 @@ int sun3scsi_detect(struct scsi_host_template * tpnt)
268 ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; 268 ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0;
269 269
270 if (request_irq(instance->irq, scsi_sun3_intr, 270 if (request_irq(instance->irq, scsi_sun3_intr,
271 0, "Sun3SCSI-5380", NULL)) { 271 0, "Sun3SCSI-5380", instance)) {
272#ifndef REAL_DMA 272#ifndef REAL_DMA
273 printk("scsi%d: IRQ%d not free, interrupts disabled\n", 273 printk("scsi%d: IRQ%d not free, interrupts disabled\n",
274 instance->host_no, instance->irq); 274 instance->host_no, instance->irq);
@@ -310,7 +310,7 @@ int sun3scsi_detect(struct scsi_host_template * tpnt)
310int sun3scsi_release (struct Scsi_Host *shpnt) 310int sun3scsi_release (struct Scsi_Host *shpnt)
311{ 311{
312 if (shpnt->irq != SCSI_IRQ_NONE) 312 if (shpnt->irq != SCSI_IRQ_NONE)
313 free_irq (shpnt->irq, NULL); 313 free_irq(shpnt->irq, shpnt);
314 314
315 iounmap((void *)sun3_scsi_regp); 315 iounmap((void *)sun3_scsi_regp);
316 316
diff --git a/drivers/scsi/sun3_scsi_vme.c b/drivers/scsi/sun3_scsi_vme.c
index 7cb4a31453e6..02d9727f017a 100644
--- a/drivers/scsi/sun3_scsi_vme.c
+++ b/drivers/scsi/sun3_scsi_vme.c
@@ -230,7 +230,7 @@ static int sun3scsi_detect(struct scsi_host_template * tpnt)
230 ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; 230 ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0;
231 231
232 if (request_irq(instance->irq, scsi_sun3_intr, 232 if (request_irq(instance->irq, scsi_sun3_intr,
233 0, "Sun3SCSI-5380VME", NULL)) { 233 0, "Sun3SCSI-5380VME", instance)) {
234#ifndef REAL_DMA 234#ifndef REAL_DMA
235 printk("scsi%d: IRQ%d not free, interrupts disabled\n", 235 printk("scsi%d: IRQ%d not free, interrupts disabled\n",
236 instance->host_no, instance->irq); 236 instance->host_no, instance->irq);
@@ -279,7 +279,7 @@ static int sun3scsi_detect(struct scsi_host_template * tpnt)
279int sun3scsi_release (struct Scsi_Host *shpnt) 279int sun3scsi_release (struct Scsi_Host *shpnt)
280{ 280{
281 if (shpnt->irq != SCSI_IRQ_NONE) 281 if (shpnt->irq != SCSI_IRQ_NONE)
282 free_irq (shpnt->irq, NULL); 282 free_irq(shpnt->irq, shpnt);
283 283
284 iounmap((void *)sun3_scsi_regp); 284 iounmap((void *)sun3_scsi_regp);
285 285
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c
index 248d60b8d899..041eaaace2c3 100644
--- a/drivers/scsi/t128.c
+++ b/drivers/scsi/t128.c
@@ -259,7 +259,8 @@ found:
259 instance->irq = NCR5380_probe_irq(instance, T128_IRQS); 259 instance->irq = NCR5380_probe_irq(instance, T128_IRQS);
260 260
261 if (instance->irq != SCSI_IRQ_NONE) 261 if (instance->irq != SCSI_IRQ_NONE)
262 if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128", instance)) { 262 if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128",
263 instance)) {
263 printk("scsi%d : IRQ%d not free, interrupts disabled\n", 264 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
264 instance->host_no, instance->irq); 265 instance->host_no, instance->irq);
265 instance->irq = SCSI_IRQ_NONE; 266 instance->irq = SCSI_IRQ_NONE;
@@ -295,7 +296,7 @@ static int t128_release(struct Scsi_Host *shost)
295 NCR5380_local_declare(); 296 NCR5380_local_declare();
296 NCR5380_setup(shost); 297 NCR5380_setup(shost);
297 if (shost->irq) 298 if (shost->irq)
298 free_irq(shost->irq, NULL); 299 free_irq(shost->irq, shost);
299 NCR5380_exit(shost); 300 NCR5380_exit(shost);
300 if (shost->io_port && shost->n_io_port) 301 if (shost->io_port && shost->n_io_port)
301 release_region(shost->io_port, shost->n_io_port); 302 release_region(shost->io_port, shost->n_io_port);
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index af3a011b2b24..352fcb8926a6 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -585,11 +585,11 @@ serial_pxa_type(struct uart_port *port)
585 return up->name; 585 return up->name;
586} 586}
587 587
588#ifdef CONFIG_SERIAL_PXA_CONSOLE
589
590static struct uart_pxa_port *serial_pxa_ports[4]; 588static struct uart_pxa_port *serial_pxa_ports[4];
591static struct uart_driver serial_pxa_reg; 589static struct uart_driver serial_pxa_reg;
592 590
591#ifdef CONFIG_SERIAL_PXA_CONSOLE
592
593#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) 593#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
594 594
595/* 595/*
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 39f3d6519035..5fccfe222a63 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -374,9 +374,16 @@ static int proc_delete_dentry(struct dentry * dentry)
374 return 1; 374 return 1;
375} 375}
376 376
377static int proc_revalidate_dentry(struct dentry *dentry, struct nameidata *nd)
378{
379 d_drop(dentry);
380 return 0;
381}
382
377static struct dentry_operations proc_dentry_operations = 383static struct dentry_operations proc_dentry_operations =
378{ 384{
379 .d_delete = proc_delete_dentry, 385 .d_delete = proc_delete_dentry,
386 .d_revalidate = proc_revalidate_dentry,
380}; 387};
381 388
382/* 389/*
@@ -397,8 +404,11 @@ struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry, struct nam
397 if (de->namelen != dentry->d_name.len) 404 if (de->namelen != dentry->d_name.len)
398 continue; 405 continue;
399 if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { 406 if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
400 unsigned int ino = de->low_ino; 407 unsigned int ino;
401 408
409 if (de->shadow_proc)
410 de = de->shadow_proc(current, de);
411 ino = de->low_ino;
402 de_get(de); 412 de_get(de);
403 spin_unlock(&proc_subdir_lock); 413 spin_unlock(&proc_subdir_lock);
404 error = -EINVAL; 414 error = -EINVAL;
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 131f9c68be5f..0afe21ee0607 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -50,89 +50,14 @@ struct net *get_proc_net(const struct inode *inode)
50} 50}
51EXPORT_SYMBOL_GPL(get_proc_net); 51EXPORT_SYMBOL_GPL(get_proc_net);
52 52
53static struct proc_dir_entry *proc_net_shadow; 53static struct proc_dir_entry *shadow_pde;
54 54
55static struct dentry *proc_net_shadow_dentry(struct dentry *parent, 55static struct proc_dir_entry *proc_net_shadow(struct task_struct *task,
56 struct proc_dir_entry *de) 56 struct proc_dir_entry *de)
57{ 57{
58 struct dentry *shadow = NULL; 58 return task->nsproxy->net_ns->proc_net;
59 struct inode *inode;
60 if (!de)
61 goto out;
62 de_get(de);
63 inode = proc_get_inode(parent->d_inode->i_sb, de->low_ino, de);
64 if (!inode)
65 goto out_de_put;
66 shadow = d_alloc_name(parent, de->name);
67 if (!shadow)
68 goto out_iput;
69 shadow->d_op = parent->d_op; /* proc_dentry_operations */
70 d_instantiate(shadow, inode);
71out:
72 return shadow;
73out_iput:
74 iput(inode);
75out_de_put:
76 de_put(de);
77 goto out;
78}
79
80static void *proc_net_follow_link(struct dentry *parent, struct nameidata *nd)
81{
82 struct net *net = current->nsproxy->net_ns;
83 struct dentry *shadow;
84 shadow = proc_net_shadow_dentry(parent, net->proc_net);
85 if (!shadow)
86 return ERR_PTR(-ENOENT);
87
88 dput(nd->dentry);
89 /* My dentry count is 1 and that should be enough as the
90 * shadow dentry is thrown away immediately.
91 */
92 nd->dentry = shadow;
93 return NULL;
94} 59}
95 60
96static struct dentry *proc_net_lookup(struct inode *dir, struct dentry *dentry,
97 struct nameidata *nd)
98{
99 struct net *net = current->nsproxy->net_ns;
100 struct dentry *shadow;
101
102 shadow = proc_net_shadow_dentry(nd->dentry, net->proc_net);
103 if (!shadow)
104 return ERR_PTR(-ENOENT);
105
106 dput(nd->dentry);
107 nd->dentry = shadow;
108
109 return shadow->d_inode->i_op->lookup(shadow->d_inode, dentry, nd);
110}
111
112static int proc_net_setattr(struct dentry *dentry, struct iattr *iattr)
113{
114 struct net *net = current->nsproxy->net_ns;
115 struct dentry *shadow;
116 int ret;
117
118 shadow = proc_net_shadow_dentry(dentry->d_parent, net->proc_net);
119 if (!shadow)
120 return -ENOENT;
121 ret = shadow->d_inode->i_op->setattr(shadow, iattr);
122 dput(shadow);
123 return ret;
124}
125
126static const struct file_operations proc_net_dir_operations = {
127 .read = generic_read_dir,
128};
129
130static struct inode_operations proc_net_dir_inode_operations = {
131 .follow_link = proc_net_follow_link,
132 .lookup = proc_net_lookup,
133 .setattr = proc_net_setattr,
134};
135
136static __net_init int proc_net_ns_init(struct net *net) 61static __net_init int proc_net_ns_init(struct net *net)
137{ 62{
138 struct proc_dir_entry *root, *netd, *net_statd; 63 struct proc_dir_entry *root, *netd, *net_statd;
@@ -185,9 +110,8 @@ static struct pernet_operations __net_initdata proc_net_ns_ops = {
185 110
186int __init proc_net_init(void) 111int __init proc_net_init(void)
187{ 112{
188 proc_net_shadow = proc_mkdir("net", NULL); 113 shadow_pde = proc_mkdir("net", NULL);
189 proc_net_shadow->proc_iops = &proc_net_dir_inode_operations; 114 shadow_pde->shadow_proc = proc_net_shadow;
190 proc_net_shadow->proc_fops = &proc_net_dir_operations;
191 115
192 return register_pernet_subsys(&proc_net_ns_ops); 116 return register_pernet_subsys(&proc_net_ns_ops);
193} 117}
diff --git a/include/asm-arm/arch-at91/board.h b/include/asm-arm/arch-at91/board.h
index c0d7075982c1..79054965baa6 100644
--- a/include/asm-arm/arch-at91/board.h
+++ b/include/asm-arm/arch-at91/board.h
@@ -33,6 +33,7 @@
33 33
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/i2c.h>
36#include <linux/spi/spi.h> 37#include <linux/spi/spi.h>
37 38
38 /* USB Device */ 39 /* USB Device */
@@ -94,7 +95,7 @@ struct at91_nand_data {
94extern void __init at91_add_device_nand(struct at91_nand_data *data); 95extern void __init at91_add_device_nand(struct at91_nand_data *data);
95 96
96 /* I2C*/ 97 /* I2C*/
97extern void __init at91_add_device_i2c(void); 98extern void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices);
98 99
99 /* SPI */ 100 /* SPI */
100extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices); 101extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices);
diff --git a/include/asm-arm/arch-ixp23xx/irqs.h b/include/asm-arm/arch-ixp23xx/irqs.h
index e69639585721..27c580898958 100644
--- a/include/asm-arm/arch-ixp23xx/irqs.h
+++ b/include/asm-arm/arch-ixp23xx/irqs.h
@@ -153,7 +153,7 @@
153 */ 153 */
154#define NR_IXP23XX_MACH_IRQS 32 154#define NR_IXP23XX_MACH_IRQS 32
155 155
156#define NR_IRQS NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS 156#define NR_IRQS (NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS)
157 157
158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq)) 158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq))
159 159
diff --git a/include/asm-arm/arch-omap/board-innovator.h b/include/asm-arm/arch-omap/board-innovator.h
index b3cf33441f6e..56d2c98e143c 100644
--- a/include/asm-arm/arch-omap/board-innovator.h
+++ b/include/asm-arm/arch-omap/board-innovator.h
@@ -37,7 +37,7 @@
37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00 37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00
38 38
39#define NR_FPGA_IRQS 24 39#define NR_FPGA_IRQS 24
40#define NR_IRQS IH_BOARD_BASE + NR_FPGA_IRQS 40#define NR_IRQS (IH_BOARD_BASE + NR_FPGA_IRQS)
41 41
42#ifndef __ASSEMBLY__ 42#ifndef __ASSEMBLY__
43void fpga_write(unsigned char val, int reg); 43void fpga_write(unsigned char val, int reg);
diff --git a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h
index 6238dbf7a236..b76ee6d1f5b4 100644
--- a/include/asm-arm/arch-pxa/irqs.h
+++ b/include/asm-arm/arch-pxa/irqs.h
@@ -13,7 +13,7 @@
13 13
14#define PXA_IRQ(x) (x) 14#define PXA_IRQ(x) (x)
15 15
16#ifdef CONFIG_PXA27x 16#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
17#define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */ 17#define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */
18#define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */ 18#define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */
19#define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */ 19#define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */
@@ -52,11 +52,27 @@
52#define IRQ_RTC1Hz PXA_IRQ(30) /* RTC HZ Clock Tick */ 52#define IRQ_RTC1Hz PXA_IRQ(30) /* RTC HZ Clock Tick */
53#define IRQ_RTCAlrm PXA_IRQ(31) /* RTC Alarm */ 53#define IRQ_RTCAlrm PXA_IRQ(31) /* RTC Alarm */
54 54
55#ifdef CONFIG_PXA27x 55#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
56#define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */ 56#define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */
57#define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */ 57#define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */
58#endif 58#endif
59 59
60#ifdef CONFIG_PXA3xx
61#define IRQ_SSP4 PXA_IRQ(13) /* SSP4 service request */
62#define IRQ_CIR PXA_IRQ(34) /* Consumer IR */
63#define IRQ_TSI PXA_IRQ(36) /* Touch Screen Interface (PXA320) */
64#define IRQ_USIM2 PXA_IRQ(38) /* USIM2 Controller */
65#define IRQ_GRPHICS PXA_IRQ(39) /* Graphics Controller */
66#define IRQ_MMC2 PXA_IRQ(41) /* MMC2 Controller */
67#define IRQ_1WIRE PXA_IRQ(44) /* 1-Wire Controller */
68#define IRQ_NAND PXA_IRQ(45) /* NAND Controller */
69#define IRQ_USB2 PXA_IRQ(46) /* USB 2.0 Device Controller */
70#define IRQ_WAKEUP0 PXA_IRQ(49) /* EXT_WAKEUP0 */
71#define IRQ_WAKEUP1 PXA_IRQ(50) /* EXT_WAKEUP1 */
72#define IRQ_DMEMC PXA_IRQ(51) /* Dynamic Memory Controller */
73#define IRQ_MMC3 PXA_IRQ(55) /* MMC3 Controller (PXA310) */
74#endif
75
60#define PXA_GPIO_IRQ_BASE (64) 76#define PXA_GPIO_IRQ_BASE (64)
61#define PXA_GPIO_IRQ_NUM (128) 77#define PXA_GPIO_IRQ_NUM (128)
62 78
diff --git a/include/asm-arm/arch-pxa/mfp-pxa300.h b/include/asm-arm/arch-pxa/mfp-pxa300.h
index 822a27cd7864..a20996649889 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa300.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa300.h
@@ -179,7 +179,7 @@
179#define GPIO62_LCD_CS_N MFP_CFG_DRV(GPIO62, AF2, DS01X) 179#define GPIO62_LCD_CS_N MFP_CFG_DRV(GPIO62, AF2, DS01X)
180#define GPIO72_LCD_FCLK MFP_CFG_DRV(GPIO72, AF1, DS01X) 180#define GPIO72_LCD_FCLK MFP_CFG_DRV(GPIO72, AF1, DS01X)
181#define GPIO73_LCD_LCLK MFP_CFG_DRV(GPIO73, AF1, DS01X) 181#define GPIO73_LCD_LCLK MFP_CFG_DRV(GPIO73, AF1, DS01X)
182#define GPIO74_LCD_PCLK MFP_CFG_DRV(GPIO74, AF1, DS01X) 182#define GPIO74_LCD_PCLK MFP_CFG_DRV(GPIO74, AF1, DS02X)
183#define GPIO75_LCD_BIAS MFP_CFG_DRV(GPIO75, AF1, DS01X) 183#define GPIO75_LCD_BIAS MFP_CFG_DRV(GPIO75, AF1, DS01X)
184#define GPIO76_LCD_VSYNC MFP_CFG_DRV(GPIO76, AF2, DS01X) 184#define GPIO76_LCD_VSYNC MFP_CFG_DRV(GPIO76, AF2, DS01X)
185 185
diff --git a/include/asm-arm/arch-pxa/mfp-pxa320.h b/include/asm-arm/arch-pxa/mfp-pxa320.h
index 488a5bbc49e9..52deedcaf3bd 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa320.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa320.h
@@ -18,7 +18,7 @@
18#include <asm/arch/mfp.h> 18#include <asm/arch/mfp.h>
19 19
20/* GPIO */ 20/* GPIO */
21#define GPIO46_GPIO MFP_CFG(GPIO6, AF0) 21#define GPIO46_GPIO MFP_CFG(GPIO46, AF0)
22#define GPIO49_GPIO MFP_CFG(GPIO49, AF0) 22#define GPIO49_GPIO MFP_CFG(GPIO49, AF0)
23#define GPIO50_GPIO MFP_CFG(GPIO50, AF0) 23#define GPIO50_GPIO MFP_CFG(GPIO50, AF0)
24#define GPIO51_GPIO MFP_CFG(GPIO51, AF0) 24#define GPIO51_GPIO MFP_CFG(GPIO51, AF0)
diff --git a/include/asm-arm/arch-pxa/mfp.h b/include/asm-arm/arch-pxa/mfp.h
index ac4157af5a8e..03c508d94f0e 100644
--- a/include/asm-arm/arch-pxa/mfp.h
+++ b/include/asm-arm/arch-pxa/mfp.h
@@ -346,23 +346,31 @@ typedef uint32_t mfp_cfg_t;
346#define MFP_CFG_PIN(mfp_cfg) (((mfp_cfg) >> 16) & 0xffff) 346#define MFP_CFG_PIN(mfp_cfg) (((mfp_cfg) >> 16) & 0xffff)
347#define MFP_CFG_VAL(mfp_cfg) ((mfp_cfg) & 0xffff) 347#define MFP_CFG_VAL(mfp_cfg) ((mfp_cfg) & 0xffff)
348 348
349#define MFPR_DEFAULT (0x0000) 349/*
350 * MFP register defaults to
351 * drive strength fast 3mA (010'b)
352 * edge detection logic disabled
353 * alternate function 0
354 */
355#define MFPR_DEFAULT (0x0840)
350 356
351#define MFP_CFG(pin, af) \ 357#define MFP_CFG(pin, af) \
352 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af)) 358 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af))
353 359
354#define MFP_CFG_DRV(pin, af, drv) \ 360#define MFP_CFG_DRV(pin, af, drv) \
355 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT |\ 361 ((MFP_PIN_##pin << 16) | (MFPR_DEFAULT & ~MFPR_DRV_MASK) |\
356 ((MFP_##drv) << 10) | (MFP_##af)) 362 ((MFP_##drv) << 10) | (MFP_##af))
357 363
358#define MFP_CFG_LPM(pin, af, lpm) \ 364#define MFP_CFG_LPM(pin, af, lpm) \
359 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af) |\ 365 ((MFP_PIN_##pin << 16) | (MFPR_DEFAULT & ~MFPR_LPM_MASK) |\
360 (((MFP_LPM_##lpm) & 0x3) << 7) |\ 366 (((MFP_LPM_##lpm) & 0x3) << 7) |\
361 (((MFP_LPM_##lpm) & 0x4) << 12) |\ 367 (((MFP_LPM_##lpm) & 0x4) << 12) |\
362 (((MFP_LPM_##lpm) & 0x8) << 10)) 368 (((MFP_LPM_##lpm) & 0x8) << 10) |\
369 (MFP_##af))
363 370
364#define MFP_CFG_X(pin, af, drv, lpm) \ 371#define MFP_CFG_X(pin, af, drv, lpm) \
365 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT |\ 372 ((MFP_PIN_##pin << 16) |\
373 (MFPR_DEFAULT & ~(MFPR_DRV_MASK | MFPR_LPM_MASK)) |\
366 ((MFP_##drv) << 10) | (MFP_##af) |\ 374 ((MFP_##drv) << 10) | (MFP_##af) |\
367 (((MFP_LPM_##lpm) & 0x3) << 7) |\ 375 (((MFP_LPM_##lpm) & 0x3) << 7) |\
368 (((MFP_LPM_##lpm) & 0x4) << 12) |\ 376 (((MFP_LPM_##lpm) & 0x4) << 12) |\
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index bb68b598c436..6b33df6f1995 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -110,7 +110,10 @@
110#define DALGN __REG(0x400000a0) /* DMA Alignment Register */ 110#define DALGN __REG(0x400000a0) /* DMA Alignment Register */
111#define DINT __REG(0x400000f0) /* DMA Interrupt Register */ 111#define DINT __REG(0x400000f0) /* DMA Interrupt Register */
112 112
113#define DRCMR(n) __REG2(0x40000100, (n)<<2) 113#define DRCMR(n) (*(((n) < 64) ? \
114 &__REG2(0x40000100, ((n) & 0x3f) << 2) : \
115 &__REG2(0x40001100, ((n) & 0x3f) << 2)))
116
114#define DRCMR0 __REG(0x40000100) /* Request to Channel Map Register for DREQ 0 */ 117#define DRCMR0 __REG(0x40000100) /* Request to Channel Map Register for DREQ 0 */
115#define DRCMR1 __REG(0x40000104) /* Request to Channel Map Register for DREQ 1 */ 118#define DRCMR1 __REG(0x40000104) /* Request to Channel Map Register for DREQ 1 */
116#define DRCMR2 __REG(0x40000108) /* Request to Channel Map Register for I2S receive Request */ 119#define DRCMR2 __REG(0x40000108) /* Request to Channel Map Register for I2S receive Request */
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index f6bd308f047f..5ea701fc3425 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -207,13 +207,13 @@
207#endif 207#endif
208 208
209#ifndef cpu_dcache_line_size 209#ifndef cpu_dcache_line_size
210#define cpu_dcache_line_size() current_cpu_data.dcache.linesz 210#define cpu_dcache_line_size() cpu_data[0].dcache.linesz
211#endif 211#endif
212#ifndef cpu_icache_line_size 212#ifndef cpu_icache_line_size
213#define cpu_icache_line_size() current_cpu_data.icache.linesz 213#define cpu_icache_line_size() cpu_data[0].icache.linesz
214#endif 214#endif
215#ifndef cpu_scache_line_size 215#ifndef cpu_scache_line_size
216#define cpu_scache_line_size() current_cpu_data.scache.linesz 216#define cpu_scache_line_size() cpu_data[0].scache.linesz
217#endif 217#endif
218 218
219#endif /* __ASM_CPU_FEATURES_H */ 219#endif /* __ASM_CPU_FEATURES_H */
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index 87db8728e82d..8eaa7b28d9d0 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -164,8 +164,7 @@ extern int rtas_call(int token, int, int, int *, ...);
164extern void rtas_restart(char *cmd); 164extern void rtas_restart(char *cmd);
165extern void rtas_power_off(void); 165extern void rtas_power_off(void);
166extern void rtas_halt(void); 166extern void rtas_halt(void);
167extern void rtas_panic_msg(char *str); 167extern void rtas_os_term(char *str);
168extern void rtas_os_term(void);
169extern int rtas_get_sensor(int sensor, int index, int *state); 168extern int rtas_get_sensor(int sensor, int index, int *state);
170extern int rtas_get_power_level(int powerdomain, int *level); 169extern int rtas_get_power_level(int powerdomain, int *level);
171extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); 170extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
diff --git a/include/asm-x86/hpet.h b/include/asm-x86/hpet.h
index b1f3c1ea55d9..ad8d6e758785 100644
--- a/include/asm-x86/hpet.h
+++ b/include/asm-x86/hpet.h
@@ -61,6 +61,7 @@ extern unsigned long force_hpet_address;
61extern int hpet_force_user; 61extern int hpet_force_user;
62extern int is_hpet_enabled(void); 62extern int is_hpet_enabled(void);
63extern int hpet_enable(void); 63extern int hpet_enable(void);
64extern void hpet_disable(void);
64extern unsigned long hpet_readl(unsigned long a); 65extern unsigned long hpet_readl(unsigned long a);
65extern void force_hpet_resume(void); 66extern void force_hpet_resume(void);
66 67
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index d62fcee9a08a..9ec43186ba80 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -30,3 +30,10 @@ SUBSYS(cpu_cgroup)
30#endif 30#endif
31 31
32/* */ 32/* */
33
34#ifdef CONFIG_CGROUP_CPUACCT
35SUBSYS(cpuacct)
36#endif
37
38/* */
39
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 1ee009e8fec8..111aa10f1136 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1237,6 +1237,10 @@
1237#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761 1237#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761
1238#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762 1238#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762
1239#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763 1239#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763
1240#define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0
1241#define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1
1242#define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2
1243#define PCI_DEVICE_ID_NVIDIA_NVENET_39 0x0AB3
1240 1244
1241#define PCI_VENDOR_ID_IMS 0x10e0 1245#define PCI_VENDOR_ID_IMS 0x10e0
1242#define PCI_DEVICE_ID_IMS_TT128 0x9128 1246#define PCI_DEVICE_ID_IMS_TT128 0x9128
diff --git a/include/linux/phy.h b/include/linux/phy.h
index f0742b6aaa64..e10763d79181 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -58,6 +58,8 @@ typedef enum {
58 PHY_INTERFACE_MODE_RMII, 58 PHY_INTERFACE_MODE_RMII,
59 PHY_INTERFACE_MODE_RGMII, 59 PHY_INTERFACE_MODE_RGMII,
60 PHY_INTERFACE_MODE_RGMII_ID, 60 PHY_INTERFACE_MODE_RGMII_ID,
61 PHY_INTERFACE_MODE_RGMII_RXID,
62 PHY_INTERFACE_MODE_RGMII_TXID,
61 PHY_INTERFACE_MODE_RTBI 63 PHY_INTERFACE_MODE_RTBI
62} phy_interface_t; 64} phy_interface_t;
63 65
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 1273c6ec535c..523528d237b0 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -48,6 +48,8 @@ typedef int (read_proc_t)(char *page, char **start, off_t off,
48typedef int (write_proc_t)(struct file *file, const char __user *buffer, 48typedef int (write_proc_t)(struct file *file, const char __user *buffer,
49 unsigned long count, void *data); 49 unsigned long count, void *data);
50typedef int (get_info_t)(char *, char **, off_t, int); 50typedef int (get_info_t)(char *, char **, off_t, int);
51typedef struct proc_dir_entry *(shadow_proc_t)(struct task_struct *task,
52 struct proc_dir_entry *pde);
51 53
52struct proc_dir_entry { 54struct proc_dir_entry {
53 unsigned int low_ino; 55 unsigned int low_ino;
@@ -79,6 +81,7 @@ struct proc_dir_entry {
79 int pde_users; /* number of callers into module in progress */ 81 int pde_users; /* number of callers into module in progress */
80 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ 82 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
81 struct completion *pde_unload_completion; 83 struct completion *pde_unload_completion;
84 shadow_proc_t *shadow_proc;
82}; 85};
83 86
84struct kcore_list { 87struct kcore_list {
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index f30b537d6952..05f22a6afbcd 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -441,11 +441,14 @@ enum {
441 SCTP_AUTH_HMAC_ID_RESERVED_0, 441 SCTP_AUTH_HMAC_ID_RESERVED_0,
442 SCTP_AUTH_HMAC_ID_SHA1, 442 SCTP_AUTH_HMAC_ID_SHA1,
443 SCTP_AUTH_HMAC_ID_RESERVED_2, 443 SCTP_AUTH_HMAC_ID_RESERVED_2,
444 SCTP_AUTH_HMAC_ID_SHA256 444#if defined (CONFIG_CRYPTO_SHA256) || defined (CONFIG_CRYPTO_SHA256_MODULE)
445 SCTP_AUTH_HMAC_ID_SHA256,
446#endif
447 __SCTP_AUTH_HMAC_MAX
445}; 448};
446 449
447#define SCTP_AUTH_HMAC_ID_MAX SCTP_AUTH_HMAC_ID_SHA256 450#define SCTP_AUTH_HMAC_ID_MAX __SCTP_AUTH_HMAC_MAX - 1
448#define SCTP_AUTH_NUM_HMACS (SCTP_AUTH_HMAC_ID_SHA256 + 1) 451#define SCTP_AUTH_NUM_HMACS __SCTP_AUTH_HMAC_MAX
449#define SCTP_SHA1_SIG_SIZE 20 452#define SCTP_SHA1_SIG_SIZE 20
450#define SCTP_SHA256_SIG_SIZE 32 453#define SCTP_SHA256_SIG_SIZE 32
451 454
diff --git a/init/Kconfig b/init/Kconfig
index d35e44f4dd6b..404bbf3699be 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -354,6 +354,13 @@ config FAIR_CGROUP_SCHED
354 354
355endchoice 355endchoice
356 356
357config CGROUP_CPUACCT
358 bool "Simple CPU accounting cgroup subsystem"
359 depends on CGROUPS
360 help
361 Provides a simple Resource Controller for monitoring the
362 total CPU consumed by the tasks in a cgroup
363
357config SYSFS_DEPRECATED 364config SYSFS_DEPRECATED
358 bool "Create deprecated sysfs files" 365 bool "Create deprecated sysfs files"
359 default y 366 default y
diff --git a/kernel/Kconfig.instrumentation b/kernel/Kconfig.instrumentation
index f5f2c769d95e..2ea1e347df45 100644
--- a/kernel/Kconfig.instrumentation
+++ b/kernel/Kconfig.instrumentation
@@ -21,7 +21,7 @@ config PROFILING
21config OPROFILE 21config OPROFILE
22 tristate "OProfile system profiling (EXPERIMENTAL)" 22 tristate "OProfile system profiling (EXPERIMENTAL)"
23 depends on PROFILING 23 depends on PROFILING
24 depends on ALPHA || ARM || BLACKFIN || X86_32 || IA64 || M32R || MIPS || PARISC || PPC || S390 || SUPERH || SPARC || X86_64 24 depends on (ALPHA || ARM || BLACKFIN || X86_32 || IA64 || M32R || MIPS || PARISC || PPC || S390 || SUPERH || SPARC || X86_64) && !UML
25 help 25 help
26 OProfile is a profiling system capable of profiling the 26 OProfile is a profiling system capable of profiling the
27 whole system, include the kernel, kernel modules, libraries, 27 whole system, include the kernel, kernel modules, libraries,
@@ -32,7 +32,7 @@ config OPROFILE
32config KPROBES 32config KPROBES
33 bool "Kprobes" 33 bool "Kprobes"
34 depends on KALLSYMS && MODULES 34 depends on KALLSYMS && MODULES
35 depends on X86_32 || IA64 || PPC || S390 || SPARC64 || X86_64 || AVR32 35 depends on (X86_32 || IA64 || PPC || S390 || SPARC64 || X86_64 || AVR32) && !UML
36 help 36 help
37 Kprobes allows you to trap at almost any kernel address and 37 Kprobes allows you to trap at almost any kernel address and
38 execute a callback function. register_kprobe() establishes 38 execute a callback function. register_kprobe() establishes
diff --git a/kernel/sched.c b/kernel/sched.c
index 98dcdf272db3..59ff6b140edb 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -854,6 +854,12 @@ iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
854 struct rq_iterator *iterator); 854 struct rq_iterator *iterator);
855#endif 855#endif
856 856
857#ifdef CONFIG_CGROUP_CPUACCT
858static void cpuacct_charge(struct task_struct *tsk, u64 cputime);
859#else
860static inline void cpuacct_charge(struct task_struct *tsk, u64 cputime) {}
861#endif
862
857#include "sched_stats.h" 863#include "sched_stats.h"
858#include "sched_idletask.c" 864#include "sched_idletask.c"
859#include "sched_fair.c" 865#include "sched_fair.c"
@@ -7221,38 +7227,12 @@ static u64 cpu_shares_read_uint(struct cgroup *cgrp, struct cftype *cft)
7221 return (u64) tg->shares; 7227 return (u64) tg->shares;
7222} 7228}
7223 7229
7224static u64 cpu_usage_read(struct cgroup *cgrp, struct cftype *cft)
7225{
7226 struct task_group *tg = cgroup_tg(cgrp);
7227 unsigned long flags;
7228 u64 res = 0;
7229 int i;
7230
7231 for_each_possible_cpu(i) {
7232 /*
7233 * Lock to prevent races with updating 64-bit counters
7234 * on 32-bit arches.
7235 */
7236 spin_lock_irqsave(&cpu_rq(i)->lock, flags);
7237 res += tg->se[i]->sum_exec_runtime;
7238 spin_unlock_irqrestore(&cpu_rq(i)->lock, flags);
7239 }
7240 /* Convert from ns to ms */
7241 do_div(res, NSEC_PER_MSEC);
7242
7243 return res;
7244}
7245
7246static struct cftype cpu_files[] = { 7230static struct cftype cpu_files[] = {
7247 { 7231 {
7248 .name = "shares", 7232 .name = "shares",
7249 .read_uint = cpu_shares_read_uint, 7233 .read_uint = cpu_shares_read_uint,
7250 .write_uint = cpu_shares_write_uint, 7234 .write_uint = cpu_shares_write_uint,
7251 }, 7235 },
7252 {
7253 .name = "usage",
7254 .read_uint = cpu_usage_read,
7255 },
7256}; 7236};
7257 7237
7258static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont) 7238static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont)
@@ -7272,3 +7252,126 @@ struct cgroup_subsys cpu_cgroup_subsys = {
7272}; 7252};
7273 7253
7274#endif /* CONFIG_FAIR_CGROUP_SCHED */ 7254#endif /* CONFIG_FAIR_CGROUP_SCHED */
7255
7256#ifdef CONFIG_CGROUP_CPUACCT
7257
7258/*
7259 * CPU accounting code for task groups.
7260 *
7261 * Based on the work by Paul Menage (menage@google.com) and Balbir Singh
7262 * (balbir@in.ibm.com).
7263 */
7264
7265/* track cpu usage of a group of tasks */
7266struct cpuacct {
7267 struct cgroup_subsys_state css;
7268 /* cpuusage holds pointer to a u64-type object on every cpu */
7269 u64 *cpuusage;
7270};
7271
7272struct cgroup_subsys cpuacct_subsys;
7273
7274/* return cpu accounting group corresponding to this container */
7275static inline struct cpuacct *cgroup_ca(struct cgroup *cont)
7276{
7277 return container_of(cgroup_subsys_state(cont, cpuacct_subsys_id),
7278 struct cpuacct, css);
7279}
7280
7281/* return cpu accounting group to which this task belongs */
7282static inline struct cpuacct *task_ca(struct task_struct *tsk)
7283{
7284 return container_of(task_subsys_state(tsk, cpuacct_subsys_id),
7285 struct cpuacct, css);
7286}
7287
7288/* create a new cpu accounting group */
7289static struct cgroup_subsys_state *cpuacct_create(
7290 struct cgroup_subsys *ss, struct cgroup *cont)
7291{
7292 struct cpuacct *ca = kzalloc(sizeof(*ca), GFP_KERNEL);
7293
7294 if (!ca)
7295 return ERR_PTR(-ENOMEM);
7296
7297 ca->cpuusage = alloc_percpu(u64);
7298 if (!ca->cpuusage) {
7299 kfree(ca);
7300 return ERR_PTR(-ENOMEM);
7301 }
7302
7303 return &ca->css;
7304}
7305
7306/* destroy an existing cpu accounting group */
7307static void cpuacct_destroy(struct cgroup_subsys *ss,
7308 struct cgroup *cont)
7309{
7310 struct cpuacct *ca = cgroup_ca(cont);
7311
7312 free_percpu(ca->cpuusage);
7313 kfree(ca);
7314}
7315
7316/* return total cpu usage (in nanoseconds) of a group */
7317static u64 cpuusage_read(struct cgroup *cont, struct cftype *cft)
7318{
7319 struct cpuacct *ca = cgroup_ca(cont);
7320 u64 totalcpuusage = 0;
7321 int i;
7322
7323 for_each_possible_cpu(i) {
7324 u64 *cpuusage = percpu_ptr(ca->cpuusage, i);
7325
7326 /*
7327 * Take rq->lock to make 64-bit addition safe on 32-bit
7328 * platforms.
7329 */
7330 spin_lock_irq(&cpu_rq(i)->lock);
7331 totalcpuusage += *cpuusage;
7332 spin_unlock_irq(&cpu_rq(i)->lock);
7333 }
7334
7335 return totalcpuusage;
7336}
7337
7338static struct cftype files[] = {
7339 {
7340 .name = "usage",
7341 .read_uint = cpuusage_read,
7342 },
7343};
7344
7345static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cont)
7346{
7347 return cgroup_add_files(cont, ss, files, ARRAY_SIZE(files));
7348}
7349
7350/*
7351 * charge this task's execution time to its accounting group.
7352 *
7353 * called with rq->lock held.
7354 */
7355static void cpuacct_charge(struct task_struct *tsk, u64 cputime)
7356{
7357 struct cpuacct *ca;
7358
7359 if (!cpuacct_subsys.active)
7360 return;
7361
7362 ca = task_ca(tsk);
7363 if (ca) {
7364 u64 *cpuusage = percpu_ptr(ca->cpuusage, task_cpu(tsk));
7365
7366 *cpuusage += cputime;
7367 }
7368}
7369
7370struct cgroup_subsys cpuacct_subsys = {
7371 .name = "cpuacct",
7372 .create = cpuacct_create,
7373 .destroy = cpuacct_destroy,
7374 .populate = cpuacct_populate,
7375 .subsys_id = cpuacct_subsys_id,
7376};
7377#endif /* CONFIG_CGROUP_CPUACCT */
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 2f16e15c022c..37bb265598db 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -351,6 +351,12 @@ static void update_curr(struct cfs_rq *cfs_rq)
351 351
352 __update_curr(cfs_rq, curr, delta_exec); 352 __update_curr(cfs_rq, curr, delta_exec);
353 curr->exec_start = now; 353 curr->exec_start = now;
354
355 if (entity_is_task(curr)) {
356 struct task_struct *curtask = task_of(curr);
357
358 cpuacct_charge(curtask, delta_exec);
359 }
354} 360}
355 361
356static inline void 362static inline void
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 8abd752a0ebd..ee9c8b6529e9 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -23,6 +23,7 @@ static void update_curr_rt(struct rq *rq)
23 23
24 curr->se.sum_exec_runtime += delta_exec; 24 curr->se.sum_exec_runtime += delta_exec;
25 curr->se.exec_start = rq->clock; 25 curr->se.exec_start = rq->clock;
26 cpuacct_charge(curr, delta_exec);
26} 27}
27 28
28static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup) 29static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
diff --git a/lib/textsearch.c b/lib/textsearch.c
index 88c98a2ec8d9..be8bda3862f5 100644
--- a/lib/textsearch.c
+++ b/lib/textsearch.c
@@ -7,7 +7,7 @@
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 * 8 *
9 * Authors: Thomas Graf <tgraf@suug.ch> 9 * Authors: Thomas Graf <tgraf@suug.ch>
10 * Pablo Neira Ayuso <pablo@eurodev.net> 10 * Pablo Neira Ayuso <pablo@netfilter.org>
11 * 11 *
12 * ========================================================================== 12 * ==========================================================================
13 * 13 *
@@ -250,7 +250,8 @@ unsigned int textsearch_find_continuous(struct ts_config *conf,
250 * the various search algorithms. 250 * the various search algorithms.
251 * 251 *
252 * Returns a new textsearch configuration according to the specified 252 * Returns a new textsearch configuration according to the specified
253 * parameters or a ERR_PTR(). 253 * parameters or a ERR_PTR(). If a zero length pattern is passed, this
254 * function returns EINVAL.
254 */ 255 */
255struct ts_config *textsearch_prepare(const char *algo, const void *pattern, 256struct ts_config *textsearch_prepare(const char *algo, const void *pattern,
256 unsigned int len, gfp_t gfp_mask, int flags) 257 unsigned int len, gfp_t gfp_mask, int flags)
@@ -259,6 +260,9 @@ struct ts_config *textsearch_prepare(const char *algo, const void *pattern,
259 struct ts_config *conf; 260 struct ts_config *conf;
260 struct ts_ops *ops; 261 struct ts_ops *ops;
261 262
263 if (len == 0)
264 return ERR_PTR(-EINVAL);
265
262 ops = lookup_ts_algo(algo); 266 ops = lookup_ts_algo(algo);
263#ifdef CONFIG_KMOD 267#ifdef CONFIG_KMOD
264 /* 268 /*
diff --git a/mm/slab.c b/mm/slab.c
index c31cd3682a0b..202465a193c1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2881,6 +2881,8 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp,
2881 unsigned int objnr; 2881 unsigned int objnr;
2882 struct slab *slabp; 2882 struct slab *slabp;
2883 2883
2884 BUG_ON(virt_to_cache(objp) != cachep);
2885
2884 objp -= obj_offset(cachep); 2886 objp -= obj_offset(cachep);
2885 kfree_debugcheck(objp); 2887 kfree_debugcheck(objp);
2886 page = virt_to_head_page(objp); 2888 page = virt_to_head_page(objp);
@@ -3759,8 +3761,6 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp)
3759{ 3761{
3760 unsigned long flags; 3762 unsigned long flags;
3761 3763
3762 BUG_ON(virt_to_cache(objp) != cachep);
3763
3764 local_irq_save(flags); 3764 local_irq_save(flags);
3765 debug_check_no_locks_freed(objp, obj_size(cachep)); 3765 debug_check_no_locks_freed(objp, obj_size(cachep));
3766 __cache_free(cachep, objp); 3766 __cache_free(cachep, objp);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 7a36878241da..4f99bb86af5c 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -462,7 +462,8 @@ int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
462 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs... 462 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs...
463 */ 463 */
464 464
465 if (veth->h_vlan_proto != htons(ETH_P_8021Q)) { 465 if (veth->h_vlan_proto != htons(ETH_P_8021Q) ||
466 VLAN_DEV_INFO(dev)->flags & VLAN_FLAG_REORDER_HDR) {
466 int orig_headroom = skb_headroom(skb); 467 int orig_headroom = skb_headroom(skb);
467 unsigned short veth_TCI; 468 unsigned short veth_TCI;
468 469
diff --git a/net/bridge/br.c b/net/bridge/br.c
index 93867bb6cc97..a90182873120 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -39,7 +39,7 @@ static int __init br_init(void)
39 39
40 err = br_fdb_init(); 40 err = br_fdb_init();
41 if (err) 41 if (err)
42 goto err_out1; 42 goto err_out;
43 43
44 err = br_netfilter_init(); 44 err = br_netfilter_init();
45 if (err) 45 if (err)
@@ -65,6 +65,8 @@ err_out3:
65err_out2: 65err_out2:
66 br_netfilter_fini(); 66 br_netfilter_fini();
67err_out1: 67err_out1:
68 br_fdb_fini();
69err_out:
68 llc_sap_put(br_stp_sap); 70 llc_sap_put(br_stp_sap);
69 return err; 71 return err;
70} 72}
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 3cedd4eeeed6..0ee79a726d91 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -122,6 +122,7 @@ static inline int is_link_local(const unsigned char *dest)
122struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb) 122struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb)
123{ 123{
124 const unsigned char *dest = eth_hdr(skb)->h_dest; 124 const unsigned char *dest = eth_hdr(skb)->h_dest;
125 int (*rhook)(struct sk_buff *skb);
125 126
126 if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) 127 if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
127 goto drop; 128 goto drop;
@@ -147,9 +148,9 @@ struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb)
147 148
148 switch (p->state) { 149 switch (p->state) {
149 case BR_STATE_FORWARDING: 150 case BR_STATE_FORWARDING:
150 151 rhook = rcu_dereference(br_should_route_hook);
151 if (br_should_route_hook) { 152 if (rhook != NULL) {
152 if (br_should_route_hook(skb)) 153 if (rhook(skb))
153 return skb; 154 return skb;
154 dest = eth_hdr(skb)->h_dest; 155 dest = eth_hdr(skb)->h_dest;
155 } 156 }
diff --git a/net/bridge/netfilter/ebtable_broute.c b/net/bridge/netfilter/ebtable_broute.c
index e44519ebf1d2..be6f18681053 100644
--- a/net/bridge/netfilter/ebtable_broute.c
+++ b/net/bridge/netfilter/ebtable_broute.c
@@ -70,13 +70,13 @@ static int __init ebtable_broute_init(void)
70 if (ret < 0) 70 if (ret < 0)
71 return ret; 71 return ret;
72 /* see br_input.c */ 72 /* see br_input.c */
73 br_should_route_hook = ebt_broute; 73 rcu_assign_pointer(br_should_route_hook, ebt_broute);
74 return ret; 74 return ret;
75} 75}
76 76
77static void __exit ebtable_broute_fini(void) 77static void __exit ebtable_broute_fini(void)
78{ 78{
79 br_should_route_hook = NULL; 79 rcu_assign_pointer(br_should_route_hook, NULL);
80 synchronize_net(); 80 synchronize_net();
81 ebt_unregister_table(&broute_table); 81 ebt_unregister_table(&broute_table);
82} 82}
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 66e266fb5908..3bc82dc83b38 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -651,16 +651,18 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
651 struct dn_dev *dn_db; 651 struct dn_dev *dn_db;
652 struct ifaddrmsg *ifm; 652 struct ifaddrmsg *ifm;
653 struct dn_ifaddr *ifa, **ifap; 653 struct dn_ifaddr *ifa, **ifap;
654 int err = -EADDRNOTAVAIL; 654 int err;
655 655
656 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy); 656 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
657 if (err < 0) 657 if (err < 0)
658 goto errout; 658 goto errout;
659 659
660 err = -ENODEV;
660 ifm = nlmsg_data(nlh); 661 ifm = nlmsg_data(nlh);
661 if ((dn_db = dn_dev_by_index(ifm->ifa_index)) == NULL) 662 if ((dn_db = dn_dev_by_index(ifm->ifa_index)) == NULL)
662 goto errout; 663 goto errout;
663 664
665 err = -EADDRNOTAVAIL;
664 for (ifap = &dn_db->ifa_list; (ifa = *ifap); ifap = &ifa->ifa_next) { 666 for (ifap = &dn_db->ifa_list; (ifa = *ifap); ifap = &ifa->ifa_next) {
665 if (tb[IFA_LOCAL] && 667 if (tb[IFA_LOCAL] &&
666 nla_memcmp(tb[IFA_LOCAL], &ifa->ifa_local, 2)) 668 nla_memcmp(tb[IFA_LOCAL], &ifa->ifa_local, 2))
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
index a4c3c51140a3..6d06f1385e28 100644
--- a/net/ieee80211/ieee80211_tx.c
+++ b/net/ieee80211/ieee80211_tx.c
@@ -144,7 +144,8 @@ static int ieee80211_copy_snap(u8 * data, u16 h_proto)
144 snap->oui[1] = oui[1]; 144 snap->oui[1] = oui[1];
145 snap->oui[2] = oui[2]; 145 snap->oui[2] = oui[2];
146 146
147 *(u16 *) (data + SNAP_SIZE) = htons(h_proto); 147 h_proto = htons(h_proto);
148 memcpy(data + SNAP_SIZE, &h_proto, sizeof(u16));
148 149
149 return SNAP_SIZE + sizeof(u16); 150 return SNAP_SIZE + sizeof(u16);
150} 151}
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index b0170732b5e9..e468e7a7aac4 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -51,6 +51,29 @@ static struct sock *idiagnl;
51#define INET_DIAG_PUT(skb, attrtype, attrlen) \ 51#define INET_DIAG_PUT(skb, attrtype, attrlen) \
52 RTA_DATA(__RTA_PUT(skb, attrtype, attrlen)) 52 RTA_DATA(__RTA_PUT(skb, attrtype, attrlen))
53 53
54static DEFINE_MUTEX(inet_diag_table_mutex);
55
56static const struct inet_diag_handler *inet_diag_lock_handler(int type)
57{
58#ifdef CONFIG_KMOD
59 if (!inet_diag_table[type])
60 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
61 NETLINK_INET_DIAG, type);
62#endif
63
64 mutex_lock(&inet_diag_table_mutex);
65 if (!inet_diag_table[type])
66 return ERR_PTR(-ENOENT);
67
68 return inet_diag_table[type];
69}
70
71static inline void inet_diag_unlock_handler(
72 const struct inet_diag_handler *handler)
73{
74 mutex_unlock(&inet_diag_table_mutex);
75}
76
54static int inet_csk_diag_fill(struct sock *sk, 77static int inet_csk_diag_fill(struct sock *sk,
55 struct sk_buff *skb, 78 struct sk_buff *skb,
56 int ext, u32 pid, u32 seq, u16 nlmsg_flags, 79 int ext, u32 pid, u32 seq, u16 nlmsg_flags,
@@ -235,9 +258,12 @@ static int inet_diag_get_exact(struct sk_buff *in_skb,
235 struct inet_hashinfo *hashinfo; 258 struct inet_hashinfo *hashinfo;
236 const struct inet_diag_handler *handler; 259 const struct inet_diag_handler *handler;
237 260
238 handler = inet_diag_table[nlh->nlmsg_type]; 261 handler = inet_diag_lock_handler(nlh->nlmsg_type);
239 BUG_ON(handler == NULL); 262 if (!handler)
263 return -ENOENT;
264
240 hashinfo = handler->idiag_hashinfo; 265 hashinfo = handler->idiag_hashinfo;
266 err = -EINVAL;
241 267
242 if (req->idiag_family == AF_INET) { 268 if (req->idiag_family == AF_INET) {
243 sk = inet_lookup(hashinfo, req->id.idiag_dst[0], 269 sk = inet_lookup(hashinfo, req->id.idiag_dst[0],
@@ -255,11 +281,12 @@ static int inet_diag_get_exact(struct sk_buff *in_skb,
255 } 281 }
256#endif 282#endif
257 else { 283 else {
258 return -EINVAL; 284 goto unlock;
259 } 285 }
260 286
287 err = -ENOENT;
261 if (sk == NULL) 288 if (sk == NULL)
262 return -ENOENT; 289 goto unlock;
263 290
264 err = -ESTALE; 291 err = -ESTALE;
265 if ((req->id.idiag_cookie[0] != INET_DIAG_NOCOOKIE || 292 if ((req->id.idiag_cookie[0] != INET_DIAG_NOCOOKIE ||
@@ -296,6 +323,8 @@ out:
296 else 323 else
297 sock_put(sk); 324 sock_put(sk);
298 } 325 }
326unlock:
327 inet_diag_unlock_handler(handler);
299 return err; 328 return err;
300} 329}
301 330
@@ -678,8 +707,10 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
678 const struct inet_diag_handler *handler; 707 const struct inet_diag_handler *handler;
679 struct inet_hashinfo *hashinfo; 708 struct inet_hashinfo *hashinfo;
680 709
681 handler = inet_diag_table[cb->nlh->nlmsg_type]; 710 handler = inet_diag_lock_handler(cb->nlh->nlmsg_type);
682 BUG_ON(handler == NULL); 711 if (!handler)
712 goto no_handler;
713
683 hashinfo = handler->idiag_hashinfo; 714 hashinfo = handler->idiag_hashinfo;
684 715
685 s_i = cb->args[1]; 716 s_i = cb->args[1];
@@ -743,7 +774,7 @@ skip_listen_ht:
743 } 774 }
744 775
745 if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV))) 776 if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV)))
746 return skb->len; 777 goto unlock;
747 778
748 for (i = s_i; i < hashinfo->ehash_size; i++) { 779 for (i = s_i; i < hashinfo->ehash_size; i++) {
749 struct inet_ehash_bucket *head = &hashinfo->ehash[i]; 780 struct inet_ehash_bucket *head = &hashinfo->ehash[i];
@@ -805,6 +836,9 @@ next_dying:
805done: 836done:
806 cb->args[1] = i; 837 cb->args[1] = i;
807 cb->args[2] = num; 838 cb->args[2] = num;
839unlock:
840 inet_diag_unlock_handler(handler);
841no_handler:
808 return skb->len; 842 return skb->len;
809} 843}
810 844
@@ -816,15 +850,6 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
816 nlmsg_len(nlh) < hdrlen) 850 nlmsg_len(nlh) < hdrlen)
817 return -EINVAL; 851 return -EINVAL;
818 852
819#ifdef CONFIG_KMOD
820 if (inet_diag_table[nlh->nlmsg_type] == NULL)
821 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
822 NETLINK_INET_DIAG, nlh->nlmsg_type);
823#endif
824
825 if (inet_diag_table[nlh->nlmsg_type] == NULL)
826 return -ENOENT;
827
828 if (nlh->nlmsg_flags & NLM_F_DUMP) { 853 if (nlh->nlmsg_flags & NLM_F_DUMP) {
829 if (nlmsg_attrlen(nlh, hdrlen)) { 854 if (nlmsg_attrlen(nlh, hdrlen)) {
830 struct nlattr *attr; 855 struct nlattr *attr;
@@ -853,8 +878,6 @@ static void inet_diag_rcv(struct sk_buff *skb)
853 mutex_unlock(&inet_diag_mutex); 878 mutex_unlock(&inet_diag_mutex);
854} 879}
855 880
856static DEFINE_SPINLOCK(inet_diag_register_lock);
857
858int inet_diag_register(const struct inet_diag_handler *h) 881int inet_diag_register(const struct inet_diag_handler *h)
859{ 882{
860 const __u16 type = h->idiag_type; 883 const __u16 type = h->idiag_type;
@@ -863,13 +886,13 @@ int inet_diag_register(const struct inet_diag_handler *h)
863 if (type >= INET_DIAG_GETSOCK_MAX) 886 if (type >= INET_DIAG_GETSOCK_MAX)
864 goto out; 887 goto out;
865 888
866 spin_lock(&inet_diag_register_lock); 889 mutex_lock(&inet_diag_table_mutex);
867 err = -EEXIST; 890 err = -EEXIST;
868 if (inet_diag_table[type] == NULL) { 891 if (inet_diag_table[type] == NULL) {
869 inet_diag_table[type] = h; 892 inet_diag_table[type] = h;
870 err = 0; 893 err = 0;
871 } 894 }
872 spin_unlock(&inet_diag_register_lock); 895 mutex_unlock(&inet_diag_table_mutex);
873out: 896out:
874 return err; 897 return err;
875} 898}
@@ -882,11 +905,9 @@ void inet_diag_unregister(const struct inet_diag_handler *h)
882 if (type >= INET_DIAG_GETSOCK_MAX) 905 if (type >= INET_DIAG_GETSOCK_MAX)
883 return; 906 return;
884 907
885 spin_lock(&inet_diag_register_lock); 908 mutex_lock(&inet_diag_table_mutex);
886 inet_diag_table[type] = NULL; 909 inet_diag_table[type] = NULL;
887 spin_unlock(&inet_diag_register_lock); 910 mutex_unlock(&inet_diag_table_mutex);
888
889 synchronize_rcu();
890} 911}
891EXPORT_SYMBOL_GPL(inet_diag_unregister); 912EXPORT_SYMBOL_GPL(inet_diag_unregister);
892 913
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index 64f1cbaf96e8..5aa5f5496d6d 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -298,7 +298,7 @@ static u32 tcp_illinois_ssthresh(struct sock *sk)
298 struct illinois *ca = inet_csk_ca(sk); 298 struct illinois *ca = inet_csk_ca(sk);
299 299
300 /* Multiplicative decrease */ 300 /* Multiplicative decrease */
301 return max((tp->snd_cwnd * ca->beta) >> BETA_SHIFT, 2U); 301 return max(tp->snd_cwnd - ((tp->snd_cwnd * ca->beta) >> BETA_SHIFT), 2U);
302} 302}
303 303
304 304
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 567664eac463..e8c347579da9 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2293,6 +2293,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2293 break; 2293 break;
2294 } 2294 }
2295 2295
2296 if (!idev && dev->mtu >= IPV6_MIN_MTU)
2297 idev = ipv6_add_dev(dev);
2298
2296 if (idev) 2299 if (idev)
2297 idev->if_flags |= IF_READY; 2300 idev->if_flags |= IF_READY;
2298 } else { 2301 } else {
@@ -2357,12 +2360,18 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2357 break; 2360 break;
2358 2361
2359 case NETDEV_CHANGEMTU: 2362 case NETDEV_CHANGEMTU:
2360 if ( idev && dev->mtu >= IPV6_MIN_MTU) { 2363 if (idev && dev->mtu >= IPV6_MIN_MTU) {
2361 rt6_mtu_change(dev, dev->mtu); 2364 rt6_mtu_change(dev, dev->mtu);
2362 idev->cnf.mtu6 = dev->mtu; 2365 idev->cnf.mtu6 = dev->mtu;
2363 break; 2366 break;
2364 } 2367 }
2365 2368
2369 if (!idev && dev->mtu >= IPV6_MIN_MTU) {
2370 idev = ipv6_add_dev(dev);
2371 if (idev)
2372 break;
2373 }
2374
2366 /* MTU falled under IPV6_MIN_MTU. Stop IPv6 on this interface. */ 2375 /* MTU falled under IPV6_MIN_MTU. Stop IPv6 on this interface. */
2367 2376
2368 case NETDEV_DOWN: 2377 case NETDEV_DOWN:
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 59350b8727ec..505af1f067ab 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -216,6 +216,7 @@ static int ieee80211_open(struct net_device *dev)
216 res = local->ops->start(local_to_hw(local)); 216 res = local->ops->start(local_to_hw(local));
217 if (res) 217 if (res)
218 return res; 218 return res;
219 ieee80211_hw_config(local);
219 } 220 }
220 221
221 switch (sdata->type) { 222 switch (sdata->type) {
@@ -232,7 +233,6 @@ static int ieee80211_open(struct net_device *dev)
232 netif_tx_unlock_bh(local->mdev); 233 netif_tx_unlock_bh(local->mdev);
233 234
234 local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; 235 local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP;
235 ieee80211_hw_config(local);
236 } 236 }
237 break; 237 break;
238 case IEEE80211_IF_TYPE_STA: 238 case IEEE80211_IF_TYPE_STA:
@@ -334,8 +334,7 @@ static int ieee80211_stop(struct net_device *dev)
334 ieee80211_configure_filter(local); 334 ieee80211_configure_filter(local);
335 netif_tx_unlock_bh(local->mdev); 335 netif_tx_unlock_bh(local->mdev);
336 336
337 local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; 337 local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP;
338 ieee80211_hw_config(local);
339 } 338 }
340 break; 339 break;
341 case IEEE80211_IF_TYPE_STA: 340 case IEEE80211_IF_TYPE_STA:
@@ -357,6 +356,11 @@ static int ieee80211_stop(struct net_device *dev)
357 cancel_delayed_work(&local->scan_work); 356 cancel_delayed_work(&local->scan_work);
358 } 357 }
359 flush_workqueue(local->hw.workqueue); 358 flush_workqueue(local->hw.workqueue);
359
360 sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
361 kfree(sdata->u.sta.extra_ie);
362 sdata->u.sta.extra_ie = NULL;
363 sdata->u.sta.extra_ie_len = 0;
360 /* fall through */ 364 /* fall through */
361 default: 365 default:
362 conf.if_id = dev->ifindex; 366 conf.if_id = dev->ifindex;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 428a9fcf57d6..00f908d9275e 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -997,7 +997,7 @@ ieee80211_rx_h_drop_unencrypted(struct ieee80211_txrx_data *rx)
997 if (unlikely(!(rx->fc & IEEE80211_FCTL_PROTECTED) && 997 if (unlikely(!(rx->fc & IEEE80211_FCTL_PROTECTED) &&
998 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA && 998 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA &&
999 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_NULLFUNC && 999 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_NULLFUNC &&
1000 rx->sdata->drop_unencrypted && 1000 (rx->key || rx->sdata->drop_unencrypted) &&
1001 (rx->sdata->eapol == 0 || !ieee80211_is_eapol(rx->skb)))) { 1001 (rx->sdata->eapol == 0 || !ieee80211_is_eapol(rx->skb)))) {
1002 if (net_ratelimit()) 1002 if (net_ratelimit())
1003 printk(KERN_DEBUG "%s: RX non-WEP frame, but expected " 1003 printk(KERN_DEBUG "%s: RX non-WEP frame, but expected "
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 9bf0e1cc530a..b5f3413403bd 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -265,7 +265,8 @@ int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,
265 if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen, 265 if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen,
266 skb->data + hdrlen + WEP_IV_LEN, 266 skb->data + hdrlen + WEP_IV_LEN,
267 len)) { 267 len)) {
268 printk(KERN_DEBUG "WEP decrypt failed (ICV)\n"); 268 if (net_ratelimit())
269 printk(KERN_DEBUG "WEP decrypt failed (ICV)\n");
269 ret = -1; 270 ret = -1;
270 } 271 }
271 272
diff --git a/net/netfilter/xt_CONNMARK.c b/net/netfilter/xt_CONNMARK.c
index 856793e8db7a..0621ca7de3b0 100644
--- a/net/netfilter/xt_CONNMARK.c
+++ b/net/netfilter/xt_CONNMARK.c
@@ -86,11 +86,6 @@ checkentry(const char *tablename,
86{ 86{
87 const struct xt_connmark_target_info *matchinfo = targinfo; 87 const struct xt_connmark_target_info *matchinfo = targinfo;
88 88
89 if (nf_ct_l3proto_try_module_get(target->family) < 0) {
90 printk(KERN_WARNING "can't load conntrack support for "
91 "proto=%d\n", target->family);
92 return false;
93 }
94 if (matchinfo->mode == XT_CONNMARK_RESTORE) { 89 if (matchinfo->mode == XT_CONNMARK_RESTORE) {
95 if (strcmp(tablename, "mangle") != 0) { 90 if (strcmp(tablename, "mangle") != 0) {
96 printk(KERN_WARNING "CONNMARK: restore can only be " 91 printk(KERN_WARNING "CONNMARK: restore can only be "
@@ -103,6 +98,11 @@ checkentry(const char *tablename,
103 printk(KERN_WARNING "CONNMARK: Only supports 32bit mark\n"); 98 printk(KERN_WARNING "CONNMARK: Only supports 32bit mark\n");
104 return false; 99 return false;
105 } 100 }
101 if (nf_ct_l3proto_try_module_get(target->family) < 0) {
102 printk(KERN_WARNING "can't load conntrack support for "
103 "proto=%d\n", target->family);
104 return false;
105 }
106 return true; 106 return true;
107} 107}
108 108
diff --git a/net/netfilter/xt_CONNSECMARK.c b/net/netfilter/xt_CONNSECMARK.c
index 021b5c8d20e2..d8feba9bdb48 100644
--- a/net/netfilter/xt_CONNSECMARK.c
+++ b/net/netfilter/xt_CONNSECMARK.c
@@ -90,11 +90,6 @@ static bool checkentry(const char *tablename, const void *entry,
90{ 90{
91 const struct xt_connsecmark_target_info *info = targinfo; 91 const struct xt_connsecmark_target_info *info = targinfo;
92 92
93 if (nf_ct_l3proto_try_module_get(target->family) < 0) {
94 printk(KERN_WARNING "can't load conntrack support for "
95 "proto=%d\n", target->family);
96 return false;
97 }
98 switch (info->mode) { 93 switch (info->mode) {
99 case CONNSECMARK_SAVE: 94 case CONNSECMARK_SAVE:
100 case CONNSECMARK_RESTORE: 95 case CONNSECMARK_RESTORE:
@@ -105,6 +100,11 @@ static bool checkentry(const char *tablename, const void *entry,
105 return false; 100 return false;
106 } 101 }
107 102
103 if (nf_ct_l3proto_try_module_get(target->family) < 0) {
104 printk(KERN_WARNING "can't load conntrack support for "
105 "proto=%d\n", target->family);
106 return false;
107 }
108 return true; 108 return true;
109} 109}
110 110
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index 07435a602b11..8e76d1f52fbe 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -174,10 +174,8 @@ xt_tcpmss_target6(struct sk_buff *skb,
174 174
175 nexthdr = ipv6h->nexthdr; 175 nexthdr = ipv6h->nexthdr;
176 tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr); 176 tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr);
177 if (tcphoff < 0) { 177 if (tcphoff < 0)
178 WARN_ON(1);
179 return NF_DROP; 178 return NF_DROP;
180 }
181 ret = tcpmss_mangle_packet(skb, targinfo, tcphoff, 179 ret = tcpmss_mangle_packet(skb, targinfo, tcphoff,
182 sizeof(*ipv6h) + sizeof(struct tcphdr)); 180 sizeof(*ipv6h) + sizeof(struct tcphdr));
183 if (ret < 0) 181 if (ret < 0)
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 73d60a307129..4469a7be006c 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -60,11 +60,7 @@ static void rfkill_led_trigger(struct rfkill *rfkill,
60static int rfkill_toggle_radio(struct rfkill *rfkill, 60static int rfkill_toggle_radio(struct rfkill *rfkill,
61 enum rfkill_state state) 61 enum rfkill_state state)
62{ 62{
63 int retval; 63 int retval = 0;
64
65 retval = mutex_lock_interruptible(&rfkill->mutex);
66 if (retval)
67 return retval;
68 64
69 if (state != rfkill->state) { 65 if (state != rfkill->state) {
70 retval = rfkill->toggle_radio(rfkill->data, state); 66 retval = rfkill->toggle_radio(rfkill->data, state);
@@ -74,7 +70,6 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
74 } 70 }
75 } 71 }
76 72
77 mutex_unlock(&rfkill->mutex);
78 return retval; 73 return retval;
79} 74}
80 75
@@ -158,12 +153,13 @@ static ssize_t rfkill_state_store(struct device *dev,
158 if (!capable(CAP_NET_ADMIN)) 153 if (!capable(CAP_NET_ADMIN))
159 return -EPERM; 154 return -EPERM;
160 155
156 if (mutex_lock_interruptible(&rfkill->mutex))
157 return -ERESTARTSYS;
161 error = rfkill_toggle_radio(rfkill, 158 error = rfkill_toggle_radio(rfkill,
162 state ? RFKILL_STATE_ON : RFKILL_STATE_OFF); 159 state ? RFKILL_STATE_ON : RFKILL_STATE_OFF);
163 if (error) 160 mutex_unlock(&rfkill->mutex);
164 return error;
165 161
166 return count; 162 return error ? error : count;
167} 163}
168 164
169static ssize_t rfkill_claim_show(struct device *dev, 165static ssize_t rfkill_claim_show(struct device *dev,
diff --git a/net/rxrpc/Kconfig b/net/rxrpc/Kconfig
index e662f1d07664..0d3103c4f11c 100644
--- a/net/rxrpc/Kconfig
+++ b/net/rxrpc/Kconfig
@@ -5,6 +5,7 @@
5config AF_RXRPC 5config AF_RXRPC
6 tristate "RxRPC session sockets" 6 tristate "RxRPC session sockets"
7 depends on INET && EXPERIMENTAL 7 depends on INET && EXPERIMENTAL
8 select CRYPTO
8 select KEYS 9 select KEYS
9 help 10 help
10 Say Y or M here to include support for RxRPC session sockets (just 11 Say Y or M here to include support for RxRPC session sockets (just
diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig
index 8210f549c492..5390bc792159 100644
--- a/net/sctp/Kconfig
+++ b/net/sctp/Kconfig
@@ -6,9 +6,9 @@ menuconfig IP_SCTP
6 tristate "The SCTP Protocol (EXPERIMENTAL)" 6 tristate "The SCTP Protocol (EXPERIMENTAL)"
7 depends on INET && EXPERIMENTAL 7 depends on INET && EXPERIMENTAL
8 depends on IPV6 || IPV6=n 8 depends on IPV6 || IPV6=n
9 select CRYPTO if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5 9 select CRYPTO
10 select CRYPTO_HMAC if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5 10 select CRYPTO_HMAC
11 select CRYPTO_SHA1 if SCTP_HMAC_SHA1 11 select CRYPTO_SHA1
12 select CRYPTO_MD5 if SCTP_HMAC_MD5 12 select CRYPTO_MD5 if SCTP_HMAC_MD5
13 ---help--- 13 ---help---
14 Stream Control Transmission Protocol 14 Stream Control Transmission Protocol
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 6d5fa6bb371b..97e6ebd14500 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -54,11 +54,13 @@ static struct sctp_hmac sctp_hmac_list[SCTP_AUTH_NUM_HMACS] = {
54 /* id 2 is reserved as well */ 54 /* id 2 is reserved as well */
55 .hmac_id = SCTP_AUTH_HMAC_ID_RESERVED_2, 55 .hmac_id = SCTP_AUTH_HMAC_ID_RESERVED_2,
56 }, 56 },
57#if defined (CONFIG_CRYPTO_SHA256) || defined (CONFIG_CRYPTO_SHA256_MODULE)
57 { 58 {
58 .hmac_id = SCTP_AUTH_HMAC_ID_SHA256, 59 .hmac_id = SCTP_AUTH_HMAC_ID_SHA256,
59 .hmac_name="hmac(sha256)", 60 .hmac_name="hmac(sha256)",
60 .hmac_len = SCTP_SHA256_SIG_SIZE, 61 .hmac_len = SCTP_SHA256_SIG_SIZE,
61 } 62 }
63#endif
62}; 64};
63 65
64 66
@@ -631,7 +633,7 @@ static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param)
631 int found = 0; 633 int found = 0;
632 int i; 634 int i;
633 635
634 if (!param) 636 if (!param || param->param_hdr.length == 0)
635 return 0; 637 return 0;
636 638
637 len = ntohs(param->param_hdr.length) - sizeof(sctp_paramhdr_t); 639 len = ntohs(param->param_hdr.length) - sizeof(sctp_paramhdr_t);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 5a9783c38de1..f4876291bb5e 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -77,6 +77,8 @@ static int sctp_process_param(struct sctp_association *asoc,
77 union sctp_params param, 77 union sctp_params param,
78 const union sctp_addr *peer_addr, 78 const union sctp_addr *peer_addr,
79 gfp_t gfp); 79 gfp_t gfp);
80static void *sctp_addto_param(struct sctp_chunk *chunk, int len,
81 const void *data);
80 82
81/* What was the inbound interface for this chunk? */ 83/* What was the inbound interface for this chunk? */
82int sctp_chunk_iif(const struct sctp_chunk *chunk) 84int sctp_chunk_iif(const struct sctp_chunk *chunk)
@@ -207,11 +209,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
207 209
208 chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types); 210 chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types);
209 chunksize += sizeof(ecap_param); 211 chunksize += sizeof(ecap_param);
210 if (sctp_prsctp_enable) { 212
211 chunksize += sizeof(prsctp_param);
212 extensions[num_ext] = SCTP_CID_FWD_TSN;
213 num_ext += 1;
214 }
215 /* ADDIP: Section 4.2.7: 213 /* ADDIP: Section 4.2.7:
216 * An implementation supporting this extension [ADDIP] MUST list 214 * An implementation supporting this extension [ADDIP] MUST list
217 * the ASCONF,the ASCONF-ACK, and the AUTH chunks in its INIT and 215 * the ASCONF,the ASCONF-ACK, and the AUTH chunks in its INIT and
@@ -243,7 +241,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
243 if (auth_chunks->length) 241 if (auth_chunks->length)
244 chunksize += ntohs(auth_chunks->length); 242 chunksize += ntohs(auth_chunks->length);
245 else 243 else
246 auth_hmacs = NULL; 244 auth_chunks = NULL;
247 245
248 extensions[num_ext] = SCTP_CID_AUTH; 246 extensions[num_ext] = SCTP_CID_AUTH;
249 num_ext += 1; 247 num_ext += 1;
@@ -297,7 +295,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
297 htons(sizeof(sctp_supported_ext_param_t) + num_ext); 295 htons(sizeof(sctp_supported_ext_param_t) + num_ext);
298 sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t), 296 sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t),
299 &ext_param); 297 &ext_param);
300 sctp_addto_chunk(retval, num_ext, extensions); 298 sctp_addto_param(retval, num_ext, extensions);
301 } 299 }
302 300
303 if (sctp_prsctp_enable) 301 if (sctp_prsctp_enable)
@@ -371,20 +369,12 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
371 if (asoc->peer.ecn_capable) 369 if (asoc->peer.ecn_capable)
372 chunksize += sizeof(ecap_param); 370 chunksize += sizeof(ecap_param);
373 371
374 /* Tell peer that we'll do PR-SCTP only if peer advertised. */
375 if (asoc->peer.prsctp_capable) {
376 chunksize += sizeof(prsctp_param);
377 extensions[num_ext] = SCTP_CID_FWD_TSN;
378 num_ext += 1;
379 }
380
381 if (sctp_addip_enable) { 372 if (sctp_addip_enable) {
382 extensions[num_ext] = SCTP_CID_ASCONF; 373 extensions[num_ext] = SCTP_CID_ASCONF;
383 extensions[num_ext+1] = SCTP_CID_ASCONF_ACK; 374 extensions[num_ext+1] = SCTP_CID_ASCONF_ACK;
384 num_ext += 2; 375 num_ext += 2;
385 } 376 }
386 377
387 chunksize += sizeof(ext_param) + num_ext;
388 chunksize += sizeof(aiparam); 378 chunksize += sizeof(aiparam);
389 379
390 if (asoc->peer.auth_capable) { 380 if (asoc->peer.auth_capable) {
@@ -407,6 +397,9 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
407 num_ext += 1; 397 num_ext += 1;
408 } 398 }
409 399
400 if (num_ext)
401 chunksize += sizeof(sctp_supported_ext_param_t) + num_ext;
402
410 /* Now allocate and fill out the chunk. */ 403 /* Now allocate and fill out the chunk. */
411 retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize); 404 retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize);
412 if (!retval) 405 if (!retval)
@@ -428,7 +421,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
428 htons(sizeof(sctp_supported_ext_param_t) + num_ext); 421 htons(sizeof(sctp_supported_ext_param_t) + num_ext);
429 sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t), 422 sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t),
430 &ext_param); 423 &ext_param);
431 sctp_addto_chunk(retval, num_ext, extensions); 424 sctp_addto_param(retval, num_ext, extensions);
432 } 425 }
433 if (asoc->peer.prsctp_capable) 426 if (asoc->peer.prsctp_capable)
434 sctp_addto_chunk(retval, sizeof(prsctp_param), &prsctp_param); 427 sctp_addto_chunk(retval, sizeof(prsctp_param), &prsctp_param);
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index b8bbb960723c..5fb84778846d 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -959,7 +959,7 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
959{ 959{
960 struct sctp_transport *transport = (struct sctp_transport *) arg; 960 struct sctp_transport *transport = (struct sctp_transport *) arg;
961 961
962 if (asoc->overall_error_count >= asoc->max_retrans) { 962 if (asoc->overall_error_count > asoc->max_retrans) {
963 sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, 963 sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
964 SCTP_ERROR(ETIMEDOUT)); 964 SCTP_ERROR(ETIMEDOUT));
965 /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ 965 /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index e835da8fc091..060bba4567d2 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1637,8 +1637,15 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock,
1637 mutex_lock(&u->readlock); 1637 mutex_lock(&u->readlock);
1638 1638
1639 skb = skb_recv_datagram(sk, flags, noblock, &err); 1639 skb = skb_recv_datagram(sk, flags, noblock, &err);
1640 if (!skb) 1640 if (!skb) {
1641 unix_state_lock(sk);
1642 /* Signal EOF on disconnected non-blocking SEQPACKET socket. */
1643 if (sk->sk_type == SOCK_SEQPACKET && err == -EAGAIN &&
1644 (sk->sk_shutdown & RCV_SHUTDOWN))
1645 err = 0;
1646 unix_state_unlock(sk);
1641 goto out_unlock; 1647 goto out_unlock;
1648 }
1642 1649
1643 wake_up_interruptible_sync(&u->peer_wait); 1650 wake_up_interruptible_sync(&u->peer_wait);
1644 1651
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b702bd8a3893..9a4cf2e45a15 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1344,6 +1344,7 @@ restart:
1344 xfrm_nr += pols[0]->xfrm_nr; 1344 xfrm_nr += pols[0]->xfrm_nr;
1345 1345
1346 switch (policy->action) { 1346 switch (policy->action) {
1347 default:
1347 case XFRM_POLICY_BLOCK: 1348 case XFRM_POLICY_BLOCK:
1348 /* Prohibit the flow */ 1349 /* Prohibit the flow */
1349 err = -EPERM; 1350 err = -EPERM;