aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-02-11 18:02:04 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-02-11 18:02:04 -0500
commit1cb9d721d9df9182a42d1ff59427a100c6522efc (patch)
tree3c7d47828f89853de49e979f97ffe78fd1dba7d6
parentca7d5e42d783e54f0057317c9226262d68ab7717 (diff)
parentbef4a456b8dc8b3638f4d49a25a89e1467da9483 (diff)
Merge branch 'upstream'
-rw-r--r--Documentation/powerpc/booting-without-of.txt60
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c29
-rw-r--r--arch/arm/mach-s3c2410/s3c2400.h31
-rw-r--r--arch/i386/kernel/smpboot.c4
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c2
-rw-r--r--arch/ia64/ia32/ia32_signal.c1
-rw-r--r--arch/ia64/kernel/entry.S16
-rw-r--r--arch/ia64/kernel/fsys.S29
-rw-r--r--arch/ia64/kernel/mca_drv.c3
-rw-r--r--arch/ia64/sn/kernel/io_init.c8
-rw-r--r--arch/ia64/sn/kernel/irq.c4
-rw-r--r--arch/powerpc/Kconfig6
-rw-r--r--arch/powerpc/Makefile3
-rw-r--r--arch/powerpc/kernel/Makefile6
-rw-r--r--arch/powerpc/kernel/systbl.S3
-rw-r--r--arch/ppc/kernel/misc.S283
-rw-r--r--arch/s390/kernel/compat_signal.c3
-rw-r--r--arch/sparc64/kernel/systbls.S2
-rw-r--r--drivers/char/tty_io.c30
-rw-r--r--drivers/net/wireless/Kconfig2
-rw-r--r--drivers/scsi/ahci.c53
-rw-r--r--drivers/scsi/libata-core.c120
-rw-r--r--drivers/scsi/libata-scsi.c14
-rw-r--r--drivers/scsi/libata.h1
-rw-r--r--drivers/scsi/sata_mv.c50
-rw-r--r--drivers/scsi/sata_qstor.c4
-rw-r--r--drivers/scsi/sata_sil.c9
-rw-r--r--drivers/scsi/sata_sil24.c61
-rw-r--r--drivers/scsi/sata_sx4.c2
-rw-r--r--drivers/serial/ioc4_serial.c14
-rw-r--r--include/asm-arm/arch-s3c2410/h1940-latch.h64
-rw-r--r--include/asm-ia64/unistd.h17
-rw-r--r--include/asm-powerpc/unistd.h3
-rw-r--r--include/linux/cpumask.h2
-rw-r--r--include/linux/kbd_kern.h4
-rw-r--r--include/linux/kexec.h1
-rw-r--r--include/linux/libata.h30
-rw-r--r--include/linux/netlink.h3
-rw-r--r--include/linux/sched.h2
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/tty_flip.h4
-rw-r--r--include/net/irda/irlap.h3
-rw-r--r--init/initramfs.c24
-rw-r--r--init/main.c1
-rw-r--r--ipc/mqueue.c3
-rw-r--r--ipc/shm.c1
-rw-r--r--kernel/panic.c1
-rw-r--r--kernel/sched.c129
-rw-r--r--kernel/signal.c9
-rw-r--r--mm/slab.c10
-rw-r--r--mm/vmscan.c25
-rw-r--r--net/bridge/br_if.c94
-rw-r--r--net/bridge/br_input.c19
-rw-r--r--net/bridge/br_netfilter.c53
-rw-r--r--net/bridge/br_private.h6
-rw-r--r--net/bridge/br_stp_bpdu.c30
-rw-r--r--net/bridge/br_sysfs_if.c50
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/fib_semantics.c2
-rw-r--r--net/ipv4/tcp_input.c3
-rw-r--r--net/irda/irda_device.c4
-rw-r--r--net/irda/irnet/irnet_irda.c2
-rw-r--r--net/netlink/af_netlink.c7
-rw-r--r--scripts/kconfig/Makefile12
65 files changed, 689 insertions, 788 deletions
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index 54e5f9b1536d..d02c64953dcd 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -44,7 +44,6 @@
44 compiler and the textural representation of 44 compiler and the textural representation of
45 the tree that can be "compiled" by dtc. 45 the tree that can be "compiled" by dtc.
46 46
47
48 November 21, 2005: Rev 0.5 47 November 21, 2005: Rev 0.5
49 - Additions/generalizations for 32-bit 48 - Additions/generalizations for 32-bit
50 - Changed to reflect the new arch/powerpc 49 - Changed to reflect the new arch/powerpc
@@ -1307,6 +1306,65 @@ platforms are moved over to use the flattened-device-tree model.
1307 }; 1306 };
1308 1307
1309 1308
1309 f) Freescale SOC USB controllers
1310
1311 The device node for a USB controller that is part of a Freescale
1312 SOC is as described in the document "Open Firmware Recommended
1313 Practice : Universal Serial Bus" with the following modifications
1314 and additions :
1315
1316 Required properties :
1317 - compatible : Should be "fsl-usb2-mph" for multi port host usb
1318 controllers, or "fsl-usb2-dr" for dual role usb controllers
1319 - phy_type : For multi port host usb controllers, should be one of
1320 "ulpi", or "serial". For dual role usb controllers, should be
1321 one of "ulpi", "utmi", "utmi_wide", or "serial".
1322 - reg : Offset and length of the register set for the device
1323 - port0 : boolean; if defined, indicates port0 is connected for
1324 fsl-usb2-mph compatible controllers. Either this property or
1325 "port1" (or both) must be defined for "fsl-usb2-mph" compatible
1326 controllers.
1327 - port1 : boolean; if defined, indicates port1 is connected for
1328 fsl-usb2-mph compatible controllers. Either this property or
1329 "port0" (or both) must be defined for "fsl-usb2-mph" compatible
1330 controllers.
1331
1332 Recommended properties :
1333 - interrupts : <a b> where a is the interrupt number and b is a
1334 field that represents an encoding of the sense and level
1335 information for the interrupt. This should be encoded based on
1336 the information in section 2) depending on the type of interrupt
1337 controller you have.
1338 - interrupt-parent : the phandle for the interrupt controller that
1339 services interrupts for this device.
1340
1341 Example multi port host usb controller device node :
1342 usb@22000 {
1343 device_type = "usb";
1344 compatible = "fsl-usb2-mph";
1345 reg = <22000 1000>;
1346 #address-cells = <1>;
1347 #size-cells = <0>;
1348 interrupt-parent = <700>;
1349 interrupts = <27 1>;
1350 phy_type = "ulpi";
1351 port0;
1352 port1;
1353 };
1354
1355 Example dual role usb controller device node :
1356 usb@23000 {
1357 device_type = "usb";
1358 compatible = "fsl-usb2-dr";
1359 reg = <23000 1000>;
1360 #address-cells = <1>;
1361 #size-cells = <0>;
1362 interrupt-parent = <700>;
1363 interrupts = <26 1>;
1364 phy = "ulpi";
1365 };
1366
1367
1310 More devices will be defined as this spec matures. 1368 More devices will be defined as this spec matures.
1311 1369
1312 1370
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 1c316f14ed94..646a3a5d33a5 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -46,10 +46,11 @@
46#include <asm/irq.h> 46#include <asm/irq.h>
47#include <asm/mach-types.h> 47#include <asm/mach-types.h>
48 48
49//#include <asm/debug-ll.h> 49
50#include <asm/arch/regs-serial.h> 50#include <asm/arch/regs-serial.h>
51#include <asm/arch/regs-lcd.h> 51#include <asm/arch/regs-lcd.h>
52 52
53#include <asm/arch/h1940-latch.h>
53#include <asm/arch/fb.h> 54#include <asm/arch/fb.h>
54 55
55#include <linux/serial_core.h> 56#include <linux/serial_core.h>
@@ -59,7 +60,12 @@
59#include "cpu.h" 60#include "cpu.h"
60 61
61static struct map_desc h1940_iodesc[] __initdata = { 62static struct map_desc h1940_iodesc[] __initdata = {
62 /* nothing here yet */ 63 [0] = {
64 .virtual = (unsigned long)H1940_LATCH,
65 .pfn = __phys_to_pfn(H1940_PA_LATCH),
66 .length = SZ_16K,
67 .type = MT_DEVICE
68 },
63}; 69};
64 70
65#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK 71#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
@@ -92,6 +98,25 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] = {
92 } 98 }
93}; 99};
94 100
101/* Board control latch control */
102
103static unsigned int latch_state = H1940_LATCH_DEFAULT;
104
105void h1940_latch_control(unsigned int clear, unsigned int set)
106{
107 unsigned long flags;
108
109 local_irq_save(flags);
110
111 latch_state &= ~clear;
112 latch_state |= set;
113
114 __raw_writel(latch_state, H1940_LATCH);
115
116 local_irq_restore(flags);
117}
118
119EXPORT_SYMBOL_GPL(h1940_latch_control);
95 120
96 121
97/** 122/**
diff --git a/arch/arm/mach-s3c2410/s3c2400.h b/arch/arm/mach-s3c2410/s3c2400.h
new file mode 100644
index 000000000000..8b2394e1ed40
--- /dev/null
+++ b/arch/arm/mach-s3c2410/s3c2400.h
@@ -0,0 +1,31 @@
1/* arch/arm/mach-s3c2410/s3c2400.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C2400 cpu support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Modifications:
13 * 09-Fev-2006 LCVR First version, based on s3c2410.h
14*/
15
16#ifdef CONFIG_CPU_S3C2400
17
18extern int s3c2400_init(void);
19
20extern void s3c2400_map_io(struct map_desc *mach_desc, int size);
21
22extern void s3c2400_init_uarts(struct s3c2410_uartcfg *cfg, int no);
23
24extern void s3c2400_init_clocks(int xtal);
25
26#else
27#define s3c2400_init_clocks NULL
28#define s3c2400_init_uarts NULL
29#define s3c2400_map_io NULL
30#define s3c2400_init NULL
31#endif
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 255adb498268..fb00ab7b7612 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -87,11 +87,7 @@ EXPORT_SYMBOL(cpu_online_map);
87cpumask_t cpu_callin_map; 87cpumask_t cpu_callin_map;
88cpumask_t cpu_callout_map; 88cpumask_t cpu_callout_map;
89EXPORT_SYMBOL(cpu_callout_map); 89EXPORT_SYMBOL(cpu_callout_map);
90#ifdef CONFIG_HOTPLUG_CPU
91cpumask_t cpu_possible_map = CPU_MASK_ALL;
92#else
93cpumask_t cpu_possible_map; 90cpumask_t cpu_possible_map;
94#endif
95EXPORT_SYMBOL(cpu_possible_map); 91EXPORT_SYMBOL(cpu_possible_map);
96static cpumask_t smp_commenced_mask; 92static cpumask_t smp_commenced_mask;
97 93
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 72a1b9cae2e4..6e4c3baef6cc 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -240,7 +240,7 @@ static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
240cpumask_t cpu_callin_map = CPU_MASK_NONE; 240cpumask_t cpu_callin_map = CPU_MASK_NONE;
241cpumask_t cpu_callout_map = CPU_MASK_NONE; 241cpumask_t cpu_callout_map = CPU_MASK_NONE;
242EXPORT_SYMBOL(cpu_callout_map); 242EXPORT_SYMBOL(cpu_callout_map);
243cpumask_t cpu_possible_map = CPU_MASK_ALL; 243cpumask_t cpu_possible_map = CPU_MASK_NONE;
244EXPORT_SYMBOL(cpu_possible_map); 244EXPORT_SYMBOL(cpu_possible_map);
245 245
246/* The per processor IRQ masks (these are usually kept in sync) */ 246/* The per processor IRQ masks (these are usually kept in sync) */
diff --git a/arch/ia64/ia32/ia32_signal.c b/arch/ia64/ia32/ia32_signal.c
index 5856510210fa..b3355a9ca2c3 100644
--- a/arch/ia64/ia32/ia32_signal.c
+++ b/arch/ia64/ia32/ia32_signal.c
@@ -515,6 +515,7 @@ sys32_signal (int sig, unsigned int handler)
515 515
516 sigact_set_handler(&new_sa, handler, 0); 516 sigact_set_handler(&new_sa, handler, 0);
517 new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK; 517 new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK;
518 sigemptyset(&new_sa.sa.sa_mask);
518 519
519 ret = do_sigaction(sig, &new_sa, &old_sa); 520 ret = do_sigaction(sig, &new_sa, &old_sa);
520 521
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 7a6ffd613789..27b222c277e4 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1601,5 +1601,21 @@ sys_call_table:
1601 data8 sys_inotify_add_watch 1601 data8 sys_inotify_add_watch
1602 data8 sys_inotify_rm_watch 1602 data8 sys_inotify_rm_watch
1603 data8 sys_migrate_pages // 1280 1603 data8 sys_migrate_pages // 1280
1604 data8 sys_openat
1605 data8 sys_mkdirat
1606 data8 sys_mknodat
1607 data8 sys_fchownat
1608 data8 sys_futimesat // 1285
1609 data8 sys_newfstatat
1610 data8 sys_unlinkat
1611 data8 sys_renameat
1612 data8 sys_linkat
1613 data8 sys_symlinkat // 1290
1614 data8 sys_readlinkat
1615 data8 sys_fchmodat
1616 data8 sys_faccessat
1617 data8 sys_ni_syscall // reserved for pselect
1618 data8 sys_ni_syscall // 1295 reserved for ppoll
1619 data8 sys_unshare
1604 1620
1605 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1621 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index ce423910ca97..ac6055c83115 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -878,31 +878,8 @@ fsyscall_table:
878 data8 0 // timer_delete 878 data8 0 // timer_delete
879 data8 0 // clock_settime 879 data8 0 // clock_settime
880 data8 fsys_clock_gettime // clock_gettime 880 data8 fsys_clock_gettime // clock_gettime
881 data8 0 // clock_getres // 1255 881 #define __NR_syscall_last 1255
882 data8 0 // clock_nanosleep 882
883 data8 0 // fstatfs64 883 .space 8*(NR_syscalls + 1024 - __NR_syscall_last), 0
884 data8 0 // statfs64
885 data8 0
886 data8 0 // 1260
887 data8 0
888 data8 0 // mq_open
889 data8 0 // mq_unlink
890 data8 0 // mq_timedsend
891 data8 0 // mq_timedreceive // 1265
892 data8 0 // mq_notify
893 data8 0 // mq_getsetattr
894 data8 0 // kexec_load
895 data8 0
896 data8 0 // 1270
897 data8 0
898 data8 0
899 data8 0
900 data8 0
901 data8 0 // 1275
902 data8 0
903 data8 0
904 data8 0
905 data8 0
906 data8 0 // 1280
907 884
908 .org fsyscall_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 885 .org fsyscall_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index 3492e3211a44..8fd93afa75a7 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -437,6 +437,9 @@ recover_from_read_error(slidx_table_t *slidx,
437 * the process not have any locks of kernel. 437 * the process not have any locks of kernel.
438 */ 438 */
439 439
440 /* Is minstate valid? */
441 if (!peidx_bottom(peidx) || !(peidx_bottom(peidx)->valid.minstate))
442 return 0;
440 psr1 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_ipsr); 443 psr1 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_ipsr);
441 444
442 /* 445 /*
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index d7e4d79e16a8..3437c2390429 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -617,15 +617,15 @@ void sn_bus_store_sysdata(struct pci_dev *dev)
617void sn_bus_free_sysdata(void) 617void sn_bus_free_sysdata(void)
618{ 618{
619 struct sysdata_el *element; 619 struct sysdata_el *element;
620 struct list_head *list; 620 struct list_head *list, *safe;
621 621
622sn_sysdata_free_start: 622 list_for_each_safe(list, safe, &sn_sysdata_list) {
623 list_for_each(list, &sn_sysdata_list) {
624 element = list_entry(list, struct sysdata_el, entry); 623 element = list_entry(list, struct sysdata_el, entry);
625 list_del(&element->entry); 624 list_del(&element->entry);
625 list_del(&(((struct pcidev_info *)
626 (element->sysdata))->pdi_list));
626 kfree(element->sysdata); 627 kfree(element->sysdata);
627 kfree(element); 628 kfree(element);
628 goto sn_sysdata_free_start;
629 } 629 }
630 return; 630 return;
631} 631}
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 74d87d903d5d..c373113d073a 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -299,7 +299,9 @@ void sn_irq_unfixup(struct pci_dev *pci_dev)
299 return; 299 return;
300 300
301 sn_irq_info = SN_PCIDEV_INFO(pci_dev)->pdi_sn_irq_info; 301 sn_irq_info = SN_PCIDEV_INFO(pci_dev)->pdi_sn_irq_info;
302 if (!sn_irq_info || !sn_irq_info->irq_irq) { 302 if (!sn_irq_info)
303 return;
304 if (!sn_irq_info->irq_irq) {
303 kfree(sn_irq_info); 305 kfree(sn_irq_info);
304 return; 306 return;
305 } 307 }
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index df338c5cc910..80d114a3a837 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -83,6 +83,12 @@ config GENERIC_TBSYNC
83 default y if PPC32 && SMP 83 default y if PPC32 && SMP
84 default n 84 default n
85 85
86config DEFAULT_UIMAGE
87 bool
88 help
89 Used to allow a board to specify it wants a uImage built by default
90 default n
91
86menu "Processor support" 92menu "Processor support"
87choice 93choice
88 prompt "Processor Type" 94 prompt "Processor Type"
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 44dd82b791d1..5500ab55d042 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -142,6 +142,7 @@ drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
142# Default to zImage, override when needed 142# Default to zImage, override when needed
143defaultimage-y := zImage 143defaultimage-y := zImage
144defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux 144defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
145defaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage
145KBUILD_IMAGE := $(defaultimage-y) 146KBUILD_IMAGE := $(defaultimage-y)
146all: $(KBUILD_IMAGE) 147all: $(KBUILD_IMAGE)
147 148
@@ -167,6 +168,8 @@ endef
167 168
168archclean: 169archclean:
169 $(Q)$(MAKE) $(clean)=$(boot) 170 $(Q)$(MAKE) $(clean)=$(boot)
171
172archmrproper:
170 $(Q)rm -rf arch/$(ARCH)/include 173 $(Q)rm -rf arch/$(ARCH)/include
171 174
172archprepare: checkbin 175archprepare: checkbin
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index c287980b7e65..80e9fe2632b8 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -12,10 +12,10 @@ endif
12 12
13obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ 13obj-y := semaphore.o cputable.o ptrace.o syscalls.o \
14 irq.o align.o signal_32.o pmc.o vdso.o \ 14 irq.o align.o signal_32.o pmc.o vdso.o \
15 init_task.o process.o 15 init_task.o process.o systbl.o
16obj-y += vdso32/ 16obj-y += vdso32/
17obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ 17obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \
18 signal_64.o ptrace32.o systbl.o \ 18 signal_64.o ptrace32.o \
19 paca.o cpu_setup_power4.o \ 19 paca.o cpu_setup_power4.o \
20 firmware.o sysfs.o idle_64.o 20 firmware.o sysfs.o idle_64.o
21obj-$(CONFIG_PPC64) += vdso64/ 21obj-$(CONFIG_PPC64) += vdso64/
@@ -46,7 +46,7 @@ extra-$(CONFIG_8xx) := head_8xx.o
46extra-y += vmlinux.lds 46extra-y += vmlinux.lds
47 47
48obj-y += time.o prom.o traps.o setup-common.o udbg.o 48obj-y += time.o prom.o traps.o setup-common.o udbg.o
49obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o systbl.o 49obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o
50obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o 50obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o
51obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o 51obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
52obj-$(CONFIG_MODULES) += ppc_ksyms.o 52obj-$(CONFIG_MODULES) += ppc_ksyms.o
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S
index 007b15ee36d2..8a9f994ed917 100644
--- a/arch/powerpc/kernel/systbl.S
+++ b/arch/powerpc/kernel/systbl.S
@@ -36,8 +36,6 @@
36#ifdef CONFIG_PPC64 36#ifdef CONFIG_PPC64
37#define sys_sigpending sys_ni_syscall 37#define sys_sigpending sys_ni_syscall
38#define sys_old_getrlimit sys_ni_syscall 38#define sys_old_getrlimit sys_ni_syscall
39#else
40#define ppc_rtas sys_ni_syscall
41#endif 39#endif
42 40
43_GLOBAL(sys_call_table) 41_GLOBAL(sys_call_table)
@@ -323,3 +321,4 @@ SYSCALL(spu_run)
323SYSCALL(spu_create) 321SYSCALL(spu_create)
324COMPAT_SYS(pselect6) 322COMPAT_SYS(pselect6)
325COMPAT_SYS(ppoll) 323COMPAT_SYS(ppoll)
324SYSCALL(unshare)
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index c3427eed8345..5a936566fd61 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -1048,286 +1048,3 @@ _GLOBAL(name) \
1048 blr 1048 blr
1049 1049
1050SYSCALL(execve) 1050SYSCALL(execve)
1051
1052/* Why isn't this a) automatic, b) written in 'C'? */
1053 .data
1054 .align 4
1055_GLOBAL(sys_call_table)
1056 .long sys_restart_syscall /* 0 */
1057 .long sys_exit
1058 .long ppc_fork
1059 .long sys_read
1060 .long sys_write
1061 .long sys_open /* 5 */
1062 .long sys_close
1063 .long sys_waitpid
1064 .long sys_creat
1065 .long sys_link
1066 .long sys_unlink /* 10 */
1067 .long sys_execve
1068 .long sys_chdir
1069 .long sys_time
1070 .long sys_mknod
1071 .long sys_chmod /* 15 */
1072 .long sys_lchown
1073 .long sys_ni_syscall /* old break syscall holder */
1074 .long sys_stat
1075 .long sys_lseek
1076 .long sys_getpid /* 20 */
1077 .long sys_mount
1078 .long sys_oldumount
1079 .long sys_setuid
1080 .long sys_getuid
1081 .long sys_stime /* 25 */
1082 .long sys_ptrace
1083 .long sys_alarm
1084 .long sys_fstat
1085 .long sys_pause
1086 .long sys_utime /* 30 */
1087 .long sys_ni_syscall /* old stty syscall holder */
1088 .long sys_ni_syscall /* old gtty syscall holder */
1089 .long sys_access
1090 .long sys_nice
1091 .long sys_ni_syscall /* 35 */ /* old ftime syscall holder */
1092 .long sys_sync
1093 .long sys_kill
1094 .long sys_rename
1095 .long sys_mkdir
1096 .long sys_rmdir /* 40 */
1097 .long sys_dup
1098 .long sys_pipe
1099 .long sys_times
1100 .long sys_ni_syscall /* old prof syscall holder */
1101 .long sys_brk /* 45 */
1102 .long sys_setgid
1103 .long sys_getgid
1104 .long sys_signal
1105 .long sys_geteuid
1106 .long sys_getegid /* 50 */
1107 .long sys_acct
1108 .long sys_umount /* recycled never used phys() */
1109 .long sys_ni_syscall /* old lock syscall holder */
1110 .long sys_ioctl
1111 .long sys_fcntl /* 55 */
1112 .long sys_ni_syscall /* old mpx syscall holder */
1113 .long sys_setpgid
1114 .long sys_ni_syscall /* old ulimit syscall holder */
1115 .long sys_olduname
1116 .long sys_umask /* 60 */
1117 .long sys_chroot
1118 .long sys_ustat
1119 .long sys_dup2
1120 .long sys_getppid
1121 .long sys_getpgrp /* 65 */
1122 .long sys_setsid
1123 .long sys_sigaction
1124 .long sys_sgetmask
1125 .long sys_ssetmask
1126 .long sys_setreuid /* 70 */
1127 .long sys_setregid
1128 .long sys_sigsuspend
1129 .long sys_sigpending
1130 .long sys_sethostname
1131 .long sys_setrlimit /* 75 */
1132 .long sys_old_getrlimit
1133 .long sys_getrusage
1134 .long sys_gettimeofday
1135 .long sys_settimeofday
1136 .long sys_getgroups /* 80 */
1137 .long sys_setgroups
1138 .long ppc_select
1139 .long sys_symlink
1140 .long sys_lstat
1141 .long sys_readlink /* 85 */
1142 .long sys_uselib
1143 .long sys_swapon
1144 .long sys_reboot
1145 .long old_readdir
1146 .long sys_mmap /* 90 */
1147 .long sys_munmap
1148 .long sys_truncate
1149 .long sys_ftruncate
1150 .long sys_fchmod
1151 .long sys_fchown /* 95 */
1152 .long sys_getpriority
1153 .long sys_setpriority
1154 .long sys_ni_syscall /* old profil syscall holder */
1155 .long sys_statfs
1156 .long sys_fstatfs /* 100 */
1157 .long sys_ni_syscall
1158 .long sys_socketcall
1159 .long sys_syslog
1160 .long sys_setitimer
1161 .long sys_getitimer /* 105 */
1162 .long sys_newstat
1163 .long sys_newlstat
1164 .long sys_newfstat
1165 .long sys_uname
1166 .long sys_ni_syscall /* 110 */
1167 .long sys_vhangup
1168 .long sys_ni_syscall /* old 'idle' syscall */
1169 .long sys_ni_syscall
1170 .long sys_wait4
1171 .long sys_swapoff /* 115 */
1172 .long sys_sysinfo
1173 .long sys_ipc
1174 .long sys_fsync
1175 .long sys_sigreturn
1176 .long ppc_clone /* 120 */
1177 .long sys_setdomainname
1178 .long sys_newuname
1179 .long sys_ni_syscall
1180 .long sys_adjtimex
1181 .long sys_mprotect /* 125 */
1182 .long sys_sigprocmask
1183 .long sys_ni_syscall /* old sys_create_module */
1184 .long sys_init_module
1185 .long sys_delete_module
1186 .long sys_ni_syscall /* old sys_get_kernel_syms */ /* 130 */
1187 .long sys_quotactl
1188 .long sys_getpgid
1189 .long sys_fchdir
1190 .long sys_bdflush
1191 .long sys_sysfs /* 135 */
1192 .long sys_personality
1193 .long sys_ni_syscall /* for afs_syscall */
1194 .long sys_setfsuid
1195 .long sys_setfsgid
1196 .long sys_llseek /* 140 */
1197 .long sys_getdents
1198 .long ppc_select
1199 .long sys_flock
1200 .long sys_msync
1201 .long sys_readv /* 145 */
1202 .long sys_writev
1203 .long sys_getsid
1204 .long sys_fdatasync
1205 .long sys_sysctl
1206 .long sys_mlock /* 150 */
1207 .long sys_munlock
1208 .long sys_mlockall
1209 .long sys_munlockall
1210 .long sys_sched_setparam
1211 .long sys_sched_getparam /* 155 */
1212 .long sys_sched_setscheduler
1213 .long sys_sched_getscheduler
1214 .long sys_sched_yield
1215 .long sys_sched_get_priority_max
1216 .long sys_sched_get_priority_min /* 160 */
1217 .long sys_sched_rr_get_interval
1218 .long sys_nanosleep
1219 .long sys_mremap
1220 .long sys_setresuid
1221 .long sys_getresuid /* 165 */
1222 .long sys_ni_syscall /* old sys_query_module */
1223 .long sys_poll
1224 .long sys_nfsservctl
1225 .long sys_setresgid
1226 .long sys_getresgid /* 170 */
1227 .long sys_prctl
1228 .long sys_rt_sigreturn
1229 .long sys_rt_sigaction
1230 .long sys_rt_sigprocmask
1231 .long sys_rt_sigpending /* 175 */
1232 .long sys_rt_sigtimedwait
1233 .long sys_rt_sigqueueinfo
1234 .long sys_rt_sigsuspend
1235 .long sys_pread64
1236 .long sys_pwrite64 /* 180 */
1237 .long sys_chown
1238 .long sys_getcwd
1239 .long sys_capget
1240 .long sys_capset
1241 .long sys_sigaltstack /* 185 */
1242 .long sys_sendfile
1243 .long sys_ni_syscall /* streams1 */
1244 .long sys_ni_syscall /* streams2 */
1245 .long ppc_vfork
1246 .long sys_getrlimit /* 190 */
1247 .long sys_readahead
1248 .long sys_mmap2
1249 .long sys_truncate64
1250 .long sys_ftruncate64
1251 .long sys_stat64 /* 195 */
1252 .long sys_lstat64
1253 .long sys_fstat64
1254 .long sys_pciconfig_read
1255 .long sys_pciconfig_write
1256 .long sys_pciconfig_iobase /* 200 */
1257 .long sys_ni_syscall /* 201 - reserved - MacOnLinux - new */
1258 .long sys_getdents64
1259 .long sys_pivot_root
1260 .long sys_fcntl64
1261 .long sys_madvise /* 205 */
1262 .long sys_mincore
1263 .long sys_gettid
1264 .long sys_tkill
1265 .long sys_setxattr
1266 .long sys_lsetxattr /* 210 */
1267 .long sys_fsetxattr
1268 .long sys_getxattr
1269 .long sys_lgetxattr
1270 .long sys_fgetxattr
1271 .long sys_listxattr /* 215 */
1272 .long sys_llistxattr
1273 .long sys_flistxattr
1274 .long sys_removexattr
1275 .long sys_lremovexattr
1276 .long sys_fremovexattr /* 220 */
1277 .long sys_futex
1278 .long sys_sched_setaffinity
1279 .long sys_sched_getaffinity
1280 .long sys_ni_syscall
1281 .long sys_ni_syscall /* 225 - reserved for Tux */
1282 .long sys_sendfile64
1283 .long sys_io_setup
1284 .long sys_io_destroy
1285 .long sys_io_getevents
1286 .long sys_io_submit /* 230 */
1287 .long sys_io_cancel
1288 .long sys_set_tid_address
1289 .long sys_fadvise64
1290 .long sys_exit_group
1291 .long sys_lookup_dcookie /* 235 */
1292 .long sys_epoll_create
1293 .long sys_epoll_ctl
1294 .long sys_epoll_wait
1295 .long sys_remap_file_pages
1296 .long sys_timer_create /* 240 */
1297 .long sys_timer_settime
1298 .long sys_timer_gettime
1299 .long sys_timer_getoverrun
1300 .long sys_timer_delete
1301 .long sys_clock_settime /* 245 */
1302 .long sys_clock_gettime
1303 .long sys_clock_getres
1304 .long sys_clock_nanosleep
1305 .long sys_swapcontext
1306 .long sys_tgkill /* 250 */
1307 .long sys_utimes
1308 .long sys_statfs64
1309 .long sys_fstatfs64
1310 .long ppc_fadvise64_64
1311 .long sys_ni_syscall /* 255 - rtas (used on ppc64) */
1312 .long sys_debug_setcontext
1313 .long sys_ni_syscall /* 257 reserved for vserver */
1314 .long sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */
1315 .long sys_ni_syscall /* 259 reserved for new sys_mbind */
1316 .long sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */
1317 .long sys_ni_syscall /* 261 reserved for new sys_set_mempolicy */
1318 .long sys_mq_open
1319 .long sys_mq_unlink
1320 .long sys_mq_timedsend
1321 .long sys_mq_timedreceive /* 265 */
1322 .long sys_mq_notify
1323 .long sys_mq_getsetattr
1324 .long sys_kexec_load
1325 .long sys_add_key
1326 .long sys_request_key /* 270 */
1327 .long sys_keyctl
1328 .long sys_waitid
1329 .long sys_ioprio_set
1330 .long sys_ioprio_get
1331 .long sys_inotify_init /* 275 */
1332 .long sys_inotify_add_watch
1333 .long sys_inotify_rm_watch
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index ef706694a0c1..5291b5f8788d 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -195,9 +195,6 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
195 return ret; 195 return ret;
196} 196}
197 197
198int
199do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact);
200
201asmlinkage long 198asmlinkage long
202sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, 199sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
203 struct sigaction32 __user *oact, size_t sigsetsize) 200 struct sigaction32 __user *oact, size_t sigsetsize)
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index 5928b3c33e27..a19168510be2 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -146,7 +146,7 @@ sys_call_table:
146/*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 146/*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
147 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 147 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
148/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat 148/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, compat_sys_newfstatat 149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_newfstatat
150/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 150/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
152 152
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 076e07c1da38..a23816d3e9a1 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -268,6 +268,8 @@ static struct tty_buffer *tty_buffer_alloc(size_t size)
268 p->size = size; 268 p->size = size;
269 p->next = NULL; 269 p->next = NULL;
270 p->active = 0; 270 p->active = 0;
271 p->commit = 0;
272 p->read = 0;
271 p->char_buf_ptr = (char *)(p->data); 273 p->char_buf_ptr = (char *)(p->data);
272 p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size; 274 p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size;
273/* printk("Flip create %p\n", p); */ 275/* printk("Flip create %p\n", p); */
@@ -298,6 +300,8 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size)
298 *tbh = t->next; 300 *tbh = t->next;
299 t->next = NULL; 301 t->next = NULL;
300 t->used = 0; 302 t->used = 0;
303 t->commit = 0;
304 t->read = 0;
301 /* DEBUG ONLY */ 305 /* DEBUG ONLY */
302 memset(t->data, '*', size); 306 memset(t->data, '*', size);
303/* printk("Flip recycle %p\n", t); */ 307/* printk("Flip recycle %p\n", t); */
@@ -335,6 +339,7 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size)
335 if (b != NULL) { 339 if (b != NULL) {
336 b->next = n; 340 b->next = n;
337 b->active = 0; 341 b->active = 0;
342 b->commit = b->used;
338 } else 343 } else
339 tty->buf.head = n; 344 tty->buf.head = n;
340 tty->buf.tail = n; 345 tty->buf.tail = n;
@@ -2752,6 +2757,9 @@ static void flush_to_ldisc(void *private_)
2752 unsigned long flags; 2757 unsigned long flags;
2753 struct tty_ldisc *disc; 2758 struct tty_ldisc *disc;
2754 struct tty_buffer *tbuf; 2759 struct tty_buffer *tbuf;
2760 int count;
2761 char *char_buf;
2762 unsigned char *flag_buf;
2755 2763
2756 disc = tty_ldisc_ref(tty); 2764 disc = tty_ldisc_ref(tty);
2757 if (disc == NULL) /* !TTY_LDISC */ 2765 if (disc == NULL) /* !TTY_LDISC */
@@ -2765,16 +2773,20 @@ static void flush_to_ldisc(void *private_)
2765 goto out; 2773 goto out;
2766 } 2774 }
2767 spin_lock_irqsave(&tty->buf.lock, flags); 2775 spin_lock_irqsave(&tty->buf.lock, flags);
2768 while((tbuf = tty->buf.head) != NULL && !tbuf->active) { 2776 while((tbuf = tty->buf.head) != NULL) {
2777 while ((count = tbuf->commit - tbuf->read) != 0) {
2778 char_buf = tbuf->char_buf_ptr + tbuf->read;
2779 flag_buf = tbuf->flag_buf_ptr + tbuf->read;
2780 tbuf->read += count;
2781 spin_unlock_irqrestore(&tty->buf.lock, flags);
2782 disc->receive_buf(tty, char_buf, flag_buf, count);
2783 spin_lock_irqsave(&tty->buf.lock, flags);
2784 }
2785 if (tbuf->active)
2786 break;
2769 tty->buf.head = tbuf->next; 2787 tty->buf.head = tbuf->next;
2770 if (tty->buf.head == NULL) 2788 if (tty->buf.head == NULL)
2771 tty->buf.tail = NULL; 2789 tty->buf.tail = NULL;
2772 spin_unlock_irqrestore(&tty->buf.lock, flags);
2773 /* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */
2774 disc->receive_buf(tty, tbuf->char_buf_ptr,
2775 tbuf->flag_buf_ptr,
2776 tbuf->used);
2777 spin_lock_irqsave(&tty->buf.lock, flags);
2778 tty_buffer_free(tty, tbuf); 2790 tty_buffer_free(tty, tbuf);
2779 } 2791 }
2780 spin_unlock_irqrestore(&tty->buf.lock, flags); 2792 spin_unlock_irqrestore(&tty->buf.lock, flags);
@@ -2871,8 +2883,10 @@ void tty_flip_buffer_push(struct tty_struct *tty)
2871{ 2883{
2872 unsigned long flags; 2884 unsigned long flags;
2873 spin_lock_irqsave(&tty->buf.lock, flags); 2885 spin_lock_irqsave(&tty->buf.lock, flags);
2874 if (tty->buf.tail != NULL) 2886 if (tty->buf.tail != NULL) {
2875 tty->buf.tail->active = 0; 2887 tty->buf.tail->active = 0;
2888 tty->buf.tail->commit = tty->buf.tail->used;
2889 }
2876 spin_unlock_irqrestore(&tty->buf.lock, flags); 2890 spin_unlock_irqrestore(&tty->buf.lock, flags);
2877 2891
2878 if (tty->low_latency) 2892 if (tty->low_latency)
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 233a4f608084..ef85d76575a2 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -148,7 +148,7 @@ config IPW2100
148 In order to use this driver, you will need a firmware image for it. 148 In order to use this driver, you will need a firmware image for it.
149 You can obtain the firmware from 149 You can obtain the firmware from
150 <http://ipw2100.sf.net/>. Once you have the firmware image, you 150 <http://ipw2100.sf.net/>. Once you have the firmware image, you
151 will need to place it in /etc/firmware. 151 will need to place it in /lib/firmware.
152 152
153 You will also very likely need the Wireless Tools in order to 153 You will also very likely need the Wireless Tools in order to
154 configure your card: 154 configure your card:
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 98ce6bb62ff8..24a54a5a91b8 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -190,7 +190,7 @@ static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
190static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 190static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
191static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); 191static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc);
192static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 192static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
193static void ahci_phy_reset(struct ata_port *ap); 193static int ahci_probe_reset(struct ata_port *ap, unsigned int *classes);
194static void ahci_irq_clear(struct ata_port *ap); 194static void ahci_irq_clear(struct ata_port *ap);
195static void ahci_eng_timeout(struct ata_port *ap); 195static void ahci_eng_timeout(struct ata_port *ap);
196static int ahci_port_start(struct ata_port *ap); 196static int ahci_port_start(struct ata_port *ap);
@@ -230,7 +230,7 @@ static const struct ata_port_operations ahci_ops = {
230 230
231 .tf_read = ahci_tf_read, 231 .tf_read = ahci_tf_read,
232 232
233 .phy_reset = ahci_phy_reset, 233 .probe_reset = ahci_probe_reset,
234 234
235 .qc_prep = ahci_qc_prep, 235 .qc_prep = ahci_qc_prep,
236 .qc_issue = ahci_qc_issue, 236 .qc_issue = ahci_qc_issue,
@@ -252,8 +252,7 @@ static const struct ata_port_info ahci_port_info[] = {
252 { 252 {
253 .sht = &ahci_sht, 253 .sht = &ahci_sht,
254 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 254 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
255 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | 255 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA,
256 ATA_FLAG_PIO_DMA,
257 .pio_mask = 0x1f, /* pio0-4 */ 256 .pio_mask = 0x1f, /* pio0-4 */
258 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 257 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
259 .port_ops = &ahci_ops, 258 .port_ops = &ahci_ops,
@@ -507,37 +506,43 @@ static unsigned int ahci_dev_classify(struct ata_port *ap)
507 return ata_dev_classify(&tf); 506 return ata_dev_classify(&tf);
508} 507}
509 508
510static void ahci_fill_cmd_slot(struct ata_port *ap, u32 opts) 509static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, u32 opts)
511{ 510{
512 struct ahci_port_priv *pp = ap->private_data;
513 pp->cmd_slot[0].opts = cpu_to_le32(opts); 511 pp->cmd_slot[0].opts = cpu_to_le32(opts);
514 pp->cmd_slot[0].status = 0; 512 pp->cmd_slot[0].status = 0;
515 pp->cmd_slot[0].tbl_addr = cpu_to_le32(pp->cmd_tbl_dma & 0xffffffff); 513 pp->cmd_slot[0].tbl_addr = cpu_to_le32(pp->cmd_tbl_dma & 0xffffffff);
516 pp->cmd_slot[0].tbl_addr_hi = cpu_to_le32((pp->cmd_tbl_dma >> 16) >> 16); 514 pp->cmd_slot[0].tbl_addr_hi = cpu_to_le32((pp->cmd_tbl_dma >> 16) >> 16);
517} 515}
518 516
519static void ahci_phy_reset(struct ata_port *ap) 517static int ahci_hardreset(struct ata_port *ap, int verbose, unsigned int *class)
520{ 518{
521 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; 519 int rc;
522 struct ata_device *dev = &ap->device[0]; 520
523 u32 new_tmp, tmp; 521 DPRINTK("ENTER\n");
524 522
525 ahci_stop_engine(ap); 523 ahci_stop_engine(ap);
526 __sata_phy_reset(ap); 524 rc = sata_std_hardreset(ap, verbose, class);
527 ahci_start_engine(ap); 525 ahci_start_engine(ap);
528 526
529 if (ap->flags & ATA_FLAG_PORT_DISABLED) 527 if (rc == 0)
530 return; 528 *class = ahci_dev_classify(ap);
529 if (*class == ATA_DEV_UNKNOWN)
530 *class = ATA_DEV_NONE;
531 531
532 dev->class = ahci_dev_classify(ap); 532 DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
533 if (!ata_dev_present(dev)) { 533 return rc;
534 ata_port_disable(ap); 534}
535 return; 535
536 } 536static void ahci_postreset(struct ata_port *ap, unsigned int *class)
537{
538 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr;
539 u32 new_tmp, tmp;
540
541 ata_std_postreset(ap, class);
537 542
538 /* Make sure port's ATAPI bit is set appropriately */ 543 /* Make sure port's ATAPI bit is set appropriately */
539 new_tmp = tmp = readl(port_mmio + PORT_CMD); 544 new_tmp = tmp = readl(port_mmio + PORT_CMD);
540 if (dev->class == ATA_DEV_ATAPI) 545 if (*class == ATA_DEV_ATAPI)
541 new_tmp |= PORT_CMD_ATAPI; 546 new_tmp |= PORT_CMD_ATAPI;
542 else 547 else
543 new_tmp &= ~PORT_CMD_ATAPI; 548 new_tmp &= ~PORT_CMD_ATAPI;
@@ -547,6 +552,12 @@ static void ahci_phy_reset(struct ata_port *ap)
547 } 552 }
548} 553}
549 554
555static int ahci_probe_reset(struct ata_port *ap, unsigned int *classes)
556{
557 return ata_drive_probe_reset(ap, NULL, NULL, ahci_hardreset,
558 ahci_postreset, classes);
559}
560
550static u8 ahci_check_status(struct ata_port *ap) 561static u8 ahci_check_status(struct ata_port *ap)
551{ 562{
552 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; 563 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr;
@@ -622,7 +633,7 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
622 if (is_atapi) 633 if (is_atapi)
623 opts |= AHCI_CMD_ATAPI; 634 opts |= AHCI_CMD_ATAPI;
624 635
625 ahci_fill_cmd_slot(ap, opts); 636 ahci_fill_cmd_slot(pp, opts);
626} 637}
627 638
628static void ahci_restart_port(struct ata_port *ap, u32 irq_stat) 639static void ahci_restart_port(struct ata_port *ap, u32 irq_stat)
@@ -703,7 +714,7 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
703 ci = readl(port_mmio + PORT_CMD_ISSUE); 714 ci = readl(port_mmio + PORT_CMD_ISSUE);
704 if (likely((ci & 0x1) == 0)) { 715 if (likely((ci & 0x1) == 0)) {
705 if (qc) { 716 if (qc) {
706 assert(qc->err_mask == 0); 717 WARN_ON(qc->err_mask);
707 ata_qc_complete(qc); 718 ata_qc_complete(qc);
708 qc = NULL; 719 qc = NULL;
709 } 720 }
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 592d3a86c840..3fd55ef5410f 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -897,8 +897,8 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
897 897
898 DPRINTK("ENTER, host %u, dev %u\n", ap->id, device); 898 DPRINTK("ENTER, host %u, dev %u\n", ap->id, device);
899 899
900 assert (dev->class == ATA_DEV_ATA || dev->class == ATA_DEV_ATAPI || 900 WARN_ON(dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ATAPI &&
901 dev->class == ATA_DEV_NONE); 901 dev->class != ATA_DEV_NONE);
902 902
903 ata_dev_select(ap, device, 1, 1); /* select device 0/1 */ 903 ata_dev_select(ap, device, 1, 1); /* select device 0/1 */
904 904
@@ -1926,11 +1926,20 @@ static int sata_phy_resume(struct ata_port *ap)
1926 * 1926 *
1927 * @ap is about to be probed. Initialize it. This function is 1927 * @ap is about to be probed. Initialize it. This function is
1928 * to be used as standard callback for ata_drive_probe_reset(). 1928 * to be used as standard callback for ata_drive_probe_reset().
1929 *
1930 * NOTE!!! Do not use this function as probeinit if a low level
1931 * driver implements only hardreset. Just pass NULL as probeinit
1932 * in that case. Using this function is probably okay but doing
1933 * so makes reset sequence different from the original
1934 * ->phy_reset implementation and Jeff nervous. :-P
1929 */ 1935 */
1930extern void ata_std_probeinit(struct ata_port *ap) 1936extern void ata_std_probeinit(struct ata_port *ap)
1931{ 1937{
1932 if (ap->flags & ATA_FLAG_SATA && ap->ops->scr_read) 1938 if (ap->flags & ATA_FLAG_SATA && ap->ops->scr_read) {
1933 sata_phy_resume(ap); 1939 sata_phy_resume(ap);
1940 if (sata_dev_present(ap))
1941 ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT);
1942 }
1934} 1943}
1935 1944
1936/** 1945/**
@@ -1956,20 +1965,17 @@ int ata_std_softreset(struct ata_port *ap, int verbose, unsigned int *classes)
1956 1965
1957 DPRINTK("ENTER\n"); 1966 DPRINTK("ENTER\n");
1958 1967
1968 if (ap->ops->scr_read && !sata_dev_present(ap)) {
1969 classes[0] = ATA_DEV_NONE;
1970 goto out;
1971 }
1972
1959 /* determine if device 0/1 are present */ 1973 /* determine if device 0/1 are present */
1960 if (ata_devchk(ap, 0)) 1974 if (ata_devchk(ap, 0))
1961 devmask |= (1 << 0); 1975 devmask |= (1 << 0);
1962 if (slave_possible && ata_devchk(ap, 1)) 1976 if (slave_possible && ata_devchk(ap, 1))
1963 devmask |= (1 << 1); 1977 devmask |= (1 << 1);
1964 1978
1965 /* devchk reports device presence without actual device on
1966 * most SATA controllers. Check SStatus and turn devmask off
1967 * if link is offline. Note that we should continue resetting
1968 * even when it seems like there's no device.
1969 */
1970 if (ap->ops->scr_read && !sata_dev_present(ap))
1971 devmask = 0;
1972
1973 /* select device 0 again */ 1979 /* select device 0 again */
1974 ap->ops->dev_select(ap, 0); 1980 ap->ops->dev_select(ap, 0);
1975 1981
@@ -1991,6 +1997,7 @@ int ata_std_softreset(struct ata_port *ap, int verbose, unsigned int *classes)
1991 if (slave_possible && err != 0x81) 1997 if (slave_possible && err != 0x81)
1992 classes[1] = ata_dev_try_classify(ap, 1, &err); 1998 classes[1] = ata_dev_try_classify(ap, 1, &err);
1993 1999
2000 out:
1994 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]); 2001 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
1995 return 0; 2002 return 0;
1996} 2003}
@@ -2013,8 +2020,6 @@ int ata_std_softreset(struct ata_port *ap, int verbose, unsigned int *classes)
2013 */ 2020 */
2014int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class) 2021int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class)
2015{ 2022{
2016 u32 serror;
2017
2018 DPRINTK("ENTER\n"); 2023 DPRINTK("ENTER\n");
2019 2024
2020 /* Issue phy wake/reset */ 2025 /* Issue phy wake/reset */
@@ -2029,10 +2034,6 @@ int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class)
2029 /* Bring phy back */ 2034 /* Bring phy back */
2030 sata_phy_resume(ap); 2035 sata_phy_resume(ap);
2031 2036
2032 /* Clear SError */
2033 serror = scr_read(ap, SCR_ERROR);
2034 scr_write(ap, SCR_ERROR, serror);
2035
2036 /* TODO: phy layer with polling, timeouts, etc. */ 2037 /* TODO: phy layer with polling, timeouts, etc. */
2037 if (!sata_dev_present(ap)) { 2038 if (!sata_dev_present(ap)) {
2038 *class = ATA_DEV_NONE; 2039 *class = ATA_DEV_NONE;
@@ -2049,6 +2050,8 @@ int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class)
2049 return -EIO; 2050 return -EIO;
2050 } 2051 }
2051 2052
2053 ap->ops->dev_select(ap, 0); /* probably unnecessary */
2054
2052 *class = ata_dev_try_classify(ap, 0, NULL); 2055 *class = ata_dev_try_classify(ap, 0, NULL);
2053 2056
2054 DPRINTK("EXIT, class=%u\n", *class); 2057 DPRINTK("EXIT, class=%u\n", *class);
@@ -2083,11 +2086,9 @@ void ata_std_postreset(struct ata_port *ap, unsigned int *classes)
2083 if (ap->cbl == ATA_CBL_SATA) 2086 if (ap->cbl == ATA_CBL_SATA)
2084 sata_print_link_status(ap); 2087 sata_print_link_status(ap);
2085 2088
2086 /* bail out if no device is present */ 2089 /* re-enable interrupts */
2087 if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) { 2090 if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */
2088 DPRINTK("EXIT, no device\n"); 2091 ata_irq_on(ap);
2089 return;
2090 }
2091 2092
2092 /* is double-select really necessary? */ 2093 /* is double-select really necessary? */
2093 if (classes[0] != ATA_DEV_NONE) 2094 if (classes[0] != ATA_DEV_NONE)
@@ -2095,9 +2096,19 @@ void ata_std_postreset(struct ata_port *ap, unsigned int *classes)
2095 if (classes[1] != ATA_DEV_NONE) 2096 if (classes[1] != ATA_DEV_NONE)
2096 ap->ops->dev_select(ap, 0); 2097 ap->ops->dev_select(ap, 0);
2097 2098
2098 /* re-enable interrupts & set up device control */ 2099 /* bail out if no device is present */
2099 if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */ 2100 if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
2100 ata_irq_on(ap); 2101 DPRINTK("EXIT, no device\n");
2102 return;
2103 }
2104
2105 /* set up device control */
2106 if (ap->ioaddr.ctl_addr) {
2107 if (ap->flags & ATA_FLAG_MMIO)
2108 writeb(ap->ctl, (void __iomem *) ap->ioaddr.ctl_addr);
2109 else
2110 outb(ap->ctl, ap->ioaddr.ctl_addr);
2111 }
2101 2112
2102 DPRINTK("EXIT\n"); 2113 DPRINTK("EXIT\n");
2103} 2114}
@@ -2292,7 +2303,7 @@ static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift)
2292 master = &ap->device[0]; 2303 master = &ap->device[0];
2293 slave = &ap->device[1]; 2304 slave = &ap->device[1];
2294 2305
2295 assert (ata_dev_present(master) || ata_dev_present(slave)); 2306 WARN_ON(!ata_dev_present(master) && !ata_dev_present(slave));
2296 2307
2297 if (shift == ATA_SHIFT_UDMA) { 2308 if (shift == ATA_SHIFT_UDMA) {
2298 mask = ap->udma_mask; 2309 mask = ap->udma_mask;
@@ -2538,11 +2549,11 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
2538 int dir = qc->dma_dir; 2549 int dir = qc->dma_dir;
2539 void *pad_buf = NULL; 2550 void *pad_buf = NULL;
2540 2551
2541 assert(qc->flags & ATA_QCFLAG_DMAMAP); 2552 WARN_ON(!(qc->flags & ATA_QCFLAG_DMAMAP));
2542 assert(sg != NULL); 2553 WARN_ON(sg == NULL);
2543 2554
2544 if (qc->flags & ATA_QCFLAG_SINGLE) 2555 if (qc->flags & ATA_QCFLAG_SINGLE)
2545 assert(qc->n_elem == 1); 2556 WARN_ON(qc->n_elem != 1);
2546 2557
2547 VPRINTK("unmapping %u sg elements\n", qc->n_elem); 2558 VPRINTK("unmapping %u sg elements\n", qc->n_elem);
2548 2559
@@ -2597,8 +2608,8 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
2597 struct scatterlist *sg; 2608 struct scatterlist *sg;
2598 unsigned int idx; 2609 unsigned int idx;
2599 2610
2600 assert(qc->__sg != NULL); 2611 WARN_ON(qc->__sg == NULL);
2601 assert(qc->n_elem > 0); 2612 WARN_ON(qc->n_elem == 0);
2602 2613
2603 idx = 0; 2614 idx = 0;
2604 ata_for_each_sg(sg, qc) { 2615 ata_for_each_sg(sg, qc) {
@@ -2750,7 +2761,7 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
2750 void *pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ); 2761 void *pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ);
2751 struct scatterlist *psg = &qc->pad_sgent; 2762 struct scatterlist *psg = &qc->pad_sgent;
2752 2763
2753 assert(qc->dev->class == ATA_DEV_ATAPI); 2764 WARN_ON(qc->dev->class != ATA_DEV_ATAPI);
2754 2765
2755 memset(pad_buf, 0, ATA_DMA_PAD_SZ); 2766 memset(pad_buf, 0, ATA_DMA_PAD_SZ);
2756 2767
@@ -2812,7 +2823,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
2812 int n_elem, pre_n_elem, dir, trim_sg = 0; 2823 int n_elem, pre_n_elem, dir, trim_sg = 0;
2813 2824
2814 VPRINTK("ENTER, ata%u\n", ap->id); 2825 VPRINTK("ENTER, ata%u\n", ap->id);
2815 assert(qc->flags & ATA_QCFLAG_SG); 2826 WARN_ON(!(qc->flags & ATA_QCFLAG_SG));
2816 2827
2817 /* we must lengthen transfers to end on a 32-bit boundary */ 2828 /* we must lengthen transfers to end on a 32-bit boundary */
2818 qc->pad_len = lsg->length & 3; 2829 qc->pad_len = lsg->length & 3;
@@ -2821,7 +2832,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
2821 struct scatterlist *psg = &qc->pad_sgent; 2832 struct scatterlist *psg = &qc->pad_sgent;
2822 unsigned int offset; 2833 unsigned int offset;
2823 2834
2824 assert(qc->dev->class == ATA_DEV_ATAPI); 2835 WARN_ON(qc->dev->class != ATA_DEV_ATAPI);
2825 2836
2826 memset(pad_buf, 0, ATA_DMA_PAD_SZ); 2837 memset(pad_buf, 0, ATA_DMA_PAD_SZ);
2827 2838
@@ -2914,7 +2925,7 @@ static unsigned long ata_pio_poll(struct ata_port *ap)
2914 unsigned int reg_state = HSM_ST_UNKNOWN; 2925 unsigned int reg_state = HSM_ST_UNKNOWN;
2915 2926
2916 qc = ata_qc_from_tag(ap, ap->active_tag); 2927 qc = ata_qc_from_tag(ap, ap->active_tag);
2917 assert(qc != NULL); 2928 WARN_ON(qc == NULL);
2918 2929
2919 switch (ap->hsm_task_state) { 2930 switch (ap->hsm_task_state) {
2920 case HSM_ST: 2931 case HSM_ST:
@@ -2983,7 +2994,7 @@ static int ata_pio_complete (struct ata_port *ap)
2983 } 2994 }
2984 2995
2985 qc = ata_qc_from_tag(ap, ap->active_tag); 2996 qc = ata_qc_from_tag(ap, ap->active_tag);
2986 assert(qc != NULL); 2997 WARN_ON(qc == NULL);
2987 2998
2988 drv_stat = ata_wait_idle(ap); 2999 drv_stat = ata_wait_idle(ap);
2989 if (!ata_ok(drv_stat)) { 3000 if (!ata_ok(drv_stat)) {
@@ -2994,7 +3005,7 @@ static int ata_pio_complete (struct ata_port *ap)
2994 3005
2995 ap->hsm_task_state = HSM_ST_IDLE; 3006 ap->hsm_task_state = HSM_ST_IDLE;
2996 3007
2997 assert(qc->err_mask == 0); 3008 WARN_ON(qc->err_mask);
2998 ata_poll_qc_complete(qc); 3009 ata_poll_qc_complete(qc);
2999 3010
3000 /* another command may start at this point */ 3011 /* another command may start at this point */
@@ -3517,7 +3528,7 @@ static void ata_pio_block(struct ata_port *ap)
3517 } 3528 }
3518 3529
3519 qc = ata_qc_from_tag(ap, ap->active_tag); 3530 qc = ata_qc_from_tag(ap, ap->active_tag);
3520 assert(qc != NULL); 3531 WARN_ON(qc == NULL);
3521 3532
3522 /* check error */ 3533 /* check error */
3523 if (status & (ATA_ERR | ATA_DF)) { 3534 if (status & (ATA_ERR | ATA_DF)) {
@@ -3554,7 +3565,7 @@ static void ata_pio_error(struct ata_port *ap)
3554 struct ata_queued_cmd *qc; 3565 struct ata_queued_cmd *qc;
3555 3566
3556 qc = ata_qc_from_tag(ap, ap->active_tag); 3567 qc = ata_qc_from_tag(ap, ap->active_tag);
3557 assert(qc != NULL); 3568 WARN_ON(qc == NULL);
3558 3569
3559 if (qc->tf.command != ATA_CMD_PACKET) 3570 if (qc->tf.command != ATA_CMD_PACKET)
3560 printk(KERN_WARNING "ata%u: PIO error\n", ap->id); 3571 printk(KERN_WARNING "ata%u: PIO error\n", ap->id);
@@ -3562,7 +3573,7 @@ static void ata_pio_error(struct ata_port *ap)
3562 /* make sure qc->err_mask is available to 3573 /* make sure qc->err_mask is available to
3563 * know what's wrong and recover 3574 * know what's wrong and recover
3564 */ 3575 */
3565 assert(qc->err_mask); 3576 WARN_ON(qc->err_mask == 0);
3566 3577
3567 ap->hsm_task_state = HSM_ST_IDLE; 3578 ap->hsm_task_state = HSM_ST_IDLE;
3568 3579
@@ -3776,7 +3787,7 @@ void ata_qc_free(struct ata_queued_cmd *qc)
3776 struct ata_port *ap = qc->ap; 3787 struct ata_port *ap = qc->ap;
3777 unsigned int tag; 3788 unsigned int tag;
3778 3789
3779 assert(qc != NULL); /* ata_qc_from_tag _might_ return NULL */ 3790 WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */
3780 3791
3781 qc->flags = 0; 3792 qc->flags = 0;
3782 tag = qc->tag; 3793 tag = qc->tag;
@@ -3788,10 +3799,10 @@ void ata_qc_free(struct ata_queued_cmd *qc)
3788 } 3799 }
3789} 3800}
3790 3801
3791inline void __ata_qc_complete(struct ata_queued_cmd *qc) 3802void __ata_qc_complete(struct ata_queued_cmd *qc)
3792{ 3803{
3793 assert(qc != NULL); /* ata_qc_from_tag _might_ return NULL */ 3804 WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */
3794 assert(qc->flags & ATA_QCFLAG_ACTIVE); 3805 WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE));
3795 3806
3796 if (likely(qc->flags & ATA_QCFLAG_DMAMAP)) 3807 if (likely(qc->flags & ATA_QCFLAG_DMAMAP))
3797 ata_sg_clean(qc); 3808 ata_sg_clean(qc);
@@ -3806,25 +3817,6 @@ inline void __ata_qc_complete(struct ata_queued_cmd *qc)
3806 qc->complete_fn(qc); 3817 qc->complete_fn(qc);
3807} 3818}
3808 3819
3809/**
3810 * ata_qc_complete - Complete an active ATA command
3811 * @qc: Command to complete
3812 * @err_mask: ATA Status register contents
3813 *
3814 * Indicate to the mid and upper layers that an ATA
3815 * command has completed, with either an ok or not-ok status.
3816 *
3817 * LOCKING:
3818 * spin_lock_irqsave(host_set lock)
3819 */
3820void ata_qc_complete(struct ata_queued_cmd *qc)
3821{
3822 if (unlikely(qc->flags & ATA_QCFLAG_EH_SCHEDULED))
3823 return;
3824
3825 __ata_qc_complete(qc);
3826}
3827
3828static inline int ata_should_dma_map(struct ata_queued_cmd *qc) 3820static inline int ata_should_dma_map(struct ata_queued_cmd *qc)
3829{ 3821{
3830 struct ata_port *ap = qc->ap; 3822 struct ata_port *ap = qc->ap;
@@ -5143,7 +5135,7 @@ EXPORT_SYMBOL_GPL(ata_device_add);
5143EXPORT_SYMBOL_GPL(ata_host_set_remove); 5135EXPORT_SYMBOL_GPL(ata_host_set_remove);
5144EXPORT_SYMBOL_GPL(ata_sg_init); 5136EXPORT_SYMBOL_GPL(ata_sg_init);
5145EXPORT_SYMBOL_GPL(ata_sg_init_one); 5137EXPORT_SYMBOL_GPL(ata_sg_init_one);
5146EXPORT_SYMBOL_GPL(ata_qc_complete); 5138EXPORT_SYMBOL_GPL(__ata_qc_complete);
5147EXPORT_SYMBOL_GPL(ata_qc_issue_prot); 5139EXPORT_SYMBOL_GPL(ata_qc_issue_prot);
5148EXPORT_SYMBOL_GPL(ata_eng_timeout); 5140EXPORT_SYMBOL_GPL(ata_eng_timeout);
5149EXPORT_SYMBOL_GPL(ata_tf_load); 5141EXPORT_SYMBOL_GPL(ata_tf_load);
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 9d67c6768335..26f07a2617f9 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -553,7 +553,7 @@ void ata_gen_ata_desc_sense(struct ata_queued_cmd *qc)
553 /* 553 /*
554 * Read the controller registers. 554 * Read the controller registers.
555 */ 555 */
556 assert(NULL != qc->ap->ops->tf_read); 556 WARN_ON(qc->ap->ops->tf_read == NULL);
557 qc->ap->ops->tf_read(qc->ap, tf); 557 qc->ap->ops->tf_read(qc->ap, tf);
558 558
559 /* 559 /*
@@ -628,7 +628,7 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc)
628 /* 628 /*
629 * Read the controller registers. 629 * Read the controller registers.
630 */ 630 */
631 assert(NULL != qc->ap->ops->tf_read); 631 WARN_ON(qc->ap->ops->tf_read == NULL);
632 qc->ap->ops->tf_read(qc->ap, tf); 632 qc->ap->ops->tf_read(qc->ap, tf);
633 633
634 /* 634 /*
@@ -746,7 +746,7 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
746 spin_lock_irqsave(&ap->host_set->lock, flags); 746 spin_lock_irqsave(&ap->host_set->lock, flags);
747 qc = ata_qc_from_tag(ap, ap->active_tag); 747 qc = ata_qc_from_tag(ap, ap->active_tag);
748 if (qc) { 748 if (qc) {
749 assert(qc->scsicmd == cmd); 749 WARN_ON(qc->scsicmd != cmd);
750 qc->flags |= ATA_QCFLAG_EH_SCHEDULED; 750 qc->flags |= ATA_QCFLAG_EH_SCHEDULED;
751 qc->err_mask |= AC_ERR_TIMEOUT; 751 qc->err_mask |= AC_ERR_TIMEOUT;
752 ret = EH_NOT_HANDLED; 752 ret = EH_NOT_HANDLED;
@@ -780,14 +780,14 @@ int ata_scsi_error(struct Scsi_Host *host)
780 ap = (struct ata_port *) &host->hostdata[0]; 780 ap = (struct ata_port *) &host->hostdata[0];
781 781
782 spin_lock_irqsave(&ap->host_set->lock, flags); 782 spin_lock_irqsave(&ap->host_set->lock, flags);
783 assert(!(ap->flags & ATA_FLAG_IN_EH)); 783 WARN_ON(ap->flags & ATA_FLAG_IN_EH);
784 ap->flags |= ATA_FLAG_IN_EH; 784 ap->flags |= ATA_FLAG_IN_EH;
785 assert(ata_qc_from_tag(ap, ap->active_tag) != NULL); 785 WARN_ON(ata_qc_from_tag(ap, ap->active_tag) == NULL);
786 spin_unlock_irqrestore(&ap->host_set->lock, flags); 786 spin_unlock_irqrestore(&ap->host_set->lock, flags);
787 787
788 ap->ops->eng_timeout(ap); 788 ap->ops->eng_timeout(ap);
789 789
790 assert(host->host_failed == 0 && list_empty(&host->eh_cmd_q)); 790 WARN_ON(host->host_failed || !list_empty(&host->eh_cmd_q));
791 791
792 scsi_eh_flush_done_q(&ap->eh_done_q); 792 scsi_eh_flush_done_q(&ap->eh_done_q);
793 793
@@ -813,7 +813,7 @@ static void __ata_eh_qc_complete(struct ata_queued_cmd *qc)
813 spin_lock_irqsave(&ap->host_set->lock, flags); 813 spin_lock_irqsave(&ap->host_set->lock, flags);
814 qc->scsidone = ata_eh_scsidone; 814 qc->scsidone = ata_eh_scsidone;
815 __ata_qc_complete(qc); 815 __ata_qc_complete(qc);
816 assert(!ata_tag_valid(qc->tag)); 816 WARN_ON(ata_tag_valid(qc->tag));
817 spin_unlock_irqrestore(&ap->host_set->lock, flags); 817 spin_unlock_irqrestore(&ap->host_set->lock, flags);
818 818
819 scsi_eh_finish_cmd(scmd, &ap->eh_done_q); 819 scsi_eh_finish_cmd(scmd, &ap->eh_done_q);
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index 1cd071a32e93..9d76923a2253 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -46,7 +46,6 @@ extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
46extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); 46extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc);
47extern void ata_qc_free(struct ata_queued_cmd *qc); 47extern void ata_qc_free(struct ata_queued_cmd *qc);
48extern unsigned int ata_qc_issue(struct ata_queued_cmd *qc); 48extern unsigned int ata_qc_issue(struct ata_queued_cmd *qc);
49extern void __ata_qc_complete(struct ata_queued_cmd *qc);
50extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); 49extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
51extern void ata_dev_select(struct ata_port *ap, unsigned int device, 50extern void ata_dev_select(struct ata_port *ap, unsigned int device,
52 unsigned int wait, unsigned int can_sleep); 51 unsigned int wait, unsigned int can_sleep);
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index cda4c495c10f..d35460ff5275 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -632,8 +632,8 @@ static void mv_irq_clear(struct ata_port *ap)
632 * @base: port base address 632 * @base: port base address
633 * @pp: port private data 633 * @pp: port private data
634 * 634 *
635 * Verify the local cache of the eDMA state is accurate with an 635 * Verify the local cache of the eDMA state is accurate with a
636 * assert. 636 * WARN_ON.
637 * 637 *
638 * LOCKING: 638 * LOCKING:
639 * Inherited from caller. 639 * Inherited from caller.
@@ -644,15 +644,15 @@ static void mv_start_dma(void __iomem *base, struct mv_port_priv *pp)
644 writelfl(EDMA_EN, base + EDMA_CMD_OFS); 644 writelfl(EDMA_EN, base + EDMA_CMD_OFS);
645 pp->pp_flags |= MV_PP_FLAG_EDMA_EN; 645 pp->pp_flags |= MV_PP_FLAG_EDMA_EN;
646 } 646 }
647 assert(EDMA_EN & readl(base + EDMA_CMD_OFS)); 647 WARN_ON(!(EDMA_EN & readl(base + EDMA_CMD_OFS)));
648} 648}
649 649
650/** 650/**
651 * mv_stop_dma - Disable eDMA engine 651 * mv_stop_dma - Disable eDMA engine
652 * @ap: ATA channel to manipulate 652 * @ap: ATA channel to manipulate
653 * 653 *
654 * Verify the local cache of the eDMA state is accurate with an 654 * Verify the local cache of the eDMA state is accurate with a
655 * assert. 655 * WARN_ON.
656 * 656 *
657 * LOCKING: 657 * LOCKING:
658 * Inherited from caller. 658 * Inherited from caller.
@@ -670,7 +670,7 @@ static void mv_stop_dma(struct ata_port *ap)
670 writelfl(EDMA_DS, port_mmio + EDMA_CMD_OFS); 670 writelfl(EDMA_DS, port_mmio + EDMA_CMD_OFS);
671 pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; 671 pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN;
672 } else { 672 } else {
673 assert(!(EDMA_EN & readl(port_mmio + EDMA_CMD_OFS))); 673 WARN_ON(EDMA_EN & readl(port_mmio + EDMA_CMD_OFS));
674 } 674 }
675 675
676 /* now properly wait for the eDMA to stop */ 676 /* now properly wait for the eDMA to stop */
@@ -1061,15 +1061,15 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
1061 return; 1061 return;
1062 1062
1063 /* the req producer index should be the same as we remember it */ 1063 /* the req producer index should be the same as we remember it */
1064 assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> 1064 WARN_ON(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >>
1065 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == 1065 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
1066 pp->req_producer); 1066 pp->req_producer);
1067 1067
1068 /* Fill in command request block 1068 /* Fill in command request block
1069 */ 1069 */
1070 if (!(qc->tf.flags & ATA_TFLAG_WRITE)) 1070 if (!(qc->tf.flags & ATA_TFLAG_WRITE))
1071 flags |= CRQB_FLAG_READ; 1071 flags |= CRQB_FLAG_READ;
1072 assert(MV_MAX_Q_DEPTH > qc->tag); 1072 WARN_ON(MV_MAX_Q_DEPTH <= qc->tag);
1073 flags |= qc->tag << CRQB_TAG_SHIFT; 1073 flags |= qc->tag << CRQB_TAG_SHIFT;
1074 1074
1075 pp->crqb[pp->req_producer].sg_addr = 1075 pp->crqb[pp->req_producer].sg_addr =
@@ -1152,16 +1152,16 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc)
1152 return; 1152 return;
1153 1153
1154 /* the req producer index should be the same as we remember it */ 1154 /* the req producer index should be the same as we remember it */
1155 assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> 1155 WARN_ON(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >>
1156 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == 1156 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
1157 pp->req_producer); 1157 pp->req_producer);
1158 1158
1159 /* Fill in Gen IIE command request block 1159 /* Fill in Gen IIE command request block
1160 */ 1160 */
1161 if (!(qc->tf.flags & ATA_TFLAG_WRITE)) 1161 if (!(qc->tf.flags & ATA_TFLAG_WRITE))
1162 flags |= CRQB_FLAG_READ; 1162 flags |= CRQB_FLAG_READ;
1163 1163
1164 assert(MV_MAX_Q_DEPTH > qc->tag); 1164 WARN_ON(MV_MAX_Q_DEPTH <= qc->tag);
1165 flags |= qc->tag << CRQB_TAG_SHIFT; 1165 flags |= qc->tag << CRQB_TAG_SHIFT;
1166 1166
1167 crqb = (struct mv_crqb_iie *) &pp->crqb[pp->req_producer]; 1167 crqb = (struct mv_crqb_iie *) &pp->crqb[pp->req_producer];
@@ -1226,12 +1226,12 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
1226 in_ptr = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS); 1226 in_ptr = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS);
1227 1227
1228 /* the req producer index should be the same as we remember it */ 1228 /* the req producer index should be the same as we remember it */
1229 assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == 1229 WARN_ON(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
1230 pp->req_producer); 1230 pp->req_producer);
1231 /* until we do queuing, the queue should be empty at this point */ 1231 /* until we do queuing, the queue should be empty at this point */
1232 assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == 1232 WARN_ON(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
1233 ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> 1233 ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >>
1234 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); 1234 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK));
1235 1235
1236 mv_inc_q_index(&pp->req_producer); /* now incr producer index */ 1236 mv_inc_q_index(&pp->req_producer); /* now incr producer index */
1237 1237
@@ -1251,7 +1251,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
1251 * 1251 *
1252 * This routine is for use when the port is in DMA mode, when it 1252 * This routine is for use when the port is in DMA mode, when it
1253 * will be using the CRPB (command response block) method of 1253 * will be using the CRPB (command response block) method of
1254 * returning command completion information. We assert indices 1254 * returning command completion information. We check indices
1255 * are good, grab status, and bump the response consumer index to 1255 * are good, grab status, and bump the response consumer index to
1256 * prove that we're up to date. 1256 * prove that we're up to date.
1257 * 1257 *
@@ -1267,16 +1267,16 @@ static u8 mv_get_crpb_status(struct ata_port *ap)
1267 out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); 1267 out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
1268 1268
1269 /* the response consumer index should be the same as we remember it */ 1269 /* the response consumer index should be the same as we remember it */
1270 assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == 1270 WARN_ON(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
1271 pp->rsp_consumer); 1271 pp->rsp_consumer);
1272 1272
1273 /* increment our consumer index... */ 1273 /* increment our consumer index... */
1274 pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); 1274 pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer);
1275 1275
1276 /* and, until we do NCQ, there should only be 1 CRPB waiting */ 1276 /* and, until we do NCQ, there should only be 1 CRPB waiting */
1277 assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> 1277 WARN_ON(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >>
1278 EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == 1278 EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
1279 pp->rsp_consumer); 1279 pp->rsp_consumer);
1280 1280
1281 /* write out our inc'd consumer index so EDMA knows we're caught up */ 1281 /* write out our inc'd consumer index so EDMA knows we're caught up */
1282 out_ptr &= EDMA_RSP_Q_BASE_LO_MASK; 1282 out_ptr &= EDMA_RSP_Q_BASE_LO_MASK;
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index d5c912763d0c..5730167d2e74 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -277,8 +277,8 @@ static unsigned int qs_fill_sg(struct ata_queued_cmd *qc)
277 unsigned int nelem; 277 unsigned int nelem;
278 u8 *prd = pp->pkt + QS_CPB_BYTES; 278 u8 *prd = pp->pkt + QS_CPB_BYTES;
279 279
280 assert(qc->__sg != NULL); 280 WARN_ON(qc->__sg == NULL);
281 assert(qc->n_elem > 0); 281 WARN_ON(qc->n_elem == 0);
282 282
283 nelem = 0; 283 nelem = 0;
284 ata_for_each_sg(sg, qc) { 284 ata_for_each_sg(sg, qc) {
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index f40f25edbb11..bd2887741d78 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -158,7 +158,7 @@ static const struct ata_port_operations sil_ops = {
158 .check_status = ata_check_status, 158 .check_status = ata_check_status,
159 .exec_command = ata_exec_command, 159 .exec_command = ata_exec_command,
160 .dev_select = ata_std_dev_select, 160 .dev_select = ata_std_dev_select,
161 .phy_reset = sata_phy_reset, 161 .probe_reset = ata_std_probe_reset,
162 .post_set_mode = sil_post_set_mode, 162 .post_set_mode = sil_post_set_mode,
163 .bmdma_setup = ata_bmdma_setup, 163 .bmdma_setup = ata_bmdma_setup,
164 .bmdma_start = ata_bmdma_start, 164 .bmdma_start = ata_bmdma_start,
@@ -181,7 +181,7 @@ static const struct ata_port_info sil_port_info[] = {
181 { 181 {
182 .sht = &sil_sht, 182 .sht = &sil_sht,
183 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 183 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
184 ATA_FLAG_SRST | ATA_FLAG_MMIO, 184 ATA_FLAG_MMIO,
185 .pio_mask = 0x1f, /* pio0-4 */ 185 .pio_mask = 0x1f, /* pio0-4 */
186 .mwdma_mask = 0x07, /* mwdma0-2 */ 186 .mwdma_mask = 0x07, /* mwdma0-2 */
187 .udma_mask = 0x3f, /* udma0-5 */ 187 .udma_mask = 0x3f, /* udma0-5 */
@@ -190,8 +190,7 @@ static const struct ata_port_info sil_port_info[] = {
190 { 190 {
191 .sht = &sil_sht, 191 .sht = &sil_sht,
192 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 192 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
193 ATA_FLAG_SRST | ATA_FLAG_MMIO | 193 ATA_FLAG_MMIO | SIL_FLAG_MOD15WRITE,
194 SIL_FLAG_MOD15WRITE,
195 .pio_mask = 0x1f, /* pio0-4 */ 194 .pio_mask = 0x1f, /* pio0-4 */
196 .mwdma_mask = 0x07, /* mwdma0-2 */ 195 .mwdma_mask = 0x07, /* mwdma0-2 */
197 .udma_mask = 0x3f, /* udma0-5 */ 196 .udma_mask = 0x3f, /* udma0-5 */
@@ -200,7 +199,7 @@ static const struct ata_port_info sil_port_info[] = {
200 { 199 {
201 .sht = &sil_sht, 200 .sht = &sil_sht,
202 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 201 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
203 ATA_FLAG_SRST | ATA_FLAG_MMIO, 202 ATA_FLAG_MMIO,
204 .pio_mask = 0x1f, /* pio0-4 */ 203 .pio_mask = 0x1f, /* pio0-4 */
205 .mwdma_mask = 0x07, /* mwdma0-2 */ 204 .mwdma_mask = 0x07, /* mwdma0-2 */
206 .udma_mask = 0x3f, /* udma0-5 */ 205 .udma_mask = 0x3f, /* udma0-5 */
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 962396b36f61..228a7fabffff 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -249,7 +249,7 @@ static u8 sil24_check_status(struct ata_port *ap);
249static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); 249static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg);
250static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); 250static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val);
251static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); 251static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
252static void sil24_phy_reset(struct ata_port *ap); 252static int sil24_probe_reset(struct ata_port *ap, unsigned int *classes);
253static void sil24_qc_prep(struct ata_queued_cmd *qc); 253static void sil24_qc_prep(struct ata_queued_cmd *qc);
254static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc); 254static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc);
255static void sil24_irq_clear(struct ata_port *ap); 255static void sil24_irq_clear(struct ata_port *ap);
@@ -306,7 +306,7 @@ static const struct ata_port_operations sil24_ops = {
306 306
307 .tf_read = sil24_tf_read, 307 .tf_read = sil24_tf_read,
308 308
309 .phy_reset = sil24_phy_reset, 309 .probe_reset = sil24_probe_reset,
310 310
311 .qc_prep = sil24_qc_prep, 311 .qc_prep = sil24_qc_prep,
312 .qc_issue = sil24_qc_issue, 312 .qc_issue = sil24_qc_issue,
@@ -336,8 +336,8 @@ static struct ata_port_info sil24_port_info[] = {
336 { 336 {
337 .sht = &sil24_sht, 337 .sht = &sil24_sht,
338 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 338 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
339 ATA_FLAG_SRST | ATA_FLAG_MMIO | 339 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
340 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(4), 340 SIL24_NPORTS2FLAG(4),
341 .pio_mask = 0x1f, /* pio0-4 */ 341 .pio_mask = 0x1f, /* pio0-4 */
342 .mwdma_mask = 0x07, /* mwdma0-2 */ 342 .mwdma_mask = 0x07, /* mwdma0-2 */
343 .udma_mask = 0x3f, /* udma0-5 */ 343 .udma_mask = 0x3f, /* udma0-5 */
@@ -347,8 +347,8 @@ static struct ata_port_info sil24_port_info[] = {
347 { 347 {
348 .sht = &sil24_sht, 348 .sht = &sil24_sht,
349 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 349 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
350 ATA_FLAG_SRST | ATA_FLAG_MMIO | 350 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
351 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(2), 351 SIL24_NPORTS2FLAG(2),
352 .pio_mask = 0x1f, /* pio0-4 */ 352 .pio_mask = 0x1f, /* pio0-4 */
353 .mwdma_mask = 0x07, /* mwdma0-2 */ 353 .mwdma_mask = 0x07, /* mwdma0-2 */
354 .udma_mask = 0x3f, /* udma0-5 */ 354 .udma_mask = 0x3f, /* udma0-5 */
@@ -358,8 +358,8 @@ static struct ata_port_info sil24_port_info[] = {
358 { 358 {
359 .sht = &sil24_sht, 359 .sht = &sil24_sht,
360 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 360 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
361 ATA_FLAG_SRST | ATA_FLAG_MMIO | 361 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
362 ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(1), 362 SIL24_NPORTS2FLAG(1),
363 .pio_mask = 0x1f, /* pio0-4 */ 363 .pio_mask = 0x1f, /* pio0-4 */
364 .mwdma_mask = 0x07, /* mwdma0-2 */ 364 .mwdma_mask = 0x07, /* mwdma0-2 */
365 .udma_mask = 0x3f, /* udma0-5 */ 365 .udma_mask = 0x3f, /* udma0-5 */
@@ -428,7 +428,8 @@ static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
428 *tf = pp->tf; 428 *tf = pp->tf;
429} 429}
430 430
431static int sil24_issue_SRST(struct ata_port *ap) 431static int sil24_softreset(struct ata_port *ap, int verbose,
432 unsigned int *class)
432{ 433{
433 void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; 434 void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr;
434 struct sil24_port_priv *pp = ap->private_data; 435 struct sil24_port_priv *pp = ap->private_data;
@@ -437,6 +438,8 @@ static int sil24_issue_SRST(struct ata_port *ap)
437 u32 irq_enable, irq_stat; 438 u32 irq_enable, irq_stat;
438 int cnt; 439 int cnt;
439 440
441 DPRINTK("ENTER\n");
442
440 /* temporarily turn off IRQs during SRST */ 443 /* temporarily turn off IRQs during SRST */
441 irq_enable = readl(port + PORT_IRQ_ENABLE_SET); 444 irq_enable = readl(port + PORT_IRQ_ENABLE_SET);
442 writel(irq_enable, port + PORT_IRQ_ENABLE_CLR); 445 writel(irq_enable, port + PORT_IRQ_ENABLE_CLR);
@@ -466,30 +469,36 @@ static int sil24_issue_SRST(struct ata_port *ap)
466 /* restore IRQs */ 469 /* restore IRQs */
467 writel(irq_enable, port + PORT_IRQ_ENABLE_SET); 470 writel(irq_enable, port + PORT_IRQ_ENABLE_SET);
468 471
469 if (!(irq_stat & PORT_IRQ_COMPLETE)) 472 if (sata_dev_present(ap)) {
470 return -1; 473 if (!(irq_stat & PORT_IRQ_COMPLETE)) {
474 DPRINTK("EXIT, srst failed\n");
475 return -EIO;
476 }
471 477
472 /* update TF */ 478 sil24_update_tf(ap);
473 sil24_update_tf(ap); 479 *class = ata_dev_classify(&pp->tf);
480 }
481 if (*class == ATA_DEV_UNKNOWN)
482 *class = ATA_DEV_NONE;
483
484 DPRINTK("EXIT, class=%u\n", *class);
474 return 0; 485 return 0;
475} 486}
476 487
477static void sil24_phy_reset(struct ata_port *ap) 488static int sil24_hardreset(struct ata_port *ap, int verbose,
489 unsigned int *class)
478{ 490{
479 struct sil24_port_priv *pp = ap->private_data; 491 unsigned int dummy_class;
480 492
481 __sata_phy_reset(ap); 493 /* sil24 doesn't report device signature after hard reset */
482 if (ap->flags & ATA_FLAG_PORT_DISABLED) 494 return sata_std_hardreset(ap, verbose, &dummy_class);
483 return; 495}
484
485 if (sil24_issue_SRST(ap) < 0) {
486 printk(KERN_ERR DRV_NAME
487 " ata%u: SRST failed, disabling port\n", ap->id);
488 ap->ops->port_disable(ap);
489 return;
490 }
491 496
492 ap->device->class = ata_dev_classify(&pp->tf); 497static int sil24_probe_reset(struct ata_port *ap, unsigned int *classes)
498{
499 return ata_drive_probe_reset(ap, ata_std_probeinit,
500 sil24_softreset, sil24_hardreset,
501 ata_std_postreset, classes);
493} 502}
494 503
495static inline void sil24_fill_sg(struct ata_queued_cmd *qc, 504static inline void sil24_fill_sg(struct ata_queued_cmd *qc,
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index b7cf279deeb2..04465fb86e1d 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -461,7 +461,7 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc)
461 unsigned int i, idx, total_len = 0, sgt_len; 461 unsigned int i, idx, total_len = 0, sgt_len;
462 u32 *buf = (u32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ]; 462 u32 *buf = (u32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ];
463 463
464 assert(qc->flags & ATA_QCFLAG_DMAMAP); 464 WARN_ON(!(qc->flags & ATA_QCFLAG_DMAMAP));
465 465
466 VPRINTK("ata%u: ENTER\n", ap->id); 466 VPRINTK("ata%u: ENTER\n", ap->id);
467 467
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index 1d85533d46d2..f3763d2ccb86 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -1717,11 +1717,9 @@ ioc4_change_speed(struct uart_port *the_port,
1717 } 1717 }
1718 1718
1719 if (cflag & CRTSCTS) { 1719 if (cflag & CRTSCTS) {
1720 info->flags |= ASYNC_CTS_FLOW;
1721 port->ip_sscr |= IOC4_SSCR_HFC_EN; 1720 port->ip_sscr |= IOC4_SSCR_HFC_EN;
1722 } 1721 }
1723 else { 1722 else {
1724 info->flags &= ~ASYNC_CTS_FLOW;
1725 port->ip_sscr &= ~IOC4_SSCR_HFC_EN; 1723 port->ip_sscr &= ~IOC4_SSCR_HFC_EN;
1726 } 1724 }
1727 writel(port->ip_sscr, &port->ip_serial_regs->sscr); 1725 writel(port->ip_sscr, &port->ip_serial_regs->sscr);
@@ -1760,18 +1758,6 @@ static inline int ic4_startup_local(struct uart_port *the_port)
1760 1758
1761 info = the_port->info; 1759 info = the_port->info;
1762 1760
1763 if (info->tty) {
1764 set_bit(TTY_IO_ERROR, &info->tty->flags);
1765 clear_bit(TTY_IO_ERROR, &info->tty->flags);
1766 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
1767 info->tty->alt_speed = 57600;
1768 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
1769 info->tty->alt_speed = 115200;
1770 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
1771 info->tty->alt_speed = 230400;
1772 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
1773 info->tty->alt_speed = 460800;
1774 }
1775 local_open(port); 1761 local_open(port);
1776 1762
1777 /* set the speed of the serial port */ 1763 /* set the speed of the serial port */
diff --git a/include/asm-arm/arch-s3c2410/h1940-latch.h b/include/asm-arm/arch-s3c2410/h1940-latch.h
new file mode 100644
index 000000000000..c5802411f43d
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/h1940-latch.h
@@ -0,0 +1,64 @@
1/* linux/include/asm-arm/arch-s3c2410/h1940-latch.h
2 *
3 * (c) 2005 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * iPAQ H1940 series - latch definitions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_H1940_LATCH_H
15#define __ASM_ARCH_H1940_LATCH_H
16
17
18#ifndef __ASSEMBLY__
19#define H1940_LATCH ((void __iomem *)0xF8000000)
20#else
21#define H1940_LATCH 0xF8000000
22#endif
23
24#define H1940_PA_LATCH (S3C2410_CS2)
25
26/* SD layer latch */
27
28#define H1940_LATCH_SDQ1 (1<<16)
29#define H1940_LATCH_LCD_P1 (1<<17)
30#define H1940_LATCH_LCD_P2 (1<<18)
31#define H1940_LATCH_LCD_P3 (1<<19)
32#define H1940_LATCH_MAX1698_nSHUTDOWN (1<<20) /* LCD backlight */
33#define H1940_LATCH_LED_RED (1<<21)
34#define H1940_LATCH_SDQ7 (1<<22)
35#define H1940_LATCH_USB_DP (1<<23)
36
37/* CPU layer latch */
38
39#define H1940_LATCH_UDA_POWER (1<<24)
40#define H1940_LATCH_AUDIO_POWER (1<<25)
41#define H1940_LATCH_SM803_ENABLE (1<<26)
42#define H1940_LATCH_LCD_P4 (1<<27)
43#define H1940_LATCH_CPUQ5 (1<<28) /* untraced */
44#define H1940_LATCH_BLUETOOTH_POWER (1<<29) /* active high */
45#define H1940_LATCH_LED_GREEN (1<<30)
46#define H1940_LATCH_LED_FLASH (1<<31)
47
48/* default settings */
49
50#define H1940_LATCH_DEFAULT \
51 H1940_LATCH_LCD_P4 | \
52 H1940_LATCH_SM803_ENABLE | \
53 H1940_LATCH_SDQ1 | \
54 H1940_LATCH_LCD_P1 | \
55 H1940_LATCH_LCD_P2 | \
56 H1940_LATCH_LCD_P3 | \
57 H1940_LATCH_MAX1698_nSHUTDOWN | \
58 H1940_LATCH_CPUQ5
59
60/* control functions */
61
62extern void h1940_latch_control(unsigned int clear, unsigned int set);
63
64#endif /* __ASM_ARCH_H1940_LATCH_H */
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 962f9bd1bdff..019956c613e4 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -270,12 +270,27 @@
270#define __NR_inotify_add_watch 1278 270#define __NR_inotify_add_watch 1278
271#define __NR_inotify_rm_watch 1279 271#define __NR_inotify_rm_watch 1279
272#define __NR_migrate_pages 1280 272#define __NR_migrate_pages 1280
273#define __NR_openat 1281
274#define __NR_mkdirat 1282
275#define __NR_mknodat 1283
276#define __NR_fchownat 1284
277#define __NR_futimesat 1285
278#define __NR_newfstatat 1286
279#define __NR_unlinkat 1287
280#define __NR_renameat 1288
281#define __NR_linkat 1289
282#define __NR_symlinkat 1290
283#define __NR_readlinkat 1291
284#define __NR_fchmodat 1292
285#define __NR_faccessat 1293
286/* 1294, 1295 reserved for pselect/ppoll */
287#define __NR_unshare 1296
273 288
274#ifdef __KERNEL__ 289#ifdef __KERNEL__
275 290
276#include <linux/config.h> 291#include <linux/config.h>
277 292
278#define NR_syscalls 270 /* length of syscall table */ 293#define NR_syscalls 273 /* length of syscall table */
279 294
280#define __ARCH_WANT_SYS_RT_SIGACTION 295#define __ARCH_WANT_SYS_RT_SIGACTION
281 296
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index a40cdff21a88..35556993f066 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -300,8 +300,9 @@
300#define __NR_spu_create 279 300#define __NR_spu_create 279
301#define __NR_pselect6 280 301#define __NR_pselect6 280
302#define __NR_ppoll 281 302#define __NR_ppoll 281
303#define __NR_unshare 282
303 304
304#define __NR_syscalls 282 305#define __NR_syscalls 283
305 306
306#ifdef __KERNEL__ 307#ifdef __KERNEL__
307#define __NR__exit __NR_exit 308#define __NR__exit __NR_exit
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 20b446f26ecd..60e56c6e03dd 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -328,7 +328,7 @@ static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
328 * bitmap of size NR_CPUS. 328 * bitmap of size NR_CPUS.
329 * 329 *
330 * #ifdef CONFIG_HOTPLUG_CPU 330 * #ifdef CONFIG_HOTPLUG_CPU
331 * cpu_possible_map - all NR_CPUS bits set 331 * cpu_possible_map - has bit 'cpu' set iff cpu is populatable
332 * cpu_present_map - has bit 'cpu' set iff cpu is populated 332 * cpu_present_map - has bit 'cpu' set iff cpu is populated
333 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler 333 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler
334 * #else 334 * #else
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 3aed37314ab8..e87c32a5c86a 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -153,8 +153,10 @@ static inline void con_schedule_flip(struct tty_struct *t)
153{ 153{
154 unsigned long flags; 154 unsigned long flags;
155 spin_lock_irqsave(&t->buf.lock, flags); 155 spin_lock_irqsave(&t->buf.lock, flags);
156 if (t->buf.tail != NULL) 156 if (t->buf.tail != NULL) {
157 t->buf.tail->active = 0; 157 t->buf.tail->active = 0;
158 t->buf.tail->commit = t->buf.tail->used;
159 }
158 spin_unlock_irqrestore(&t->buf.lock, flags); 160 spin_unlock_irqrestore(&t->buf.lock, flags);
159 schedule_work(&t->buf.work); 161 schedule_work(&t->buf.work);
160} 162}
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index a311f58c8a7c..cfb3410e32b1 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -6,6 +6,7 @@
6#include <linux/list.h> 6#include <linux/list.h>
7#include <linux/linkage.h> 7#include <linux/linkage.h>
8#include <linux/compat.h> 8#include <linux/compat.h>
9#include <linux/ioport.h>
9#include <asm/kexec.h> 10#include <asm/kexec.h>
10 11
11/* Verify architecture specific macros are defined */ 12/* Verify architecture specific macros are defined */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b169f9098649..9873f4c54f1e 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -62,16 +62,6 @@
62 62
63#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) 63#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
64 64
65#ifdef ATA_NDEBUG
66#define assert(expr)
67#else
68#define assert(expr) \
69 if(unlikely(!(expr))) { \
70 printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \
71 #expr,__FILE__,__FUNCTION__,__LINE__); \
72 }
73#endif
74
75/* NEW: debug levels */ 65/* NEW: debug levels */
76#define HAVE_LIBATA_MSG 1 66#define HAVE_LIBATA_MSG 1
77 67
@@ -559,7 +549,7 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc);
559extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 549extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
560extern u8 ata_bmdma_status(struct ata_port *ap); 550extern u8 ata_bmdma_status(struct ata_port *ap);
561extern void ata_bmdma_irq_clear(struct ata_port *ap); 551extern void ata_bmdma_irq_clear(struct ata_port *ap);
562extern void ata_qc_complete(struct ata_queued_cmd *qc); 552extern void __ata_qc_complete(struct ata_queued_cmd *qc);
563extern void ata_eng_timeout(struct ata_port *ap); 553extern void ata_eng_timeout(struct ata_port *ap);
564extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, 554extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev,
565 struct scsi_cmnd *cmd, 555 struct scsi_cmnd *cmd,
@@ -759,6 +749,24 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
759 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); 749 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno);
760} 750}
761 751
752/**
753 * ata_qc_complete - Complete an active ATA command
754 * @qc: Command to complete
755 * @err_mask: ATA Status register contents
756 *
757 * Indicate to the mid and upper layers that an ATA
758 * command has completed, with either an ok or not-ok status.
759 *
760 * LOCKING:
761 * spin_lock_irqsave(host_set lock)
762 */
763static inline void ata_qc_complete(struct ata_queued_cmd *qc)
764{
765 if (unlikely(qc->flags & ATA_QCFLAG_EH_SCHEDULED))
766 return;
767
768 __ata_qc_complete(qc);
769}
762 770
763/** 771/**
764 * ata_irq_on - Enable interrupts on a port. 772 * ata_irq_on - Enable interrupts on a port.
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 6a2ccf78a356..c256ebe2a7b4 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -160,7 +160,8 @@ extern int netlink_unregister_notifier(struct notifier_block *nb);
160 160
161/* finegrained unicast helpers: */ 161/* finegrained unicast helpers: */
162struct sock *netlink_getsockbyfilp(struct file *filp); 162struct sock *netlink_getsockbyfilp(struct file *filp);
163int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo); 163int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
164 long timeo, struct sock *ssk);
164void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 165void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
165int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); 166int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
166 167
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0cfcd1c7865e..9c1da0269a18 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1098,7 +1098,7 @@ extern struct sigqueue *sigqueue_alloc(void);
1098extern void sigqueue_free(struct sigqueue *); 1098extern void sigqueue_free(struct sigqueue *);
1099extern int send_sigqueue(int, struct sigqueue *, struct task_struct *); 1099extern int send_sigqueue(int, struct sigqueue *, struct task_struct *);
1100extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *); 1100extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *);
1101extern int do_sigaction(int, const struct k_sigaction *, struct k_sigaction *); 1101extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
1102extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); 1102extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
1103 1103
1104/* These can be the second arg to send_sig_info/send_group_sig_info. */ 1104/* These can be the second arg to send_sig_info/send_group_sig_info. */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index a7bd3b4558d2..f45cd74e6f24 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -58,6 +58,8 @@ struct tty_buffer {
58 int used; 58 int used;
59 int size; 59 int size;
60 int active; 60 int active;
61 int commit;
62 int read;
61 /* Data points here */ 63 /* Data points here */
62 unsigned long data[0]; 64 unsigned long data[0];
63}; 65};
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 82961eb19888..222faf97d5f9 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -29,8 +29,10 @@ _INLINE_ void tty_schedule_flip(struct tty_struct *tty)
29{ 29{
30 unsigned long flags; 30 unsigned long flags;
31 spin_lock_irqsave(&tty->buf.lock, flags); 31 spin_lock_irqsave(&tty->buf.lock, flags);
32 if (tty->buf.tail != NULL) 32 if (tty->buf.tail != NULL) {
33 tty->buf.tail->active = 0; 33 tty->buf.tail->active = 0;
34 tty->buf.tail->commit = tty->buf.tail->used;
35 }
34 spin_unlock_irqrestore(&tty->buf.lock, flags); 36 spin_unlock_irqrestore(&tty->buf.lock, flags);
35 schedule_delayed_work(&tty->buf.work, 1); 37 schedule_delayed_work(&tty->buf.work, 1);
36} 38}
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h
index f55e86e75030..2127cae1e0a6 100644
--- a/include/net/irda/irlap.h
+++ b/include/net/irda/irlap.h
@@ -50,6 +50,9 @@
50/* May be different when we get VFIR */ 50/* May be different when we get VFIR */
51#define LAP_MAX_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER) 51#define LAP_MAX_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER)
52 52
53/* Each IrDA device gets a random 32 bits IRLAP device address */
54#define LAP_ALEN 4
55
53#define BROADCAST 0xffffffff /* Broadcast device address */ 56#define BROADCAST 0xffffffff /* Broadcast device address */
54#define CBROADCAST 0xfe /* Connection broadcast address */ 57#define CBROADCAST 0xfe /* Connection broadcast address */
55#define XID_FORMAT 0x01 /* Discovery XID format */ 58#define XID_FORMAT 0x01 /* Discovery XID format */
diff --git a/init/initramfs.c b/init/initramfs.c
index 0c5d9a3f951b..637344b05981 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -466,10 +466,32 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
466extern char __initramfs_start[], __initramfs_end[]; 466extern char __initramfs_start[], __initramfs_end[];
467#ifdef CONFIG_BLK_DEV_INITRD 467#ifdef CONFIG_BLK_DEV_INITRD
468#include <linux/initrd.h> 468#include <linux/initrd.h>
469#include <linux/kexec.h>
469 470
470static void __init free_initrd(void) 471static void __init free_initrd(void)
471{ 472{
472 free_initrd_mem(initrd_start, initrd_end); 473#ifdef CONFIG_KEXEC
474 unsigned long crashk_start = (unsigned long)__va(crashk_res.start);
475 unsigned long crashk_end = (unsigned long)__va(crashk_res.end);
476
477 /*
478 * If the initrd region is overlapped with crashkernel reserved region,
479 * free only memory that is not part of crashkernel region.
480 */
481 if (initrd_start < crashk_end && initrd_end > crashk_start) {
482 /*
483 * Initialize initrd memory region since the kexec boot does
484 * not do.
485 */
486 memset((void *)initrd_start, 0, initrd_end - initrd_start);
487 if (initrd_start < crashk_start)
488 free_initrd_mem(initrd_start, crashk_start);
489 if (initrd_end > crashk_end)
490 free_initrd_mem(crashk_end, initrd_end);
491 } else
492#endif
493 free_initrd_mem(initrd_start, initrd_end);
494
473 initrd_start = 0; 495 initrd_start = 0;
474 initrd_end = 0; 496 initrd_end = 0;
475} 497}
diff --git a/init/main.c b/init/main.c
index 7c79da57d3a2..4c194c47395f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -668,7 +668,6 @@ static int init(void * unused)
668 */ 668 */
669 child_reaper = current; 669 child_reaper = current;
670 670
671 /* Sets up cpus_possible() */
672 smp_prepare_cpus(max_cpus); 671 smp_prepare_cpus(max_cpus);
673 672
674 do_pre_smp_initcalls(); 673 do_pre_smp_initcalls();
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 59302fc3643b..fd2e26b6f966 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1018,7 +1018,8 @@ retry:
1018 goto out; 1018 goto out;
1019 } 1019 }
1020 1020
1021 ret = netlink_attachskb(sock, nc, 0, MAX_SCHEDULE_TIMEOUT); 1021 ret = netlink_attachskb(sock, nc, 0,
1022 MAX_SCHEDULE_TIMEOUT, NULL);
1022 if (ret == 1) 1023 if (ret == 1)
1023 goto retry; 1024 goto retry;
1024 if (ret) { 1025 if (ret) {
diff --git a/ipc/shm.c b/ipc/shm.c
index 4c28d2d8e305..9162123a7b23 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -870,6 +870,7 @@ asmlinkage long sys_shmdt(char __user *shmaddr)
870 * could possibly have landed at. Also cast things to loff_t to 870 * could possibly have landed at. Also cast things to loff_t to
871 * prevent overflows and make comparisions vs. equal-width types. 871 * prevent overflows and make comparisions vs. equal-width types.
872 */ 872 */
873 size = PAGE_ALIGN(size);
873 while (vma && (loff_t)(vma->vm_end - addr) <= size) { 874 while (vma && (loff_t)(vma->vm_end - addr) <= size) {
874 next = vma->vm_next; 875 next = vma->vm_next;
875 876
diff --git a/kernel/panic.c b/kernel/panic.c
index c5c4ab255834..126dc43f1c74 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -130,6 +130,7 @@ NORET_TYPE void panic(const char * fmt, ...)
130#endif 130#endif
131 local_irq_enable(); 131 local_irq_enable();
132 for (i = 0;;) { 132 for (i = 0;;) {
133 touch_softlockup_watchdog();
133 i += panic_blink(i); 134 i += panic_blink(i);
134 mdelay(1); 135 mdelay(1);
135 i++; 136 i++;
diff --git a/kernel/sched.c b/kernel/sched.c
index bc38804e40dd..87d93be336a1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -215,7 +215,6 @@ struct runqueue {
215 */ 215 */
216 unsigned long nr_running; 216 unsigned long nr_running;
217#ifdef CONFIG_SMP 217#ifdef CONFIG_SMP
218 unsigned long prio_bias;
219 unsigned long cpu_load[3]; 218 unsigned long cpu_load[3];
220#endif 219#endif
221 unsigned long long nr_switches; 220 unsigned long long nr_switches;
@@ -669,68 +668,13 @@ static int effective_prio(task_t *p)
669 return prio; 668 return prio;
670} 669}
671 670
672#ifdef CONFIG_SMP
673static inline void inc_prio_bias(runqueue_t *rq, int prio)
674{
675 rq->prio_bias += MAX_PRIO - prio;
676}
677
678static inline void dec_prio_bias(runqueue_t *rq, int prio)
679{
680 rq->prio_bias -= MAX_PRIO - prio;
681}
682
683static inline void inc_nr_running(task_t *p, runqueue_t *rq)
684{
685 rq->nr_running++;
686 if (rt_task(p)) {
687 if (p != rq->migration_thread)
688 /*
689 * The migration thread does the actual balancing. Do
690 * not bias by its priority as the ultra high priority
691 * will skew balancing adversely.
692 */
693 inc_prio_bias(rq, p->prio);
694 } else
695 inc_prio_bias(rq, p->static_prio);
696}
697
698static inline void dec_nr_running(task_t *p, runqueue_t *rq)
699{
700 rq->nr_running--;
701 if (rt_task(p)) {
702 if (p != rq->migration_thread)
703 dec_prio_bias(rq, p->prio);
704 } else
705 dec_prio_bias(rq, p->static_prio);
706}
707#else
708static inline void inc_prio_bias(runqueue_t *rq, int prio)
709{
710}
711
712static inline void dec_prio_bias(runqueue_t *rq, int prio)
713{
714}
715
716static inline void inc_nr_running(task_t *p, runqueue_t *rq)
717{
718 rq->nr_running++;
719}
720
721static inline void dec_nr_running(task_t *p, runqueue_t *rq)
722{
723 rq->nr_running--;
724}
725#endif
726
727/* 671/*
728 * __activate_task - move a task to the runqueue. 672 * __activate_task - move a task to the runqueue.
729 */ 673 */
730static inline void __activate_task(task_t *p, runqueue_t *rq) 674static inline void __activate_task(task_t *p, runqueue_t *rq)
731{ 675{
732 enqueue_task(p, rq->active); 676 enqueue_task(p, rq->active);
733 inc_nr_running(p, rq); 677 rq->nr_running++;
734} 678}
735 679
736/* 680/*
@@ -739,7 +683,7 @@ static inline void __activate_task(task_t *p, runqueue_t *rq)
739static inline void __activate_idle_task(task_t *p, runqueue_t *rq) 683static inline void __activate_idle_task(task_t *p, runqueue_t *rq)
740{ 684{
741 enqueue_task_head(p, rq->active); 685 enqueue_task_head(p, rq->active);
742 inc_nr_running(p, rq); 686 rq->nr_running++;
743} 687}
744 688
745static int recalc_task_prio(task_t *p, unsigned long long now) 689static int recalc_task_prio(task_t *p, unsigned long long now)
@@ -863,7 +807,7 @@ static void activate_task(task_t *p, runqueue_t *rq, int local)
863 */ 807 */
864static void deactivate_task(struct task_struct *p, runqueue_t *rq) 808static void deactivate_task(struct task_struct *p, runqueue_t *rq)
865{ 809{
866 dec_nr_running(p, rq); 810 rq->nr_running--;
867 dequeue_task(p, p->array); 811 dequeue_task(p, p->array);
868 p->array = NULL; 812 p->array = NULL;
869} 813}
@@ -1007,61 +951,27 @@ void kick_process(task_t *p)
1007 * We want to under-estimate the load of migration sources, to 951 * We want to under-estimate the load of migration sources, to
1008 * balance conservatively. 952 * balance conservatively.
1009 */ 953 */
1010static unsigned long __source_load(int cpu, int type, enum idle_type idle) 954static inline unsigned long source_load(int cpu, int type)
1011{ 955{
1012 runqueue_t *rq = cpu_rq(cpu); 956 runqueue_t *rq = cpu_rq(cpu);
1013 unsigned long running = rq->nr_running; 957 unsigned long load_now = rq->nr_running * SCHED_LOAD_SCALE;
1014 unsigned long source_load, cpu_load = rq->cpu_load[type-1],
1015 load_now = running * SCHED_LOAD_SCALE;
1016
1017 if (type == 0) 958 if (type == 0)
1018 source_load = load_now; 959 return load_now;
1019 else
1020 source_load = min(cpu_load, load_now);
1021
1022 if (running > 1 || (idle == NOT_IDLE && running))
1023 /*
1024 * If we are busy rebalancing the load is biased by
1025 * priority to create 'nice' support across cpus. When
1026 * idle rebalancing we should only bias the source_load if
1027 * there is more than one task running on that queue to
1028 * prevent idle rebalance from trying to pull tasks from a
1029 * queue with only one running task.
1030 */
1031 source_load = source_load * rq->prio_bias / running;
1032 960
1033 return source_load; 961 return min(rq->cpu_load[type-1], load_now);
1034}
1035
1036static inline unsigned long source_load(int cpu, int type)
1037{
1038 return __source_load(cpu, type, NOT_IDLE);
1039} 962}
1040 963
1041/* 964/*
1042 * Return a high guess at the load of a migration-target cpu 965 * Return a high guess at the load of a migration-target cpu
1043 */ 966 */
1044static inline unsigned long __target_load(int cpu, int type, enum idle_type idle) 967static inline unsigned long target_load(int cpu, int type)
1045{ 968{
1046 runqueue_t *rq = cpu_rq(cpu); 969 runqueue_t *rq = cpu_rq(cpu);
1047 unsigned long running = rq->nr_running; 970 unsigned long load_now = rq->nr_running * SCHED_LOAD_SCALE;
1048 unsigned long target_load, cpu_load = rq->cpu_load[type-1],
1049 load_now = running * SCHED_LOAD_SCALE;
1050
1051 if (type == 0) 971 if (type == 0)
1052 target_load = load_now; 972 return load_now;
1053 else
1054 target_load = max(cpu_load, load_now);
1055 973
1056 if (running > 1 || (idle == NOT_IDLE && running)) 974 return max(rq->cpu_load[type-1], load_now);
1057 target_load = target_load * rq->prio_bias / running;
1058
1059 return target_load;
1060}
1061
1062static inline unsigned long target_load(int cpu, int type)
1063{
1064 return __target_load(cpu, type, NOT_IDLE);
1065} 975}
1066 976
1067/* 977/*
@@ -1530,7 +1440,7 @@ void fastcall wake_up_new_task(task_t *p, unsigned long clone_flags)
1530 list_add_tail(&p->run_list, &current->run_list); 1440 list_add_tail(&p->run_list, &current->run_list);
1531 p->array = current->array; 1441 p->array = current->array;
1532 p->array->nr_active++; 1442 p->array->nr_active++;
1533 inc_nr_running(p, rq); 1443 rq->nr_running++;
1534 } 1444 }
1535 set_need_resched(); 1445 set_need_resched();
1536 } else 1446 } else
@@ -1875,9 +1785,9 @@ void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t *p,
1875 runqueue_t *this_rq, prio_array_t *this_array, int this_cpu) 1785 runqueue_t *this_rq, prio_array_t *this_array, int this_cpu)
1876{ 1786{
1877 dequeue_task(p, src_array); 1787 dequeue_task(p, src_array);
1878 dec_nr_running(p, src_rq); 1788 src_rq->nr_running--;
1879 set_task_cpu(p, this_cpu); 1789 set_task_cpu(p, this_cpu);
1880 inc_nr_running(p, this_rq); 1790 this_rq->nr_running++;
1881 enqueue_task(p, this_array); 1791 enqueue_task(p, this_array);
1882 p->timestamp = (p->timestamp - src_rq->timestamp_last_tick) 1792 p->timestamp = (p->timestamp - src_rq->timestamp_last_tick)
1883 + this_rq->timestamp_last_tick; 1793 + this_rq->timestamp_last_tick;
@@ -2056,9 +1966,9 @@ find_busiest_group(struct sched_domain *sd, int this_cpu,
2056 1966
2057 /* Bias balancing toward cpus of our domain */ 1967 /* Bias balancing toward cpus of our domain */
2058 if (local_group) 1968 if (local_group)
2059 load = __target_load(i, load_idx, idle); 1969 load = target_load(i, load_idx);
2060 else 1970 else
2061 load = __source_load(i, load_idx, idle); 1971 load = source_load(i, load_idx);
2062 1972
2063 avg_load += load; 1973 avg_load += load;
2064 } 1974 }
@@ -2171,7 +2081,7 @@ static runqueue_t *find_busiest_queue(struct sched_group *group,
2171 int i; 2081 int i;
2172 2082
2173 for_each_cpu_mask(i, group->cpumask) { 2083 for_each_cpu_mask(i, group->cpumask) {
2174 load = __source_load(i, 0, idle); 2084 load = source_load(i, 0);
2175 2085
2176 if (load > max_load) { 2086 if (load > max_load) {
2177 max_load = load; 2087 max_load = load;
@@ -3571,10 +3481,8 @@ void set_user_nice(task_t *p, long nice)
3571 goto out_unlock; 3481 goto out_unlock;
3572 } 3482 }
3573 array = p->array; 3483 array = p->array;
3574 if (array) { 3484 if (array)
3575 dequeue_task(p, array); 3485 dequeue_task(p, array);
3576 dec_prio_bias(rq, p->static_prio);
3577 }
3578 3486
3579 old_prio = p->prio; 3487 old_prio = p->prio;
3580 new_prio = NICE_TO_PRIO(nice); 3488 new_prio = NICE_TO_PRIO(nice);
@@ -3584,7 +3492,6 @@ void set_user_nice(task_t *p, long nice)
3584 3492
3585 if (array) { 3493 if (array) {
3586 enqueue_task(p, array); 3494 enqueue_task(p, array);
3587 inc_prio_bias(rq, p->static_prio);
3588 /* 3495 /*
3589 * If the task increased its priority or is running and 3496 * If the task increased its priority or is running and
3590 * lowered its priority, then reschedule its CPU: 3497 * lowered its priority, then reschedule its CPU:
diff --git a/kernel/signal.c b/kernel/signal.c
index b373fc2420da..ea154104a00b 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2430,7 +2430,7 @@ sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo)
2430} 2430}
2431 2431
2432int 2432int
2433do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact) 2433do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
2434{ 2434{
2435 struct k_sigaction *k; 2435 struct k_sigaction *k;
2436 sigset_t mask; 2436 sigset_t mask;
@@ -2454,6 +2454,8 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
2454 *oact = *k; 2454 *oact = *k;
2455 2455
2456 if (act) { 2456 if (act) {
2457 sigdelsetmask(&act->sa.sa_mask,
2458 sigmask(SIGKILL) | sigmask(SIGSTOP));
2457 /* 2459 /*
2458 * POSIX 3.3.1.3: 2460 * POSIX 3.3.1.3:
2459 * "Setting a signal action to SIG_IGN for a signal that is 2461 * "Setting a signal action to SIG_IGN for a signal that is
@@ -2479,8 +2481,6 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
2479 read_lock(&tasklist_lock); 2481 read_lock(&tasklist_lock);
2480 spin_lock_irq(&t->sighand->siglock); 2482 spin_lock_irq(&t->sighand->siglock);
2481 *k = *act; 2483 *k = *act;
2482 sigdelsetmask(&k->sa.sa_mask,
2483 sigmask(SIGKILL) | sigmask(SIGSTOP));
2484 sigemptyset(&mask); 2484 sigemptyset(&mask);
2485 sigaddset(&mask, sig); 2485 sigaddset(&mask, sig);
2486 rm_from_queue_full(&mask, &t->signal->shared_pending); 2486 rm_from_queue_full(&mask, &t->signal->shared_pending);
@@ -2495,8 +2495,6 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
2495 } 2495 }
2496 2496
2497 *k = *act; 2497 *k = *act;
2498 sigdelsetmask(&k->sa.sa_mask,
2499 sigmask(SIGKILL) | sigmask(SIGSTOP));
2500 } 2498 }
2501 2499
2502 spin_unlock_irq(&current->sighand->siglock); 2500 spin_unlock_irq(&current->sighand->siglock);
@@ -2702,6 +2700,7 @@ sys_signal(int sig, __sighandler_t handler)
2702 2700
2703 new_sa.sa.sa_handler = handler; 2701 new_sa.sa.sa_handler = handler;
2704 new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK; 2702 new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK;
2703 sigemptyset(&new_sa.sa.sa_mask);
2705 2704
2706 ret = do_sigaction(sig, &new_sa, &old_sa); 2705 ret = do_sigaction(sig, &new_sa, &old_sa);
2707 2706
diff --git a/mm/slab.c b/mm/slab.c
index d66c2b0d9715..add05d808a4a 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1717,6 +1717,12 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1717 BUG(); 1717 BUG();
1718 } 1718 }
1719 1719
1720 /*
1721 * Prevent CPUs from coming and going.
1722 * lock_cpu_hotplug() nests outside cache_chain_mutex
1723 */
1724 lock_cpu_hotplug();
1725
1720 mutex_lock(&cache_chain_mutex); 1726 mutex_lock(&cache_chain_mutex);
1721 1727
1722 list_for_each(p, &cache_chain) { 1728 list_for_each(p, &cache_chain) {
@@ -1918,8 +1924,6 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1918 cachep->dtor = dtor; 1924 cachep->dtor = dtor;
1919 cachep->name = name; 1925 cachep->name = name;
1920 1926
1921 /* Don't let CPUs to come and go */
1922 lock_cpu_hotplug();
1923 1927
1924 if (g_cpucache_up == FULL) { 1928 if (g_cpucache_up == FULL) {
1925 enable_cpucache(cachep); 1929 enable_cpucache(cachep);
@@ -1978,12 +1982,12 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1978 1982
1979 /* cache setup completed, link it into the list */ 1983 /* cache setup completed, link it into the list */
1980 list_add(&cachep->next, &cache_chain); 1984 list_add(&cachep->next, &cache_chain);
1981 unlock_cpu_hotplug();
1982 oops: 1985 oops:
1983 if (!cachep && (flags & SLAB_PANIC)) 1986 if (!cachep && (flags & SLAB_PANIC))
1984 panic("kmem_cache_create(): failed to create slab `%s'\n", 1987 panic("kmem_cache_create(): failed to create slab `%s'\n",
1985 name); 1988 name);
1986 mutex_unlock(&cache_chain_mutex); 1989 mutex_unlock(&cache_chain_mutex);
1990 unlock_cpu_hotplug();
1987 return cachep; 1991 return cachep;
1988} 1992}
1989EXPORT_SYMBOL(kmem_cache_create); 1993EXPORT_SYMBOL(kmem_cache_create);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5a610804cd06..5db32fdfaf39 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -632,7 +632,7 @@ static int swap_page(struct page *page)
632 struct address_space *mapping = page_mapping(page); 632 struct address_space *mapping = page_mapping(page);
633 633
634 if (page_mapped(page) && mapping) 634 if (page_mapped(page) && mapping)
635 if (try_to_unmap(page, 0) != SWAP_SUCCESS) 635 if (try_to_unmap(page, 1) != SWAP_SUCCESS)
636 goto unlock_retry; 636 goto unlock_retry;
637 637
638 if (PageDirty(page)) { 638 if (PageDirty(page)) {
@@ -839,7 +839,7 @@ EXPORT_SYMBOL(migrate_page);
839 * pages are swapped out. 839 * pages are swapped out.
840 * 840 *
841 * The function returns after 10 attempts or if no pages 841 * The function returns after 10 attempts or if no pages
842 * are movable anymore because t has become empty 842 * are movable anymore because to has become empty
843 * or no retryable pages exist anymore. 843 * or no retryable pages exist anymore.
844 * 844 *
845 * Return: Number of pages not migrated when "to" ran empty. 845 * Return: Number of pages not migrated when "to" ran empty.
@@ -928,12 +928,21 @@ redo:
928 goto unlock_both; 928 goto unlock_both;
929 929
930 if (mapping->a_ops->migratepage) { 930 if (mapping->a_ops->migratepage) {
931 /*
932 * Most pages have a mapping and most filesystems
933 * should provide a migration function. Anonymous
934 * pages are part of swap space which also has its
935 * own migration function. This is the most common
936 * path for page migration.
937 */
931 rc = mapping->a_ops->migratepage(newpage, page); 938 rc = mapping->a_ops->migratepage(newpage, page);
932 goto unlock_both; 939 goto unlock_both;
933 } 940 }
934 941
935 /* 942 /*
936 * Trigger writeout if page is dirty 943 * Default handling if a filesystem does not provide
944 * a migration function. We can only migrate clean
945 * pages so try to write out any dirty pages first.
937 */ 946 */
938 if (PageDirty(page)) { 947 if (PageDirty(page)) {
939 switch (pageout(page, mapping)) { 948 switch (pageout(page, mapping)) {
@@ -949,9 +958,10 @@ redo:
949 ; /* try to migrate the page below */ 958 ; /* try to migrate the page below */
950 } 959 }
951 } 960 }
961
952 /* 962 /*
953 * If we have no buffer or can release the buffer 963 * Buffers are managed in a filesystem specific way.
954 * then do a simple migration. 964 * We must have no buffers or drop them.
955 */ 965 */
956 if (!page_has_buffers(page) || 966 if (!page_has_buffers(page) ||
957 try_to_release_page(page, GFP_KERNEL)) { 967 try_to_release_page(page, GFP_KERNEL)) {
@@ -966,6 +976,11 @@ redo:
966 * swap them out. 976 * swap them out.
967 */ 977 */
968 if (pass > 4) { 978 if (pass > 4) {
979 /*
980 * Persistently unable to drop buffers..... As a
981 * measure of last resort we fall back to
982 * swap_page().
983 */
969 unlock_page(newpage); 984 unlock_page(newpage);
970 newpage = NULL; 985 newpage = NULL;
971 rc = swap_page(page); 986 rc = swap_page(page);
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index da687c8dc6ff..7fa3a5a9971f 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -79,9 +79,14 @@ static int port_cost(struct net_device *dev)
79 */ 79 */
80static void port_carrier_check(void *arg) 80static void port_carrier_check(void *arg)
81{ 81{
82 struct net_bridge_port *p = arg; 82 struct net_device *dev = arg;
83 struct net_bridge_port *p;
83 84
84 rtnl_lock(); 85 rtnl_lock();
86 p = dev->br_port;
87 if (!p)
88 goto done;
89
85 if (netif_carrier_ok(p->dev)) { 90 if (netif_carrier_ok(p->dev)) {
86 u32 cost = port_cost(p->dev); 91 u32 cost = port_cost(p->dev);
87 92
@@ -97,19 +102,33 @@ static void port_carrier_check(void *arg)
97 br_stp_disable_port(p); 102 br_stp_disable_port(p);
98 spin_unlock_bh(&p->br->lock); 103 spin_unlock_bh(&p->br->lock);
99 } 104 }
105done:
100 rtnl_unlock(); 106 rtnl_unlock();
101} 107}
102 108
109static void release_nbp(struct kobject *kobj)
110{
111 struct net_bridge_port *p
112 = container_of(kobj, struct net_bridge_port, kobj);
113 kfree(p);
114}
115
116static struct kobj_type brport_ktype = {
117#ifdef CONFIG_SYSFS
118 .sysfs_ops = &brport_sysfs_ops,
119#endif
120 .release = release_nbp,
121};
122
103static void destroy_nbp(struct net_bridge_port *p) 123static void destroy_nbp(struct net_bridge_port *p)
104{ 124{
105 struct net_device *dev = p->dev; 125 struct net_device *dev = p->dev;
106 126
107 dev->br_port = NULL;
108 p->br = NULL; 127 p->br = NULL;
109 p->dev = NULL; 128 p->dev = NULL;
110 dev_put(dev); 129 dev_put(dev);
111 130
112 br_sysfs_freeif(p); 131 kobject_put(&p->kobj);
113} 132}
114 133
115static void destroy_nbp_rcu(struct rcu_head *head) 134static void destroy_nbp_rcu(struct rcu_head *head)
@@ -133,24 +152,24 @@ static void del_nbp(struct net_bridge_port *p)
133 struct net_bridge *br = p->br; 152 struct net_bridge *br = p->br;
134 struct net_device *dev = p->dev; 153 struct net_device *dev = p->dev;
135 154
136 /* Race between RTNL notify and RCU callback */ 155 sysfs_remove_link(&br->ifobj, dev->name);
137 if (p->deleted)
138 return;
139 156
140 dev_set_promiscuity(dev, -1); 157 dev_set_promiscuity(dev, -1);
141 158
142 cancel_delayed_work(&p->carrier_check); 159 cancel_delayed_work(&p->carrier_check);
143 flush_scheduled_work();
144 160
145 spin_lock_bh(&br->lock); 161 spin_lock_bh(&br->lock);
146 br_stp_disable_port(p); 162 br_stp_disable_port(p);
147 p->deleted = 1;
148 spin_unlock_bh(&br->lock); 163 spin_unlock_bh(&br->lock);
149 164
150 br_fdb_delete_by_port(br, p); 165 br_fdb_delete_by_port(br, p);
151 166
152 list_del_rcu(&p->list); 167 list_del_rcu(&p->list);
153 168
169 rcu_assign_pointer(dev->br_port, NULL);
170
171 kobject_del(&p->kobj);
172
154 call_rcu(&p->rcu, destroy_nbp_rcu); 173 call_rcu(&p->rcu, destroy_nbp_rcu);
155} 174}
156 175
@@ -160,7 +179,6 @@ static void del_br(struct net_bridge *br)
160 struct net_bridge_port *p, *n; 179 struct net_bridge_port *p, *n;
161 180
162 list_for_each_entry_safe(p, n, &br->port_list, list) { 181 list_for_each_entry_safe(p, n, &br->port_list, list) {
163 br_sysfs_removeif(p);
164 del_nbp(p); 182 del_nbp(p);
165 } 183 }
166 184
@@ -254,13 +272,17 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
254 p->dev = dev; 272 p->dev = dev;
255 p->path_cost = port_cost(dev); 273 p->path_cost = port_cost(dev);
256 p->priority = 0x8000 >> BR_PORT_BITS; 274 p->priority = 0x8000 >> BR_PORT_BITS;
257 dev->br_port = p;
258 p->port_no = index; 275 p->port_no = index;
259 br_init_port(p); 276 br_init_port(p);
260 p->state = BR_STATE_DISABLED; 277 p->state = BR_STATE_DISABLED;
261 INIT_WORK(&p->carrier_check, port_carrier_check, p); 278 INIT_WORK(&p->carrier_check, port_carrier_check, dev);
262 kobject_init(&p->kobj); 279 kobject_init(&p->kobj);
263 280
281 kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
282 p->kobj.ktype = &brport_ktype;
283 p->kobj.parent = &(dev->class_dev.kobj);
284 p->kobj.kset = NULL;
285
264 return p; 286 return p;
265} 287}
266 288
@@ -388,30 +410,43 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
388 if (dev->br_port != NULL) 410 if (dev->br_port != NULL)
389 return -EBUSY; 411 return -EBUSY;
390 412
391 if (IS_ERR(p = new_nbp(br, dev))) 413 p = new_nbp(br, dev);
414 if (IS_ERR(p))
392 return PTR_ERR(p); 415 return PTR_ERR(p);
393 416
394 if ((err = br_fdb_insert(br, p, dev->dev_addr))) 417 err = kobject_add(&p->kobj);
395 destroy_nbp(p); 418 if (err)
396 419 goto err0;
397 else if ((err = br_sysfs_addif(p)))
398 del_nbp(p);
399 else {
400 dev_set_promiscuity(dev, 1);
401 420
402 list_add_rcu(&p->list, &br->port_list); 421 err = br_fdb_insert(br, p, dev->dev_addr);
422 if (err)
423 goto err1;
403 424
404 spin_lock_bh(&br->lock); 425 err = br_sysfs_addif(p);
405 br_stp_recalculate_bridge_id(br); 426 if (err)
406 br_features_recompute(br); 427 goto err2;
407 if ((br->dev->flags & IFF_UP)
408 && (dev->flags & IFF_UP) && netif_carrier_ok(dev))
409 br_stp_enable_port(p);
410 spin_unlock_bh(&br->lock);
411 428
412 dev_set_mtu(br->dev, br_min_mtu(br)); 429 rcu_assign_pointer(dev->br_port, p);
413 } 430 dev_set_promiscuity(dev, 1);
431
432 list_add_rcu(&p->list, &br->port_list);
414 433
434 spin_lock_bh(&br->lock);
435 br_stp_recalculate_bridge_id(br);
436 br_features_recompute(br);
437 schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE);
438 spin_unlock_bh(&br->lock);
439
440 dev_set_mtu(br->dev, br_min_mtu(br));
441 kobject_uevent(&p->kobj, KOBJ_ADD);
442
443 return 0;
444err2:
445 br_fdb_delete_by_port(br, p);
446err1:
447 kobject_del(&p->kobj);
448err0:
449 kobject_put(&p->kobj);
415 return err; 450 return err;
416} 451}
417 452
@@ -423,7 +458,6 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
423 if (!p || p->br != br) 458 if (!p || p->br != br)
424 return -EINVAL; 459 return -EINVAL;
425 460
426 br_sysfs_removeif(p);
427 del_nbp(p); 461 del_nbp(p);
428 462
429 spin_lock_bh(&br->lock); 463 spin_lock_bh(&br->lock);
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index e3a73cead6b6..4eef83755315 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -45,18 +45,20 @@ static void br_pass_frame_up(struct net_bridge *br, struct sk_buff *skb)
45int br_handle_frame_finish(struct sk_buff *skb) 45int br_handle_frame_finish(struct sk_buff *skb)
46{ 46{
47 const unsigned char *dest = eth_hdr(skb)->h_dest; 47 const unsigned char *dest = eth_hdr(skb)->h_dest;
48 struct net_bridge_port *p = skb->dev->br_port; 48 struct net_bridge_port *p = rcu_dereference(skb->dev->br_port);
49 struct net_bridge *br = p->br; 49 struct net_bridge *br;
50 struct net_bridge_fdb_entry *dst; 50 struct net_bridge_fdb_entry *dst;
51 int passedup = 0; 51 int passedup = 0;
52 52
53 if (!p || p->state == BR_STATE_DISABLED)
54 goto drop;
55
53 /* insert into forwarding database after filtering to avoid spoofing */ 56 /* insert into forwarding database after filtering to avoid spoofing */
54 br_fdb_update(p->br, p, eth_hdr(skb)->h_source); 57 br = p->br;
58 br_fdb_update(br, p, eth_hdr(skb)->h_source);
55 59
56 if (p->state == BR_STATE_LEARNING) { 60 if (p->state == BR_STATE_LEARNING)
57 kfree_skb(skb); 61 goto drop;
58 goto out;
59 }
60 62
61 if (br->dev->flags & IFF_PROMISC) { 63 if (br->dev->flags & IFF_PROMISC) {
62 struct sk_buff *skb2; 64 struct sk_buff *skb2;
@@ -93,6 +95,9 @@ int br_handle_frame_finish(struct sk_buff *skb)
93 95
94out: 96out:
95 return 0; 97 return 0;
98drop:
99 kfree_skb(skb);
100 goto out;
96} 101}
97 102
98/* 103/*
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 7cac3fb9f809..b5018166b0e5 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -51,9 +51,6 @@
51#define store_orig_dstaddr(skb) (skb_origaddr(skb) = (skb)->nh.iph->daddr) 51#define store_orig_dstaddr(skb) (skb_origaddr(skb) = (skb)->nh.iph->daddr)
52#define dnat_took_place(skb) (skb_origaddr(skb) != (skb)->nh.iph->daddr) 52#define dnat_took_place(skb) (skb_origaddr(skb) != (skb)->nh.iph->daddr)
53 53
54#define has_bridge_parent(device) ((device)->br_port != NULL)
55#define bridge_parent(device) ((device)->br_port->br->dev)
56
57#ifdef CONFIG_SYSCTL 54#ifdef CONFIG_SYSCTL
58static struct ctl_table_header *brnf_sysctl_header; 55static struct ctl_table_header *brnf_sysctl_header;
59static int brnf_call_iptables = 1; 56static int brnf_call_iptables = 1;
@@ -98,6 +95,12 @@ static struct rtable __fake_rtable = {
98 .rt_flags = 0, 95 .rt_flags = 0,
99}; 96};
100 97
98static inline struct net_device *bridge_parent(const struct net_device *dev)
99{
100 struct net_bridge_port *port = rcu_dereference(dev->br_port);
101
102 return port ? port->br->dev : NULL;
103}
101 104
102/* PF_BRIDGE/PRE_ROUTING *********************************************/ 105/* PF_BRIDGE/PRE_ROUTING *********************************************/
103/* Undo the changes made for ip6tables PREROUTING and continue the 106/* Undo the changes made for ip6tables PREROUTING and continue the
@@ -189,11 +192,15 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
189 skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; 192 skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
190 193
191 skb->dev = bridge_parent(skb->dev); 194 skb->dev = bridge_parent(skb->dev);
192 if (skb->protocol == __constant_htons(ETH_P_8021Q)) { 195 if (!skb->dev)
193 skb_pull(skb, VLAN_HLEN); 196 kfree_skb(skb);
194 skb->nh.raw += VLAN_HLEN; 197 else {
198 if (skb->protocol == __constant_htons(ETH_P_8021Q)) {
199 skb_pull(skb, VLAN_HLEN);
200 skb->nh.raw += VLAN_HLEN;
201 }
202 skb->dst->output(skb);
195 } 203 }
196 skb->dst->output(skb);
197 return 0; 204 return 0;
198} 205}
199 206
@@ -270,7 +277,7 @@ bridged_dnat:
270} 277}
271 278
272/* Some common code for IPv4/IPv6 */ 279/* Some common code for IPv4/IPv6 */
273static void setup_pre_routing(struct sk_buff *skb) 280static struct net_device *setup_pre_routing(struct sk_buff *skb)
274{ 281{
275 struct nf_bridge_info *nf_bridge = skb->nf_bridge; 282 struct nf_bridge_info *nf_bridge = skb->nf_bridge;
276 283
@@ -282,6 +289,8 @@ static void setup_pre_routing(struct sk_buff *skb)
282 nf_bridge->mask |= BRNF_NF_BRIDGE_PREROUTING; 289 nf_bridge->mask |= BRNF_NF_BRIDGE_PREROUTING;
283 nf_bridge->physindev = skb->dev; 290 nf_bridge->physindev = skb->dev;
284 skb->dev = bridge_parent(skb->dev); 291 skb->dev = bridge_parent(skb->dev);
292
293 return skb->dev;
285} 294}
286 295
287/* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */ 296/* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */
@@ -376,7 +385,8 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook,
376 nf_bridge_put(skb->nf_bridge); 385 nf_bridge_put(skb->nf_bridge);
377 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) 386 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL)
378 return NF_DROP; 387 return NF_DROP;
379 setup_pre_routing(skb); 388 if (!setup_pre_routing(skb))
389 return NF_DROP;
380 390
381 NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL, 391 NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL,
382 br_nf_pre_routing_finish_ipv6); 392 br_nf_pre_routing_finish_ipv6);
@@ -465,7 +475,8 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,
465 nf_bridge_put(skb->nf_bridge); 475 nf_bridge_put(skb->nf_bridge);
466 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) 476 if ((nf_bridge = nf_bridge_alloc(skb)) == NULL)
467 return NF_DROP; 477 return NF_DROP;
468 setup_pre_routing(skb); 478 if (!setup_pre_routing(skb))
479 return NF_DROP;
469 store_orig_dstaddr(skb); 480 store_orig_dstaddr(skb);
470 481
471 NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL, 482 NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL,
@@ -539,11 +550,16 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff **pskb,
539 struct sk_buff *skb = *pskb; 550 struct sk_buff *skb = *pskb;
540 struct nf_bridge_info *nf_bridge; 551 struct nf_bridge_info *nf_bridge;
541 struct vlan_ethhdr *hdr = vlan_eth_hdr(skb); 552 struct vlan_ethhdr *hdr = vlan_eth_hdr(skb);
553 struct net_device *parent;
542 int pf; 554 int pf;
543 555
544 if (!skb->nf_bridge) 556 if (!skb->nf_bridge)
545 return NF_ACCEPT; 557 return NF_ACCEPT;
546 558
559 parent = bridge_parent(out);
560 if (!parent)
561 return NF_DROP;
562
547 if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) 563 if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP)
548 pf = PF_INET; 564 pf = PF_INET;
549 else 565 else
@@ -564,8 +580,8 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff **pskb,
564 nf_bridge->mask |= BRNF_BRIDGED; 580 nf_bridge->mask |= BRNF_BRIDGED;
565 nf_bridge->physoutdev = skb->dev; 581 nf_bridge->physoutdev = skb->dev;
566 582
567 NF_HOOK(pf, NF_IP_FORWARD, skb, bridge_parent(in), 583 NF_HOOK(pf, NF_IP_FORWARD, skb, bridge_parent(in), parent,
568 bridge_parent(out), br_nf_forward_finish); 584 br_nf_forward_finish);
569 585
570 return NF_STOLEN; 586 return NF_STOLEN;
571} 587}
@@ -688,6 +704,8 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb,
688 goto out; 704 goto out;
689 } 705 }
690 realoutdev = bridge_parent(skb->dev); 706 realoutdev = bridge_parent(skb->dev);
707 if (!realoutdev)
708 return NF_DROP;
691 709
692#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 710#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
693 /* iptables should match -o br0.x */ 711 /* iptables should match -o br0.x */
@@ -701,9 +719,11 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb,
701 /* IP forwarded traffic has a physindev, locally 719 /* IP forwarded traffic has a physindev, locally
702 * generated traffic hasn't. */ 720 * generated traffic hasn't. */
703 if (realindev != NULL) { 721 if (realindev != NULL) {
704 if (!(nf_bridge->mask & BRNF_DONT_TAKE_PARENT) && 722 if (!(nf_bridge->mask & BRNF_DONT_TAKE_PARENT) ) {
705 has_bridge_parent(realindev)) 723 struct net_device *parent = bridge_parent(realindev);
706 realindev = bridge_parent(realindev); 724 if (parent)
725 realindev = parent;
726 }
707 727
708 NF_HOOK_THRESH(pf, NF_IP_FORWARD, skb, realindev, 728 NF_HOOK_THRESH(pf, NF_IP_FORWARD, skb, realindev,
709 realoutdev, br_nf_local_out_finish, 729 realoutdev, br_nf_local_out_finish,
@@ -743,6 +763,9 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb,
743 if (!nf_bridge) 763 if (!nf_bridge)
744 return NF_ACCEPT; 764 return NF_ACCEPT;
745 765
766 if (!realoutdev)
767 return NF_DROP;
768
746 if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) 769 if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP)
747 pf = PF_INET; 770 pf = PF_INET;
748 else 771 else
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index e330b17b6d81..8f10e09f251b 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -68,7 +68,6 @@ struct net_bridge_port
68 /* STP */ 68 /* STP */
69 u8 priority; 69 u8 priority;
70 u8 state; 70 u8 state;
71 u8 deleted;
72 u16 port_no; 71 u16 port_no;
73 unsigned char topology_change_ack; 72 unsigned char topology_change_ack;
74 unsigned char config_pending; 73 unsigned char config_pending;
@@ -233,9 +232,8 @@ extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
233 232
234#ifdef CONFIG_SYSFS 233#ifdef CONFIG_SYSFS
235/* br_sysfs_if.c */ 234/* br_sysfs_if.c */
235extern struct sysfs_ops brport_sysfs_ops;
236extern int br_sysfs_addif(struct net_bridge_port *p); 236extern int br_sysfs_addif(struct net_bridge_port *p);
237extern void br_sysfs_removeif(struct net_bridge_port *p);
238extern void br_sysfs_freeif(struct net_bridge_port *p);
239 237
240/* br_sysfs_br.c */ 238/* br_sysfs_br.c */
241extern int br_sysfs_addbr(struct net_device *dev); 239extern int br_sysfs_addbr(struct net_device *dev);
@@ -244,8 +242,6 @@ extern void br_sysfs_delbr(struct net_device *dev);
244#else 242#else
245 243
246#define br_sysfs_addif(p) (0) 244#define br_sysfs_addif(p) (0)
247#define br_sysfs_removeif(p) do { } while(0)
248#define br_sysfs_freeif(p) kfree(p)
249#define br_sysfs_addbr(dev) (0) 245#define br_sysfs_addbr(dev) (0)
250#define br_sysfs_delbr(dev) do { } while(0) 246#define br_sysfs_delbr(dev) do { } while(0)
251#endif /* CONFIG_SYSFS */ 247#endif /* CONFIG_SYSFS */
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index d071f1c9ad0b..296f6a487c52 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -133,29 +133,35 @@ void br_send_tcn_bpdu(struct net_bridge_port *p)
133 133
134static const unsigned char header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00}; 134static const unsigned char header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00};
135 135
136/* NO locks */ 136/* NO locks, but rcu_read_lock (preempt_disabled) */
137int br_stp_handle_bpdu(struct sk_buff *skb) 137int br_stp_handle_bpdu(struct sk_buff *skb)
138{ 138{
139 struct net_bridge_port *p = skb->dev->br_port; 139 struct net_bridge_port *p = rcu_dereference(skb->dev->br_port);
140 struct net_bridge *br = p->br; 140 struct net_bridge *br;
141 unsigned char *buf; 141 unsigned char *buf;
142 142
143 if (!p)
144 goto err;
145
146 br = p->br;
147 spin_lock(&br->lock);
148
149 if (p->state == BR_STATE_DISABLED || !(br->dev->flags & IFF_UP))
150 goto out;
151
143 /* insert into forwarding database after filtering to avoid spoofing */ 152 /* insert into forwarding database after filtering to avoid spoofing */
144 br_fdb_update(p->br, p, eth_hdr(skb)->h_source); 153 br_fdb_update(br, p, eth_hdr(skb)->h_source);
154
155 if (!br->stp_enabled)
156 goto out;
145 157
146 /* need at least the 802 and STP headers */ 158 /* need at least the 802 and STP headers */
147 if (!pskb_may_pull(skb, sizeof(header)+1) || 159 if (!pskb_may_pull(skb, sizeof(header)+1) ||
148 memcmp(skb->data, header, sizeof(header))) 160 memcmp(skb->data, header, sizeof(header)))
149 goto err; 161 goto out;
150 162
151 buf = skb_pull(skb, sizeof(header)); 163 buf = skb_pull(skb, sizeof(header));
152 164
153 spin_lock_bh(&br->lock);
154 if (p->state == BR_STATE_DISABLED
155 || !(br->dev->flags & IFF_UP)
156 || !br->stp_enabled)
157 goto out;
158
159 if (buf[0] == BPDU_TYPE_CONFIG) { 165 if (buf[0] == BPDU_TYPE_CONFIG) {
160 struct br_config_bpdu bpdu; 166 struct br_config_bpdu bpdu;
161 167
@@ -201,7 +207,7 @@ int br_stp_handle_bpdu(struct sk_buff *skb)
201 br_received_tcn_bpdu(p); 207 br_received_tcn_bpdu(p);
202 } 208 }
203 out: 209 out:
204 spin_unlock_bh(&br->lock); 210 spin_unlock(&br->lock);
205 err: 211 err:
206 kfree_skb(skb); 212 kfree_skb(skb);
207 return 0; 213 return 0;
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index 0ac0355d16dd..c51c9e42aeb3 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -195,23 +195,11 @@ static ssize_t brport_store(struct kobject * kobj,
195 return ret; 195 return ret;
196} 196}
197 197
198/* called from kobject_put when port ref count goes to zero. */ 198struct sysfs_ops brport_sysfs_ops = {
199static void brport_release(struct kobject *kobj)
200{
201 kfree(container_of(kobj, struct net_bridge_port, kobj));
202}
203
204static struct sysfs_ops brport_sysfs_ops = {
205 .show = brport_show, 199 .show = brport_show,
206 .store = brport_store, 200 .store = brport_store,
207}; 201};
208 202
209static struct kobj_type brport_ktype = {
210 .sysfs_ops = &brport_sysfs_ops,
211 .release = brport_release,
212};
213
214
215/* 203/*
216 * Add sysfs entries to ethernet device added to a bridge. 204 * Add sysfs entries to ethernet device added to a bridge.
217 * Creates a brport subdirectory with bridge attributes. 205 * Creates a brport subdirectory with bridge attributes.
@@ -223,17 +211,6 @@ int br_sysfs_addif(struct net_bridge_port *p)
223 struct brport_attribute **a; 211 struct brport_attribute **a;
224 int err; 212 int err;
225 213
226 ASSERT_RTNL();
227
228 kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
229 p->kobj.ktype = &brport_ktype;
230 p->kobj.parent = &(p->dev->class_dev.kobj);
231 p->kobj.kset = NULL;
232
233 err = kobject_add(&p->kobj);
234 if(err)
235 goto out1;
236
237 err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj, 214 err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj,
238 SYSFS_BRIDGE_PORT_LINK); 215 SYSFS_BRIDGE_PORT_LINK);
239 if (err) 216 if (err)
@@ -245,28 +222,7 @@ int br_sysfs_addif(struct net_bridge_port *p)
245 goto out2; 222 goto out2;
246 } 223 }
247 224
248 err = sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name); 225 err= sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name);
249 if (err) 226out2:
250 goto out2;
251
252 kobject_uevent(&p->kobj, KOBJ_ADD);
253 return 0;
254 out2:
255 kobject_del(&p->kobj);
256 out1:
257 return err; 227 return err;
258} 228}
259
260void br_sysfs_removeif(struct net_bridge_port *p)
261{
262 pr_debug("br_sysfs_removeif\n");
263 sysfs_remove_link(&p->br->ifobj, p->dev->name);
264 kobject_uevent(&p->kobj, KOBJ_REMOVE);
265 kobject_del(&p->kobj);
266}
267
268void br_sysfs_freeif(struct net_bridge_port *p)
269{
270 pr_debug("br_sysfs_freeif\n");
271 kobject_put(&p->kobj);
272}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 8700379685e0..eca2976abb25 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -455,7 +455,7 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
455 if (!skb) 455 if (!skb)
456 return; 456 return;
457 457
458 if (rtnetlink_fill_ifinfo(skb, dev, type, current->pid, 0, change, 0) < 0) { 458 if (rtnetlink_fill_ifinfo(skb, dev, type, 0, 0, change, 0) < 0) {
459 kfree_skb(skb); 459 kfree_skb(skb);
460 return; 460 return;
461 } 461 }
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 95b9d81ac488..3ffa60dadc0c 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1135,7 +1135,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa)
1135 1135
1136 if (!skb) 1136 if (!skb)
1137 netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS); 1137 netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS);
1138 else if (inet_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) { 1138 else if (inet_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) {
1139 kfree_skb(skb); 1139 kfree_skb(skb);
1140 netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL); 1140 netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL);
1141 } else { 1141 } else {
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index ef4724de7350..0f4145babb14 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1045,7 +1045,7 @@ fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm,
1045 } 1045 }
1046 1046
1047 nl->nlmsg_flags = NLM_F_REQUEST; 1047 nl->nlmsg_flags = NLM_F_REQUEST;
1048 nl->nlmsg_pid = current->pid; 1048 nl->nlmsg_pid = 0;
1049 nl->nlmsg_seq = 0; 1049 nl->nlmsg_seq = 0;
1050 nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm)); 1050 nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm));
1051 if (cmd == SIOCDELRT) { 1051 if (cmd == SIOCDELRT) {
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a97ed5416c28..e9a54ae7d690 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -456,7 +456,8 @@ void tcp_rcv_space_adjust(struct sock *sk)
456 456
457 tp->rcvq_space.space = space; 457 tp->rcvq_space.space = space;
458 458
459 if (sysctl_tcp_moderate_rcvbuf) { 459 if (sysctl_tcp_moderate_rcvbuf &&
460 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {
460 int new_clamp = space; 461 int new_clamp = space;
461 462
462 /* Receive space grows, normalize in order to 463 /* Receive space grows, normalize in order to
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c
index 890bac0d4a56..e3debbdb67f5 100644
--- a/net/irda/irda_device.c
+++ b/net/irda/irda_device.c
@@ -343,12 +343,12 @@ static void irda_task_timer_expired(void *data)
343static void irda_device_setup(struct net_device *dev) 343static void irda_device_setup(struct net_device *dev)
344{ 344{
345 dev->hard_header_len = 0; 345 dev->hard_header_len = 0;
346 dev->addr_len = 0; 346 dev->addr_len = LAP_ALEN;
347 347
348 dev->type = ARPHRD_IRDA; 348 dev->type = ARPHRD_IRDA;
349 dev->tx_queue_len = 8; /* Window size + 1 s-frame */ 349 dev->tx_queue_len = 8; /* Window size + 1 s-frame */
350 350
351 memset(dev->broadcast, 0xff, 4); 351 memset(dev->broadcast, 0xff, LAP_ALEN);
352 352
353 dev->mtu = 2048; 353 dev->mtu = 2048;
354 dev->flags = IFF_NOARP; 354 dev->flags = IFF_NOARP;
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c
index 07ec326c71f5..f65c7a83bc5c 100644
--- a/net/irda/irnet/irnet_irda.c
+++ b/net/irda/irnet/irnet_irda.c
@@ -696,7 +696,7 @@ irnet_daddr_to_dname(irnet_socket * self)
696 { 696 {
697 /* Yes !!! Get it.. */ 697 /* Yes !!! Get it.. */
698 strlcpy(self->rname, discoveries[i].info, sizeof(self->rname)); 698 strlcpy(self->rname, discoveries[i].info, sizeof(self->rname));
699 self->rname[NICKNAME_MAX_LEN + 1] = '\0'; 699 self->rname[sizeof(self->rname) - 1] = '\0';
700 DEBUG(IRDA_SERV_INFO, "Device 0x%08x is in fact ``%s''.\n", 700 DEBUG(IRDA_SERV_INFO, "Device 0x%08x is in fact ``%s''.\n",
701 self->daddr, self->rname); 701 self->daddr, self->rname);
702 kfree(discoveries); 702 kfree(discoveries);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 2101b45d2ec6..6b9772d95872 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -702,7 +702,8 @@ struct sock *netlink_getsockbyfilp(struct file *filp)
702 * 0: continue 702 * 0: continue
703 * 1: repeat lookup - reference dropped while waiting for socket memory. 703 * 1: repeat lookup - reference dropped while waiting for socket memory.
704 */ 704 */
705int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo) 705int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
706 long timeo, struct sock *ssk)
706{ 707{
707 struct netlink_sock *nlk; 708 struct netlink_sock *nlk;
708 709
@@ -712,7 +713,7 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long t
712 test_bit(0, &nlk->state)) { 713 test_bit(0, &nlk->state)) {
713 DECLARE_WAITQUEUE(wait, current); 714 DECLARE_WAITQUEUE(wait, current);
714 if (!timeo) { 715 if (!timeo) {
715 if (!nlk->pid) 716 if (!ssk || nlk_sk(ssk)->pid == 0)
716 netlink_overrun(sk); 717 netlink_overrun(sk);
717 sock_put(sk); 718 sock_put(sk);
718 kfree_skb(skb); 719 kfree_skb(skb);
@@ -797,7 +798,7 @@ retry:
797 kfree_skb(skb); 798 kfree_skb(skb);
798 return PTR_ERR(sk); 799 return PTR_ERR(sk);
799 } 800 }
800 err = netlink_attachskb(sk, skb, nonblock, timeo); 801 err = netlink_attachskb(sk, skb, nonblock, timeo, ssk);
801 if (err == 1) 802 if (err == 1)
802 goto retry; 803 goto retry;
803 if (err) 804 if (err)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index d64aae85c378..5760e057ecba 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -123,17 +123,7 @@ KBUILD_HAVE_NLS := $(shell \
123 then echo yes ; \ 123 then echo yes ; \
124 else echo no ; fi) 124 else echo no ; fi)
125ifeq ($(KBUILD_HAVE_NLS),no) 125ifeq ($(KBUILD_HAVE_NLS),no)
126 HOSTCFLAGS += -DKBUILD_NO_NLS 126HOSTCFLAGS += -DKBUILD_NO_NLS
127else
128 KBUILD_NEED_LINTL := $(shell \
129 if echo -e "\#include <libintl.h>\nint main(int a, char** b) { gettext(\"\"); return 0; }\n" | \
130 $(HOSTCC) $(HOSTCFLAGS) -x c - -o /dev/null> /dev/null 2>&1 ; \
131 then echo no ; \
132 else echo yes ; fi)
133 ifeq ($(KBUILD_NEED_LINTL),yes)
134 HOSTLOADLIBES_conf += -lintl
135 HOSTLOADLIBES_mconf += -lintl
136 endif
137endif 127endif
138 128
139# generated files seem to need this to find local include files 129# generated files seem to need this to find local include files