aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt8
-rw-r--r--MAINTAINERS18
-rw-r--r--arch/arm/vfp/vfp.h2
-rw-r--r--arch/arm/vfp/vfpdouble.c14
-rw-r--r--arch/cris/arch-v10/drivers/ds1302.c131
-rw-r--r--arch/cris/arch-v10/kernel/signal.c251
-rw-r--r--arch/cris/arch-v10/kernel/time.c1
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/cobalt/console.c5
-rw-r--r--arch/mips/kernel/setup.c7
-rw-r--r--arch/mips/lasat/image/Makefile6
-rw-r--r--arch/mips/mips-boards/generic/memory.c2
-rw-r--r--arch/mips/mips-boards/generic/reset.c10
-rw-r--r--arch/mips/mm/dma-default.c2
-rw-r--r--arch/mips/pci/fixup-cobalt.c2
-rw-r--r--arch/mips/philips/pnx8550/common/time.c109
-rw-r--r--arch/powerpc/kernel/iommu.c17
-rw-r--r--arch/powerpc/kernel/prom_init.c39
-rw-r--r--arch/powerpc/mm/slb.c2
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c2
-rw-r--r--arch/x86/kernel/apm_32.c10
-rw-r--r--arch/x86/kernel/process_32.c11
-rw-r--r--arch/x86/kernel/process_64.c11
-rw-r--r--block/blktrace.c81
-rw-r--r--drivers/acpi/Kconfig9
-rw-r--r--drivers/acpi/ac.c16
-rw-r--r--drivers/acpi/battery.c31
-rw-r--r--drivers/acpi/bus.c7
-rw-r--r--drivers/acpi/ec.c14
-rw-r--r--drivers/acpi/events/evregion.c8
-rw-r--r--drivers/acpi/pci_irq.c9
-rw-r--r--drivers/acpi/processor_idle.c4
-rw-r--r--drivers/acpi/sbs.c23
-rw-r--r--drivers/acpi/scan.c6
-rw-r--r--drivers/ata/ata_piix.c51
-rw-r--r--drivers/ata/libata-eh.c24
-rw-r--r--drivers/ata/libata-pmp.c12
-rw-r--r--drivers/ata/libata-scsi.c5
-rw-r--r--drivers/ata/libata-sff.c7
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c3
-rw-r--r--drivers/ata/pata_pdc202xx_old.c15
-rw-r--r--drivers/ata/sata_qstor.c2
-rw-r--r--drivers/ata/sata_sil24.c42
-rw-r--r--drivers/block/cciss.c2
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/char/tpm/tpm.c12
-rw-r--r--drivers/crypto/padlock-aes.c4
-rw-r--r--drivers/i2c/busses/i2c-at91.c2
-rw-r--r--drivers/i2c/busses/i2c-omap.c2
-rw-r--r--drivers/i2c/busses/i2c-powermac.c2
-rw-r--r--drivers/i2c/busses/i2c-sibyte.c7
-rw-r--r--drivers/i2c/i2c-dev.c2
-rw-r--r--drivers/ide/ide-acpi.c38
-rw-r--r--drivers/ide/ide-iops.c6
-rw-r--r--drivers/ide/pci/trm290.c29
-rw-r--r--drivers/input/gameport/gameport.c2
-rw-r--r--drivers/input/input.c8
-rw-r--r--drivers/input/keyboard/Kconfig12
-rw-r--r--drivers/input/keyboard/jornada680_kbd.c40
-rw-r--r--drivers/input/keyboard/spitzkbd.c1
-rw-r--r--drivers/input/touchscreen/Kconfig8
-rw-r--r--drivers/macintosh/adbhid.c3
-rw-r--r--drivers/media/dvb/ttpci/av7110.c10
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c4
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c7
-rw-r--r--drivers/net/3c509.c4
-rw-r--r--drivers/net/Kconfig20
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c11
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/netxen/netxen_nic.h69
-rw-r--r--drivers/net/netxen/netxen_nic_init.c20
-rw-r--r--drivers/net/netxen/netxen_nic_main.c70
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c8
-rw-r--r--drivers/net/r8169.c2
-rw-r--r--drivers/net/sky2.c48
-rw-r--r--drivers/net/sky2.h4
-rw-r--r--drivers/net/tulip/de4x5.c127
-rw-r--r--drivers/net/tulip/tulip_core.c3
-rw-r--r--drivers/net/tulip/xircom_cb.c54
-rw-r--r--drivers/net/usb/asix.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c20
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c17
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c12
-rw-r--r--drivers/pci/quirks.c6
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c14
-rw-r--r--drivers/scsi/advansys.c2
-rw-r--r--drivers/scsi/qla1280.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c4
-rw-r--r--drivers/video/atmel_lcdfb.c2
-rw-r--r--drivers/video/ps3fb.c24
-rw-r--r--drivers/video/s3c2410fb.c2
-rw-r--r--drivers/video/uvesafb.c4
-rw-r--r--drivers/w1/w1.c6
-rw-r--r--fs/fs-writeback.c2
-rw-r--r--fs/namei.c4
-rw-r--r--fs/nfs/nfs4_fs.h1
-rw-r--r--fs/nfs/nfs4state.c5
-rw-r--r--fs/nfsd/nfs3xdr.c5
-rw-r--r--fs/nfsd/nfsxdr.c5
-rw-r--r--fs/proc/array.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c16
-rw-r--r--include/asm-arm/arch-pxa/hardware.h24
-rw-r--r--include/asm-arm/system.h13
-rw-r--r--include/asm-cris/unistd.h1
-rw-r--r--include/asm-mips/cacheops.h2
-rw-r--r--include/asm-sh/cacheflush.h6
-rw-r--r--include/asm-sh/uaccess.h42
-rw-r--r--include/linux/i2c-id.h4
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/pm.h9
-rw-r--r--include/linux/pm_legacy.h6
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/scatterlist.h4
-rw-r--r--include/linux/sched.h13
-rw-r--r--include/linux/writeback.h1
-rw-r--r--kernel/module.c29
-rw-r--r--kernel/power/main.c3
-rw-r--r--kernel/power/pm.c4
-rw-r--r--kernel/timer.c2
-rw-r--r--mm/hugetlb.c13
-rw-r--r--mm/page-writeback.c9
-rw-r--r--mm/quicklist.c12
-rw-r--r--sound/oss/msnd.h4
124 files changed, 1096 insertions, 950 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e5b447a0acda..c4178778e7fd 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -883,6 +883,14 @@ and is between 256 and 4096 characters. It is defined in the file
883 lapic_timer_c2_ok [X86-32,x86-64,APIC] trust the local apic timer in 883 lapic_timer_c2_ok [X86-32,x86-64,APIC] trust the local apic timer in
884 C2 power state. 884 C2 power state.
885 885
886 libata.dma= [LIBATA] DMA control
887 libata.dma=0 Disable all PATA and SATA DMA
888 libata.dma=1 PATA and SATA Disk DMA only
889 libata.dma=2 ATAPI (CDROM) DMA only
890 libata.dma=4 Compact Flash DMA only
891 Combinations also work, so libata.dma=3 enables DMA
892 for disks and CDROMs, but not CFs.
893
886 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume 894 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume
887 when set. 895 when set.
888 Format: <int> 896 Format: <int>
diff --git a/MAINTAINERS b/MAINTAINERS
index b4f611c60cfc..2340cfb1e25d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -665,12 +665,18 @@ S: Maintained
665 665
666ATMEL AT91 MCI DRIVER 666ATMEL AT91 MCI DRIVER
667P: Nicolas Ferre 667P: Nicolas Ferre
668M: nicolas.ferre@rfo.atmel.com 668M: nicolas.ferre@atmel.com
669L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 669L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
670W: http://www.atmel.com/products/AT91/ 670W: http://www.atmel.com/products/AT91/
671W: http://www.at91.com/ 671W: http://www.at91.com/
672S: Maintained 672S: Maintained
673 673
674ATMEL LCDFB DRIVER
675P: Nicolas Ferre
676M: nicolas.ferre@atmel.com
677L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
678S: Maintained
679
674ATMEL MACB ETHERNET DRIVER 680ATMEL MACB ETHERNET DRIVER
675P: Haavard Skinnemoen 681P: Haavard Skinnemoen
676M: hskinnemoen@atmel.com 682M: hskinnemoen@atmel.com
@@ -2739,8 +2745,8 @@ T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
2739S: Maintained 2745S: Maintained
2740 2746
2741NETXEN (1/10) GbE SUPPORT 2747NETXEN (1/10) GbE SUPPORT
2742P: Amit S. Kale 2748P: Dhananjay Phadke
2743M: amitkale@netxen.com 2749M: dhananjay@netxen.com
2744L: netdev@vger.kernel.org 2750L: netdev@vger.kernel.org
2745W: http://www.netxen.com 2751W: http://www.netxen.com
2746S: Supported 2752S: Supported
@@ -3611,8 +3617,10 @@ L: linux-kernel@vger.kernel.org ?
3611S: Supported 3617S: Supported
3612 3618
3613SPIDERNET NETWORK DRIVER for CELL 3619SPIDERNET NETWORK DRIVER for CELL
3614P: Linas Vepstas 3620P: Ishizaki Kou
3615M: linas@austin.ibm.com 3621M: kou.ishizaki@toshiba.co.jp
3622P: Jens Osterkamp
3623M: jens@de.ibm.com
3616L: netdev@vger.kernel.org 3624L: netdev@vger.kernel.org
3617S: Supported 3625S: Supported
3618 3626
diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h
index 54a2ad6d9ca2..791d0238c68f 100644
--- a/arch/arm/vfp/vfp.h
+++ b/arch/arm/vfp/vfp.h
@@ -361,10 +361,12 @@ u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand);
361 * OP_SCALAR - this operation always operates in scalar mode 361 * OP_SCALAR - this operation always operates in scalar mode
362 * OP_SD - the instruction exceptionally writes to a single precision result. 362 * OP_SD - the instruction exceptionally writes to a single precision result.
363 * OP_DD - the instruction exceptionally writes to a double precision result. 363 * OP_DD - the instruction exceptionally writes to a double precision result.
364 * OP_SM - the instruction exceptionally reads from a single precision operand.
364 */ 365 */
365#define OP_SCALAR (1 << 0) 366#define OP_SCALAR (1 << 0)
366#define OP_SD (1 << 1) 367#define OP_SD (1 << 1)
367#define OP_DD (1 << 1) 368#define OP_DD (1 << 1)
369#define OP_SM (1 << 2)
368 370
369struct op { 371struct op {
370 u32 (* const fn)(int dd, int dn, int dm, u32 fpscr); 372 u32 (* const fn)(int dd, int dn, int dm, u32 fpscr);
diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c
index 190a09ad18eb..6cac43bd1d86 100644
--- a/arch/arm/vfp/vfpdouble.c
+++ b/arch/arm/vfp/vfpdouble.c
@@ -668,8 +668,8 @@ static struct op fops_ext[32] = {
668 [FEXT_TO_IDX(FEXT_FCMPZ)] = { vfp_double_fcmpz, OP_SCALAR }, 668 [FEXT_TO_IDX(FEXT_FCMPZ)] = { vfp_double_fcmpz, OP_SCALAR },
669 [FEXT_TO_IDX(FEXT_FCMPEZ)] = { vfp_double_fcmpez, OP_SCALAR }, 669 [FEXT_TO_IDX(FEXT_FCMPEZ)] = { vfp_double_fcmpez, OP_SCALAR },
670 [FEXT_TO_IDX(FEXT_FCVT)] = { vfp_double_fcvts, OP_SCALAR|OP_SD }, 670 [FEXT_TO_IDX(FEXT_FCVT)] = { vfp_double_fcvts, OP_SCALAR|OP_SD },
671 [FEXT_TO_IDX(FEXT_FUITO)] = { vfp_double_fuito, OP_SCALAR }, 671 [FEXT_TO_IDX(FEXT_FUITO)] = { vfp_double_fuito, OP_SCALAR|OP_SM },
672 [FEXT_TO_IDX(FEXT_FSITO)] = { vfp_double_fsito, OP_SCALAR }, 672 [FEXT_TO_IDX(FEXT_FSITO)] = { vfp_double_fsito, OP_SCALAR|OP_SM },
673 [FEXT_TO_IDX(FEXT_FTOUI)] = { vfp_double_ftoui, OP_SCALAR|OP_SD }, 673 [FEXT_TO_IDX(FEXT_FTOUI)] = { vfp_double_ftoui, OP_SCALAR|OP_SD },
674 [FEXT_TO_IDX(FEXT_FTOUIZ)] = { vfp_double_ftouiz, OP_SCALAR|OP_SD }, 674 [FEXT_TO_IDX(FEXT_FTOUIZ)] = { vfp_double_ftouiz, OP_SCALAR|OP_SD },
675 [FEXT_TO_IDX(FEXT_FTOSI)] = { vfp_double_ftosi, OP_SCALAR|OP_SD }, 675 [FEXT_TO_IDX(FEXT_FTOSI)] = { vfp_double_ftosi, OP_SCALAR|OP_SD },
@@ -1128,7 +1128,7 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
1128 u32 exceptions = 0; 1128 u32 exceptions = 0;
1129 unsigned int dest; 1129 unsigned int dest;
1130 unsigned int dn = vfp_get_dn(inst); 1130 unsigned int dn = vfp_get_dn(inst);
1131 unsigned int dm = vfp_get_dm(inst); 1131 unsigned int dm;
1132 unsigned int vecitr, veclen, vecstride; 1132 unsigned int vecitr, veclen, vecstride;
1133 struct op *fop; 1133 struct op *fop;
1134 1134
@@ -1146,6 +1146,14 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
1146 dest = vfp_get_dd(inst); 1146 dest = vfp_get_dd(inst);
1147 1147
1148 /* 1148 /*
1149 * f[us]ito takes a sN operand, not a dN operand.
1150 */
1151 if (fop->flags & OP_SM)
1152 dm = vfp_get_sm(inst);
1153 else
1154 dm = vfp_get_dm(inst);
1155
1156 /*
1149 * If destination bank is zero, vector length is always '1'. 1157 * If destination bank is zero, vector length is always '1'.
1150 * ARM DDI0100F C5.1.3, C5.3.2. 1158 * ARM DDI0100F C5.1.3, C5.3.2.
1151 */ 1159 */
diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
index 88eff7f54ea6..1d1936a18133 100644
--- a/arch/cris/arch-v10/drivers/ds1302.c
+++ b/arch/cris/arch-v10/drivers/ds1302.c
@@ -6,136 +6,9 @@
6*! 6*!
7*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init 7*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init
8*! 8*!
9*! $Log: ds1302.c,v $
10*! Revision 1.18 2005/01/24 09:11:26 mikaelam
11*! Minor changes to get DS1302 RTC chip driver to work
12*!
13*! Revision 1.17 2005/01/05 06:11:22 starvik
14*! No need to do local_irq_disable after local_irq_save.
15*!
16*! Revision 1.16 2004/12/13 12:21:52 starvik
17*! Added I/O and DMA allocators from Linux 2.4
18*!
19*! Revision 1.14 2004/08/24 06:48:43 starvik
20*! Whitespace cleanup
21*!
22*! Revision 1.13 2004/05/28 09:26:59 starvik
23*! Modified I2C initialization to work in 2.6.
24*!
25*! Revision 1.12 2004/05/14 07:58:03 starvik
26*! Merge of changes from 2.4
27*!
28*! Revision 1.10 2004/02/04 09:25:12 starvik
29*! Merge of Linux 2.6.2
30*!
31*! Revision 1.9 2003/07/04 08:27:37 starvik
32*! Merge of Linux 2.5.74
33*!
34*! Revision 1.8 2003/04/09 05:20:47 starvik
35*! Merge of Linux 2.5.67
36*!
37*! Revision 1.6 2003/01/09 14:42:51 starvik
38*! Merge of Linux 2.5.55
39*!
40*! Revision 1.4 2002/12/11 13:13:57 starvik
41*! Added arch/ to v10 specific includes
42*! Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)
43*!
44*! Revision 1.3 2002/11/20 11:56:10 starvik
45*! Merge of Linux 2.5.48
46*!
47*! Revision 1.2 2002/11/18 13:16:06 starvik
48*! Linux 2.5 port of latest 2.4 drivers
49*!
50*! Revision 1.15 2002/10/11 16:14:33 johana
51*! Added CONFIG_ETRAX_DS1302_TRICKLE_CHARGE and initial setting of the
52*! trcklecharge register.
53*!
54*! Revision 1.14 2002/10/10 12:15:38 magnusmn
55*! Added support for having the RST signal on bit g0
56*!
57*! Revision 1.13 2002/05/29 15:16:08 johana
58*! Removed unused variables.
59*!
60*! Revision 1.12 2002/04/10 15:35:25 johana
61*! Moved probe function closer to init function and marked it __init.
62*!
63*! Revision 1.11 2001/06/14 12:35:52 jonashg
64*! The ATA hack is back. It is unfortunately the only way to set g27 to output.
65*!
66*! Revision 1.9 2001/06/14 10:00:14 jonashg
67*! No need for tempudelay to be inline anymore (had to adjust the usec to
68*! loops conversion because of this to make it slow enough to be a udelay).
69*!
70*! Revision 1.8 2001/06/14 08:06:32 jonashg
71*! Made tempudelay delay usecs (well, just a tad more).
72*!
73*! Revision 1.7 2001/06/13 14:18:11 jonashg
74*! Only allow processes with SYS_TIME capability to set time and charge.
75*!
76*! Revision 1.6 2001/06/12 15:22:07 jonashg
77*! * Made init function __init.
78*! * Parameter to out_byte() is unsigned char.
79*! * The magic number 42 has got a name.
80*! * Removed comment about /proc (nothing is exported there).
81*!
82*! Revision 1.5 2001/06/12 14:35:13 jonashg
83*! Gave the module a name and added it to printk's.
84*!
85*! Revision 1.4 2001/05/31 14:53:40 jonashg
86*! Made tempudelay() inline so that the watchdog doesn't reset (see
87*! function comment).
88*!
89*! Revision 1.3 2001/03/26 16:03:06 bjornw
90*! Needs linux/config.h
91*!
92*! Revision 1.2 2001/03/20 19:42:00 bjornw
93*! Use the ETRAX prefix on the DS1302 options
94*!
95*! Revision 1.1 2001/03/20 09:13:50 magnusmn
96*! Linux 2.4 port
97*!
98*! Revision 1.10 2000/07/05 15:38:23 bjornw
99*! Dont update kernel time when a RTC_SET_TIME is done
100*!
101*! Revision 1.9 2000/03/02 15:42:59 macce
102*! * Hack to make RTC work on all 2100/2400
103*!
104*! Revision 1.8 2000/02/23 16:59:18 torbjore
105*! added setup of R_GEN_CONFIG when RTC is connected to the generic port.
106*!
107*! Revision 1.7 2000/01/17 15:51:43 johana
108*! Added RTC_SET_CHARGE ioctl to enable trickle charger.
109*!
110*! Revision 1.6 1999/10/27 13:19:47 bjornw
111*! Added update_xtime_from_cmos which reads back the updated RTC into the kernel.
112*! /dev/rtc calls it now.
113*!
114*! Revision 1.5 1999/10/27 12:39:37 bjornw
115*! Disabled superuser check. Anyone can now set the time.
116*!
117*! Revision 1.4 1999/09/02 13:27:46 pkj
118*! Added shadow for R_PORT_PB_CONFIG.
119*! Renamed port_g_shadow to port_g_data_shadow.
120*!
121*! Revision 1.3 1999/09/02 08:28:06 pkj
122*! Made it possible to select either port PB or the generic port for the RST
123*! signal line to the DS1302 RTC.
124*! Also make sure the RST bit is configured as output on Port PB (if used).
125*!
126*! Revision 1.2 1999/09/01 14:47:20 bjornw
127*! Added support for /dev/rtc operations with ioctl RD_TIME and SET_TIME to read
128*! and set the date. Register as major 121.
129*!
130*! Revision 1.1 1999/09/01 09:45:29 bjornw
131*! Implemented a DS1302 RTC driver.
132*!
133*!
134*! --------------------------------------------------------------------------- 9*! ---------------------------------------------------------------------------
135*! 10*!
136*! (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004 Axis Communications AB, LUND, SWEDEN 11*! (C) Copyright 1999-2007 Axis Communications AB, LUND, SWEDEN
137*!
138*! $Id: ds1302.c,v 1.18 2005/01/24 09:11:26 mikaelam Exp $
139*! 12*!
140*!***************************************************************************/ 13*!***************************************************************************/
141 14
@@ -156,6 +29,8 @@
156#include <asm/rtc.h> 29#include <asm/rtc.h>
157#include <asm/arch/io_interface_mux.h> 30#include <asm/arch/io_interface_mux.h>
158 31
32#include "i2c.h"
33
159#define RTC_MAJOR_NR 121 /* local major, change later */ 34#define RTC_MAJOR_NR 121 /* local major, change later */
160 35
161static const char ds1302_name[] = "ds1302"; 36static const char ds1302_name[] = "ds1302";
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
index 41d4a5f93284..b6be705c2a3e 100644
--- a/arch/cris/arch-v10/kernel/signal.c
+++ b/arch/cris/arch-v10/kernel/signal.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * Ideas also taken from arch/arm. 8 * Ideas also taken from arch/arm.
9 * 9 *
10 * Copyright (C) 2000, 2001 Axis Communications AB 10 * Copyright (C) 2000-2007 Axis Communications AB
11 * 11 *
12 * Authors: Bjorn Wesen (bjornw@axis.com) 12 * Authors: Bjorn Wesen (bjornw@axis.com)
13 * 13 *
@@ -40,84 +40,30 @@
40 */ 40 */
41#define RESTART_CRIS_SYS(regs) regs->r10 = regs->orig_r10; regs->irp -= 2; 41#define RESTART_CRIS_SYS(regs) regs->r10 = regs->orig_r10; regs->irp -= 2;
42 42
43int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs); 43void do_signal(int canrestart, struct pt_regs *regs);
44 44
45/* 45/*
46 * Atomically swap in the new signal mask, and wait for a signal. Define 46 * Atomically swap in the new signal mask, and wait for a signal. Define
47 * dummy arguments to be able to reach the regs argument. (Note that this 47 * dummy arguments to be able to reach the regs argument. (Note that this
48 * arrangement relies on old_sigset_t occupying one register.) 48 * arrangement relies on old_sigset_t occupying one register.)
49 */ 49 */
50int 50int sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof,
51sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof, 51 long srp, struct pt_regs *regs)
52 long srp, struct pt_regs *regs)
53{ 52{
54 sigset_t saveset;
55
56 mask &= _BLOCKABLE; 53 mask &= _BLOCKABLE;
57 spin_lock_irq(&current->sighand->siglock); 54 spin_lock_irq(&current->sighand->siglock);
58 saveset = current->blocked; 55 current->saved_sigmask = current->blocked;
59 siginitset(&current->blocked, mask); 56 siginitset(&current->blocked, mask);
60 recalc_sigpending(); 57 recalc_sigpending();
61 spin_unlock_irq(&current->sighand->siglock); 58 spin_unlock_irq(&current->sighand->siglock);
62 59 current->state = TASK_INTERRUPTIBLE;
63 regs->r10 = -EINTR; 60 schedule();
64 while (1) { 61 set_thread_flag(TIF_RESTORE_SIGMASK);
65 current->state = TASK_INTERRUPTIBLE; 62 return -ERESTARTNOHAND;
66 schedule();
67 if (do_signal(0, &saveset, regs))
68 /* We will get here twice: once to call the signal
69 handler, then again to return from the
70 sigsuspend system call. When calling the
71 signal handler, R10 holds the signal number as
72 set through do_signal. The sigsuspend call
73 will return with the restored value set above;
74 always -EINTR. */
75 return regs->r10;
76 }
77} 63}
78 64
79/* Define dummy arguments to be able to reach the regs argument. (Note that 65int sys_sigaction(int sig, const struct old_sigaction __user *act,
80 * this arrangement relies on size_t occupying one register.) 66 struct old_sigaction *oact)
81 */
82int
83sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, long r12, long r13,
84 long mof, long srp, struct pt_regs *regs)
85{
86 sigset_t saveset, newset;
87
88 /* XXX: Don't preclude handling different sized sigset_t's. */
89 if (sigsetsize != sizeof(sigset_t))
90 return -EINVAL;
91
92 if (copy_from_user(&newset, unewset, sizeof(newset)))
93 return -EFAULT;
94 sigdelsetmask(&newset, ~_BLOCKABLE);
95
96 spin_lock_irq(&current->sighand->siglock);
97 saveset = current->blocked;
98 current->blocked = newset;
99 recalc_sigpending();
100 spin_unlock_irq(&current->sighand->siglock);
101
102 regs->r10 = -EINTR;
103 while (1) {
104 current->state = TASK_INTERRUPTIBLE;
105 schedule();
106 if (do_signal(0, &saveset, regs))
107 /* We will get here twice: once to call the signal
108 handler, then again to return from the
109 sigsuspend system call. When calling the
110 signal handler, R10 holds the signal number as
111 set through do_signal. The sigsuspend call
112 will return with the restored value set above;
113 always -EINTR. */
114 return regs->r10;
115 }
116}
117
118int
119sys_sigaction(int sig, const struct old_sigaction __user *act,
120 struct old_sigaction *oact)
121{ 67{
122 struct k_sigaction new_ka, old_ka; 68 struct k_sigaction new_ka, old_ka;
123 int ret; 69 int ret;
@@ -147,8 +93,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
147 return ret; 93 return ret;
148} 94}
149 95
150int 96int sys_sigaltstack(const stack_t *uss, stack_t __user *uoss)
151sys_sigaltstack(const stack_t *uss, stack_t __user *uoss)
152{ 97{
153 return do_sigaltstack(uss, uoss, rdusp()); 98 return do_sigaltstack(uss, uoss, rdusp());
154} 99}
@@ -205,7 +150,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
205 150
206 /* TODO: the other ports use regs->orig_XX to disable syscall checks 151 /* TODO: the other ports use regs->orig_XX to disable syscall checks
207 * after this completes, but we don't use that mechanism. maybe we can 152 * after this completes, but we don't use that mechanism. maybe we can
208 * use it now ? 153 * use it now ?
209 */ 154 */
210 155
211 return err; 156 return err;
@@ -216,7 +161,7 @@ badframe:
216 161
217/* Define dummy arguments to be able to reach the regs argument. */ 162/* Define dummy arguments to be able to reach the regs argument. */
218 163
219asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof, 164asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
220 long srp, struct pt_regs *regs) 165 long srp, struct pt_regs *regs)
221{ 166{
222 struct sigframe __user *frame = (struct sigframe *)rdusp(); 167 struct sigframe __user *frame = (struct sigframe *)rdusp();
@@ -243,7 +188,7 @@ asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
243 current->blocked = set; 188 current->blocked = set;
244 recalc_sigpending(); 189 recalc_sigpending();
245 spin_unlock_irq(&current->sighand->siglock); 190 spin_unlock_irq(&current->sighand->siglock);
246 191
247 if (restore_sigcontext(regs, &frame->sc)) 192 if (restore_sigcontext(regs, &frame->sc))
248 goto badframe; 193 goto badframe;
249 194
@@ -254,11 +199,11 @@ asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
254badframe: 199badframe:
255 force_sig(SIGSEGV, current); 200 force_sig(SIGSEGV, current);
256 return 0; 201 return 0;
257} 202}
258 203
259/* Define dummy arguments to be able to reach the regs argument. */ 204/* Define dummy arguments to be able to reach the regs argument. */
260 205
261asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13, 206asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
262 long mof, long srp, struct pt_regs *regs) 207 long mof, long srp, struct pt_regs *regs)
263{ 208{
264 struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp(); 209 struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp();
@@ -282,7 +227,7 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
282 current->blocked = set; 227 current->blocked = set;
283 recalc_sigpending(); 228 recalc_sigpending();
284 spin_unlock_irq(&current->sighand->siglock); 229 spin_unlock_irq(&current->sighand->siglock);
285 230
286 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 231 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
287 goto badframe; 232 goto badframe;
288 233
@@ -294,14 +239,14 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
294badframe: 239badframe:
295 force_sig(SIGSEGV, current); 240 force_sig(SIGSEGV, current);
296 return 0; 241 return 0;
297} 242}
298 243
299/* 244/*
300 * Set up a signal frame. 245 * Set up a signal frame.
301 */ 246 */
302 247
303static int 248static int setup_sigcontext(struct sigcontext __user *sc,
304setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask) 249 struct pt_regs *regs, unsigned long mask)
305{ 250{
306 int err = 0; 251 int err = 0;
307 unsigned long usp = rdusp(); 252 unsigned long usp = rdusp();
@@ -324,10 +269,11 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned lo
324 return err; 269 return err;
325} 270}
326 271
327/* figure out where we want to put the new signal frame - usually on the stack */ 272/* Figure out where we want to put the new signal frame
273 * - usually on the stack. */
328 274
329static inline void __user * 275static inline void __user *
330get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) 276get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
331{ 277{
332 unsigned long sp = rdusp(); 278 unsigned long sp = rdusp();
333 279
@@ -345,15 +291,15 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
345} 291}
346 292
347/* grab and setup a signal frame. 293/* grab and setup a signal frame.
348 * 294 *
349 * basically we stack a lot of state info, and arrange for the 295 * basically we stack a lot of state info, and arrange for the
350 * user-mode program to return to the kernel using either a 296 * user-mode program to return to the kernel using either a
351 * trampoline which performs the syscall sigreturn, or a provided 297 * trampoline which performs the syscall sigreturn, or a provided
352 * user-mode trampoline. 298 * user-mode trampoline.
353 */ 299 */
354 300
355static void setup_frame(int sig, struct k_sigaction *ka, 301static int setup_frame(int sig, struct k_sigaction *ka,
356 sigset_t *set, struct pt_regs * regs) 302 sigset_t *set, struct pt_regs *regs)
357{ 303{
358 struct sigframe __user *frame; 304 struct sigframe __user *frame;
359 unsigned long return_ip; 305 unsigned long return_ip;
@@ -401,14 +347,15 @@ static void setup_frame(int sig, struct k_sigaction *ka,
401 347
402 wrusp((unsigned long)frame); 348 wrusp((unsigned long)frame);
403 349
404 return; 350 return 0;
405 351
406give_sigsegv: 352give_sigsegv:
407 force_sigsegv(sig, current); 353 force_sigsegv(sig, current);
354 return -EFAULT;
408} 355}
409 356
410static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 357static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
411 sigset_t *set, struct pt_regs * regs) 358 sigset_t *set, struct pt_regs *regs)
412{ 359{
413 struct rt_sigframe __user *frame; 360 struct rt_sigframe __user *frame;
414 unsigned long return_ip; 361 unsigned long return_ip;
@@ -443,9 +390,10 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
443 /* trampoline - the desired return ip is the retcode itself */ 390 /* trampoline - the desired return ip is the retcode itself */
444 return_ip = (unsigned long)&frame->retcode; 391 return_ip = (unsigned long)&frame->retcode;
445 /* This is movu.w __NR_rt_sigreturn, r9; break 13; */ 392 /* This is movu.w __NR_rt_sigreturn, r9; break 13; */
446 err |= __put_user(0x9c5f, (short __user*)(frame->retcode+0)); 393 err |= __put_user(0x9c5f, (short __user *)(frame->retcode+0));
447 err |= __put_user(__NR_rt_sigreturn, (short __user*)(frame->retcode+2)); 394 err |= __put_user(__NR_rt_sigreturn,
448 err |= __put_user(0xe93d, (short __user*)(frame->retcode+4)); 395 (short __user *)(frame->retcode+2));
396 err |= __put_user(0xe93d, (short __user *)(frame->retcode+4));
449 } 397 }
450 398
451 if (err) 399 if (err)
@@ -455,73 +403,81 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
455 403
456 /* Set up registers for signal handler */ 404 /* Set up registers for signal handler */
457 405
458 regs->irp = (unsigned long) ka->sa.sa_handler; /* what we enter NOW */ 406 /* What we enter NOW */
459 regs->srp = return_ip; /* what we enter LATER */ 407 regs->irp = (unsigned long) ka->sa.sa_handler;
460 regs->r10 = sig; /* first argument is signo */ 408 /* What we enter LATER */
461 regs->r11 = (unsigned long) &frame->info; /* second argument is (siginfo_t *) */ 409 regs->srp = return_ip;
462 regs->r12 = 0; /* third argument is unused */ 410 /* First argument is signo */
463 411 regs->r10 = sig;
464 /* actually move the usp to reflect the stacked frame */ 412 /* Second argument is (siginfo_t *) */
465 413 regs->r11 = (unsigned long)&frame->info;
414 /* Third argument is unused */
415 regs->r12 = 0;
416
417 /* Actually move the usp to reflect the stacked frame */
466 wrusp((unsigned long)frame); 418 wrusp((unsigned long)frame);
467 419
468 return; 420 return 0;
469 421
470give_sigsegv: 422give_sigsegv:
471 force_sigsegv(sig, current); 423 force_sigsegv(sig, current);
424 return -EFAULT;
472} 425}
473 426
474/* 427/*
475 * OK, we're invoking a handler 428 * OK, we're invoking a handler
476 */ 429 */
477 430
478static inline void 431static inline int handle_signal(int canrestart, unsigned long sig,
479handle_signal(int canrestart, unsigned long sig, 432 siginfo_t *info, struct k_sigaction *ka,
480 siginfo_t *info, struct k_sigaction *ka, 433 sigset_t *oldset, struct pt_regs *regs)
481 sigset_t *oldset, struct pt_regs * regs)
482{ 434{
435 int ret;
436
483 /* Are we from a system call? */ 437 /* Are we from a system call? */
484 if (canrestart) { 438 if (canrestart) {
485 /* If so, check system call restarting.. */ 439 /* If so, check system call restarting.. */
486 switch (regs->r10) { 440 switch (regs->r10) {
487 case -ERESTART_RESTARTBLOCK: 441 case -ERESTART_RESTARTBLOCK:
488 case -ERESTARTNOHAND: 442 case -ERESTARTNOHAND:
489 /* ERESTARTNOHAND means that the syscall should only be 443 /* ERESTARTNOHAND means that the syscall should
490 restarted if there was no handler for the signal, and since 444 * only be restarted if there was no handler for
491 we only get here if there is a handler, we don't restart */ 445 * the signal, and since we only get here if there
446 * is a handler, we don't restart */
447 regs->r10 = -EINTR;
448 break;
449 case -ERESTARTSYS:
450 /* ERESTARTSYS means to restart the syscall if
451 * there is no handler or the handler was
452 * registered with SA_RESTART */
453 if (!(ka->sa.sa_flags & SA_RESTART)) {
492 regs->r10 = -EINTR; 454 regs->r10 = -EINTR;
493 break; 455 break;
494 456 }
495 case -ERESTARTSYS: 457 /* fallthrough */
496 /* ERESTARTSYS means to restart the syscall if there is no 458 case -ERESTARTNOINTR:
497 handler or the handler was registered with SA_RESTART */ 459 /* ERESTARTNOINTR means that the syscall should
498 if (!(ka->sa.sa_flags & SA_RESTART)) { 460 * be called again after the signal handler returns. */
499 regs->r10 = -EINTR; 461 RESTART_CRIS_SYS(regs);
500 break;
501 }
502 /* fallthrough */
503 case -ERESTARTNOINTR:
504 /* ERESTARTNOINTR means that the syscall should be called again
505 after the signal handler returns. */
506 RESTART_CRIS_SYS(regs);
507 } 462 }
508 } 463 }
509 464
510 /* Set up the stack frame */ 465 /* Set up the stack frame */
511 if (ka->sa.sa_flags & SA_SIGINFO) 466 if (ka->sa.sa_flags & SA_SIGINFO)
512 setup_rt_frame(sig, ka, info, oldset, regs); 467 ret = setup_rt_frame(sig, ka, info, oldset, regs);
513 else 468 else
514 setup_frame(sig, ka, oldset, regs); 469 ret = setup_frame(sig, ka, oldset, regs);
515 470
516 if (ka->sa.sa_flags & SA_ONESHOT) 471 if (ret == 0) {
517 ka->sa.sa_handler = SIG_DFL; 472 spin_lock_irq(&current->sighand->siglock);
518 473 sigorsets(&current->blocked, &current->blocked,
519 spin_lock_irq(&current->sighand->siglock); 474 &ka->sa.sa_mask);
520 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 475 if (!(ka->sa.sa_flags & SA_NODEFER))
521 if (!(ka->sa.sa_flags & SA_NODEFER)) 476 sigaddset(&current->blocked, sig);
522 sigaddset(&current->blocked,sig); 477 recalc_sigpending();
523 recalc_sigpending(); 478 spin_unlock_irq(&current->sighand->siglock);
524 spin_unlock_irq(&current->sighand->siglock); 479 }
480 return ret;
525} 481}
526 482
527/* 483/*
@@ -536,11 +492,12 @@ handle_signal(int canrestart, unsigned long sig,
536 * mode below. 492 * mode below.
537 */ 493 */
538 494
539int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs) 495void do_signal(int canrestart, struct pt_regs *regs)
540{ 496{
541 siginfo_t info; 497 siginfo_t info;
542 int signr; 498 int signr;
543 struct k_sigaction ka; 499 struct k_sigaction ka;
500 sigset_t *oldset;
544 501
545 /* 502 /*
546 * We want the common case to go fast, which 503 * We want the common case to go fast, which
@@ -549,16 +506,26 @@ int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs)
549 * if so. 506 * if so.
550 */ 507 */
551 if (!user_mode(regs)) 508 if (!user_mode(regs))
552 return 1; 509 return;
553 510
554 if (!oldset) 511 if (test_thread_flag(TIF_RESTORE_SIGMASK))
512 oldset = &current->saved_sigmask;
513 else
555 oldset = &current->blocked; 514 oldset = &current->blocked;
556 515
557 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 516 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
558 if (signr > 0) { 517 if (signr > 0) {
559 /* Whee! Actually deliver the signal. */ 518 /* Whee! Actually deliver the signal. */
560 handle_signal(canrestart, signr, &info, &ka, oldset, regs); 519 if (handle_signal(canrestart, signr, &info, &ka,
561 return 1; 520 oldset, regs)) {
521 /* a signal was successfully delivered; the saved
522 * sigmask will have been stored in the signal frame,
523 * and will be restored by sigreturn, so we can simply
524 * clear the TIF_RESTORE_SIGMASK flag */
525 if (test_thread_flag(TIF_RESTORE_SIGMASK))
526 clear_thread_flag(TIF_RESTORE_SIGMASK);
527 }
528 return;
562 } 529 }
563 530
564 /* Did we come from a system call? */ 531 /* Did we come from a system call? */
@@ -569,10 +536,16 @@ int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs)
569 regs->r10 == -ERESTARTNOINTR) { 536 regs->r10 == -ERESTARTNOINTR) {
570 RESTART_CRIS_SYS(regs); 537 RESTART_CRIS_SYS(regs);
571 } 538 }
572 if (regs->r10 == -ERESTART_RESTARTBLOCK){ 539 if (regs->r10 == -ERESTART_RESTARTBLOCK) {
573 regs->r10 = __NR_restart_syscall; 540 regs->r10 = __NR_restart_syscall;
574 regs->irp -= 2; 541 regs->irp -= 2;
575 } 542 }
576 } 543 }
577 return 0; 544
545 /* if there's no signal to deliver, we just put the saved sigmask
546 * back */
547 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
548 clear_thread_flag(TIF_RESTORE_SIGMASK);
549 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
550 }
578} 551}
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 5976f6199c47..9310a7b476e9 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -13,6 +13,7 @@
13#include <linux/swap.h> 13#include <linux/swap.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/vmstat.h>
16#include <asm/arch/svinto.h> 17#include <asm/arch/svinto.h>
17#include <asm/types.h> 18#include <asm/types.h>
18#include <asm/signal.h> 19#include <asm/signal.h>
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 291d368ffd28..b22c043b6ef8 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -59,6 +59,8 @@ config BCM47XX
59 select SYS_SUPPORTS_LITTLE_ENDIAN 59 select SYS_SUPPORTS_LITTLE_ENDIAN
60 select SSB 60 select SSB
61 select SSB_DRIVER_MIPS 61 select SSB_DRIVER_MIPS
62 select SSB_DRIVER_EXTIF
63 select SSB_PCICORE_HOSTMODE if PCI
62 select GENERIC_GPIO 64 select GENERIC_GPIO
63 select SYS_HAS_EARLY_PRINTK 65 select SYS_HAS_EARLY_PRINTK
64 select CFE 66 select CFE
diff --git a/arch/mips/cobalt/console.c b/arch/mips/cobalt/console.c
index db330e811025..d1ba701c9dd1 100644
--- a/arch/mips/cobalt/console.c
+++ b/arch/mips/cobalt/console.c
@@ -4,10 +4,15 @@
4#include <linux/io.h> 4#include <linux/io.h>
5#include <linux/serial_reg.h> 5#include <linux/serial_reg.h>
6 6
7#include <cobalt.h>
8
7#define UART_BASE ((void __iomem *)CKSEG1ADDR(0x1c800000)) 9#define UART_BASE ((void __iomem *)CKSEG1ADDR(0x1c800000))
8 10
9void prom_putchar(char c) 11void prom_putchar(char c)
10{ 12{
13 if (cobalt_board_id <= COBALT_BRD_ID_QUBE1)
14 return;
15
11 while (!(readb(UART_BASE + UART_LSR) & UART_LSR_THRE)) 16 while (!(readb(UART_BASE + UART_LSR) & UART_LSR_THRE))
12 ; 17 ;
13 18
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 7f6ddcb5d485..f8a535afce39 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -269,7 +269,7 @@ static void __init bootmem_init(void)
269 269
270static void __init bootmem_init(void) 270static void __init bootmem_init(void)
271{ 271{
272 unsigned long init_begin, reserved_end; 272 unsigned long reserved_end;
273 unsigned long mapstart = ~0UL; 273 unsigned long mapstart = ~0UL;
274 unsigned long bootmap_size; 274 unsigned long bootmap_size;
275 int i; 275 int i;
@@ -344,7 +344,6 @@ static void __init bootmem_init(void)
344 min_low_pfn, max_low_pfn); 344 min_low_pfn, max_low_pfn);
345 345
346 346
347 init_begin = PFN_UP(__pa_symbol(&__init_begin));
348 for (i = 0; i < boot_mem_map.nr_map; i++) { 347 for (i = 0; i < boot_mem_map.nr_map; i++) {
349 unsigned long start, end; 348 unsigned long start, end;
350 349
@@ -352,8 +351,8 @@ static void __init bootmem_init(void)
352 end = PFN_DOWN(boot_mem_map.map[i].addr 351 end = PFN_DOWN(boot_mem_map.map[i].addr
353 + boot_mem_map.map[i].size); 352 + boot_mem_map.map[i].size);
354 353
355 if (start <= init_begin) 354 if (start <= min_low_pfn)
356 start = init_begin; 355 start = min_low_pfn;
357 if (start >= end) 356 if (start >= end)
358 continue; 357 continue;
359 358
diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
index 5332449ec040..460626b6d62f 100644
--- a/arch/mips/lasat/image/Makefile
+++ b/arch/mips/lasat/image/Makefile
@@ -12,11 +12,11 @@ endif
12 12
13MKLASATIMG = mklasatimg 13MKLASATIMG = mklasatimg
14MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200 14MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
15KERNEL_IMAGE = $(TOPDIR)/vmlinux 15KERNEL_IMAGE = vmlinux
16KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ ) 16KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
17KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ ) 17KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )
18 18
19LDSCRIPT= -L$(obj) -Tromscript.normal 19LDSCRIPT= -L$(srctree)/$(src) -Tromscript.normal
20 20
21HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \ 21HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
22 -D_kernel_entry=0x$(KERNEL_ENTRY) \ 22 -D_kernel_entry=0x$(KERNEL_ENTRY) \
@@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
24 -D TIMESTAMP=$(shell date +%s) 24 -D TIMESTAMP=$(shell date +%s)
25 25
26$(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE) 26$(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
27 $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $< 27 $(CC) -fno-pic $(HEAD_DEFINES) $(LINUXINCLUDE) -c -o $@ $<
28 28
29OBJECTS = head.o kImage.o 29OBJECTS = head.o kImage.o
30 30
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
index 2c5c27c8e86d..dc272c188233 100644
--- a/arch/mips/mips-boards/generic/memory.c
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -169,7 +169,6 @@ void __init prom_meminit(void)
169 169
170void __init prom_free_prom_memory(void) 170void __init prom_free_prom_memory(void)
171{ 171{
172#if 0 /* for now ... */
173 unsigned long addr; 172 unsigned long addr;
174 int i; 173 int i;
175 174
@@ -181,5 +180,4 @@ void __init prom_free_prom_memory(void)
181 free_init_pages("prom memory", 180 free_init_pages("prom memory",
182 addr, addr + boot_mem_map.map[i].size); 181 addr, addr + boot_mem_map.map[i].size);
183 } 182 }
184#endif
185} 183}
diff --git a/arch/mips/mips-boards/generic/reset.c b/arch/mips/mips-boards/generic/reset.c
index 7a1bb51f81ee..583d468d98a9 100644
--- a/arch/mips/mips-boards/generic/reset.c
+++ b/arch/mips/mips-boards/generic/reset.c
@@ -39,16 +39,18 @@ static void atlas_machine_power_off(void);
39 39
40static void mips_machine_restart(char *command) 40static void mips_machine_restart(char *command)
41{ 41{
42 unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, sizeof(unsigned int)); 42 unsigned int __iomem *softres_reg =
43 ioremap(SOFTRES_REG, sizeof(unsigned int));
43 44
44 writew(GORESET, softres_reg); 45 __raw_writel(GORESET, softres_reg);
45} 46}
46 47
47static void mips_machine_halt(void) 48static void mips_machine_halt(void)
48{ 49{
49 unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, sizeof(unsigned int)); 50 unsigned int __iomem *softres_reg =
51 ioremap(SOFTRES_REG, sizeof(unsigned int));
50 52
51 writew(GORESET, softres_reg); 53 __raw_writel(GORESET, softres_reg);
52} 54}
53 55
54#if defined(CONFIG_MIPS_ATLAS) 56#if defined(CONFIG_MIPS_ATLAS)
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index ae76795685cc..810535dd091b 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -45,7 +45,7 @@ static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
45 /* ignore region specifiers */ 45 /* ignore region specifiers */
46 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM); 46 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
47 47
48#ifdef CONFIG_ZONE_DMA32 48#ifdef CONFIG_ZONE_DMA
49 if (dev == NULL) 49 if (dev == NULL)
50 gfp |= __GFP_DMA; 50 gfp |= __GFP_DMA;
51 else if (dev->coherent_dma_mask < DMA_BIT_MASK(24)) 51 else if (dev->coherent_dma_mask < DMA_BIT_MASK(24))
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c
index f7df1142912b..9553b14002dd 100644
--- a/arch/mips/pci/fixup-cobalt.c
+++ b/arch/mips/pci/fixup-cobalt.c
@@ -177,7 +177,7 @@ static char irq_tab_raq2[] __initdata = {
177 177
178int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 178int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
179{ 179{
180 if (cobalt_board_id < COBALT_BRD_ID_QUBE2) 180 if (cobalt_board_id <= COBALT_BRD_ID_QUBE1)
181 return irq_tab_qube1[slot]; 181 return irq_tab_qube1[slot];
182 182
183 if (cobalt_board_id == COBALT_BRD_ID_RAQ2) 183 if (cobalt_board_id == COBALT_BRD_ID_RAQ2)
diff --git a/arch/mips/philips/pnx8550/common/time.c b/arch/mips/philips/pnx8550/common/time.c
index e818fd0f1584..6d494e0de3d9 100644
--- a/arch/mips/philips/pnx8550/common/time.c
+++ b/arch/mips/philips/pnx8550/common/time.c
@@ -22,7 +22,6 @@
22#include <linux/kernel_stat.h> 22#include <linux/kernel_stat.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/module.h>
26 25
27#include <asm/bootinfo.h> 26#include <asm/bootinfo.h>
28#include <asm/cpu.h> 27#include <asm/cpu.h>
@@ -41,11 +40,60 @@ static cycle_t hpt_read(void)
41 return read_c0_count2(); 40 return read_c0_count2();
42} 41}
43 42
43static struct clocksource pnx_clocksource = {
44 .name = "pnx8xxx",
45 .rating = 200,
46 .read = hpt_read,
47 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
48};
49
44static void timer_ack(void) 50static void timer_ack(void)
45{ 51{
46 write_c0_compare(cpj); 52 write_c0_compare(cpj);
47} 53}
48 54
55static irqreturn_t pnx8xxx_timer_interrupt(int irq, void *dev_id)
56{
57 struct clock_event_device *c = dev_id;
58
59 /* clear MATCH, signal the event */
60 c->event_handler(c);
61
62 return IRQ_HANDLED;
63}
64
65static struct irqaction pnx8xxx_timer_irq = {
66 .handler = pnx8xxx_timer_interrupt,
67 .flags = IRQF_DISABLED | IRQF_PERCPU,
68 .name = "pnx8xxx_timer",
69};
70
71static irqreturn_t monotonic_interrupt(int irq, void *dev_id)
72{
73 /* Timer 2 clear interrupt */
74 write_c0_compare2(-1);
75 return IRQ_HANDLED;
76}
77
78static struct irqaction monotonic_irqaction = {
79 .handler = monotonic_interrupt,
80 .flags = IRQF_DISABLED,
81 .name = "Monotonic timer",
82};
83
84static int pnx8xxx_set_next_event(unsigned long delta,
85 struct clock_event_device *evt)
86{
87 write_c0_compare(delta);
88 return 0;
89}
90
91static struct clock_event_device pnx8xxx_clockevent = {
92 .name = "pnx8xxx_clockevent",
93 .features = CLOCK_EVT_FEAT_ONESHOT,
94 .set_next_event = pnx8xxx_set_next_event,
95};
96
49/* 97/*
50 * plat_time_init() - it does the following things: 98 * plat_time_init() - it does the following things:
51 * 99 *
@@ -58,11 +106,34 @@ static void timer_ack(void)
58 106
59__init void plat_time_init(void) 107__init void plat_time_init(void)
60{ 108{
109 unsigned int configPR;
61 unsigned int n; 110 unsigned int n;
62 unsigned int m; 111 unsigned int m;
63 unsigned int p; 112 unsigned int p;
64 unsigned int pow2p; 113 unsigned int pow2p;
65 114
115 clockevents_register_device(&pnx8xxx_clockevent);
116 clocksource_register(&pnx_clocksource);
117
118 setup_irq(PNX8550_INT_TIMER1, &pnx8xxx_timer_irq);
119 setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction);
120
121 /* Timer 1 start */
122 configPR = read_c0_config7();
123 configPR &= ~0x00000008;
124 write_c0_config7(configPR);
125
126 /* Timer 2 start */
127 configPR = read_c0_config7();
128 configPR &= ~0x00000010;
129 write_c0_config7(configPR);
130
131 /* Timer 3 stop */
132 configPR = read_c0_config7();
133 configPR |= 0x00000020;
134 write_c0_config7(configPR);
135
136
66 /* PLL0 sets MIPS clock (PLL1 <=> TM1, PLL6 <=> TM2, PLL5 <=> mem) */ 137 /* PLL0 sets MIPS clock (PLL1 <=> TM1, PLL6 <=> TM2, PLL5 <=> mem) */
67 /* (but only if CLK_MIPS_CTL select value [bits 3:1] is 1: FIXME) */ 138 /* (but only if CLK_MIPS_CTL select value [bits 3:1] is 1: FIXME) */
68 139
@@ -87,42 +158,6 @@ __init void plat_time_init(void)
87 write_c0_count2(0); 158 write_c0_count2(0);
88 write_c0_compare2(0xffffffff); 159 write_c0_compare2(0xffffffff);
89 160
90 clocksource_mips.read = hpt_read;
91 mips_timer_ack = timer_ack;
92}
93
94static irqreturn_t monotonic_interrupt(int irq, void *dev_id)
95{
96 /* Timer 2 clear interrupt */
97 write_c0_compare2(-1);
98 return IRQ_HANDLED;
99} 161}
100 162
101static struct irqaction monotonic_irqaction = {
102 .handler = monotonic_interrupt,
103 .flags = IRQF_DISABLED,
104 .name = "Monotonic timer",
105};
106 163
107void __init plat_timer_setup(struct irqaction *irq)
108{
109 int configPR;
110
111 setup_irq(PNX8550_INT_TIMER1, irq);
112 setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction);
113
114 /* Timer 1 start */
115 configPR = read_c0_config7();
116 configPR &= ~0x00000008;
117 write_c0_config7(configPR);
118
119 /* Timer 2 start */
120 configPR = read_c0_config7();
121 configPR &= ~0x00000010;
122 write_c0_config7(configPR);
123
124 /* Timer 3 stop */
125 configPR = read_c0_config7();
126 configPR |= 0x00000020;
127 write_c0_config7(configPR);
128}
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 2d0c9ef555e9..79a85d656871 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -278,6 +278,7 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
278 unsigned long flags; 278 unsigned long flags;
279 struct scatterlist *s, *outs, *segstart; 279 struct scatterlist *s, *outs, *segstart;
280 int outcount, incount, i; 280 int outcount, incount, i;
281 unsigned int align;
281 unsigned long handle; 282 unsigned long handle;
282 283
283 BUG_ON(direction == DMA_NONE); 284 BUG_ON(direction == DMA_NONE);
@@ -309,7 +310,12 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
309 /* Allocate iommu entries for that segment */ 310 /* Allocate iommu entries for that segment */
310 vaddr = (unsigned long) sg_virt(s); 311 vaddr = (unsigned long) sg_virt(s);
311 npages = iommu_num_pages(vaddr, slen); 312 npages = iommu_num_pages(vaddr, slen);
312 entry = iommu_range_alloc(tbl, npages, &handle, mask >> IOMMU_PAGE_SHIFT, 0); 313 align = 0;
314 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && slen >= PAGE_SIZE &&
315 (vaddr & ~PAGE_MASK) == 0)
316 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
317 entry = iommu_range_alloc(tbl, npages, &handle,
318 mask >> IOMMU_PAGE_SHIFT, align);
313 319
314 DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen); 320 DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen);
315 321
@@ -572,7 +578,7 @@ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
572{ 578{
573 dma_addr_t dma_handle = DMA_ERROR_CODE; 579 dma_addr_t dma_handle = DMA_ERROR_CODE;
574 unsigned long uaddr; 580 unsigned long uaddr;
575 unsigned int npages; 581 unsigned int npages, align;
576 582
577 BUG_ON(direction == DMA_NONE); 583 BUG_ON(direction == DMA_NONE);
578 584
@@ -580,8 +586,13 @@ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
580 npages = iommu_num_pages(uaddr, size); 586 npages = iommu_num_pages(uaddr, size);
581 587
582 if (tbl) { 588 if (tbl) {
589 align = 0;
590 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && size >= PAGE_SIZE &&
591 ((unsigned long)vaddr & ~PAGE_MASK) == 0)
592 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
593
583 dma_handle = iommu_alloc(tbl, vaddr, npages, direction, 594 dma_handle = iommu_alloc(tbl, vaddr, npages, direction,
584 mask >> IOMMU_PAGE_SHIFT, 0); 595 mask >> IOMMU_PAGE_SHIFT, align);
585 if (dma_handle == DMA_ERROR_CODE) { 596 if (dma_handle == DMA_ERROR_CODE) {
586 if (printk_ratelimit()) { 597 if (printk_ratelimit()) {
587 printk(KERN_INFO "iommu_alloc failed, " 598 printk(KERN_INFO "iommu_alloc failed, "
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 1add6efdb315..5d89a21dd0d6 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2216,6 +2216,45 @@ static void __init fixup_device_tree_efika(void)
2216 prom_printf("fixup_device_tree_efika: ", 2216 prom_printf("fixup_device_tree_efika: ",
2217 "skipped entry %x - setprop error\n", i); 2217 "skipped entry %x - setprop error\n", i);
2218 } 2218 }
2219
2220 /* Make sure ethernet mdio bus node exists */
2221 node = call_prom("finddevice", 1, 1, ADDR("/builtin/mdio"));
2222 if (!PHANDLE_VALID(node)) {
2223 prom_printf("Adding Ethernet MDIO node\n");
2224 call_prom("interpret", 1, 1,
2225 " s\" /builtin\" find-device"
2226 " new-device"
2227 " 1 encode-int s\" #address-cells\" property"
2228 " 0 encode-int s\" #size-cells\" property"
2229 " s\" mdio\" 2dup device-name device-type"
2230 " s\" mpc5200b-fec-phy\" encode-string"
2231 " s\" compatible\" property"
2232 " 0xf0003000 0x400 reg"
2233 " 0x2 encode-int"
2234 " 0x5 encode-int encode+"
2235 " 0x3 encode-int encode+"
2236 " s\" interrupts\" property"
2237 " finish-device");
2238 };
2239
2240 /* Make sure ethernet phy device node exist */
2241 node = call_prom("finddevice", 1, 1, ADDR("/builtin/mdio/ethernet-phy"));
2242 if (!PHANDLE_VALID(node)) {
2243 prom_printf("Adding Ethernet PHY node\n");
2244 call_prom("interpret", 1, 1,
2245 " s\" /builtin/mdio\" find-device"
2246 " new-device"
2247 " s\" ethernet-phy\" device-name"
2248 " 0x10 encode-int s\" reg\" property"
2249 " my-self"
2250 " ihandle>phandle"
2251 " finish-device"
2252 " s\" /builtin/ethernet\" find-device"
2253 " encode-int"
2254 " s\" phy-handle\" property"
2255 " device-end");
2256 }
2257
2219} 2258}
2220#else 2259#else
2221#define fixup_device_tree_efika() 2260#define fixup_device_tree_efika()
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index 27922dff8b94..50d7372bc2ce 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -292,6 +292,8 @@ void slb_initialize(void)
292 292
293 create_shadowed_slbe(VMALLOC_START, mmu_kernel_ssize, vflags, 1); 293 create_shadowed_slbe(VMALLOC_START, mmu_kernel_ssize, vflags, 1);
294 294
295 slb_shadow_clear(2);
296
295 /* We don't bolt the stack for the time being - we're in boot, 297 /* We don't bolt the stack for the time being - we're in boot,
296 * so the stack is in the bolted segment. By the time it goes 298 * so the stack is in the bolted segment. By the time it goes
297 * elsewhere, we'll call _switch() which will bolt in the new 299 * elsewhere, we'll call _switch() which will bolt in the new
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index fc48b96c81bf..412e6b42986f 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -29,6 +29,7 @@
29#include <asm/vdso_datapage.h> 29#include <asm/vdso_datapage.h>
30#include <asm/pSeries_reconfig.h> 30#include <asm/pSeries_reconfig.h>
31#include "xics.h" 31#include "xics.h"
32#include "plpar_wrappers.h"
32 33
33/* This version can't take the spinlock, because it never returns */ 34/* This version can't take the spinlock, because it never returns */
34static struct rtas_args rtas_stop_self_args = { 35static struct rtas_args rtas_stop_self_args = {
@@ -58,6 +59,7 @@ static void pseries_mach_cpu_die(void)
58 local_irq_disable(); 59 local_irq_disable();
59 idle_task_exit(); 60 idle_task_exit();
60 xics_teardown_cpu(0); 61 xics_teardown_cpu(0);
62 unregister_slb_shadow(hard_smp_processor_id(), __pa(get_slb_shadow()));
61 rtas_stop_self(); 63 rtas_stop_self();
62 /* Should never get here... */ 64 /* Should never get here... */
63 BUG(); 65 BUG();
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 17089a041028..af045ca0f653 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -2256,14 +2256,12 @@ static int __init apm_init(void)
2256 apm_info.disabled = 1; 2256 apm_info.disabled = 1;
2257 return -ENODEV; 2257 return -ENODEV;
2258 } 2258 }
2259 if (PM_IS_ACTIVE()) { 2259 if (pm_flags & PM_ACPI) {
2260 printk(KERN_NOTICE "apm: overridden by ACPI.\n"); 2260 printk(KERN_NOTICE "apm: overridden by ACPI.\n");
2261 apm_info.disabled = 1; 2261 apm_info.disabled = 1;
2262 return -ENODEV; 2262 return -ENODEV;
2263 } 2263 }
2264#ifdef CONFIG_PM_LEGACY 2264 pm_flags |= PM_APM;
2265 pm_active = 1;
2266#endif
2267 2265
2268 /* 2266 /*
2269 * Set up a segment that references the real mode segment 0x40 2267 * Set up a segment that references the real mode segment 0x40
@@ -2366,9 +2364,7 @@ static void __exit apm_exit(void)
2366 kthread_stop(kapmd_task); 2364 kthread_stop(kapmd_task);
2367 kapmd_task = NULL; 2365 kapmd_task = NULL;
2368 } 2366 }
2369#ifdef CONFIG_PM_LEGACY 2367 pm_flags &= ~PM_APM;
2370 pm_active = 0;
2371#endif
2372} 2368}
2373 2369
2374module_init(apm_init); 2370module_init(apm_init);
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 9663c2a74830..46d391d49de8 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -204,6 +204,10 @@ void cpu_idle(void)
204 } 204 }
205} 205}
206 206
207static void do_nothing(void *unused)
208{
209}
210
207void cpu_idle_wait(void) 211void cpu_idle_wait(void)
208{ 212{
209 unsigned int cpu, this_cpu = get_cpu(); 213 unsigned int cpu, this_cpu = get_cpu();
@@ -228,6 +232,13 @@ void cpu_idle_wait(void)
228 cpu_clear(cpu, map); 232 cpu_clear(cpu, map);
229 } 233 }
230 cpus_and(map, map, cpu_online_map); 234 cpus_and(map, map, cpu_online_map);
235 /*
236 * We waited 1 sec, if a CPU still did not call idle
237 * it may be because it is in idle and not waking up
238 * because it has nothing to do.
239 * Give all the remaining CPUS a kick.
240 */
241 smp_call_function_mask(map, do_nothing, 0, 0);
231 } while (!cpus_empty(map)); 242 } while (!cpus_empty(map));
232 243
233 set_cpus_allowed(current, tmp); 244 set_cpus_allowed(current, tmp);
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 6309b275cb9c..ab79e1dfa023 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -135,6 +135,10 @@ static void poll_idle (void)
135 cpu_relax(); 135 cpu_relax();
136} 136}
137 137
138static void do_nothing(void *unused)
139{
140}
141
138void cpu_idle_wait(void) 142void cpu_idle_wait(void)
139{ 143{
140 unsigned int cpu, this_cpu = get_cpu(); 144 unsigned int cpu, this_cpu = get_cpu();
@@ -160,6 +164,13 @@ void cpu_idle_wait(void)
160 cpu_clear(cpu, map); 164 cpu_clear(cpu, map);
161 } 165 }
162 cpus_and(map, map, cpu_online_map); 166 cpus_and(map, map, cpu_online_map);
167 /*
168 * We waited 1 sec, if a CPU still did not call idle
169 * it may be because it is in idle and not waking up
170 * because it has nothing to do.
171 * Give all the remaining CPUS a kick.
172 */
173 smp_call_function_mask(map, do_nothing, 0, 0);
163 } while (!cpus_empty(map)); 174 } while (!cpus_empty(map));
164 175
165 set_cpus_allowed(current, tmp); 176 set_cpus_allowed(current, tmp);
diff --git a/block/blktrace.c b/block/blktrace.c
index 498a0a54a6aa..9b4da4ae3c7d 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -25,7 +25,6 @@
25#include <linux/time.h> 25#include <linux/time.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27 27
28static DEFINE_PER_CPU(unsigned long long, blk_trace_cpu_offset) = { 0, };
29static unsigned int blktrace_seq __read_mostly = 1; 28static unsigned int blktrace_seq __read_mostly = 1;
30 29
31/* 30/*
@@ -41,7 +40,7 @@ static void trace_note(struct blk_trace *bt, pid_t pid, int action,
41 const int cpu = smp_processor_id(); 40 const int cpu = smp_processor_id();
42 41
43 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION; 42 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
44 t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu); 43 t->time = ktime_to_ns(ktime_get());
45 t->device = bt->dev; 44 t->device = bt->dev;
46 t->action = action; 45 t->action = action;
47 t->pid = pid; 46 t->pid = pid;
@@ -159,7 +158,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
159 158
160 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION; 159 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
161 t->sequence = ++(*sequence); 160 t->sequence = ++(*sequence);
162 t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu); 161 t->time = ktime_to_ns(ktime_get());
163 t->sector = sector; 162 t->sector = sector;
164 t->bytes = bytes; 163 t->bytes = bytes;
165 t->action = what; 164 t->action = what;
@@ -179,7 +178,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
179EXPORT_SYMBOL_GPL(__blk_add_trace); 178EXPORT_SYMBOL_GPL(__blk_add_trace);
180 179
181static struct dentry *blk_tree_root; 180static struct dentry *blk_tree_root;
182static struct mutex blk_tree_mutex; 181static DEFINE_MUTEX(blk_tree_mutex);
183static unsigned int root_users; 182static unsigned int root_users;
184 183
185static inline void blk_remove_root(void) 184static inline void blk_remove_root(void)
@@ -505,77 +504,3 @@ void blk_trace_shutdown(struct request_queue *q)
505 blk_trace_remove(q); 504 blk_trace_remove(q);
506 } 505 }
507} 506}
508
509/*
510 * Average offset over two calls to cpu_clock() with a gettimeofday()
511 * in the middle
512 */
513static void blk_check_time(unsigned long long *t, int this_cpu)
514{
515 unsigned long long a, b;
516 struct timeval tv;
517
518 a = cpu_clock(this_cpu);
519 do_gettimeofday(&tv);
520 b = cpu_clock(this_cpu);
521
522 *t = tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
523 *t -= (a + b) / 2;
524}
525
526/*
527 * calibrate our inter-CPU timings
528 */
529static void blk_trace_check_cpu_time(void *data)
530{
531 unsigned long long *t;
532 int this_cpu = get_cpu();
533
534 t = &per_cpu(blk_trace_cpu_offset, this_cpu);
535
536 /*
537 * Just call it twice, hopefully the second call will be cache hot
538 * and a little more precise
539 */
540 blk_check_time(t, this_cpu);
541 blk_check_time(t, this_cpu);
542
543 put_cpu();
544}
545
546static void blk_trace_set_ht_offsets(void)
547{
548#if defined(CONFIG_SCHED_SMT)
549 int cpu, i;
550
551 /*
552 * now make sure HT siblings have the same time offset
553 */
554 preempt_disable();
555 for_each_online_cpu(cpu) {
556 unsigned long long *cpu_off, *sibling_off;
557
558 for_each_cpu_mask(i, per_cpu(cpu_sibling_map, cpu)) {
559 if (i == cpu)
560 continue;
561
562 cpu_off = &per_cpu(blk_trace_cpu_offset, cpu);
563 sibling_off = &per_cpu(blk_trace_cpu_offset, i);
564 *sibling_off = *cpu_off;
565 }
566 }
567 preempt_enable();
568#endif
569}
570
571static __init int blk_trace_init(void)
572{
573 mutex_init(&blk_tree_mutex);
574 on_each_cpu(blk_trace_check_cpu_time, NULL, 1, 1);
575 blk_trace_set_ht_offsets();
576
577 return 0;
578}
579
580module_init(blk_trace_init);
581
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index b9f923ef173d..ccf6ea95f68c 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -82,6 +82,12 @@ config ACPI_PROCFS_POWER
82 and functions, which do not yet exist in /sys 82 and functions, which do not yet exist in /sys
83 83
84 Say N to delete power /proc/acpi/ folders that have moved to /sys/ 84 Say N to delete power /proc/acpi/ folders that have moved to /sys/
85config ACPI_SYSFS_POWER
86 bool "Future power /sys interface"
87 select POWER_SUPPLY
88 default y
89 ---help---
90 Say N to disable power /sys interface
85config ACPI_PROC_EVENT 91config ACPI_PROC_EVENT
86 bool "Deprecated /proc/acpi/event support" 92 bool "Deprecated /proc/acpi/event support"
87 depends on PROC_FS 93 depends on PROC_FS
@@ -103,7 +109,6 @@ config ACPI_PROC_EVENT
103config ACPI_AC 109config ACPI_AC
104 tristate "AC Adapter" 110 tristate "AC Adapter"
105 depends on X86 111 depends on X86
106 select POWER_SUPPLY
107 default y 112 default y
108 help 113 help
109 This driver adds support for the AC Adapter object, which indicates 114 This driver adds support for the AC Adapter object, which indicates
@@ -113,7 +118,6 @@ config ACPI_AC
113config ACPI_BATTERY 118config ACPI_BATTERY
114 tristate "Battery" 119 tristate "Battery"
115 depends on X86 120 depends on X86
116 select POWER_SUPPLY
117 default y 121 default y
118 help 122 help
119 This driver adds support for battery information through 123 This driver adds support for battery information through
@@ -368,7 +372,6 @@ config ACPI_HOTPLUG_MEMORY
368config ACPI_SBS 372config ACPI_SBS
369 tristate "Smart Battery System" 373 tristate "Smart Battery System"
370 depends on X86 374 depends on X86
371 select POWER_SUPPLY
372 help 375 help
373 This driver adds support for the Smart Battery System, another 376 This driver adds support for the Smart Battery System, another
374 type of access to battery information, found on some laptops. 377 type of access to battery information, found on some laptops.
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 76ed4f52bebd..76b9bea98b6d 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -31,7 +31,9 @@
31#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
32#include <linux/seq_file.h> 32#include <linux/seq_file.h>
33#endif 33#endif
34#ifdef CONFIG_ACPI_SYSFS_POWER
34#include <linux/power_supply.h> 35#include <linux/power_supply.h>
36#endif
35#include <acpi/acpi_bus.h> 37#include <acpi/acpi_bus.h>
36#include <acpi/acpi_drivers.h> 38#include <acpi/acpi_drivers.h>
37 39
@@ -79,7 +81,9 @@ static struct acpi_driver acpi_ac_driver = {
79}; 81};
80 82
81struct acpi_ac { 83struct acpi_ac {
84#ifdef CONFIG_ACPI_SYSFS_POWER
82 struct power_supply charger; 85 struct power_supply charger;
86#endif
83 struct acpi_device * device; 87 struct acpi_device * device;
84 unsigned long state; 88 unsigned long state;
85}; 89};
@@ -94,7 +98,7 @@ static const struct file_operations acpi_ac_fops = {
94 .release = single_release, 98 .release = single_release,
95}; 99};
96#endif 100#endif
97 101#ifdef CONFIG_ACPI_SYSFS_POWER
98static int get_ac_property(struct power_supply *psy, 102static int get_ac_property(struct power_supply *psy,
99 enum power_supply_property psp, 103 enum power_supply_property psp,
100 union power_supply_propval *val) 104 union power_supply_propval *val)
@@ -113,7 +117,7 @@ static int get_ac_property(struct power_supply *psy,
113static enum power_supply_property ac_props[] = { 117static enum power_supply_property ac_props[] = {
114 POWER_SUPPLY_PROP_ONLINE, 118 POWER_SUPPLY_PROP_ONLINE,
115}; 119};
116 120#endif
117/* -------------------------------------------------------------------------- 121/* --------------------------------------------------------------------------
118 AC Adapter Management 122 AC Adapter Management
119 -------------------------------------------------------------------------- */ 123 -------------------------------------------------------------------------- */
@@ -241,7 +245,9 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
241 acpi_bus_generate_netlink_event(device->pnp.device_class, 245 acpi_bus_generate_netlink_event(device->pnp.device_class,
242 device->dev.bus_id, event, 246 device->dev.bus_id, event,
243 (u32) ac->state); 247 (u32) ac->state);
248#ifdef CONFIG_ACPI_SYSFS_POWER
244 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 249 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
250#endif
245 break; 251 break;
246 default: 252 default:
247 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 253 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -280,12 +286,14 @@ static int acpi_ac_add(struct acpi_device *device)
280#endif 286#endif
281 if (result) 287 if (result)
282 goto end; 288 goto end;
289#ifdef CONFIG_ACPI_SYSFS_POWER
283 ac->charger.name = acpi_device_bid(device); 290 ac->charger.name = acpi_device_bid(device);
284 ac->charger.type = POWER_SUPPLY_TYPE_MAINS; 291 ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
285 ac->charger.properties = ac_props; 292 ac->charger.properties = ac_props;
286 ac->charger.num_properties = ARRAY_SIZE(ac_props); 293 ac->charger.num_properties = ARRAY_SIZE(ac_props);
287 ac->charger.get_property = get_ac_property; 294 ac->charger.get_property = get_ac_property;
288 power_supply_register(&ac->device->dev, &ac->charger); 295 power_supply_register(&ac->device->dev, &ac->charger);
296#endif
289 status = acpi_install_notify_handler(device->handle, 297 status = acpi_install_notify_handler(device->handle,
290 ACPI_ALL_NOTIFY, acpi_ac_notify, 298 ACPI_ALL_NOTIFY, acpi_ac_notify,
291 ac); 299 ac);
@@ -319,8 +327,10 @@ static int acpi_ac_resume(struct acpi_device *device)
319 old_state = ac->state; 327 old_state = ac->state;
320 if (acpi_ac_get_state(ac)) 328 if (acpi_ac_get_state(ac))
321 return 0; 329 return 0;
330#ifdef CONFIG_ACPI_SYSFS_POWER
322 if (old_state != ac->state) 331 if (old_state != ac->state)
323 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 332 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
333#endif
324 return 0; 334 return 0;
325} 335}
326 336
@@ -337,8 +347,10 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
337 347
338 status = acpi_remove_notify_handler(device->handle, 348 status = acpi_remove_notify_handler(device->handle,
339 ACPI_ALL_NOTIFY, acpi_ac_notify); 349 ACPI_ALL_NOTIFY, acpi_ac_notify);
350#ifdef CONFIG_ACPI_SYSFS_POWER
340 if (ac->charger.dev) 351 if (ac->charger.dev)
341 power_supply_unregister(&ac->charger); 352 power_supply_unregister(&ac->charger);
353#endif
342#ifdef CONFIG_ACPI_PROCFS_POWER 354#ifdef CONFIG_ACPI_PROCFS_POWER
343 acpi_ac_remove_fs(device); 355 acpi_ac_remove_fs(device);
344#endif 356#endif
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 8f7505d304b5..c4a769d1ba85 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -40,7 +40,9 @@
40#include <acpi/acpi_bus.h> 40#include <acpi/acpi_bus.h>
41#include <acpi/acpi_drivers.h> 41#include <acpi/acpi_drivers.h>
42 42
43#ifdef CONFIG_ACPI_SYSFS_POWER
43#include <linux/power_supply.h> 44#include <linux/power_supply.h>
45#endif
44 46
45#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF 47#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
46 48
@@ -86,7 +88,9 @@ MODULE_DEVICE_TABLE(acpi, battery_device_ids);
86 88
87struct acpi_battery { 89struct acpi_battery {
88 struct mutex lock; 90 struct mutex lock;
91#ifdef CONFIG_ACPI_SYSFS_POWER
89 struct power_supply bat; 92 struct power_supply bat;
93#endif
90 struct acpi_device *device; 94 struct acpi_device *device;
91 unsigned long update_time; 95 unsigned long update_time;
92 int current_now; 96 int current_now;
@@ -117,6 +121,7 @@ inline int acpi_battery_present(struct acpi_battery *battery)
117 return battery->device->status.battery_present; 121 return battery->device->status.battery_present;
118} 122}
119 123
124#ifdef CONFIG_ACPI_SYSFS_POWER
120static int acpi_battery_technology(struct acpi_battery *battery) 125static int acpi_battery_technology(struct acpi_battery *battery)
121{ 126{
122 if (!strcasecmp("NiCd", battery->type)) 127 if (!strcasecmp("NiCd", battery->type))
@@ -222,6 +227,7 @@ static enum power_supply_property energy_battery_props[] = {
222 POWER_SUPPLY_PROP_MODEL_NAME, 227 POWER_SUPPLY_PROP_MODEL_NAME,
223 POWER_SUPPLY_PROP_MANUFACTURER, 228 POWER_SUPPLY_PROP_MANUFACTURER,
224}; 229};
230#endif
225 231
226#ifdef CONFIG_ACPI_PROCFS_POWER 232#ifdef CONFIG_ACPI_PROCFS_POWER
227inline char *acpi_battery_units(struct acpi_battery *battery) 233inline char *acpi_battery_units(struct acpi_battery *battery)
@@ -398,6 +404,7 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery)
398 return acpi_battery_set_alarm(battery); 404 return acpi_battery_set_alarm(battery);
399} 405}
400 406
407#ifdef CONFIG_ACPI_SYSFS_POWER
401static ssize_t acpi_battery_alarm_show(struct device *dev, 408static ssize_t acpi_battery_alarm_show(struct device *dev,
402 struct device_attribute *attr, 409 struct device_attribute *attr,
403 char *buf) 410 char *buf)
@@ -429,11 +436,6 @@ static int sysfs_add_battery(struct acpi_battery *battery)
429{ 436{
430 int result; 437 int result;
431 438
432 battery->update_time = 0;
433 result = acpi_battery_get_info(battery);
434 acpi_battery_init_alarm(battery);
435 if (result)
436 return result;
437 if (battery->power_unit) { 439 if (battery->power_unit) {
438 battery->bat.properties = charge_battery_props; 440 battery->bat.properties = charge_battery_props;
439 battery->bat.num_properties = 441 battery->bat.num_properties =
@@ -462,18 +464,31 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
462 power_supply_unregister(&battery->bat); 464 power_supply_unregister(&battery->bat);
463 battery->bat.dev = NULL; 465 battery->bat.dev = NULL;
464} 466}
467#endif
465 468
466static int acpi_battery_update(struct acpi_battery *battery) 469static int acpi_battery_update(struct acpi_battery *battery)
467{ 470{
468 int result = acpi_battery_get_status(battery); 471 int result;
472 result = acpi_battery_get_status(battery);
469 if (result) 473 if (result)
470 return result; 474 return result;
475#ifdef CONFIG_ACPI_SYSFS_POWER
471 if (!acpi_battery_present(battery)) { 476 if (!acpi_battery_present(battery)) {
472 sysfs_remove_battery(battery); 477 sysfs_remove_battery(battery);
478 battery->update_time = 0;
473 return 0; 479 return 0;
474 } 480 }
481#endif
482 if (!battery->update_time) {
483 result = acpi_battery_get_info(battery);
484 if (result)
485 return result;
486 acpi_battery_init_alarm(battery);
487 }
488#ifdef CONFIG_ACPI_SYSFS_POWER
475 if (!battery->bat.dev) 489 if (!battery->bat.dev)
476 sysfs_add_battery(battery); 490 sysfs_add_battery(battery);
491#endif
477 return acpi_battery_get_state(battery); 492 return acpi_battery_get_state(battery);
478} 493}
479 494
@@ -767,9 +782,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
767 acpi_bus_generate_netlink_event(device->pnp.device_class, 782 acpi_bus_generate_netlink_event(device->pnp.device_class,
768 device->dev.bus_id, event, 783 device->dev.bus_id, event,
769 acpi_battery_present(battery)); 784 acpi_battery_present(battery));
785#ifdef CONFIG_ACPI_SYSFS_POWER
770 /* acpi_batter_update could remove power_supply object */ 786 /* acpi_batter_update could remove power_supply object */
771 if (battery->bat.dev) 787 if (battery->bat.dev)
772 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); 788 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
789#endif
773} 790}
774 791
775static int acpi_battery_add(struct acpi_device *device) 792static int acpi_battery_add(struct acpi_device *device)
@@ -828,7 +845,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
828#ifdef CONFIG_ACPI_PROCFS_POWER 845#ifdef CONFIG_ACPI_PROCFS_POWER
829 acpi_battery_remove_fs(device); 846 acpi_battery_remove_fs(device);
830#endif 847#endif
848#ifdef CONFIG_ACPI_SYSFS_POWER
831 sysfs_remove_battery(battery); 849 sysfs_remove_battery(battery);
850#endif
832 mutex_destroy(&battery->lock); 851 mutex_destroy(&battery->lock);
833 kfree(battery); 852 kfree(battery);
834 return 0; 853 return 0;
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 49d432d0a12c..d7a115c362d1 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -29,7 +29,6 @@
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <linux/pm.h> 31#include <linux/pm.h>
32#include <linux/pm_legacy.h>
33#include <linux/device.h> 32#include <linux/device.h>
34#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
35#ifdef CONFIG_X86 34#ifdef CONFIG_X86
@@ -764,16 +763,14 @@ static int __init acpi_init(void)
764 result = acpi_bus_init(); 763 result = acpi_bus_init();
765 764
766 if (!result) { 765 if (!result) {
767#ifdef CONFIG_PM_LEGACY 766 if (!(pm_flags & PM_APM))
768 if (!PM_IS_ACTIVE()) 767 pm_flags |= PM_ACPI;
769 pm_active = 1;
770 else { 768 else {
771 printk(KERN_INFO PREFIX 769 printk(KERN_INFO PREFIX
772 "APM is already active, exiting\n"); 770 "APM is already active, exiting\n");
773 disable_acpi(); 771 disable_acpi();
774 result = -ENODEV; 772 result = -ENODEV;
775 } 773 }
776#endif
777 } else 774 } else
778 disable_acpi(); 775 disable_acpi();
779 776
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index d411017f8c06..97dc16155a55 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -892,6 +892,17 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
892 return 0; 892 return 0;
893} 893}
894 894
895int __init acpi_boot_ec_enable(void)
896{
897 if (!boot_ec || boot_ec->handlers_installed)
898 return 0;
899 if (!ec_install_handlers(boot_ec)) {
900 first_ec = boot_ec;
901 return 0;
902 }
903 return -EFAULT;
904}
905
895int __init acpi_ec_ecdt_probe(void) 906int __init acpi_ec_ecdt_probe(void)
896{ 907{
897 int ret; 908 int ret;
@@ -924,9 +935,10 @@ int __init acpi_ec_ecdt_probe(void)
924 goto error; 935 goto error;
925 /* We really need to limit this workaround, the only ASUS, 936 /* We really need to limit this workaround, the only ASUS,
926 * which needs it, has fake EC._INI method, so use it as flag. 937 * which needs it, has fake EC._INI method, so use it as flag.
938 * Keep boot_ec struct as it will be needed soon.
927 */ 939 */
928 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) 940 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
929 goto error; 941 return -ENODEV;
930 } 942 }
931 943
932 ret = ec_install_handlers(boot_ec); 944 ret = ec_install_handlers(boot_ec);
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index e99f0c435a47..58ad09725dd2 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -344,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
344 * setup will potentially execute control methods 344 * setup will potentially execute control methods
345 * (e.g., _REG method for this region) 345 * (e.g., _REG method for this region)
346 */ 346 */
347 acpi_ex_relinquish_interpreter(); 347 acpi_ex_exit_interpreter();
348 348
349 status = region_setup(region_obj, ACPI_REGION_ACTIVATE, 349 status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
350 handler_desc->address_space.context, 350 handler_desc->address_space.context,
@@ -352,7 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
352 352
353 /* Re-enter the interpreter */ 353 /* Re-enter the interpreter */
354 354
355 acpi_ex_reacquire_interpreter(); 355 acpi_ex_enter_interpreter();
356 356
357 /* Check for failure of the Region Setup */ 357 /* Check for failure of the Region Setup */
358 358
@@ -405,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
405 * exit the interpreter because the handler *might* block -- we don't 405 * exit the interpreter because the handler *might* block -- we don't
406 * know what it will do, so we can't hold the lock on the intepreter. 406 * know what it will do, so we can't hold the lock on the intepreter.
407 */ 407 */
408 acpi_ex_relinquish_interpreter(); 408 acpi_ex_exit_interpreter();
409 } 409 }
410 410
411 /* Call the handler */ 411 /* Call the handler */
@@ -426,7 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
426 * We just returned from a non-default handler, we must re-enter the 426 * We just returned from a non-default handler, we must re-enter the
427 * interpreter 427 * interpreter
428 */ 428 */
429 acpi_ex_reacquire_interpreter(); 429 acpi_ex_enter_interpreter();
430 } 430 }
431 431
432 return_ACPI_STATUS(status); 432 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index dd3186abe07a..62010c2481b3 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -429,6 +429,15 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
429 &polarity, &link, 429 &polarity, &link,
430 acpi_pci_allocate_irq); 430 acpi_pci_allocate_irq);
431 431
432 if (irq < 0) {
433 /*
434 * IDE legacy mode controller IRQs are magic. Why do compat
435 * extensions always make such a nasty mess.
436 */
437 if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE &&
438 (dev->class & 0x05) == 0)
439 return 0;
440 }
432 /* 441 /*
433 * No IRQ known to the ACPI subsystem - maybe the BIOS / 442 * No IRQ known to the ACPI subsystem - maybe the BIOS /
434 * driver reported one, then use it. Exit in any case. 443 * driver reported one, then use it. Exit in any case.
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 2fe34cc73c13..2235f4e02d26 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -76,7 +76,11 @@ static void (*pm_idle_save) (void) __read_mostly;
76#define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000)) 76#define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000))
77 77
78static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; 78static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
79#ifdef CONFIG_CPU_IDLE
79module_param(max_cstate, uint, 0000); 80module_param(max_cstate, uint, 0000);
81#else
82module_param(max_cstate, uint, 0644);
83#endif
80static unsigned int nocst __read_mostly; 84static unsigned int nocst __read_mostly;
81module_param(nocst, uint, 0000); 85module_param(nocst, uint, 0000);
82 86
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 22cb95b349e4..f136c7d3b3c2 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -40,7 +40,9 @@
40#include <linux/jiffies.h> 40#include <linux/jiffies.h>
41#include <linux/delay.h> 41#include <linux/delay.h>
42 42
43#ifdef CONFIG_ACPI_SYSFS_POWER
43#include <linux/power_supply.h> 44#include <linux/power_supply.h>
45#endif
44 46
45#include "sbshc.h" 47#include "sbshc.h"
46 48
@@ -80,7 +82,9 @@ static const struct acpi_device_id sbs_device_ids[] = {
80MODULE_DEVICE_TABLE(acpi, sbs_device_ids); 82MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
81 83
82struct acpi_battery { 84struct acpi_battery {
85#ifdef CONFIG_ACPI_SYSFS_POWER
83 struct power_supply bat; 86 struct power_supply bat;
87#endif
84 struct acpi_sbs *sbs; 88 struct acpi_sbs *sbs;
85#ifdef CONFIG_ACPI_PROCFS_POWER 89#ifdef CONFIG_ACPI_PROCFS_POWER
86 struct proc_dir_entry *proc_entry; 90 struct proc_dir_entry *proc_entry;
@@ -113,7 +117,9 @@ struct acpi_battery {
113#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 117#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
114 118
115struct acpi_sbs { 119struct acpi_sbs {
120#ifdef CONFIG_ACPI_SYSFS_POWER
116 struct power_supply charger; 121 struct power_supply charger;
122#endif
117 struct acpi_device *device; 123 struct acpi_device *device;
118 struct acpi_smb_hc *hc; 124 struct acpi_smb_hc *hc;
119 struct mutex lock; 125 struct mutex lock;
@@ -157,6 +163,7 @@ static inline int acpi_battery_scale(struct acpi_battery *battery)
157 acpi_battery_ipscale(battery); 163 acpi_battery_ipscale(battery);
158} 164}
159 165
166#ifdef CONFIG_ACPI_SYSFS_POWER
160static int sbs_get_ac_property(struct power_supply *psy, 167static int sbs_get_ac_property(struct power_supply *psy,
161 enum power_supply_property psp, 168 enum power_supply_property psp,
162 union power_supply_propval *val) 169 union power_supply_propval *val)
@@ -294,6 +301,7 @@ static enum power_supply_property sbs_energy_battery_props[] = {
294 POWER_SUPPLY_PROP_MODEL_NAME, 301 POWER_SUPPLY_PROP_MODEL_NAME,
295 POWER_SUPPLY_PROP_MANUFACTURER, 302 POWER_SUPPLY_PROP_MANUFACTURER,
296}; 303};
304#endif
297 305
298/* -------------------------------------------------------------------------- 306/* --------------------------------------------------------------------------
299 Smart Battery System Management 307 Smart Battery System Management
@@ -429,6 +437,7 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs)
429 return result; 437 return result;
430} 438}
431 439
440#ifdef CONFIG_ACPI_SYSFS_POWER
432static ssize_t acpi_battery_alarm_show(struct device *dev, 441static ssize_t acpi_battery_alarm_show(struct device *dev,
433 struct device_attribute *attr, 442 struct device_attribute *attr,
434 char *buf) 443 char *buf)
@@ -458,6 +467,7 @@ static struct device_attribute alarm_attr = {
458 .show = acpi_battery_alarm_show, 467 .show = acpi_battery_alarm_show,
459 .store = acpi_battery_alarm_store, 468 .store = acpi_battery_alarm_store,
460}; 469};
470#endif
461 471
462/* -------------------------------------------------------------------------- 472/* --------------------------------------------------------------------------
463 FS Interface (/proc/acpi) 473 FS Interface (/proc/acpi)
@@ -793,6 +803,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
793 &acpi_battery_state_fops, &acpi_battery_alarm_fops, 803 &acpi_battery_state_fops, &acpi_battery_alarm_fops,
794 battery); 804 battery);
795#endif 805#endif
806#ifdef CONFIG_ACPI_SYSFS_POWER
796 battery->bat.name = battery->name; 807 battery->bat.name = battery->name;
797 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; 808 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
798 if (!acpi_battery_mode(battery)) { 809 if (!acpi_battery_mode(battery)) {
@@ -813,6 +824,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
813 goto end; 824 goto end;
814 battery->have_sysfs_alarm = 1; 825 battery->have_sysfs_alarm = 1;
815 end: 826 end:
827#endif
816 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", 828 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
817 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), 829 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
818 battery->name, sbs->battery->present ? "present" : "absent"); 830 battery->name, sbs->battery->present ? "present" : "absent");
@@ -822,12 +834,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
822static void acpi_battery_remove(struct acpi_sbs *sbs, int id) 834static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
823{ 835{
824 struct acpi_battery *battery = &sbs->battery[id]; 836 struct acpi_battery *battery = &sbs->battery[id];
825 837#ifdef CONFIG_ACPI_SYSFS_POWER
826 if (battery->bat.dev) { 838 if (battery->bat.dev) {
827 if (battery->have_sysfs_alarm) 839 if (battery->have_sysfs_alarm)
828 device_remove_file(battery->bat.dev, &alarm_attr); 840 device_remove_file(battery->bat.dev, &alarm_attr);
829 power_supply_unregister(&battery->bat); 841 power_supply_unregister(&battery->bat);
830 } 842 }
843#endif
831#ifdef CONFIG_ACPI_PROCFS_POWER 844#ifdef CONFIG_ACPI_PROCFS_POWER
832 if (battery->proc_entry) 845 if (battery->proc_entry)
833 acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); 846 acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
@@ -848,12 +861,14 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
848 if (result) 861 if (result)
849 goto end; 862 goto end;
850#endif 863#endif
864#ifdef CONFIG_ACPI_SYSFS_POWER
851 sbs->charger.name = "sbs-charger"; 865 sbs->charger.name = "sbs-charger";
852 sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; 866 sbs->charger.type = POWER_SUPPLY_TYPE_MAINS;
853 sbs->charger.properties = sbs_ac_props; 867 sbs->charger.properties = sbs_ac_props;
854 sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); 868 sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props);
855 sbs->charger.get_property = sbs_get_ac_property; 869 sbs->charger.get_property = sbs_get_ac_property;
856 power_supply_register(&sbs->device->dev, &sbs->charger); 870 power_supply_register(&sbs->device->dev, &sbs->charger);
871#endif
857 printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", 872 printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n",
858 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), 873 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
859 ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); 874 ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line");
@@ -863,8 +878,10 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
863 878
864static void acpi_charger_remove(struct acpi_sbs *sbs) 879static void acpi_charger_remove(struct acpi_sbs *sbs)
865{ 880{
881#ifdef CONFIG_ACPI_SYSFS_POWER
866 if (sbs->charger.dev) 882 if (sbs->charger.dev)
867 power_supply_unregister(&sbs->charger); 883 power_supply_unregister(&sbs->charger);
884#endif
868#ifdef CONFIG_ACPI_PROCFS_POWER 885#ifdef CONFIG_ACPI_PROCFS_POWER
869 if (sbs->charger_entry) 886 if (sbs->charger_entry)
870 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); 887 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
@@ -885,7 +902,9 @@ void acpi_sbs_callback(void *context)
885 ACPI_SBS_NOTIFY_STATUS, 902 ACPI_SBS_NOTIFY_STATUS,
886 sbs->charger_present); 903 sbs->charger_present);
887#endif 904#endif
905#ifdef CONFIG_ACPI_SYSFS_POWER
888 kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); 906 kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE);
907#endif
889 } 908 }
890 if (sbs->manager_present) { 909 if (sbs->manager_present) {
891 for (id = 0; id < MAX_SBS_BAT; ++id) { 910 for (id = 0; id < MAX_SBS_BAT; ++id) {
@@ -902,7 +921,9 @@ void acpi_sbs_callback(void *context)
902 ACPI_SBS_NOTIFY_STATUS, 921 ACPI_SBS_NOTIFY_STATUS,
903 bat->present); 922 bat->present);
904#endif 923#endif
924#ifdef CONFIG_ACPI_SYSFS_POWER
905 kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); 925 kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE);
926#endif
906 } 927 }
907 } 928 }
908} 929}
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5b4d462117cf..cbfe9ae7a9e5 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1449,6 +1449,8 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
1449 return result; 1449 return result;
1450} 1450}
1451 1451
1452int __init acpi_boot_ec_enable(void);
1453
1452static int __init acpi_scan_init(void) 1454static int __init acpi_scan_init(void)
1453{ 1455{
1454 int result; 1456 int result;
@@ -1480,6 +1482,10 @@ static int __init acpi_scan_init(void)
1480 * Enumerate devices in the ACPI namespace. 1482 * Enumerate devices in the ACPI namespace.
1481 */ 1483 */
1482 result = acpi_bus_scan_fixed(acpi_root); 1484 result = acpi_bus_scan_fixed(acpi_root);
1485
1486 /* EC region might be needed at bus_scan, so enable it now */
1487 acpi_boot_ec_enable();
1488
1483 if (!result) 1489 if (!result)
1484 result = acpi_bus_scan(acpi_root, &ops); 1490 result = acpi_bus_scan(acpi_root, &ops);
1485 1491
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index bb62a588f489..b406b39b878e 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -132,6 +132,7 @@ enum {
132 ich8_2port_sata, 132 ich8_2port_sata,
133 ich8m_apple_sata_ahci, /* locks up on second port enable */ 133 ich8m_apple_sata_ahci, /* locks up on second port enable */
134 tolapai_sata_ahci, 134 tolapai_sata_ahci,
135 piix_pata_vmw, /* PIIX4 for VMware, spurious DMA_ERR */
135 136
136 /* constants for mapping table */ 137 /* constants for mapping table */
137 P0 = 0, /* port 0 */ 138 P0 = 0, /* port 0 */
@@ -165,6 +166,7 @@ static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev);
165static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev); 166static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev);
166static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev); 167static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev);
167static int ich_pata_cable_detect(struct ata_port *ap); 168static int ich_pata_cable_detect(struct ata_port *ap);
169static u8 piix_vmw_bmdma_status(struct ata_port *ap);
168#ifdef CONFIG_PM 170#ifdef CONFIG_PM
169static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 171static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
170static int piix_pci_device_resume(struct pci_dev *pdev); 172static int piix_pci_device_resume(struct pci_dev *pdev);
@@ -175,6 +177,8 @@ static unsigned int in_module_init = 1;
175static const struct pci_device_id piix_pci_tbl[] = { 177static const struct pci_device_id piix_pci_tbl[] = {
176 /* Intel PIIX3 for the 430HX etc */ 178 /* Intel PIIX3 for the 430HX etc */
177 { 0x8086, 0x7010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_mwdma }, 179 { 0x8086, 0x7010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_mwdma },
180 /* VMware ICH4 */
181 { 0x8086, 0x7111, 0x15ad, 0x1976, 0, 0, piix_pata_vmw },
178 /* Intel PIIX4 for the 430TX/440BX/MX chipset: UDMA 33 */ 182 /* Intel PIIX4 for the 430TX/440BX/MX chipset: UDMA 33 */
179 /* Also PIIX4E (fn3 rev 2) and PIIX4M (fn3 rev 3) */ 183 /* Also PIIX4E (fn3 rev 2) and PIIX4M (fn3 rev 3) */
180 { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_33 }, 184 { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_33 },
@@ -383,6 +387,38 @@ static const struct ata_port_operations piix_sata_ops = {
383 .port_start = ata_port_start, 387 .port_start = ata_port_start,
384}; 388};
385 389
390static const struct ata_port_operations piix_vmw_ops = {
391 .set_piomode = piix_set_piomode,
392 .set_dmamode = piix_set_dmamode,
393 .mode_filter = ata_pci_default_filter,
394
395 .tf_load = ata_tf_load,
396 .tf_read = ata_tf_read,
397 .check_status = ata_check_status,
398 .exec_command = ata_exec_command,
399 .dev_select = ata_std_dev_select,
400
401 .bmdma_setup = ata_bmdma_setup,
402 .bmdma_start = ata_bmdma_start,
403 .bmdma_stop = ata_bmdma_stop,
404 .bmdma_status = piix_vmw_bmdma_status,
405 .qc_prep = ata_qc_prep,
406 .qc_issue = ata_qc_issue_prot,
407 .data_xfer = ata_data_xfer,
408
409 .freeze = ata_bmdma_freeze,
410 .thaw = ata_bmdma_thaw,
411 .error_handler = piix_pata_error_handler,
412 .post_internal_cmd = ata_bmdma_post_internal_cmd,
413 .cable_detect = ata_cable_40wire,
414
415 .irq_handler = ata_interrupt,
416 .irq_clear = ata_bmdma_irq_clear,
417 .irq_on = ata_irq_on,
418
419 .port_start = ata_port_start,
420};
421
386static const struct piix_map_db ich5_map_db = { 422static const struct piix_map_db ich5_map_db = {
387 .mask = 0x7, 423 .mask = 0x7,
388 .port_enable = 0x3, 424 .port_enable = 0x3,
@@ -623,6 +659,16 @@ static struct ata_port_info piix_port_info[] = {
623 .port_ops = &piix_sata_ops, 659 .port_ops = &piix_sata_ops,
624 }, 660 },
625 661
662 [piix_pata_vmw] =
663 {
664 .sht = &piix_sht,
665 .flags = PIIX_PATA_FLAGS,
666 .pio_mask = 0x1f, /* pio0-4 */
667 .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
668 .udma_mask = ATA_UDMA_MASK_40C,
669 .port_ops = &piix_vmw_ops,
670 },
671
626}; 672};
627 673
628static struct pci_bits piix_enable_bits[] = { 674static struct pci_bits piix_enable_bits[] = {
@@ -1135,6 +1181,11 @@ static int piix_pci_device_resume(struct pci_dev *pdev)
1135} 1181}
1136#endif 1182#endif
1137 1183
1184static u8 piix_vmw_bmdma_status(struct ata_port *ap)
1185{
1186 return ata_bmdma_status(ap) & ~ATA_DMA_ERR;
1187}
1188
1138#define AHCI_PCI_BAR 5 1189#define AHCI_PCI_BAR 5
1139#define AHCI_GLOBAL_CTL 0x04 1190#define AHCI_GLOBAL_CTL 0x04
1140#define AHCI_ENABLE (1 << 31) 1191#define AHCI_ENABLE (1 << 31)
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index f0124a8d3134..21a81cd148e4 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1733,11 +1733,15 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1733 ehc->i.action &= ~ATA_EH_PERDEV_MASK; 1733 ehc->i.action &= ~ATA_EH_PERDEV_MASK;
1734 } 1734 }
1735 1735
1736 /* consider speeding down */ 1736 /* propagate timeout to host link */
1737 if ((all_err_mask & AC_ERR_TIMEOUT) && !ata_is_host_link(link))
1738 ap->link.eh_context.i.err_mask |= AC_ERR_TIMEOUT;
1739
1740 /* record error and consider speeding down */
1737 dev = ehc->i.dev; 1741 dev = ehc->i.dev;
1738 if (!dev && ata_link_max_devices(link) == 1 && 1742 if (!dev && ((ata_link_max_devices(link) == 1 &&
1739 ata_dev_enabled(link->device)) 1743 ata_dev_enabled(link->device))))
1740 dev = link->device; 1744 dev = link->device;
1741 1745
1742 if (dev) 1746 if (dev)
1743 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask); 1747 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask);
@@ -1759,8 +1763,14 @@ void ata_eh_autopsy(struct ata_port *ap)
1759{ 1763{
1760 struct ata_link *link; 1764 struct ata_link *link;
1761 1765
1762 __ata_port_for_each_link(link, ap) 1766 ata_port_for_each_link(link, ap)
1763 ata_eh_link_autopsy(link); 1767 ata_eh_link_autopsy(link);
1768
1769 /* Autopsy of fanout ports can affect host link autopsy.
1770 * Perform host link autopsy last.
1771 */
1772 if (ap->nr_pmp_links)
1773 ata_eh_link_autopsy(&ap->link);
1764} 1774}
1765 1775
1766/** 1776/**
@@ -2157,13 +2167,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
2157 if (ata_link_offline(link)) 2167 if (ata_link_offline(link))
2158 continue; 2168 continue;
2159 2169
2160 /* apply class override and convert UNKNOWN to NONE */ 2170 /* apply class override */
2161 if (lflags & ATA_LFLAG_ASSUME_ATA) 2171 if (lflags & ATA_LFLAG_ASSUME_ATA)
2162 classes[dev->devno] = ATA_DEV_ATA; 2172 classes[dev->devno] = ATA_DEV_ATA;
2163 else if (lflags & ATA_LFLAG_ASSUME_SEMB) 2173 else if (lflags & ATA_LFLAG_ASSUME_SEMB)
2164 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */ 2174 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
2165 else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2166 classes[dev->devno] = ATA_DEV_NONE;
2167 } 2175 }
2168 2176
2169 /* record current link speed */ 2177 /* record current link speed */
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index c0c4dbcde091..caef2bbd4a8a 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -495,14 +495,12 @@ static void sata_pmp_quirks(struct ata_port *ap)
495 /* SError.N need a kick in the ass to get working */ 495 /* SError.N need a kick in the ass to get working */
496 link->flags |= ATA_LFLAG_HRST_TO_RESUME; 496 link->flags |= ATA_LFLAG_HRST_TO_RESUME;
497 497
498 /* class code report is unreliable */ 498 /* Class code report is unreliable and SRST
499 if (link->pmp < 5) 499 * times out under certain configurations.
500 link->flags |= ATA_LFLAG_ASSUME_ATA; 500 * Config device can be at port 0 or 5 and
501 501 * locks up on SRST.
502 /* The config device, which can be either at
503 * port 0 or 5, locks up on SRST.
504 */ 502 */
505 if (link->pmp == 0 || link->pmp == 5) 503 if (link->pmp <= 5)
506 link->flags |= ATA_LFLAG_NO_SRST | 504 link->flags |= ATA_LFLAG_NO_SRST |
507 ATA_LFLAG_ASSUME_ATA; 505 ATA_LFLAG_ASSUME_ATA;
508 506
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a883bb03d4c7..14daf4848f09 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -841,6 +841,9 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1); 841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
842 } 842 }
843 843
844 if (dev->class == ATA_DEV_ATA)
845 sdev->manage_start_stop = 1;
846
844 if (dev->flags & ATA_DFLAG_AN) 847 if (dev->flags & ATA_DFLAG_AN)
845 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); 848 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
846 849
@@ -872,8 +875,6 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
872 875
873 ata_scsi_sdev_config(sdev); 876 ata_scsi_sdev_config(sdev);
874 877
875 sdev->manage_start_stop = 1;
876
877 if (dev) 878 if (dev)
878 ata_scsi_dev_config(sdev, dev); 879 ata_scsi_dev_config(sdev, dev);
879 880
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 48acc09dab96..b7ac80b4b1fb 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -806,7 +806,10 @@ int ata_pci_init_one(struct pci_dev *pdev,
806 if (rc) 806 if (rc)
807 goto err_out; 807 goto err_out;
808 808
809 if (!legacy_mode) { 809 if (!legacy_mode && pdev->irq) {
810 /* We may have no IRQ assigned in which case we can poll. This
811 shouldn't happen on a sane system but robustness is cheap
812 in this case */
810 rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler, 813 rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler,
811 IRQF_SHARED, DRV_NAME, host); 814 IRQF_SHARED, DRV_NAME, host);
812 if (rc) 815 if (rc)
@@ -814,7 +817,7 @@ int ata_pci_init_one(struct pci_dev *pdev,
814 817
815 ata_port_desc(host->ports[0], "irq %d", pdev->irq); 818 ata_port_desc(host->ports[0], "irq %d", pdev->irq);
816 ata_port_desc(host->ports[1], "irq %d", pdev->irq); 819 ata_port_desc(host->ports[1], "irq %d", pdev->irq);
817 } else { 820 } else if (legacy_mode) {
818 if (!ata_port_is_dummy(host->ports[0])) { 821 if (!ata_port_is_dummy(host->ports[0])) {
819 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev), 822 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev),
820 pi->port_ops->irq_handler, 823 pi->port_ops->irq_handler,
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index fcd532afbf2e..120b5bfa7ce6 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -130,10 +130,11 @@ static struct ata_port_operations ixp4xx_port_ops = {
130 .port_start = ata_port_start, 130 .port_start = ata_port_start,
131}; 131};
132 132
133static void ixp4xx_setup_port(struct ata_ioports *ioaddr, 133static void ixp4xx_setup_port(struct ata_port *ap,
134 struct ixp4xx_pata_data *data, 134 struct ixp4xx_pata_data *data,
135 unsigned long raw_cs0, unsigned long raw_cs1) 135 unsigned long raw_cs0, unsigned long raw_cs1)
136{ 136{
137 struct ata_ioports *ioaddr = &ap->ioaddr;
137 unsigned long raw_cmd = raw_cs0; 138 unsigned long raw_cmd = raw_cs0;
138 unsigned long raw_ctl = raw_cs1 + 0x06; 139 unsigned long raw_ctl = raw_cs1 + 0x06;
139 140
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index bc7c2d5d8d5e..8f2815601791 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -215,8 +215,8 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
215 /* Flip back to 33Mhz for PIO */ 215 /* Flip back to 33Mhz for PIO */
216 if (adev->dma_mode >= XFER_UDMA_2) 216 if (adev->dma_mode >= XFER_UDMA_2)
217 iowrite8(ioread8(clock) & ~sel66, clock); 217 iowrite8(ioread8(clock) & ~sel66, clock);
218
219 ata_bmdma_stop(qc); 218 ata_bmdma_stop(qc);
219 pdc202xx_set_piomode(ap, adev);
220} 220}
221 221
222/** 222/**
@@ -233,6 +233,17 @@ static void pdc2026x_dev_config(struct ata_device *adev)
233 adev->max_sectors = 256; 233 adev->max_sectors = 256;
234} 234}
235 235
236static int pdc2026x_port_start(struct ata_port *ap)
237{
238 void __iomem *bmdma = ap->ioaddr.bmdma_addr;
239 if (bmdma) {
240 /* Enable burst mode */
241 u8 burst = ioread8(bmdma + 0x1f);
242 iowrite8(burst | 0x01, bmdma + 0x1f);
243 }
244 return ata_sff_port_start(ap);
245}
246
236static struct scsi_host_template pdc202xx_sht = { 247static struct scsi_host_template pdc202xx_sht = {
237 .module = THIS_MODULE, 248 .module = THIS_MODULE,
238 .name = DRV_NAME, 249 .name = DRV_NAME,
@@ -313,7 +324,7 @@ static struct ata_port_operations pdc2026x_port_ops = {
313 .irq_clear = ata_bmdma_irq_clear, 324 .irq_clear = ata_bmdma_irq_clear,
314 .irq_on = ata_irq_on, 325 .irq_on = ata_irq_on,
315 326
316 .port_start = ata_sff_port_start, 327 .port_start = pdc2026x_port_start,
317}; 328};
318 329
319static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 330static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 2f1de6ec044c..c68b241805fd 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -270,7 +270,7 @@ static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
270static void qs_error_handler(struct ata_port *ap) 270static void qs_error_handler(struct ata_port *ap)
271{ 271{
272 qs_enter_reg_mode(ap); 272 qs_enter_reg_mode(ap);
273 ata_do_eh(ap, qs_prereset, ata_std_softreset, NULL, 273 ata_do_eh(ap, qs_prereset, NULL, sata_std_hardreset,
274 ata_std_postreset); 274 ata_std_postreset);
275} 275}
276 276
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 96fd5260446d..864c1c1b8511 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -301,7 +301,7 @@ static struct sil24_cerr_info {
301 [PORT_CERR_PKT_PROT] = { AC_ERR_HSM, ATA_EH_SOFTRESET, 301 [PORT_CERR_PKT_PROT] = { AC_ERR_HSM, ATA_EH_SOFTRESET,
302 "invalid data directon for ATAPI CDB" }, 302 "invalid data directon for ATAPI CDB" },
303 [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_SOFTRESET, 303 [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_SOFTRESET,
304 "SGT no on qword boundary" }, 304 "SGT not on qword boundary" },
305 [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, 305 [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET,
306 "PCI target abort while fetching SGT" }, 306 "PCI target abort while fetching SGT" },
307 [PORT_CERR_SGT_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, 307 [PORT_CERR_SGT_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET,
@@ -832,16 +832,31 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
832 struct ata_link *link = qc->dev->link; 832 struct ata_link *link = qc->dev->link;
833 struct ata_port *ap = link->ap; 833 struct ata_port *ap = link->ap;
834 u8 prot = qc->tf.protocol; 834 u8 prot = qc->tf.protocol;
835 int is_atapi = (prot == ATA_PROT_ATAPI || 835
836 prot == ATA_PROT_ATAPI_NODATA || 836 /*
837 prot == ATA_PROT_ATAPI_DMA); 837 * There is a bug in the chip:
838 838 * Port LRAM Causes the PRB/SGT Data to be Corrupted
839 /* ATAPI commands completing with CHECK_SENSE cause various 839 * If the host issues a read request for LRAM and SActive registers
840 * weird problems if other commands are active. PMP DMA CS 840 * while active commands are available in the port, PRB/SGT data in
841 * errata doesn't cover all and HSM violation occurs even with 841 * the LRAM can become corrupted. This issue applies only when
842 * only one other device active. Always run an ATAPI command 842 * reading from, but not writing to, the LRAM.
843 * by itself. 843 *
844 */ 844 * Therefore, reading LRAM when there is no particular error [and
845 * other commands may be outstanding] is prohibited.
846 *
847 * To avoid this bug there are two situations where a command must run
848 * exclusive of any other commands on the port:
849 *
850 * - ATAPI commands which check the sense data
851 * - Passthrough ATA commands which always have ATA_QCFLAG_RESULT_TF
852 * set.
853 *
854 */
855 int is_excl = (prot == ATA_PROT_ATAPI ||
856 prot == ATA_PROT_ATAPI_NODATA ||
857 prot == ATA_PROT_ATAPI_DMA ||
858 (qc->flags & ATA_QCFLAG_RESULT_TF));
859
845 if (unlikely(ap->excl_link)) { 860 if (unlikely(ap->excl_link)) {
846 if (link == ap->excl_link) { 861 if (link == ap->excl_link) {
847 if (ap->nr_active_links) 862 if (ap->nr_active_links)
@@ -849,7 +864,7 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
849 qc->flags |= ATA_QCFLAG_CLEAR_EXCL; 864 qc->flags |= ATA_QCFLAG_CLEAR_EXCL;
850 } else 865 } else
851 return ATA_DEFER_PORT; 866 return ATA_DEFER_PORT;
852 } else if (unlikely(is_atapi)) { 867 } else if (unlikely(is_excl)) {
853 ap->excl_link = link; 868 ap->excl_link = link;
854 if (ap->nr_active_links) 869 if (ap->nr_active_links)
855 return ATA_DEFER_PORT; 870 return ATA_DEFER_PORT;
@@ -1079,10 +1094,13 @@ static void sil24_error_intr(struct ata_port *ap)
1079 if (ci && ci->desc) { 1094 if (ci && ci->desc) {
1080 err_mask |= ci->err_mask; 1095 err_mask |= ci->err_mask;
1081 action |= ci->action; 1096 action |= ci->action;
1097 if (action & ATA_EH_RESET_MASK)
1098 freeze = 1;
1082 ata_ehi_push_desc(ehi, "%s", ci->desc); 1099 ata_ehi_push_desc(ehi, "%s", ci->desc);
1083 } else { 1100 } else {
1084 err_mask |= AC_ERR_OTHER; 1101 err_mask |= AC_ERR_OTHER;
1085 action |= ATA_EH_SOFTRESET; 1102 action |= ATA_EH_SOFTRESET;
1103 freeze = 1;
1086 ata_ehi_push_desc(ehi, "unknown command error %d", 1104 ata_ehi_push_desc(ehi, "unknown command error %d",
1087 cerr); 1105 cerr);
1088 } 1106 }
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 7d704968765f..509b6490413b 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -2927,7 +2927,7 @@ default_int_mode:
2927 return; 2927 return;
2928} 2928}
2929 2929
2930static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) 2930static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
2931{ 2931{
2932 ushort subsystem_vendor_id, subsystem_device_id, command; 2932 ushort subsystem_vendor_id, subsystem_device_id, command;
2933 __u32 board_id, scratchpad = 0; 2933 __u32 board_id, scratchpad = 0;
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 56e23042728a..b8af22e610df 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -610,7 +610,7 @@ static int loop_thread(void *data)
610static int loop_switch(struct loop_device *lo, struct file *file) 610static int loop_switch(struct loop_device *lo, struct file *file)
611{ 611{
612 struct switch_request w; 612 struct switch_request w;
613 struct bio *bio = bio_alloc(GFP_KERNEL, 1); 613 struct bio *bio = bio_alloc(GFP_KERNEL, 0);
614 if (!bio) 614 if (!bio)
615 return -ENOMEM; 615 return -ENOMEM;
616 init_completion(&w.wait); 616 init_completion(&w.wait);
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 39564b76d4a3..c88424a0c89b 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1046,12 +1046,6 @@ void tpm_remove_hardware(struct device *dev)
1046} 1046}
1047EXPORT_SYMBOL_GPL(tpm_remove_hardware); 1047EXPORT_SYMBOL_GPL(tpm_remove_hardware);
1048 1048
1049static u8 savestate[] = {
1050 0, 193, /* TPM_TAG_RQU_COMMAND */
1051 0, 0, 0, 10, /* blob length (in bytes) */
1052 0, 0, 0, 152 /* TPM_ORD_SaveState */
1053};
1054
1055/* 1049/*
1056 * We are about to suspend. Save the TPM state 1050 * We are about to suspend. Save the TPM state
1057 * so that it can be restored. 1051 * so that it can be restored.
@@ -1059,6 +1053,12 @@ static u8 savestate[] = {
1059int tpm_pm_suspend(struct device *dev, pm_message_t pm_state) 1053int tpm_pm_suspend(struct device *dev, pm_message_t pm_state)
1060{ 1054{
1061 struct tpm_chip *chip = dev_get_drvdata(dev); 1055 struct tpm_chip *chip = dev_get_drvdata(dev);
1056 u8 savestate[] = {
1057 0, 193, /* TPM_TAG_RQU_COMMAND */
1058 0, 0, 0, 10, /* blob length (in bytes) */
1059 0, 0, 0, 152 /* TPM_ORD_SaveState */
1060 };
1061
1062 if (chip == NULL) 1062 if (chip == NULL)
1063 return -ENODEV; 1063 return -ENODEV;
1064 1064
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index a337b693b6c9..5f7e71810489 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -429,8 +429,8 @@ static inline void padlock_xcrypt(const u8 *input, u8 *output, void *key,
429 429
430static void aes_crypt_copy(const u8 *in, u8 *out, u32 *key, struct cword *cword) 430static void aes_crypt_copy(const u8 *in, u8 *out, u32 *key, struct cword *cword)
431{ 431{
432 u8 tmp[AES_BLOCK_SIZE * 2] 432 u8 buf[AES_BLOCK_SIZE * 2 + PADLOCK_ALIGNMENT - 1];
433 __attribute__ ((__aligned__(PADLOCK_ALIGNMENT))); 433 u8 *tmp = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT);
434 434
435 memcpy(tmp, in, AES_BLOCK_SIZE); 435 memcpy(tmp, in, AES_BLOCK_SIZE);
436 padlock_xcrypt(tmp, out, key, cword); 436 padlock_xcrypt(tmp, out, key, cword);
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 9c8b6d5eaec9..c09b036913bd 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -135,7 +135,7 @@ static int xfer_write(struct i2c_adapter *adap, unsigned char *buf, int length)
135 * Generic i2c master transfer entrypoint. 135 * Generic i2c master transfer entrypoint.
136 * 136 *
137 * Note: We do not use Atmel's feature of storing the "internal device address". 137 * Note: We do not use Atmel's feature of storing the "internal device address".
138 * Instead the "internal device address" has to be written using a seperate 138 * Instead the "internal device address" has to be written using a separate
139 * i2c message. 139 * i2c message.
140 * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html 140 * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html
141 */ 141 */
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index cb55cf2ba1e9..f2552b19ea60 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -619,13 +619,13 @@ omap_i2c_probe(struct platform_device *pdev)
619err_free_irq: 619err_free_irq:
620 free_irq(dev->irq, dev); 620 free_irq(dev->irq, dev);
621err_unuse_clocks: 621err_unuse_clocks:
622 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
622 omap_i2c_disable_clocks(dev); 623 omap_i2c_disable_clocks(dev);
623 omap_i2c_put_clocks(dev); 624 omap_i2c_put_clocks(dev);
624err_free_mem: 625err_free_mem:
625 platform_set_drvdata(pdev, NULL); 626 platform_set_drvdata(pdev, NULL);
626 kfree(dev); 627 kfree(dev);
627err_release_region: 628err_release_region:
628 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
629 release_mem_region(mem->start, (mem->end - mem->start) + 1); 629 release_mem_region(mem->start, (mem->end - mem->start) + 1);
630 630
631 return r; 631 return r;
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 0ab4f2627c26..7813127649a1 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -94,7 +94,7 @@ static s32 i2c_powermac_smbus_xfer( struct i2c_adapter* adap,
94 break; 94 break;
95 95
96 /* Note that these are broken vs. the expected smbus API where 96 /* Note that these are broken vs. the expected smbus API where
97 * on reads, the lenght is actually returned from the function, 97 * on reads, the length is actually returned from the function,
98 * but I think the current API makes no sense and I don't want 98 * but I think the current API makes no sense and I don't want
99 * any driver that I haven't verified for correctness to go 99 * any driver that I haven't verified for correctness to go
100 * anywhere near a pmac i2c bus anyway ... 100 * anywhere near a pmac i2c bus anyway ...
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c
index 0ca599d3b402..503a134ec803 100644
--- a/drivers/i2c/busses/i2c-sibyte.c
+++ b/drivers/i2c/busses/i2c-sibyte.c
@@ -200,11 +200,14 @@ static struct i2c_adapter sibyte_board_adapter[2] = {
200 200
201static int __init i2c_sibyte_init(void) 201static int __init i2c_sibyte_init(void)
202{ 202{
203 printk("i2c-swarm.o: i2c SMBus adapter module for SiByte board\n"); 203 pr_info("i2c-sibyte: i2c SMBus adapter module for SiByte board\n");
204 if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0) 204 if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0)
205 return -ENODEV; 205 return -ENODEV;
206 if (i2c_sibyte_add_bus(&sibyte_board_adapter[1], K_SMB_FREQ_400KHZ) < 0) 206 if (i2c_sibyte_add_bus(&sibyte_board_adapter[1],
207 K_SMB_FREQ_400KHZ) < 0) {
208 i2c_del_adapter(&sibyte_board_adapter[0]);
207 return -ENODEV; 209 return -ENODEV;
210 }
208 return 0; 211 return 0;
209} 212}
210 213
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index c21ae20ae362..df540d5dfaf4 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -184,7 +184,7 @@ static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t c
184 184
185/* This address checking function differs from the one in i2c-core 185/* This address checking function differs from the one in i2c-core
186 in that it considers an address with a registered device, but no 186 in that it considers an address with a registered device, but no
187 bounded driver, as NOT busy. */ 187 bound driver, as NOT busy. */
188static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr) 188static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr)
189{ 189{
190 struct list_head *item; 190 struct list_head *item;
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 89df48fdc69d..899d56536e80 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -16,6 +16,7 @@
16#include <acpi/acpi.h> 16#include <acpi/acpi.h>
17#include <linux/ide.h> 17#include <linux/ide.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/dmi.h>
19 20
20#include <acpi/acpi_bus.h> 21#include <acpi/acpi_bus.h>
21#include <acpi/acnames.h> 22#include <acpi/acnames.h>
@@ -65,6 +66,39 @@ extern int ide_noacpi;
65extern int ide_noacpitfs; 66extern int ide_noacpitfs;
66extern int ide_noacpionboot; 67extern int ide_noacpionboot;
67 68
69static bool ide_noacpi_psx;
70static int no_acpi_psx(const struct dmi_system_id *id)
71{
72 ide_noacpi_psx = true;
73 printk(KERN_NOTICE"%s detected - disable ACPI _PSx.\n", id->ident);
74 return 0;
75}
76
77static const struct dmi_system_id ide_acpi_dmi_table[] = {
78 /* Bug 9673. */
79 /* We should check if this is because ACPI NVS isn't save/restored. */
80 {
81 .callback = no_acpi_psx,
82 .ident = "HP nx9005",
83 .matches = {
84 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies Ltd."),
85 DMI_MATCH(DMI_BIOS_VERSION, "KAM1.60")
86 },
87 },
88
89 { } /* terminate list */
90};
91
92static int ide_acpi_blacklist(void)
93{
94 static int done;
95 if (done)
96 return 0;
97 done = 1;
98 dmi_check_system(ide_acpi_dmi_table);
99 return 0;
100}
101
68/** 102/**
69 * ide_get_dev_handle - finds acpi_handle and PCI device.function 103 * ide_get_dev_handle - finds acpi_handle and PCI device.function
70 * @dev: device to locate 104 * @dev: device to locate
@@ -623,7 +657,7 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on)
623{ 657{
624 int unit; 658 int unit;
625 659
626 if (ide_noacpi) 660 if (ide_noacpi || ide_noacpi_psx)
627 return; 661 return;
628 662
629 DEBPRINT("ENTER:\n"); 663 DEBPRINT("ENTER:\n");
@@ -668,6 +702,8 @@ void ide_acpi_init(ide_hwif_t *hwif)
668 struct ide_acpi_drive_link *master; 702 struct ide_acpi_drive_link *master;
669 struct ide_acpi_drive_link *slave; 703 struct ide_acpi_drive_link *slave;
670 704
705 ide_acpi_blacklist();
706
671 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); 707 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL);
672 if (!hwif->acpidata) 708 if (!hwif->acpidata)
673 return; 709 return;
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index cef405ddaf0e..bb9693dabe41 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -612,12 +612,12 @@ u8 eighty_ninty_three (ide_drive_t *drive)
612 printk(KERN_DEBUG "%s: skipping word 93 validity check\n", 612 printk(KERN_DEBUG "%s: skipping word 93 validity check\n",
613 drive->name); 613 drive->name);
614 614
615 if (ide_dev_is_sata(id) && !ivb)
616 return 1;
617
615 if (hwif->cbl != ATA_CBL_PATA80 && !ivb) 618 if (hwif->cbl != ATA_CBL_PATA80 && !ivb)
616 goto no_80w; 619 goto no_80w;
617 620
618 if (ide_dev_is_sata(id))
619 return 1;
620
621 /* 621 /*
622 * FIXME: 622 * FIXME:
623 * - force bit13 (80c cable present) check also for !ivb devices 623 * - force bit13 (80c cable present) check also for !ivb devices
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index 0895e753a35d..0151d7fdfb8a 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * linux/drivers/ide/pci/trm290.c Version 1.02 Mar. 18, 2000 2 * linux/drivers/ide/pci/trm290.c Version 1.05 Dec. 26, 2007
3 * 3 *
4 * Copyright (c) 1997-1998 Mark Lord 4 * Copyright (c) 1997-1998 Mark Lord
5 * Copyright (c) 2007 MontaVista Software, Inc. <source@mvista.com>
5 * May be copied or modified under the terms of the GNU General Public License 6 * May be copied or modified under the terms of the GNU General Public License
6 * 7 *
7 * June 22, 2004 - get rid of check_region 8 * June 22, 2004 - get rid of check_region
@@ -177,7 +178,7 @@ static void trm290_selectproc (ide_drive_t *drive)
177 trm290_prepare_drive(drive, drive->using_dma); 178 trm290_prepare_drive(drive, drive->using_dma);
178} 179}
179 180
180static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) 181static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command)
181{ 182{
182 BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */ 183 BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */
183 ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); 184 ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
@@ -185,7 +186,7 @@ static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
185 outb(command, IDE_COMMAND_REG); 186 outb(command, IDE_COMMAND_REG);
186} 187}
187 188
188static int trm290_ide_dma_setup(ide_drive_t *drive) 189static int trm290_dma_setup(ide_drive_t *drive)
189{ 190{
190 ide_hwif_t *hwif = drive->hwif; 191 ide_hwif_t *hwif = drive->hwif;
191 struct request *rq = hwif->hwgroup->rq; 192 struct request *rq = hwif->hwgroup->rq;
@@ -215,7 +216,7 @@ static int trm290_ide_dma_setup(ide_drive_t *drive)
215 return 0; 216 return 0;
216} 217}
217 218
218static void trm290_ide_dma_start(ide_drive_t *drive) 219static void trm290_dma_start(ide_drive_t *drive)
219{ 220{
220} 221}
221 222
@@ -240,6 +241,14 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive)
240 return (status == 0x00ff); 241 return (status == 0x00ff);
241} 242}
242 243
244static void trm290_dma_host_on(ide_drive_t *drive)
245{
246}
247
248static void trm290_dma_host_off(ide_drive_t *drive)
249{
250}
251
243static void __devinit init_hwif_trm290(ide_hwif_t *hwif) 252static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
244{ 253{
245 unsigned int cfgbase = 0; 254 unsigned int cfgbase = 0;
@@ -280,11 +289,13 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
280 289
281 ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3); 290 ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3);
282 291
283 hwif->dma_setup = &trm290_ide_dma_setup; 292 hwif->dma_host_off = &trm290_dma_host_off;
284 hwif->dma_exec_cmd = &trm290_ide_dma_exec_cmd; 293 hwif->dma_host_on = &trm290_dma_host_on;
285 hwif->dma_start = &trm290_ide_dma_start; 294 hwif->dma_setup = &trm290_dma_setup;
286 hwif->ide_dma_end = &trm290_ide_dma_end; 295 hwif->dma_exec_cmd = &trm290_dma_exec_cmd;
287 hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq; 296 hwif->dma_start = &trm290_dma_start;
297 hwif->ide_dma_end = &trm290_ide_dma_end;
298 hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq;
288 299
289 hwif->selectproc = &trm290_selectproc; 300 hwif->selectproc = &trm290_selectproc;
290#if 1 301#if 1
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index bfc6061f1554..1dc2ac9f3d1c 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -38,8 +38,6 @@ EXPORT_SYMBOL(gameport_unregister_driver);
38EXPORT_SYMBOL(gameport_open); 38EXPORT_SYMBOL(gameport_open);
39EXPORT_SYMBOL(gameport_close); 39EXPORT_SYMBOL(gameport_close);
40EXPORT_SYMBOL(gameport_rescan); 40EXPORT_SYMBOL(gameport_rescan);
41EXPORT_SYMBOL(gameport_cooked_read);
42EXPORT_SYMBOL(gameport_set_name);
43EXPORT_SYMBOL(gameport_set_phys); 41EXPORT_SYMBOL(gameport_set_phys);
44EXPORT_SYMBOL(gameport_start_polling); 42EXPORT_SYMBOL(gameport_start_polling);
45EXPORT_SYMBOL(gameport_stop_polling); 43EXPORT_SYMBOL(gameport_stop_polling);
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 307c7b5c2b33..a0be978501ff 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -235,6 +235,10 @@ static void input_handle_event(struct input_dev *dev,
235 if (value >= 0) 235 if (value >= 0)
236 disposition = INPUT_PASS_TO_ALL; 236 disposition = INPUT_PASS_TO_ALL;
237 break; 237 break;
238
239 case EV_PWR:
240 disposition = INPUT_PASS_TO_ALL;
241 break;
238 } 242 }
239 243
240 if (type != EV_SYN) 244 if (type != EV_SYN)
@@ -1266,6 +1270,10 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
1266 __set_bit(code, dev->ffbit); 1270 __set_bit(code, dev->ffbit);
1267 break; 1271 break;
1268 1272
1273 case EV_PWR:
1274 /* do nothing */
1275 break;
1276
1269 default: 1277 default:
1270 printk(KERN_ERR 1278 printk(KERN_ERR
1271 "input_set_capability: unknown type %u (code %u)\n", 1279 "input_set_capability: unknown type %u (code %u)\n",
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index dfa6592c10f6..086d58c0ccbe 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -209,22 +209,22 @@ config KEYBOARD_HIL
209 to your machine, so normally you should say Y here. 209 to your machine, so normally you should say Y here.
210 210
211config KEYBOARD_HP6XX 211config KEYBOARD_HP6XX
212 tristate "HP Jornada 6XX Keyboard support" 212 tristate "HP Jornada 6xx keyboard"
213 depends on SH_HP6XX 213 depends on SH_HP6XX
214 select INPUT_POLLDEV 214 select INPUT_POLLDEV
215 help 215 help
216 This adds support for the onboard keyboard found on 216 Say Y here if you have a HP Jornada 620/660/680/690 and want to
217 HP Jornada 620/660/680/690. 217 support the built-in keyboard.
218 218
219 To compile this driver as a module, choose M here: the 219 To compile this driver as a module, choose M here: the
220 module will be called jornada680_kbd. 220 module will be called jornada680_kbd.
221 221
222config KEYBOARD_HP7XX 222config KEYBOARD_HP7XX
223 tristate "HP Jornada 7XX Keyboard Driver" 223 tristate "HP Jornada 7xx keyboard"
224 depends on SA1100_JORNADA720_SSP && SA1100_SSP 224 depends on SA1100_JORNADA720_SSP && SA1100_SSP
225 help 225 help
226 Say Y here to add support for the HP Jornada 7xx (710/720/728) 226 Say Y here if you have a HP Jornada 710/720/728 and want to
227 onboard keyboard. 227 support the built-in keyboard.
228 228
229 To compile this driver as a module, choose M here: the 229 To compile this driver as a module, choose M here: the
230 module will be called jornada720_kbd. 230 module will be called jornada720_kbd.
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c
index bec1cf483723..a23633a2e1b4 100644
--- a/drivers/input/keyboard/jornada680_kbd.c
+++ b/drivers/input/keyboard/jornada680_kbd.c
@@ -16,14 +16,14 @@
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 */ 17 */
18 18
19#include <linux/input.h>
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/input.h>
23#include <linux/input-polldev.h> 21#include <linux/input-polldev.h>
22#include <linux/interrupt.h>
24#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/kernel.h>
25#include <linux/module.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/interrupt.h>
27 27
28#include <asm/delay.h> 28#include <asm/delay.h>
29#include <asm/io.h> 29#include <asm/io.h>
@@ -43,22 +43,22 @@
43#define PLDR 0xa4000134 43#define PLDR 0xa4000134
44 44
45static const unsigned short jornada_scancodes[] = { 45static const unsigned short jornada_scancodes[] = {
46/* PTD1 */ KEY_CAPSLOCK, KEY_MACRO, KEY_LEFTCTRL, 0, KEY_ESC, 0, 0, 0, /* 1 -> 8 */ 46/* PTD1 */ KEY_CAPSLOCK, KEY_MACRO, KEY_LEFTCTRL, 0, KEY_ESC, KEY_KP5, 0, 0, /* 1 -> 8 */
47 KEY_F1, KEY_F2, KEY_F3, KEY_F8, KEY_F7, KEY_F2, KEY_F4, KEY_F5, /* 9 -> 16 */ 47 KEY_F1, KEY_F2, KEY_F3, KEY_F8, KEY_F7, KEY_F6, KEY_F4, KEY_F5, /* 9 -> 16 */
48/* PTD5 */ KEY_SLASH, KEY_APOSTROPHE, KEY_ENTER, 0, KEY_Z, 0, 0, 0, /* 17 -> 24 */ 48/* PTD5 */ KEY_SLASH, KEY_APOSTROPHE, KEY_ENTER, 0, KEY_Z, 0, 0, 0, /* 17 -> 24 */
49 KEY_X, KEY_C, KEY_V, KEY_DOT, KEY_COMMA, KEY_M, KEY_B, KEY_N, /* 25 -> 32 */ 49 KEY_X, KEY_C, KEY_V, KEY_DOT, KEY_COMMA, KEY_M, KEY_B, KEY_N, /* 25 -> 32 */
50/* PTD7 */ KEY_KP2, KEY_KP6, 0, 0, 0, 0, 0, 0, /* 33 -> 40 */ 50/* PTD7 */ KEY_KP2, KEY_KP6, KEY_KP3, 0, 0, 0, 0, 0, /* 33 -> 40 */
51 0, 0, 0, KEY_KP4, 0, 0, KEY_LEFTALT, KEY_HANJA, /* 41 -> 48 */ 51 KEY_F10, KEY_RO, KEY_F9, KEY_KP4, KEY_NUMLOCK, KEY_SCROLLLOCK, KEY_LEFTALT, KEY_HANJA, /* 41 -> 48 */
52/* PTE0 */ 0, 0, 0, 0, KEY_FINANCE, 0, 0, 0, /* 49 -> 56 */ 52/* PTE0 */ KEY_KATAKANA, KEY_KP0, KEY_GRAVE, 0, KEY_FINANCE, 0, 0, 0, /* 49 -> 56 */
53 KEY_LEFTCTRL, 0, KEY_SPACE, KEY_KPDOT, KEY_VOLUMEUP, 249, 0, 0, /* 57 -> 64 */ 53 KEY_KPMINUS, KEY_HIRAGANA, KEY_SPACE, KEY_KPDOT, KEY_VOLUMEUP, 249, 0, 0, /* 57 -> 64 */
54/* PTE1 */ KEY_SEMICOLON, KEY_RIGHTBRACE, KEY_BACKSLASH, 0, KEY_A, 0, 0, 0,/* 65 -> 72 */ 54/* PTE1 */ KEY_SEMICOLON, KEY_RIGHTBRACE, KEY_BACKSLASH, 0, KEY_A, 0, 0, 0, /* 65 -> 72 */
55 KEY_S, KEY_D, KEY_F, KEY_L, KEY_K, KEY_J, KEY_G, KEY_H, /* 73 -> 80 */ 55 KEY_S, KEY_D, KEY_F, KEY_L, KEY_K, KEY_J, KEY_G, KEY_H, /* 73 -> 80 */
56/* PTE3 */ KEY_KP8, KEY_LEFTMETA, KEY_RIGHTSHIFT, 0, KEY_TAB, 0, 0,0, /* 81 -> 88 */ 56/* PTE3 */ KEY_KP8, KEY_LEFTMETA, KEY_RIGHTSHIFT, 0, KEY_TAB, 0, 0, 0, /* 81 -> 88 */
57 0, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0, /* 89 -> 96 */ 57 0, KEY_LEFTSHIFT, KEY_KP7, KEY_KP9, KEY_KP1, KEY_F11, KEY_KPPLUS, KEY_KPASTERISK, /* 89 -> 96 */
58/* PTE6 */ KEY_P, KEY_LEFTBRACE, KEY_BACKSPACE, 0, KEY_Q, 0, 0, 0, /* 97 -> 104 */ 58/* PTE6 */ KEY_P, KEY_LEFTBRACE, KEY_BACKSPACE, 0, KEY_Q, 0, 0, 0, /* 97 -> 104 */
59 KEY_W, KEY_E, KEY_R, KEY_O, KEY_I, KEY_U, KEY_T, KEY_R, /* 105 -> 112 */ 59 KEY_W, KEY_E, KEY_R, KEY_O, KEY_I, KEY_U, KEY_T, KEY_Y, /* 105 -> 112 */
60/* PTE7 */ KEY_0, KEY_MINUS, KEY_EQUAL, 0, KEY_1, 0, 0, 0, /* 113 -> 120 */ 60/* PTE7 */ KEY_0, KEY_MINUS, KEY_EQUAL, 0, KEY_1, 0, 0, 0, /* 113 -> 120 */
61 KEY_2, KEY_3, KEY_4, KEY_9, KEY_8, KEY_7, KEY_5, KEY_6, /* 121 -> 128 */ 61 KEY_2, KEY_3, KEY_4, KEY_9, KEY_8, KEY_7, KEY_5, KEY_6, /* 121 -> 128 */
62/* **** */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62/* **** */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63 0, 0, 0, 0, 0 63 0, 0, 0, 0, 0
64}; 64};
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index 410d78a774d0..1d59a2dc3c17 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -391,6 +391,7 @@ static int __init spitzkbd_probe(struct platform_device *dev)
391 for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++) 391 for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++)
392 set_bit(spitzkbd->keycode[i], input_dev->keybit); 392 set_bit(spitzkbd->keycode[i], input_dev->keybit);
393 clear_bit(0, input_dev->keybit); 393 clear_bit(0, input_dev->keybit);
394 set_bit(KEY_SUSPEND, input_dev->keybit);
394 set_bit(SW_LID, input_dev->swbit); 395 set_bit(SW_LID, input_dev->swbit);
395 set_bit(SW_TABLET_MODE, input_dev->swbit); 396 set_bit(SW_TABLET_MODE, input_dev->swbit);
396 set_bit(SW_HEADPHONE_INSERT, input_dev->swbit); 397 set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index fa8442b6241c..90e8e92dfe47 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -115,19 +115,17 @@ config TOUCHSCREEN_MK712
115 module will be called mk712. 115 module will be called mk712.
116 116
117config TOUCHSCREEN_HP600 117config TOUCHSCREEN_HP600
118 tristate "HP Jornada 680/690 touchscreen" 118 tristate "HP Jornada 6xx touchscreen"
119 depends on SH_HP6XX && SH_ADC 119 depends on SH_HP6XX && SH_ADC
120 help 120 help
121 Say Y here if you have a HP Jornada 680 or 690 and want to 121 Say Y here if you have a HP Jornada 620/660/680/690 and want to
122 support the built-in touchscreen. 122 support the built-in touchscreen.
123 123
124 If unsure, say N.
125
126 To compile this driver as a module, choose M here: the 124 To compile this driver as a module, choose M here: the
127 module will be called hp680_ts_input. 125 module will be called hp680_ts_input.
128 126
129config TOUCHSCREEN_HP7XX 127config TOUCHSCREEN_HP7XX
130 tristate "HP Jornada 710/720/728 touchscreen" 128 tristate "HP Jornada 7xx touchscreen"
131 depends on SA1100_JORNADA720_SSP 129 depends on SA1100_JORNADA720_SSP
132 help 130 help
133 Say Y here if you have a HP Jornada 710/720/728 and want 131 Say Y here if you have a HP Jornada 710/720/728 and want
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index 883da72b5368..ef4c117ea35f 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -322,8 +322,9 @@ adbhid_input_keycode(int id, int scancode, int repeat)
322 input_sync(ahid->input); 322 input_sync(ahid->input);
323 input_report_key(ahid->input, KEY_CAPSLOCK, 0); 323 input_report_key(ahid->input, KEY_CAPSLOCK, 0);
324 input_sync(ahid->input); 324 input_sync(ahid->input);
325 return;
325 } 326 }
326 return; 327 break;
327#ifdef CONFIG_PPC_PMAC 328#ifdef CONFIG_PPC_PMAC
328 case ADB_KEY_POWER_OLD: /* Power key on PBook 3400 needs remapping */ 329 case ADB_KEY_POWER_OLD: /* Power key on PBook 3400 needs remapping */
329 switch(pmac_call_feature(PMAC_FTR_GET_MB_INFO, 330 switch(pmac_call_feature(PMAC_FTR_GET_MB_INFO,
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 8b8144f77a73..0d36c155695b 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -2800,12 +2800,12 @@ static void av7110_irq(struct saa7146_dev* dev, u32 *isr)
2800} 2800}
2801 2801
2802 2802
2803static struct saa7146_extension av7110_extension; 2803static struct saa7146_extension av7110_extension_driver;
2804 2804
2805#define MAKE_AV7110_INFO(x_var,x_name) \ 2805#define MAKE_AV7110_INFO(x_var,x_name) \
2806static struct saa7146_pci_extension_data x_var = { \ 2806static struct saa7146_pci_extension_data x_var = { \
2807 .ext_priv = x_name, \ 2807 .ext_priv = x_name, \
2808 .ext = &av7110_extension } 2808 .ext = &av7110_extension_driver }
2809 2809
2810MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C"); 2810MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C");
2811MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X"); 2811MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X");
@@ -2843,7 +2843,7 @@ static struct pci_device_id pci_tbl[] = {
2843MODULE_DEVICE_TABLE(pci, pci_tbl); 2843MODULE_DEVICE_TABLE(pci, pci_tbl);
2844 2844
2845 2845
2846static struct saa7146_extension av7110_extension = { 2846static struct saa7146_extension av7110_extension_driver = {
2847 .name = "dvb", 2847 .name = "dvb",
2848 .flags = SAA7146_USE_I2C_IRQ, 2848 .flags = SAA7146_USE_I2C_IRQ,
2849 2849
@@ -2860,14 +2860,14 @@ static struct saa7146_extension av7110_extension = {
2860static int __init av7110_init(void) 2860static int __init av7110_init(void)
2861{ 2861{
2862 int retval; 2862 int retval;
2863 retval = saa7146_register_extension(&av7110_extension); 2863 retval = saa7146_register_extension(&av7110_extension_driver);
2864 return retval; 2864 return retval;
2865} 2865}
2866 2866
2867 2867
2868static void __exit av7110_exit(void) 2868static void __exit av7110_exit(void)
2869{ 2869{
2870 saa7146_unregister_extension(&av7110_extension); 2870 saa7146_unregister_extension(&av7110_extension_driver);
2871} 2871}
2872 2872
2873module_init(av7110_init); 2873module_init(av7110_init);
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 10d6faf8ccda..6d2dd8764f81 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -1076,10 +1076,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
1076 ivtv_process_eeprom(itv); 1076 ivtv_process_eeprom(itv);
1077 } 1077 }
1078 1078
1079 /* The mspx4xx chips need a longer delay for some reason */
1080 if (!(itv->hw_flags & IVTV_HW_MSP34XX))
1081 itv->i2c_algo.udelay = 5;
1082
1083 if (itv->std == 0) { 1079 if (itv->std == 0) {
1084 itv->std = V4L2_STD_NTSC_M; 1080 itv->std = V4L2_STD_NTSC_M;
1085 } 1081 }
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index a9eb1c516247..1707f98c322c 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -1504,9 +1504,12 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1504 int ret, wbufsize, word_gap, words; 1504 int ret, wbufsize, word_gap, words;
1505 const struct kvec *vec; 1505 const struct kvec *vec;
1506 unsigned long vec_seek; 1506 unsigned long vec_seek;
1507 unsigned long initial_adr;
1508 int initial_len = len;
1507 1509
1508 wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize; 1510 wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
1509 adr += chip->start; 1511 adr += chip->start;
1512 initial_adr = adr;
1510 cmd_adr = adr & ~(wbufsize-1); 1513 cmd_adr = adr & ~(wbufsize-1);
1511 1514
1512 /* Let's determine this according to the interleave only once */ 1515 /* Let's determine this according to the interleave only once */
@@ -1519,7 +1522,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1519 return ret; 1522 return ret;
1520 } 1523 }
1521 1524
1522 XIP_INVAL_CACHED_RANGE(map, adr, len); 1525 XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len);
1523 ENABLE_VPP(map); 1526 ENABLE_VPP(map);
1524 xip_disable(map, chip, cmd_adr); 1527 xip_disable(map, chip, cmd_adr);
1525 1528
@@ -1610,7 +1613,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1610 chip->state = FL_WRITING; 1613 chip->state = FL_WRITING;
1611 1614
1612 ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, 1615 ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
1613 adr, len, 1616 initial_adr, initial_len,
1614 chip->buffer_write_time); 1617 chip->buffer_write_time);
1615 if (ret) { 1618 if (ret) {
1616 map_write(map, CMD(0x70), cmd_adr); 1619 map_write(map, CMD(0x70), cmd_adr);
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index edda6e10ebe5..8fafac987e0b 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -385,6 +385,7 @@ static int __init el3_probe(int card_idx)
385#if defined(__ISAPNP__) 385#if defined(__ISAPNP__)
386 static int pnp_cards; 386 static int pnp_cards;
387 struct pnp_dev *idev = NULL; 387 struct pnp_dev *idev = NULL;
388 int pnp_found = 0;
388 389
389 if (nopnp == 1) 390 if (nopnp == 1)
390 goto no_pnp; 391 goto no_pnp;
@@ -430,6 +431,7 @@ __again:
430 pnp_cards++; 431 pnp_cards++;
431 432
432 netdev_boot_setup_check(dev); 433 netdev_boot_setup_check(dev);
434 pnp_found = 1;
433 goto found; 435 goto found;
434 } 436 }
435 } 437 }
@@ -560,6 +562,8 @@ no_pnp:
560 lp = netdev_priv(dev); 562 lp = netdev_priv(dev);
561#if defined(__ISAPNP__) 563#if defined(__ISAPNP__)
562 lp->dev = &idev->dev; 564 lp->dev = &idev->dev;
565 if (pnp_found)
566 lp->type = EL3_PNP;
563#endif 567#endif
564 err = el3_common_init(dev); 568 err = el3_common_init(dev);
565 569
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index d9107e542dfa..114771a2a133 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -166,16 +166,6 @@ config NET_SB1000
166 166
167 If you don't have this card, of course say N. 167 If you don't have this card, of course say N.
168 168
169config IP1000
170 tristate "IP1000 Gigabit Ethernet support"
171 depends on PCI && EXPERIMENTAL
172 select MII
173 ---help---
174 This driver supports IP1000 gigabit Ethernet cards.
175
176 To compile this driver as a module, choose M here: the module
177 will be called ipg. This is recommended.
178
179source "drivers/net/arcnet/Kconfig" 169source "drivers/net/arcnet/Kconfig"
180 170
181source "drivers/net/phy/Kconfig" 171source "drivers/net/phy/Kconfig"
@@ -1992,6 +1982,16 @@ config E1000E
1992 To compile this driver as a module, choose M here. The module 1982 To compile this driver as a module, choose M here. The module
1993 will be called e1000e. 1983 will be called e1000e.
1994 1984
1985config IP1000
1986 tristate "IP1000 Gigabit Ethernet support"
1987 depends on PCI && EXPERIMENTAL
1988 select MII
1989 ---help---
1990 This driver supports IP1000 gigabit Ethernet cards.
1991
1992 To compile this driver as a module, choose M here: the module
1993 will be called ipg. This is recommended.
1994
1995source "drivers/net/ixp2000/Kconfig" 1995source "drivers/net/ixp2000/Kconfig"
1996 1996
1997config MYRI_SBUS 1997config MYRI_SBUS
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 3e1a57a42f11..c83bd6560088 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -894,14 +894,21 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs,
894static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 894static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
895{ 895{
896 struct fs_enet_private *fep = netdev_priv(dev); 896 struct fs_enet_private *fep = netdev_priv(dev);
897
898 if (!fep->phydev)
899 return -ENODEV;
900
897 return phy_ethtool_gset(fep->phydev, cmd); 901 return phy_ethtool_gset(fep->phydev, cmd);
898} 902}
899 903
900static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 904static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
901{ 905{
902 struct fs_enet_private *fep = netdev_priv(dev); 906 struct fs_enet_private *fep = netdev_priv(dev);
903 phy_ethtool_sset(fep->phydev, cmd); 907
904 return 0; 908 if (!fep->phydev)
909 return -ENODEV;
910
911 return phy_ethtool_sset(fep->phydev, cmd);
905} 912}
906 913
907static int fs_nway_reset(struct net_device *dev) 914static int fs_nway_reset(struct net_device *dev)
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 662b8d16803c..fa147cd5d68c 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -242,7 +242,7 @@ static void loopback_setup(struct net_device *dev)
242 | NETIF_F_NO_CSUM 242 | NETIF_F_NO_CSUM
243 | NETIF_F_HIGHDMA 243 | NETIF_F_HIGHDMA
244 | NETIF_F_LLTX 244 | NETIF_F_LLTX
245 | NETIF_F_NETNS_LOCAL, 245 | NETIF_F_NETNS_LOCAL;
246 dev->ethtool_ops = &loopback_ethtool_ops; 246 dev->ethtool_ops = &loopback_ethtool_ops;
247 dev->header_ops = &eth_header_ops; 247 dev->header_ops = &eth_header_ops;
248 dev->init = loopback_dev_init; 248 dev->init = loopback_dev_init;
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index fbc2553275dc..a8f63c47b3cd 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -65,8 +65,8 @@
65 65
66#define _NETXEN_NIC_LINUX_MAJOR 3 66#define _NETXEN_NIC_LINUX_MAJOR 3
67#define _NETXEN_NIC_LINUX_MINOR 4 67#define _NETXEN_NIC_LINUX_MINOR 4
68#define _NETXEN_NIC_LINUX_SUBVERSION 2 68#define _NETXEN_NIC_LINUX_SUBVERSION 18
69#define NETXEN_NIC_LINUX_VERSIONID "3.4.2" 69#define NETXEN_NIC_LINUX_VERSIONID "3.4.18"
70 70
71#define NETXEN_NUM_FLASH_SECTORS (64) 71#define NETXEN_NUM_FLASH_SECTORS (64)
72#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) 72#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024)
@@ -309,23 +309,26 @@ struct netxen_ring_ctx {
309 ((cmd_desc)->port_ctxid |= ((var) & 0xF0)) 309 ((cmd_desc)->port_ctxid |= ((var) & 0xF0))
310 310
311#define netxen_set_cmd_desc_flags(cmd_desc, val) \ 311#define netxen_set_cmd_desc_flags(cmd_desc, val) \
312 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \ 312 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \
313 (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f)) 313 ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f)
314#define netxen_set_cmd_desc_opcode(cmd_desc, val) \ 314#define netxen_set_cmd_desc_opcode(cmd_desc, val) \
315 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \ 315 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \
316 (cmd_desc)->flags_opcode |= cpu_to_le16(((val & 0x3f)<<7))) 316 ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7)
317 317
318#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ 318#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \
319 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \ 319 (cmd_desc)->num_of_buffers_total_length = \
320 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff)) 320 ((cmd_desc)->num_of_buffers_total_length & \
321 ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff)
321#define netxen_set_cmd_desc_totallength(cmd_desc, val) \ 322#define netxen_set_cmd_desc_totallength(cmd_desc, val) \
322 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xffffff00), \ 323 (cmd_desc)->num_of_buffers_total_length = \
323 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 8)) 324 ((cmd_desc)->num_of_buffers_total_length & \
325 ~cpu_to_le32((u32)0xffffff << 8)) | \
326 cpu_to_le32(((val) & 0xffffff) << 8)
324 327
325#define netxen_get_cmd_desc_opcode(cmd_desc) \ 328#define netxen_get_cmd_desc_opcode(cmd_desc) \
326 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F) 329 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f)
327#define netxen_get_cmd_desc_totallength(cmd_desc) \ 330#define netxen_get_cmd_desc_totallength(cmd_desc) \
328 (le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) 331 ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff)
329 332
330struct cmd_desc_type0 { 333struct cmd_desc_type0 {
331 u8 tcp_hdr_offset; /* For LSO only */ 334 u8 tcp_hdr_offset; /* For LSO only */
@@ -412,29 +415,29 @@ struct rcv_desc {
412#define netxen_get_sts_desc_lro_last_frag(status_desc) \ 415#define netxen_get_sts_desc_lro_last_frag(status_desc) \
413 (((status_desc)->lro & 0x80) >> 7) 416 (((status_desc)->lro & 0x80) >> 7)
414 417
415#define netxen_get_sts_port(status_desc) \ 418#define netxen_get_sts_port(sts_data) \
416 (le64_to_cpu((status_desc)->status_desc_data) & 0x0F) 419 ((sts_data) & 0x0F)
417#define netxen_get_sts_status(status_desc) \ 420#define netxen_get_sts_status(sts_data) \
418 ((le64_to_cpu((status_desc)->status_desc_data) >> 4) & 0x0F) 421 (((sts_data) >> 4) & 0x0F)
419#define netxen_get_sts_type(status_desc) \ 422#define netxen_get_sts_type(sts_data) \
420 ((le64_to_cpu((status_desc)->status_desc_data) >> 8) & 0x0F) 423 (((sts_data) >> 8) & 0x0F)
421#define netxen_get_sts_totallength(status_desc) \ 424#define netxen_get_sts_totallength(sts_data) \
422 ((le64_to_cpu((status_desc)->status_desc_data) >> 12) & 0xFFFF) 425 (((sts_data) >> 12) & 0xFFFF)
423#define netxen_get_sts_refhandle(status_desc) \ 426#define netxen_get_sts_refhandle(sts_data) \
424 ((le64_to_cpu((status_desc)->status_desc_data) >> 28) & 0xFFFF) 427 (((sts_data) >> 28) & 0xFFFF)
425#define netxen_get_sts_prot(status_desc) \ 428#define netxen_get_sts_prot(sts_data) \
426 ((le64_to_cpu((status_desc)->status_desc_data) >> 44) & 0x0F) 429 (((sts_data) >> 44) & 0x0F)
430#define netxen_get_sts_opcode(sts_data) \
431 (((sts_data) >> 58) & 0x03F)
432
427#define netxen_get_sts_owner(status_desc) \ 433#define netxen_get_sts_owner(status_desc) \
428 ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03) 434 ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03)
429#define netxen_get_sts_opcode(status_desc) \ 435#define netxen_set_sts_owner(status_desc, val) { \
430 ((le64_to_cpu((status_desc)->status_desc_data) >> 58) & 0x03F) 436 (status_desc)->status_desc_data = \
431 437 ((status_desc)->status_desc_data & \
432#define netxen_clear_sts_owner(status_desc) \ 438 ~cpu_to_le64(0x3ULL << 56)) | \
433 ((status_desc)->status_desc_data &= \ 439 cpu_to_le64((u64)((val) & 0x3) << 56); \
434 ~cpu_to_le64(((unsigned long long)3) << 56 )) 440}
435#define netxen_set_sts_owner(status_desc, val) \
436 ((status_desc)->status_desc_data |= \
437 cpu_to_le64(((unsigned long long)((val) & 0x3)) << 56 ))
438 441
439struct status_desc { 442struct status_desc {
440 /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length 443 /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 37589265297e..485ff9398910 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1070,16 +1070,17 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1070{ 1070{
1071 struct pci_dev *pdev = adapter->pdev; 1071 struct pci_dev *pdev = adapter->pdev;
1072 struct net_device *netdev = adapter->netdev; 1072 struct net_device *netdev = adapter->netdev;
1073 int index = netxen_get_sts_refhandle(desc); 1073 u64 sts_data = le64_to_cpu(desc->status_desc_data);
1074 int index = netxen_get_sts_refhandle(sts_data);
1074 struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); 1075 struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]);
1075 struct netxen_rx_buffer *buffer; 1076 struct netxen_rx_buffer *buffer;
1076 struct sk_buff *skb; 1077 struct sk_buff *skb;
1077 u32 length = netxen_get_sts_totallength(desc); 1078 u32 length = netxen_get_sts_totallength(sts_data);
1078 u32 desc_ctx; 1079 u32 desc_ctx;
1079 struct netxen_rcv_desc_ctx *rcv_desc; 1080 struct netxen_rcv_desc_ctx *rcv_desc;
1080 int ret; 1081 int ret;
1081 1082
1082 desc_ctx = netxen_get_sts_type(desc); 1083 desc_ctx = netxen_get_sts_type(sts_data);
1083 if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) { 1084 if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) {
1084 printk("%s: %s Bad Rcv descriptor ring\n", 1085 printk("%s: %s Bad Rcv descriptor ring\n",
1085 netxen_nic_driver_name, netdev->name); 1086 netxen_nic_driver_name, netdev->name);
@@ -1119,7 +1120,7 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1119 skb = (struct sk_buff *)buffer->skb; 1120 skb = (struct sk_buff *)buffer->skb;
1120 1121
1121 if (likely(adapter->rx_csum && 1122 if (likely(adapter->rx_csum &&
1122 netxen_get_sts_status(desc) == STATUS_CKSUM_OK)) { 1123 netxen_get_sts_status(sts_data) == STATUS_CKSUM_OK)) {
1123 adapter->stats.csummed++; 1124 adapter->stats.csummed++;
1124 skb->ip_summed = CHECKSUM_UNNECESSARY; 1125 skb->ip_summed = CHECKSUM_UNNECESSARY;
1125 } else 1126 } else
@@ -1209,7 +1210,6 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max)
1209 break; 1210 break;
1210 } 1211 }
1211 netxen_process_rcv(adapter, ctxid, desc); 1212 netxen_process_rcv(adapter, ctxid, desc);
1212 netxen_clear_sts_owner(desc);
1213 netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM); 1213 netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM);
1214 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); 1214 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1);
1215 count++; 1215 count++;
@@ -1248,7 +1248,6 @@ int netxen_process_cmd_ring(unsigned long data)
1248 struct pci_dev *pdev; 1248 struct pci_dev *pdev;
1249 struct netxen_skb_frag *frag; 1249 struct netxen_skb_frag *frag;
1250 u32 i; 1250 u32 i;
1251 struct sk_buff *skb = NULL;
1252 int done; 1251 int done;
1253 1252
1254 spin_lock(&adapter->tx_lock); 1253 spin_lock(&adapter->tx_lock);
@@ -1278,9 +1277,8 @@ int netxen_process_cmd_ring(unsigned long data)
1278 while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) { 1277 while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) {
1279 buffer = &adapter->cmd_buf_arr[last_consumer]; 1278 buffer = &adapter->cmd_buf_arr[last_consumer];
1280 pdev = adapter->pdev; 1279 pdev = adapter->pdev;
1281 frag = &buffer->frag_array[0]; 1280 if (buffer->skb) {
1282 skb = buffer->skb; 1281 frag = &buffer->frag_array[0];
1283 if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) {
1284 pci_unmap_single(pdev, frag->dma, frag->length, 1282 pci_unmap_single(pdev, frag->dma, frag->length,
1285 PCI_DMA_TODEVICE); 1283 PCI_DMA_TODEVICE);
1286 frag->dma = 0ULL; 1284 frag->dma = 0ULL;
@@ -1293,8 +1291,8 @@ int netxen_process_cmd_ring(unsigned long data)
1293 } 1291 }
1294 1292
1295 adapter->stats.skbfreed++; 1293 adapter->stats.skbfreed++;
1296 dev_kfree_skb_any(skb); 1294 dev_kfree_skb_any(buffer->skb);
1297 skb = NULL; 1295 buffer->skb = NULL;
1298 } else if (adapter->proc_cmd_buf_counter == 1) { 1296 } else if (adapter->proc_cmd_buf_counter == 1) {
1299 adapter->stats.txnullskb++; 1297 adapter->stats.txnullskb++;
1300 } 1298 }
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 454226f7baa8..263b55e36c7a 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -732,11 +732,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
732 732
733 unregister_netdev(netdev); 733 unregister_netdev(netdev);
734 734
735 if (adapter->stop_port)
736 adapter->stop_port(adapter);
737
738 netxen_nic_disable_int(adapter);
739
740 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { 735 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
741 init_firmware_done++; 736 init_firmware_done++;
742 netxen_free_hw_resources(adapter); 737 netxen_free_hw_resources(adapter);
@@ -919,6 +914,9 @@ static int netxen_nic_close(struct net_device *netdev)
919 netif_stop_queue(netdev); 914 netif_stop_queue(netdev);
920 napi_disable(&adapter->napi); 915 napi_disable(&adapter->napi);
921 916
917 if (adapter->stop_port)
918 adapter->stop_port(adapter);
919
922 netxen_nic_disable_int(adapter); 920 netxen_nic_disable_int(adapter);
923 921
924 cmd_buff = adapter->cmd_buf_arr; 922 cmd_buff = adapter->cmd_buf_arr;
@@ -996,28 +994,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
996 return NETDEV_TX_OK; 994 return NETDEV_TX_OK;
997 } 995 }
998 996
999 /*
1000 * Everything is set up. Now, we just need to transmit it out.
1001 * Note that we have to copy the contents of buffer over to
1002 * right place. Later on, this can be optimized out by de-coupling the
1003 * producer index from the buffer index.
1004 */
1005 retry_getting_window:
1006 spin_lock_bh(&adapter->tx_lock);
1007 if (adapter->total_threads >= MAX_XMIT_PRODUCERS) {
1008 spin_unlock_bh(&adapter->tx_lock);
1009 /*
1010 * Yield CPU
1011 */
1012 if (!in_atomic())
1013 schedule();
1014 else {
1015 for (i = 0; i < 20; i++)
1016 cpu_relax(); /*This a nop instr on i386 */
1017 }
1018 goto retry_getting_window;
1019 }
1020 local_producer = adapter->cmd_producer;
1021 /* There 4 fragments per descriptor */ 997 /* There 4 fragments per descriptor */
1022 no_of_desc = (frag_count + 3) >> 2; 998 no_of_desc = (frag_count + 3) >> 2;
1023 if (netdev->features & NETIF_F_TSO) { 999 if (netdev->features & NETIF_F_TSO) {
@@ -1031,16 +1007,19 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1031 } 1007 }
1032 } 1008 }
1033 } 1009 }
1010
1011 spin_lock_bh(&adapter->tx_lock);
1012 if (adapter->total_threads >= MAX_XMIT_PRODUCERS) {
1013 goto out_requeue;
1014 }
1015 local_producer = adapter->cmd_producer;
1034 k = adapter->cmd_producer; 1016 k = adapter->cmd_producer;
1035 max_tx_desc_count = adapter->max_tx_desc_count; 1017 max_tx_desc_count = adapter->max_tx_desc_count;
1036 last_cmd_consumer = adapter->last_cmd_consumer; 1018 last_cmd_consumer = adapter->last_cmd_consumer;
1037 if ((k + no_of_desc) >= 1019 if ((k + no_of_desc) >=
1038 ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count : 1020 ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count :
1039 last_cmd_consumer)) { 1021 last_cmd_consumer)) {
1040 netif_stop_queue(netdev); 1022 goto out_requeue;
1041 adapter->flags |= NETXEN_NETDEV_STATUS;
1042 spin_unlock_bh(&adapter->tx_lock);
1043 return NETDEV_TX_BUSY;
1044 } 1023 }
1045 k = get_index_range(k, max_tx_desc_count, no_of_desc); 1024 k = get_index_range(k, max_tx_desc_count, no_of_desc);
1046 adapter->cmd_producer = k; 1025 adapter->cmd_producer = k;
@@ -1093,6 +1072,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1093 adapter->max_tx_desc_count); 1072 adapter->max_tx_desc_count);
1094 hwdesc = &hw->cmd_desc_head[producer]; 1073 hwdesc = &hw->cmd_desc_head[producer];
1095 memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); 1074 memset(hwdesc, 0, sizeof(struct cmd_desc_type0));
1075 pbuf = &adapter->cmd_buf_arr[producer];
1076 pbuf->skb = NULL;
1096 } 1077 }
1097 frag = &skb_shinfo(skb)->frags[i - 1]; 1078 frag = &skb_shinfo(skb)->frags[i - 1];
1098 len = frag->size; 1079 len = frag->size;
@@ -1148,6 +1129,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1148 } 1129 }
1149 /* copy the MAC/IP/TCP headers to the cmd descriptor list */ 1130 /* copy the MAC/IP/TCP headers to the cmd descriptor list */
1150 hwdesc = &hw->cmd_desc_head[producer]; 1131 hwdesc = &hw->cmd_desc_head[producer];
1132 pbuf = &adapter->cmd_buf_arr[producer];
1133 pbuf->skb = NULL;
1151 1134
1152 /* copy the first 64 bytes */ 1135 /* copy the first 64 bytes */
1153 memcpy(((void *)hwdesc) + 2, 1136 memcpy(((void *)hwdesc) + 2,
@@ -1156,6 +1139,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1156 1139
1157 if (more_hdr) { 1140 if (more_hdr) {
1158 hwdesc = &hw->cmd_desc_head[producer]; 1141 hwdesc = &hw->cmd_desc_head[producer];
1142 pbuf = &adapter->cmd_buf_arr[producer];
1143 pbuf->skb = NULL;
1159 /* copy the next 64 bytes - should be enough except 1144 /* copy the next 64 bytes - should be enough except
1160 * for pathological case 1145 * for pathological case
1161 */ 1146 */
@@ -1167,16 +1152,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1167 } 1152 }
1168 } 1153 }
1169 1154
1170 i = netxen_get_cmd_desc_totallength(&hw->cmd_desc_head[saved_producer]);
1171
1172 hw->cmd_desc_head[saved_producer].flags_opcode =
1173 cpu_to_le16(hw->cmd_desc_head[saved_producer].flags_opcode);
1174 hw->cmd_desc_head[saved_producer].num_of_buffers_total_length =
1175 cpu_to_le32(hw->cmd_desc_head[saved_producer].
1176 num_of_buffers_total_length);
1177
1178 spin_lock_bh(&adapter->tx_lock); 1155 spin_lock_bh(&adapter->tx_lock);
1179 adapter->stats.txbytes += i; 1156 adapter->stats.txbytes += skb->len;
1180 1157
1181 /* Code to update the adapter considering how many producer threads 1158 /* Code to update the adapter considering how many producer threads
1182 are currently working */ 1159 are currently working */
@@ -1189,14 +1166,17 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1189 } 1166 }
1190 1167
1191 adapter->stats.xmitfinished++; 1168 adapter->stats.xmitfinished++;
1192 spin_unlock_bh(&adapter->tx_lock);
1193
1194 netdev->trans_start = jiffies; 1169 netdev->trans_start = jiffies;
1195 1170
1196 DPRINTK(INFO, "wrote CMD producer %x to phantom\n", producer); 1171 spin_unlock_bh(&adapter->tx_lock);
1197
1198 DPRINTK(INFO, "Done. Send\n");
1199 return NETDEV_TX_OK; 1172 return NETDEV_TX_OK;
1173
1174out_requeue:
1175 netif_stop_queue(netdev);
1176 adapter->flags |= NETXEN_NETDEV_STATUS;
1177
1178 spin_unlock_bh(&adapter->tx_lock);
1179 return NETDEV_TX_BUSY;
1200} 1180}
1201 1181
1202static void netxen_watchdog(unsigned long v) 1182static void netxen_watchdog(unsigned long v)
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index 5b9e1b300fab..d04ecb77d08c 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -736,12 +736,12 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
736 __u32 mac_cfg; 736 __u32 mac_cfg;
737 u32 port = physical_port[adapter->portnum]; 737 u32 port = physical_port[adapter->portnum];
738 738
739 if (port != 0) 739 if (port > NETXEN_NIU_MAX_XG_PORTS)
740 return -EINVAL; 740 return -EINVAL;
741
741 mac_cfg = 0; 742 mac_cfg = 0;
742 netxen_xg_soft_reset(mac_cfg); 743 if (netxen_nic_hw_write_wx(adapter,
743 if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_CONFIG_0, 744 NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), &mac_cfg, 4))
744 &mac_cfg, 4))
745 return -EIO; 745 return -EIO;
746 return 0; 746 return 0;
747} 747}
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index af8030981f10..3acfeeabdee1 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2002,7 +2002,7 @@ static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
2002 u32 clk; 2002 u32 clk;
2003 2003
2004 clk = RTL_R8(Config2) & PCI_Clock_66MHz; 2004 clk = RTL_R8(Config2) & PCI_Clock_66MHz;
2005 for (i = 0; i < ARRAY_SIZE(cfg2_info); i++) { 2005 for (i = 0; i < ARRAY_SIZE(cfg2_info); i++, p++) {
2006 if ((p->mac_version == mac_version) && (p->clk == clk)) { 2006 if ((p->mac_version == mac_version) && (p->clk == clk)) {
2007 RTL_W32(0x7c, p->val); 2007 RTL_W32(0x7c, p->val);
2008 break; 2008 break;
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 52ec89b82f64..7023bbe545ee 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -944,7 +944,6 @@ static void tx_init(struct sky2_port *sky2)
944 le = get_tx_le(sky2); 944 le = get_tx_le(sky2);
945 le->addr = 0; 945 le->addr = 0;
946 le->opcode = OP_ADDR64 | HW_OWNER; 946 le->opcode = OP_ADDR64 | HW_OWNER;
947 sky2->tx_addr64 = 0;
948} 947}
949 948
950static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2, 949static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2,
@@ -978,13 +977,11 @@ static void sky2_rx_add(struct sky2_port *sky2, u8 op,
978 dma_addr_t map, unsigned len) 977 dma_addr_t map, unsigned len)
979{ 978{
980 struct sky2_rx_le *le; 979 struct sky2_rx_le *le;
981 u32 hi = upper_32_bits(map);
982 980
983 if (sky2->rx_addr64 != hi) { 981 if (sizeof(dma_addr_t) > sizeof(u32)) {
984 le = sky2_next_rx(sky2); 982 le = sky2_next_rx(sky2);
985 le->addr = cpu_to_le32(hi); 983 le->addr = cpu_to_le32(upper_32_bits(map));
986 le->opcode = OP_ADDR64 | HW_OWNER; 984 le->opcode = OP_ADDR64 | HW_OWNER;
987 sky2->rx_addr64 = upper_32_bits(map + len);
988 } 985 }
989 986
990 le = sky2_next_rx(sky2); 987 le = sky2_next_rx(sky2);
@@ -1480,7 +1477,6 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1480 struct tx_ring_info *re; 1477 struct tx_ring_info *re;
1481 unsigned i, len; 1478 unsigned i, len;
1482 dma_addr_t mapping; 1479 dma_addr_t mapping;
1483 u32 addr64;
1484 u16 mss; 1480 u16 mss;
1485 u8 ctrl; 1481 u8 ctrl;
1486 1482
@@ -1493,15 +1489,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1493 1489
1494 len = skb_headlen(skb); 1490 len = skb_headlen(skb);
1495 mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); 1491 mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
1496 addr64 = upper_32_bits(mapping);
1497 1492
1498 /* Send high bits if changed or crosses boundary */ 1493 /* Send high bits if needed */
1499 if (addr64 != sky2->tx_addr64 || 1494 if (sizeof(dma_addr_t) > sizeof(u32)) {
1500 upper_32_bits(mapping + len) != sky2->tx_addr64) {
1501 le = get_tx_le(sky2); 1495 le = get_tx_le(sky2);
1502 le->addr = cpu_to_le32(addr64); 1496 le->addr = cpu_to_le32(upper_32_bits(mapping));
1503 le->opcode = OP_ADDR64 | HW_OWNER; 1497 le->opcode = OP_ADDR64 | HW_OWNER;
1504 sky2->tx_addr64 = upper_32_bits(mapping + len);
1505 } 1498 }
1506 1499
1507 /* Check for TCP Segmentation Offload */ 1500 /* Check for TCP Segmentation Offload */
@@ -1582,13 +1575,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1582 1575
1583 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset, 1576 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset,
1584 frag->size, PCI_DMA_TODEVICE); 1577 frag->size, PCI_DMA_TODEVICE);
1585 addr64 = upper_32_bits(mapping); 1578
1586 if (addr64 != sky2->tx_addr64) { 1579 if (sizeof(dma_addr_t) > sizeof(u32)) {
1587 le = get_tx_le(sky2); 1580 le = get_tx_le(sky2);
1588 le->addr = cpu_to_le32(addr64); 1581 le->addr = cpu_to_le32(upper_32_bits(mapping));
1589 le->ctrl = 0; 1582 le->ctrl = 0;
1590 le->opcode = OP_ADDR64 | HW_OWNER; 1583 le->opcode = OP_ADDR64 | HW_OWNER;
1591 sky2->tx_addr64 = addr64;
1592 } 1584 }
1593 1585
1594 le = get_tx_le(sky2); 1586 le = get_tx_le(sky2);
@@ -3957,7 +3949,7 @@ static __exit void sky2_debug_cleanup(void)
3957/* Initialize network device */ 3949/* Initialize network device */
3958static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, 3950static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3959 unsigned port, 3951 unsigned port,
3960 int highmem, int wol) 3952 int highmem)
3961{ 3953{
3962 struct sky2_port *sky2; 3954 struct sky2_port *sky2;
3963 struct net_device *dev = alloc_etherdev(sizeof(*sky2)); 3955 struct net_device *dev = alloc_etherdev(sizeof(*sky2));
@@ -3997,7 +3989,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3997 sky2->speed = -1; 3989 sky2->speed = -1;
3998 sky2->advertising = sky2_supported_modes(hw); 3990 sky2->advertising = sky2_supported_modes(hw);
3999 sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL); 3991 sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL);
4000 sky2->wol = wol; 3992 sky2->wol = sky2_wol_supported(hw) & WAKE_MAGIC;
4001 3993
4002 spin_lock_init(&sky2->phy_lock); 3994 spin_lock_init(&sky2->phy_lock);
4003 sky2->tx_pending = TX_DEF_PENDING; 3995 sky2->tx_pending = TX_DEF_PENDING;
@@ -4094,24 +4086,12 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
4094 return err; 4086 return err;
4095} 4087}
4096 4088
4097static int __devinit pci_wake_enabled(struct pci_dev *dev)
4098{
4099 int pm = pci_find_capability(dev, PCI_CAP_ID_PM);
4100 u16 value;
4101
4102 if (!pm)
4103 return 0;
4104 if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value))
4105 return 0;
4106 return value & PCI_PM_CTRL_PME_ENABLE;
4107}
4108
4109static int __devinit sky2_probe(struct pci_dev *pdev, 4089static int __devinit sky2_probe(struct pci_dev *pdev,
4110 const struct pci_device_id *ent) 4090 const struct pci_device_id *ent)
4111{ 4091{
4112 struct net_device *dev; 4092 struct net_device *dev;
4113 struct sky2_hw *hw; 4093 struct sky2_hw *hw;
4114 int err, using_dac = 0, wol_default; 4094 int err, using_dac = 0;
4115 4095
4116 err = pci_enable_device(pdev); 4096 err = pci_enable_device(pdev);
4117 if (err) { 4097 if (err) {
@@ -4144,8 +4124,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4144 } 4124 }
4145 } 4125 }
4146 4126
4147 wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0;
4148
4149 err = -ENOMEM; 4127 err = -ENOMEM;
4150 hw = kzalloc(sizeof(*hw), GFP_KERNEL); 4128 hw = kzalloc(sizeof(*hw), GFP_KERNEL);
4151 if (!hw) { 4129 if (!hw) {
@@ -4189,7 +4167,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4189 4167
4190 sky2_reset(hw); 4168 sky2_reset(hw);
4191 4169
4192 dev = sky2_init_netdev(hw, 0, using_dac, wol_default); 4170 dev = sky2_init_netdev(hw, 0, using_dac);
4193 if (!dev) { 4171 if (!dev) {
4194 err = -ENOMEM; 4172 err = -ENOMEM;
4195 goto err_out_free_pci; 4173 goto err_out_free_pci;
@@ -4226,7 +4204,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4226 if (hw->ports > 1) { 4204 if (hw->ports > 1) {
4227 struct net_device *dev1; 4205 struct net_device *dev1;
4228 4206
4229 dev1 = sky2_init_netdev(hw, 1, using_dac, wol_default); 4207 dev1 = sky2_init_netdev(hw, 1, using_dac);
4230 if (!dev1) 4208 if (!dev1)
4231 dev_warn(&pdev->dev, "allocation for second device failed\n"); 4209 dev_warn(&pdev->dev, "allocation for second device failed\n");
4232 else if ((err = register_netdev(dev1))) { 4210 else if ((err = register_netdev(dev1))) {
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index bc646a47edd2..ffe9b8a50a1b 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1991,14 +1991,14 @@ struct sky2_port {
1991 u16 tx_cons; /* next le to check */ 1991 u16 tx_cons; /* next le to check */
1992 u16 tx_prod; /* next le to use */ 1992 u16 tx_prod; /* next le to use */
1993 u16 tx_next; /* debug only */ 1993 u16 tx_next; /* debug only */
1994 u32 tx_addr64; 1994
1995 u16 tx_pending; 1995 u16 tx_pending;
1996 u16 tx_last_mss; 1996 u16 tx_last_mss;
1997 u32 tx_tcpsum; 1997 u32 tx_tcpsum;
1998 1998
1999 struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp; 1999 struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp;
2000 struct sky2_rx_le *rx_le; 2000 struct sky2_rx_le *rx_le;
2001 u32 rx_addr64; 2001
2002 u16 rx_next; /* next re to check */ 2002 u16 rx_next; /* next re to check */
2003 u16 rx_put; /* next le index to use */ 2003 u16 rx_put; /* next le index to use */
2004 u16 rx_pending; 2004 u16 rx_pending;
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index 41f34bb91cad..6e8b18a3b3cc 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -911,7 +911,7 @@ static int de4x5_init(struct net_device *dev);
911static int de4x5_sw_reset(struct net_device *dev); 911static int de4x5_sw_reset(struct net_device *dev);
912static int de4x5_rx(struct net_device *dev); 912static int de4x5_rx(struct net_device *dev);
913static int de4x5_tx(struct net_device *dev); 913static int de4x5_tx(struct net_device *dev);
914static int de4x5_ast(struct net_device *dev); 914static void de4x5_ast(struct net_device *dev);
915static int de4x5_txur(struct net_device *dev); 915static int de4x5_txur(struct net_device *dev);
916static int de4x5_rx_ovfc(struct net_device *dev); 916static int de4x5_rx_ovfc(struct net_device *dev);
917 917
@@ -984,11 +984,9 @@ static int test_bad_enet(struct net_device *dev, int status);
984static int an_exception(struct de4x5_private *lp); 984static int an_exception(struct de4x5_private *lp);
985static char *build_setup_frame(struct net_device *dev, int mode); 985static char *build_setup_frame(struct net_device *dev, int mode);
986static void disable_ast(struct net_device *dev); 986static void disable_ast(struct net_device *dev);
987static void enable_ast(struct net_device *dev, u32 time_out);
988static long de4x5_switch_mac_port(struct net_device *dev); 987static long de4x5_switch_mac_port(struct net_device *dev);
989static int gep_rd(struct net_device *dev); 988static int gep_rd(struct net_device *dev);
990static void gep_wr(s32 data, struct net_device *dev); 989static void gep_wr(s32 data, struct net_device *dev);
991static void timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec);
992static void yawn(struct net_device *dev, int state); 990static void yawn(struct net_device *dev, int state);
993static void de4x5_parse_params(struct net_device *dev); 991static void de4x5_parse_params(struct net_device *dev);
994static void de4x5_dbg_open(struct net_device *dev); 992static void de4x5_dbg_open(struct net_device *dev);
@@ -1139,6 +1137,8 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
1139 lp->gendev = gendev; 1137 lp->gendev = gendev;
1140 spin_lock_init(&lp->lock); 1138 spin_lock_init(&lp->lock);
1141 init_timer(&lp->timer); 1139 init_timer(&lp->timer);
1140 lp->timer.function = (void (*)(unsigned long))de4x5_ast;
1141 lp->timer.data = (unsigned long)dev;
1142 de4x5_parse_params(dev); 1142 de4x5_parse_params(dev);
1143 1143
1144 /* 1144 /*
@@ -1311,7 +1311,7 @@ de4x5_open(struct net_device *dev)
1311 lp->state = OPEN; 1311 lp->state = OPEN;
1312 de4x5_dbg_open(dev); 1312 de4x5_dbg_open(dev);
1313 1313
1314 if (request_irq(dev->irq, (void *)de4x5_interrupt, IRQF_SHARED, 1314 if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED,
1315 lp->adapter_name, dev)) { 1315 lp->adapter_name, dev)) {
1316 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); 1316 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq);
1317 if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED, 1317 if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED,
@@ -1737,27 +1737,29 @@ de4x5_tx(struct net_device *dev)
1737 return 0; 1737 return 0;
1738} 1738}
1739 1739
1740static int 1740static void
1741de4x5_ast(struct net_device *dev) 1741de4x5_ast(struct net_device *dev)
1742{ 1742{
1743 struct de4x5_private *lp = netdev_priv(dev); 1743 struct de4x5_private *lp = netdev_priv(dev);
1744 int next_tick = DE4X5_AUTOSENSE_MS; 1744 int next_tick = DE4X5_AUTOSENSE_MS;
1745 int dt;
1745 1746
1746 disable_ast(dev); 1747 if (lp->useSROM)
1748 next_tick = srom_autoconf(dev);
1749 else if (lp->chipset == DC21140)
1750 next_tick = dc21140m_autoconf(dev);
1751 else if (lp->chipset == DC21041)
1752 next_tick = dc21041_autoconf(dev);
1753 else if (lp->chipset == DC21040)
1754 next_tick = dc21040_autoconf(dev);
1755 lp->linkOK = 0;
1747 1756
1748 if (lp->useSROM) { 1757 dt = (next_tick * HZ) / 1000;
1749 next_tick = srom_autoconf(dev);
1750 } else if (lp->chipset == DC21140) {
1751 next_tick = dc21140m_autoconf(dev);
1752 } else if (lp->chipset == DC21041) {
1753 next_tick = dc21041_autoconf(dev);
1754 } else if (lp->chipset == DC21040) {
1755 next_tick = dc21040_autoconf(dev);
1756 }
1757 lp->linkOK = 0;
1758 enable_ast(dev, next_tick);
1759 1758
1760 return 0; 1759 if (!dt)
1760 dt = 1;
1761
1762 mod_timer(&lp->timer, jiffies + dt);
1761} 1763}
1762 1764
1763static int 1765static int
@@ -2174,7 +2176,7 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
2174 for (j=0, i=0; i<ETH_ALEN; i++) { 2176 for (j=0, i=0; i<ETH_ALEN; i++) {
2175 j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i); 2177 j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i);
2176 } 2178 }
2177 if ((j != 0) && (j != 0x5fa)) { 2179 if (j != 0 && j != 6 * 0xff) {
2178 last.chipset = device; 2180 last.chipset = device;
2179 last.bus = pb; 2181 last.bus = pb;
2180 last.irq = irq; 2182 last.irq = irq;
@@ -2371,30 +2373,19 @@ static struct pci_driver de4x5_pci_driver = {
2371static int 2373static int
2372autoconf_media(struct net_device *dev) 2374autoconf_media(struct net_device *dev)
2373{ 2375{
2374 struct de4x5_private *lp = netdev_priv(dev); 2376 struct de4x5_private *lp = netdev_priv(dev);
2375 u_long iobase = dev->base_addr; 2377 u_long iobase = dev->base_addr;
2376 int next_tick = DE4X5_AUTOSENSE_MS;
2377 2378
2378 lp->linkOK = 0; 2379 disable_ast(dev);
2379 lp->c_media = AUTO; /* Bogus last media */
2380 disable_ast(dev);
2381 inl(DE4X5_MFC); /* Zero the lost frames counter */
2382 lp->media = INIT;
2383 lp->tcount = 0;
2384 2380
2385 if (lp->useSROM) { 2381 lp->c_media = AUTO; /* Bogus last media */
2386 next_tick = srom_autoconf(dev); 2382 inl(DE4X5_MFC); /* Zero the lost frames counter */
2387 } else if (lp->chipset == DC21040) { 2383 lp->media = INIT;
2388 next_tick = dc21040_autoconf(dev); 2384 lp->tcount = 0;
2389 } else if (lp->chipset == DC21041) {
2390 next_tick = dc21041_autoconf(dev);
2391 } else if (lp->chipset == DC21140) {
2392 next_tick = dc21140m_autoconf(dev);
2393 }
2394 2385
2395 enable_ast(dev, next_tick); 2386 de4x5_ast(dev);
2396 2387
2397 return (lp->media); 2388 return lp->media;
2398} 2389}
2399 2390
2400/* 2391/*
@@ -4018,20 +4009,22 @@ DevicePresent(struct net_device *dev, u_long aprom_addr)
4018 outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */ 4009 outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */
4019 } 4010 }
4020 } else { /* Read new srom */ 4011 } else { /* Read new srom */
4021 u_short tmp, *p = (short *)((char *)&lp->srom + SROM_HWADD); 4012 u_short tmp;
4013 __le16 *p = (__le16 *)((char *)&lp->srom + SROM_HWADD);
4022 for (i=0; i<(ETH_ALEN>>1); i++) { 4014 for (i=0; i<(ETH_ALEN>>1); i++) {
4023 tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i); 4015 tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i);
4024 *p = le16_to_cpu(tmp); 4016 j += tmp; /* for check for 0:0:0:0:0:0 or ff:ff:ff:ff:ff:ff */
4025 j += *p++; 4017 *p = cpu_to_le16(tmp);
4026 } 4018 }
4027 if ((j == 0) || (j == 0x2fffd)) { 4019 if (j == 0 || j == 3 * 0xffff) {
4028 return; 4020 /* could get 0 only from all-0 and 3 * 0xffff only from all-1 */
4021 return;
4029 } 4022 }
4030 4023
4031 p=(short *)&lp->srom; 4024 p = (__le16 *)&lp->srom;
4032 for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) { 4025 for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) {
4033 tmp = srom_rd(aprom_addr, i); 4026 tmp = srom_rd(aprom_addr, i);
4034 *p++ = le16_to_cpu(tmp); 4027 *p++ = cpu_to_le16(tmp);
4035 } 4028 }
4036 de4x5_dbg_srom((struct de4x5_srom *)&lp->srom); 4029 de4x5_dbg_srom((struct de4x5_srom *)&lp->srom);
4037 } 4030 }
@@ -5161,21 +5154,10 @@ build_setup_frame(struct net_device *dev, int mode)
5161} 5154}
5162 5155
5163static void 5156static void
5164enable_ast(struct net_device *dev, u32 time_out)
5165{
5166 timeout(dev, (void *)&de4x5_ast, (u_long)dev, time_out);
5167
5168 return;
5169}
5170
5171static void
5172disable_ast(struct net_device *dev) 5157disable_ast(struct net_device *dev)
5173{ 5158{
5174 struct de4x5_private *lp = netdev_priv(dev); 5159 struct de4x5_private *lp = netdev_priv(dev);
5175 5160 del_timer_sync(&lp->timer);
5176 del_timer(&lp->timer);
5177
5178 return;
5179} 5161}
5180 5162
5181static long 5163static long
@@ -5245,29 +5227,6 @@ gep_rd(struct net_device *dev)
5245} 5227}
5246 5228
5247static void 5229static void
5248timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec)
5249{
5250 struct de4x5_private *lp = netdev_priv(dev);
5251 int dt;
5252
5253 /* First, cancel any pending timer events */
5254 del_timer(&lp->timer);
5255
5256 /* Convert msec to ticks */
5257 dt = (msec * HZ) / 1000;
5258 if (dt==0) dt=1;
5259
5260 /* Set up timer */
5261 init_timer(&lp->timer);
5262 lp->timer.expires = jiffies + dt;
5263 lp->timer.function = fn;
5264 lp->timer.data = data;
5265 add_timer(&lp->timer);
5266
5267 return;
5268}
5269
5270static void
5271yawn(struct net_device *dev, int state) 5230yawn(struct net_device *dev, int state)
5272{ 5231{
5273 struct de4x5_private *lp = netdev_priv(dev); 5232 struct de4x5_private *lp = netdev_priv(dev);
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index e5e2c9c4ebfe..ed600bf56e78 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -797,7 +797,8 @@ static int tulip_close (struct net_device *dev)
797 797
798 tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */ 798 tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */
799 tp->rx_ring[i].length = 0; 799 tp->rx_ring[i].length = 0;
800 tp->rx_ring[i].buffer1 = 0xBADF00D0; /* An invalid address. */ 800 /* An invalid address. */
801 tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0);
801 if (skb) { 802 if (skb) {
802 pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, 803 pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ,
803 PCI_DMA_FROMDEVICE); 804 PCI_DMA_FROMDEVICE);
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 70befe33e454..8fc7274642eb 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -83,8 +83,8 @@ static int bufferoffsets[NUMDESCRIPTORS] = {128,2048,4096,6144};
83struct xircom_private { 83struct xircom_private {
84 /* Send and receive buffers, kernel-addressable and dma addressable forms */ 84 /* Send and receive buffers, kernel-addressable and dma addressable forms */
85 85
86 unsigned int *rx_buffer; 86 __le32 *rx_buffer;
87 unsigned int *tx_buffer; 87 __le32 *tx_buffer;
88 88
89 dma_addr_t rx_dma_handle; 89 dma_addr_t rx_dma_handle;
90 dma_addr_t tx_dma_handle; 90 dma_addr_t tx_dma_handle;
@@ -412,19 +412,20 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
412 /* FIXME: The specification tells us that the length we send HAS to be a multiple of 412 /* FIXME: The specification tells us that the length we send HAS to be a multiple of
413 4 bytes. */ 413 4 bytes. */
414 414
415 card->tx_buffer[4*desc+1] = skb->len; 415 card->tx_buffer[4*desc+1] = cpu_to_le32(skb->len);
416 if (desc == NUMDESCRIPTORS-1) 416 if (desc == NUMDESCRIPTORS - 1) /* bit 25: last descriptor of the ring */
417 card->tx_buffer[4*desc+1] |= (1<<25); /* bit 25: last descriptor of the ring */ 417 card->tx_buffer[4*desc+1] |= cpu_to_le32(1<<25);
418 418
419 card->tx_buffer[4*desc+1] |= 0xF0000000; 419 card->tx_buffer[4*desc+1] |= cpu_to_le32(0xF0000000);
420 /* 0xF0... means want interrupts*/ 420 /* 0xF0... means want interrupts*/
421 card->tx_skb[desc] = skb; 421 card->tx_skb[desc] = skb;
422 422
423 wmb(); 423 wmb();
424 /* This gives the descriptor to the card */ 424 /* This gives the descriptor to the card */
425 card->tx_buffer[4*desc] = 0x80000000; 425 card->tx_buffer[4*desc] = cpu_to_le32(0x80000000);
426 trigger_transmit(card); 426 trigger_transmit(card);
427 if (((int)card->tx_buffer[nextdescriptor*4])<0) { /* next descriptor is occupied... */ 427 if (card->tx_buffer[nextdescriptor*4] & cpu_to_le32(0x8000000)) {
428 /* next descriptor is occupied... */
428 netif_stop_queue(dev); 429 netif_stop_queue(dev);
429 } 430 }
430 card->transmit_used = nextdescriptor; 431 card->transmit_used = nextdescriptor;
@@ -590,8 +591,7 @@ descriptors and programs the addresses into the card.
590*/ 591*/
591static void setup_descriptors(struct xircom_private *card) 592static void setup_descriptors(struct xircom_private *card)
592{ 593{
593 unsigned int val; 594 u32 address;
594 unsigned int address;
595 int i; 595 int i;
596 enter("setup_descriptors"); 596 enter("setup_descriptors");
597 597
@@ -604,16 +604,16 @@ static void setup_descriptors(struct xircom_private *card)
604 for (i=0;i<NUMDESCRIPTORS;i++ ) { 604 for (i=0;i<NUMDESCRIPTORS;i++ ) {
605 605
606 /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */ 606 /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */
607 card->rx_buffer[i*4 + 0] = 0x80000000; 607 card->rx_buffer[i*4 + 0] = cpu_to_le32(0x80000000);
608 /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ 608 /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */
609 card->rx_buffer[i*4 + 1] = 1536; 609 card->rx_buffer[i*4 + 1] = cpu_to_le32(1536);
610 if (i==NUMDESCRIPTORS-1) 610 if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */
611 card->rx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ 611 card->rx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25);
612 612
613 /* Rx Descr2: address of the buffer 613 /* Rx Descr2: address of the buffer
614 we store the buffer at the 2nd half of the page */ 614 we store the buffer at the 2nd half of the page */
615 615
616 address = (unsigned long) card->rx_dma_handle; 616 address = card->rx_dma_handle;
617 card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); 617 card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]);
618 /* Rx Desc3: address of 2nd buffer -> 0 */ 618 /* Rx Desc3: address of 2nd buffer -> 0 */
619 card->rx_buffer[i*4 + 3] = 0; 619 card->rx_buffer[i*4 + 3] = 0;
@@ -621,9 +621,8 @@ static void setup_descriptors(struct xircom_private *card)
621 621
622 wmb(); 622 wmb();
623 /* Write the receive descriptor ring address to the card */ 623 /* Write the receive descriptor ring address to the card */
624 address = (unsigned long) card->rx_dma_handle; 624 address = card->rx_dma_handle;
625 val = cpu_to_le32(address); 625 outl(address, card->io_port + CSR3); /* Receive descr list address */
626 outl(val, card->io_port + CSR3); /* Receive descr list address */
627 626
628 627
629 /* transmit descriptors */ 628 /* transmit descriptors */
@@ -633,13 +632,13 @@ static void setup_descriptors(struct xircom_private *card)
633 /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */ 632 /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */
634 card->tx_buffer[i*4 + 0] = 0x00000000; 633 card->tx_buffer[i*4 + 0] = 0x00000000;
635 /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ 634 /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */
636 card->tx_buffer[i*4 + 1] = 1536; 635 card->tx_buffer[i*4 + 1] = cpu_to_le32(1536);
637 if (i==NUMDESCRIPTORS-1) 636 if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */
638 card->tx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ 637 card->tx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25);
639 638
640 /* Tx Descr2: address of the buffer 639 /* Tx Descr2: address of the buffer
641 we store the buffer at the 2nd half of the page */ 640 we store the buffer at the 2nd half of the page */
642 address = (unsigned long) card->tx_dma_handle; 641 address = card->tx_dma_handle;
643 card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); 642 card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]);
644 /* Tx Desc3: address of 2nd buffer -> 0 */ 643 /* Tx Desc3: address of 2nd buffer -> 0 */
645 card->tx_buffer[i*4 + 3] = 0; 644 card->tx_buffer[i*4 + 3] = 0;
@@ -647,9 +646,8 @@ static void setup_descriptors(struct xircom_private *card)
647 646
648 wmb(); 647 wmb();
649 /* wite the transmit descriptor ring to the card */ 648 /* wite the transmit descriptor ring to the card */
650 address = (unsigned long) card->tx_dma_handle; 649 address = card->tx_dma_handle;
651 val =cpu_to_le32(address); 650 outl(address, card->io_port + CSR4); /* xmit descr list address */
652 outl(val, card->io_port + CSR4); /* xmit descr list address */
653 651
654 leave("setup_descriptors"); 652 leave("setup_descriptors");
655} 653}
@@ -1180,7 +1178,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1180 int status; 1178 int status;
1181 1179
1182 enter("investigate_read_descriptor"); 1180 enter("investigate_read_descriptor");
1183 status = card->rx_buffer[4*descnr]; 1181 status = le32_to_cpu(card->rx_buffer[4*descnr]);
1184 1182
1185 if ((status > 0)) { /* packet received */ 1183 if ((status > 0)) { /* packet received */
1186 1184
@@ -1210,7 +1208,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1210 1208
1211 out: 1209 out:
1212 /* give the buffer back to the card */ 1210 /* give the buffer back to the card */
1213 card->rx_buffer[4*descnr] = 0x80000000; 1211 card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000);
1214 trigger_receive(card); 1212 trigger_receive(card);
1215 } 1213 }
1216 1214
@@ -1226,7 +1224,7 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p
1226 1224
1227 enter("investigate_write_descriptor"); 1225 enter("investigate_write_descriptor");
1228 1226
1229 status = card->tx_buffer[4*descnr]; 1227 status = le32_to_cpu(card->tx_buffer[4*descnr]);
1230#if 0 1228#if 0
1231 if (status & 0x8000) { /* Major error */ 1229 if (status & 0x8000) { /* Major error */
1232 printk(KERN_ERR "Major transmit error status %x \n", status); 1230 printk(KERN_ERR "Major transmit error status %x \n", status);
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 1249f444039e..569028b2baf2 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -202,10 +202,10 @@ static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
202 buf, 202 buf,
203 size, 203 size,
204 USB_CTRL_GET_TIMEOUT); 204 USB_CTRL_GET_TIMEOUT);
205 if (err >= 0 && err < size) 205 if (err == size)
206 err = -EINVAL;
207 if (!err)
208 memcpy(data, buf, size); 206 memcpy(data, buf, size);
207 else if (err >= 0)
208 err = -EINVAL;
209 kfree(buf); 209 kfree(buf);
210 210
211out: 211out:
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 50775f9234cc..18b1f9145389 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -257,7 +257,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
257static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, 257static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev,
258 __le32 *mac) 258 __le32 *mac)
259{ 259{
260 rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, &mac, 260 rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, mac,
261 (3 * sizeof(__le16))); 261 (3 * sizeof(__le16)));
262} 262}
263 263
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 2780df00623c..6d5d9aba0b73 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -124,7 +124,10 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
124 struct data_entry *entry; 124 struct data_entry *entry;
125 struct data_desc *rxd; 125 struct data_desc *rxd;
126 struct sk_buff *skb; 126 struct sk_buff *skb;
127 struct ieee80211_hdr *hdr;
127 struct rxdata_entry_desc desc; 128 struct rxdata_entry_desc desc;
129 int header_size;
130 int align;
128 u32 word; 131 u32 word;
129 132
130 while (1) { 133 while (1) {
@@ -138,17 +141,26 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
138 memset(&desc, 0x00, sizeof(desc)); 141 memset(&desc, 0x00, sizeof(desc));
139 rt2x00dev->ops->lib->fill_rxdone(entry, &desc); 142 rt2x00dev->ops->lib->fill_rxdone(entry, &desc);
140 143
144 hdr = (struct ieee80211_hdr *)entry->data_addr;
145 header_size =
146 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
147
148 /*
149 * The data behind the ieee80211 header must be
150 * aligned on a 4 byte boundary.
151 */
152 align = NET_IP_ALIGN + (2 * (header_size % 4 == 0));
153
141 /* 154 /*
142 * Allocate the sk_buffer, initialize it and copy 155 * Allocate the sk_buffer, initialize it and copy
143 * all data into it. 156 * all data into it.
144 */ 157 */
145 skb = dev_alloc_skb(desc.size + NET_IP_ALIGN); 158 skb = dev_alloc_skb(desc.size + align);
146 if (!skb) 159 if (!skb)
147 return; 160 return;
148 161
149 skb_reserve(skb, NET_IP_ALIGN); 162 skb_reserve(skb, align);
150 skb_put(skb, desc.size); 163 memcpy(skb_put(skb, desc.size), entry->data_addr, desc.size);
151 memcpy(skb->data, entry->data_addr, desc.size);
152 164
153 /* 165 /*
154 * Send the frame to rt2x00lib for further processing. 166 * Send the frame to rt2x00lib for further processing.
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 1f5675dd329f..ab4797ed94c9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -221,7 +221,9 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
221 struct data_ring *ring = entry->ring; 221 struct data_ring *ring = entry->ring;
222 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; 222 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev;
223 struct sk_buff *skb; 223 struct sk_buff *skb;
224 struct ieee80211_hdr *hdr;
224 struct rxdata_entry_desc desc; 225 struct rxdata_entry_desc desc;
226 int header_size;
225 int frame_size; 227 int frame_size;
226 228
227 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || 229 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
@@ -253,9 +255,20 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
253 skb_put(skb, frame_size); 255 skb_put(skb, frame_size);
254 256
255 /* 257 /*
256 * Trim the skb_buffer to only contain the valid 258 * The data behind the ieee80211 header must be
257 * frame data (so ignore the device's descriptor). 259 * aligned on a 4 byte boundary.
260 * After that trim the entire buffer down to only
261 * contain the valid frame data excluding the device
262 * descriptor.
258 */ 263 */
264 hdr = (struct ieee80211_hdr *)entry->skb->data;
265 header_size =
266 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
267
268 if (header_size % 4 == 0) {
269 skb_push(entry->skb, 2);
270 memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2);
271 }
259 skb_trim(entry->skb, desc.size); 272 skb_trim(entry->skb, desc.size);
260 273
261 /* 274 /*
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 01dbef19d651..ecae968ce091 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1738,6 +1738,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1738{ 1738{
1739 struct data_ring *ring; 1739 struct data_ring *ring;
1740 struct data_entry *entry; 1740 struct data_entry *entry;
1741 struct data_entry *entry_done;
1741 struct data_desc *txd; 1742 struct data_desc *txd;
1742 u32 word; 1743 u32 word;
1743 u32 reg; 1744 u32 reg;
@@ -1791,6 +1792,17 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1791 !rt2x00_get_field32(word, TXD_W0_VALID)) 1792 !rt2x00_get_field32(word, TXD_W0_VALID))
1792 return; 1793 return;
1793 1794
1795 entry_done = rt2x00_get_data_entry_done(ring);
1796 while (entry != entry_done) {
1797 /* Catch up. Just report any entries we missed as
1798 * failed. */
1799 WARNING(rt2x00dev,
1800 "TX status report missed for entry %p\n",
1801 entry_done);
1802 rt2x00lib_txdone(entry_done, TX_FAIL_OTHER, 0);
1803 entry_done = rt2x00_get_data_entry_done(ring);
1804 }
1805
1794 /* 1806 /*
1795 * Obtain the status about this packet. 1807 * Obtain the status about this packet.
1796 */ 1808 */
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 26cc4dcf4f0e..72e0bd5d80ac 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -465,6 +465,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, quirk
465DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi ); 465DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi );
466DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi ); 466DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi );
467DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi ); 467DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi );
468DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, quirk_ich6_lpc_acpi );
469DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4, quirk_ich6_lpc_acpi );
470DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, quirk_ich6_lpc_acpi );
471DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_4, quirk_ich6_lpc_acpi );
472DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7, quirk_ich6_lpc_acpi );
473DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_8, quirk_ich6_lpc_acpi );
468 474
469/* 475/*
470 * VIA ACPI: One IO region pointed to by longword at 476 * VIA ACPI: One IO region pointed to by longword at
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 3c5eb374adf8..f7b8648acbfa 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -76,6 +76,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
76 int i = 0; 76 int i = 0;
77 int irq; 77 int irq;
78 int p, t; 78 int p, t;
79 static unsigned char warned;
79 80
80 if (!valid_IRQ(gsi)) 81 if (!valid_IRQ(gsi))
81 return; 82 return;
@@ -83,9 +84,10 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
83 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && 84 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
84 i < PNP_MAX_IRQ) 85 i < PNP_MAX_IRQ)
85 i++; 86 i++;
86 if (i >= PNP_MAX_IRQ) { 87 if (i >= PNP_MAX_IRQ && !warned) {
87 printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ " 88 printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ "
88 "resources: %d \n", PNP_MAX_IRQ); 89 "resources: %d \n", PNP_MAX_IRQ);
90 warned = 1;
89 return; 91 return;
90 } 92 }
91 /* 93 /*
@@ -169,6 +171,7 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
169 int bus_master, int transfer) 171 int bus_master, int transfer)
170{ 172{
171 int i = 0; 173 int i = 0;
174 static unsigned char warned;
172 175
173 while (i < PNP_MAX_DMA && 176 while (i < PNP_MAX_DMA &&
174 !(res->dma_resource[i].flags & IORESOURCE_UNSET)) 177 !(res->dma_resource[i].flags & IORESOURCE_UNSET))
@@ -183,9 +186,10 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
183 } 186 }
184 res->dma_resource[i].start = dma; 187 res->dma_resource[i].start = dma;
185 res->dma_resource[i].end = dma; 188 res->dma_resource[i].end = dma;
186 } else { 189 } else if (!warned) {
187 printk(KERN_ERR "pnpacpi: exceeded the max number of DMA " 190 printk(KERN_ERR "pnpacpi: exceeded the max number of DMA "
188 "resources: %d \n", PNP_MAX_DMA); 191 "resources: %d \n", PNP_MAX_DMA);
192 warned = 1;
189 } 193 }
190} 194}
191 195
@@ -193,6 +197,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
193 u64 io, u64 len, int io_decode) 197 u64 io, u64 len, int io_decode)
194{ 198{
195 int i = 0; 199 int i = 0;
200 static unsigned char warned;
196 201
197 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && 202 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
198 i < PNP_MAX_PORT) 203 i < PNP_MAX_PORT)
@@ -207,7 +212,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
207 } 212 }
208 res->port_resource[i].start = io; 213 res->port_resource[i].start = io;
209 res->port_resource[i].end = io + len - 1; 214 res->port_resource[i].end = io + len - 1;
210 } else { 215 } else if (!warned) {
211 printk(KERN_ERR "pnpacpi: exceeded the max number of IO " 216 printk(KERN_ERR "pnpacpi: exceeded the max number of IO "
212 "resources: %d \n", PNP_MAX_PORT); 217 "resources: %d \n", PNP_MAX_PORT);
213 } 218 }
@@ -218,6 +223,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
218 int write_protect) 223 int write_protect)
219{ 224{
220 int i = 0; 225 int i = 0;
226 static unsigned char warned;
221 227
222 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && 228 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
223 (i < PNP_MAX_MEM)) 229 (i < PNP_MAX_MEM))
@@ -233,7 +239,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
233 239
234 res->mem_resource[i].start = mem; 240 res->mem_resource[i].start = mem;
235 res->mem_resource[i].end = mem + len - 1; 241 res->mem_resource[i].end = mem + len - 1;
236 } else { 242 } else if (!warned) {
237 printk(KERN_ERR "pnpacpi: exceeded the max number of mem " 243 printk(KERN_ERR "pnpacpi: exceeded the max number of mem "
238 "resources: %d\n", PNP_MAX_MEM); 244 "resources: %d\n", PNP_MAX_MEM);
239 } 245 }
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 9dd3952516c5..38a1ee2eacd8 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -13906,7 +13906,7 @@ static int advansys_release(struct Scsi_Host *shost)
13906 13906
13907#define ASC_IOADR_TABLE_MAX_IX 11 13907#define ASC_IOADR_TABLE_MAX_IX 11
13908 13908
13909static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __devinitdata = { 13909static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] = {
13910 0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190, 13910 0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190,
13911 0x0210, 0x0230, 0x0250, 0x0330 13911 0x0210, 0x0230, 0x0250, 0x0330
13912}; 13912};
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 146d540f6281..288640756099 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -3041,7 +3041,6 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3041 int cnt; 3041 int cnt;
3042 int req_cnt; 3042 int req_cnt;
3043 int seg_cnt; 3043 int seg_cnt;
3044 dma_addr_t dma_handle;
3045 u8 dir; 3044 u8 dir;
3046 3045
3047 ENTER("qla1280_32bit_start_scsi"); 3046 ENTER("qla1280_32bit_start_scsi");
@@ -3050,6 +3049,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3050 cmd->cmnd[0]); 3049 cmd->cmnd[0]);
3051 3050
3052 /* Calculate number of entries and segments required. */ 3051 /* Calculate number of entries and segments required. */
3052 req_cnt = 1;
3053 seg_cnt = scsi_dma_map(cmd); 3053 seg_cnt = scsi_dma_map(cmd);
3054 if (seg_cnt) { 3054 if (seg_cnt) {
3055 /* 3055 /*
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index a5bcf1f390b3..8ecc0470b8f3 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1831,7 +1831,7 @@ probe_out:
1831 return ret; 1831 return ret;
1832} 1832}
1833 1833
1834static void __devexit 1834static void
1835qla2x00_remove_one(struct pci_dev *pdev) 1835qla2x00_remove_one(struct pci_dev *pdev)
1836{ 1836{
1837 scsi_qla_host_t *ha; 1837 scsi_qla_host_t *ha;
@@ -2965,7 +2965,7 @@ static struct pci_driver qla2xxx_pci_driver = {
2965 }, 2965 },
2966 .id_table = qla2xxx_pci_tbl, 2966 .id_table = qla2xxx_pci_tbl,
2967 .probe = qla2x00_probe_one, 2967 .probe = qla2x00_probe_one,
2968 .remove = __devexit_p(qla2x00_remove_one), 2968 .remove = qla2x00_remove_one,
2969 .err_handler = &qla2xxx_err_handler, 2969 .err_handler = &qla2xxx_err_handler,
2970}; 2970};
2971 2971
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 11a3a222dfc3..7c30cc8df71e 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -801,5 +801,5 @@ module_init(atmel_lcdfb_init);
801module_exit(atmel_lcdfb_exit); 801module_exit(atmel_lcdfb_exit);
802 802
803MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver"); 803MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver");
804MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@rfo.atmel.com>"); 804MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>");
805MODULE_LICENSE("GPL"); 805MODULE_LICENSE("GPL");
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index b3128903d673..044a423a72cb 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -443,8 +443,6 @@ static int ps3fb_sync(struct fb_info *info, u32 frame)
443 u32 ddr_line_length, xdr_line_length; 443 u32 ddr_line_length, xdr_line_length;
444 u64 ddr_base, xdr_base; 444 u64 ddr_base, xdr_base;
445 445
446 acquire_console_sem();
447
448 if (frame > par->num_frames - 1) { 446 if (frame > par->num_frames - 1) {
449 dev_dbg(info->device, "%s: invalid frame number (%u)\n", 447 dev_dbg(info->device, "%s: invalid frame number (%u)\n",
450 __func__, frame); 448 __func__, frame);
@@ -464,7 +462,6 @@ static int ps3fb_sync(struct fb_info *info, u32 frame)
464 xdr_line_length); 462 xdr_line_length);
465 463
466out: 464out:
467 release_console_sem();
468 return error; 465 return error;
469} 466}
470 467
@@ -479,7 +476,10 @@ static int ps3fb_release(struct fb_info *info, int user)
479 if (atomic_dec_and_test(&ps3fb.f_count)) { 476 if (atomic_dec_and_test(&ps3fb.f_count)) {
480 if (atomic_read(&ps3fb.ext_flip)) { 477 if (atomic_read(&ps3fb.ext_flip)) {
481 atomic_set(&ps3fb.ext_flip, 0); 478 atomic_set(&ps3fb.ext_flip, 0);
482 ps3fb_sync(info, 0); /* single buffer */ 479 if (!try_acquire_console_sem()) {
480 ps3fb_sync(info, 0); /* single buffer */
481 release_console_sem();
482 }
483 } 483 }
484 } 484 }
485 return 0; 485 return 0;
@@ -865,7 +865,9 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
865 break; 865 break;
866 866
867 dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val); 867 dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
868 acquire_console_sem();
868 retval = ps3fb_sync(info, val); 869 retval = ps3fb_sync(info, val);
870 release_console_sem();
869 break; 871 break;
870 872
871 default: 873 default:
@@ -885,7 +887,9 @@ static int ps3fbd(void *arg)
885 set_current_state(TASK_INTERRUPTIBLE); 887 set_current_state(TASK_INTERRUPTIBLE);
886 if (ps3fb.is_kicked) { 888 if (ps3fb.is_kicked) {
887 ps3fb.is_kicked = 0; 889 ps3fb.is_kicked = 0;
890 acquire_console_sem();
888 ps3fb_sync(info, 0); /* single buffer */ 891 ps3fb_sync(info, 0); /* single buffer */
892 release_console_sem();
889 } 893 }
890 schedule(); 894 schedule();
891 } 895 }
@@ -1234,12 +1238,6 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1234 ps3fb_flip_ctl(0, &ps3fb); /* flip off */ 1238 ps3fb_flip_ctl(0, &ps3fb); /* flip off */
1235 ps3fb.dinfo->irq.mask = 0; 1239 ps3fb.dinfo->irq.mask = 0;
1236 1240
1237 if (info) {
1238 unregister_framebuffer(info);
1239 fb_dealloc_cmap(&info->cmap);
1240 framebuffer_release(info);
1241 }
1242
1243 ps3av_register_flip_ctl(NULL, NULL); 1241 ps3av_register_flip_ctl(NULL, NULL);
1244 if (ps3fb.task) { 1242 if (ps3fb.task) {
1245 struct task_struct *task = ps3fb.task; 1243 struct task_struct *task = ps3fb.task;
@@ -1250,6 +1248,12 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1250 free_irq(ps3fb.irq_no, &dev->core); 1248 free_irq(ps3fb.irq_no, &dev->core);
1251 ps3_irq_plug_destroy(ps3fb.irq_no); 1249 ps3_irq_plug_destroy(ps3fb.irq_no);
1252 } 1250 }
1251 if (info) {
1252 unregister_framebuffer(info);
1253 fb_dealloc_cmap(&info->cmap);
1254 framebuffer_release(info);
1255 info = dev->core.driver_data = NULL;
1256 }
1253 iounmap((u8 __iomem *)ps3fb.dinfo); 1257 iounmap((u8 __iomem *)ps3fb.dinfo);
1254 1258
1255 status = lv1_gpu_context_free(ps3fb.context_handle); 1259 status = lv1_gpu_context_free(ps3fb.context_handle);
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 5857ccf5f6b1..ad35033f1a48 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -1026,7 +1026,7 @@ static int s3c2410fb_resume(struct platform_device *dev)
1026 clk_enable(info->clk); 1026 clk_enable(info->clk);
1027 msleep(1); 1027 msleep(1);
1028 1028
1029 s3c2410fb_init_registers(info); 1029 s3c2410fb_init_registers(fbinfo);
1030 1030
1031 return 0; 1031 return 0;
1032} 1032}
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index d1d6c0facd54..a14ef894d571 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -43,7 +43,7 @@ static struct fb_fix_screeninfo uvesafb_fix __devinitdata = {
43}; 43};
44 44
45static int mtrr __devinitdata = 3; /* enable mtrr by default */ 45static int mtrr __devinitdata = 3; /* enable mtrr by default */
46static int blank __devinitdata = 1; /* enable blanking by default */ 46static int blank = 1; /* enable blanking by default */
47static int ypan __devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */ 47static int ypan __devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */
48static int pmi_setpal __devinitdata = 1; /* use PMI for palette changes */ 48static int pmi_setpal __devinitdata = 1; /* use PMI for palette changes */
49static int nocrtc __devinitdata; /* ignore CRTC settings */ 49static int nocrtc __devinitdata; /* ignore CRTC settings */
@@ -1549,7 +1549,7 @@ static void __devinit uvesafb_init_info(struct fb_info *info,
1549 info->fbops->fb_pan_display = NULL; 1549 info->fbops->fb_pan_display = NULL;
1550} 1550}
1551 1551
1552static void uvesafb_init_mtrr(struct fb_info *info) 1552static void __devinit uvesafb_init_mtrr(struct fb_info *info)
1553{ 1553{
1554#ifdef CONFIG_MTRR 1554#ifdef CONFIG_MTRR
1555 if (mtrr && !(info->fix.smem_start & (PAGE_SIZE - 1))) { 1555 if (mtrr && !(info->fix.smem_start & (PAGE_SIZE - 1))) {
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 070217322c9f..33e50310e9e0 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -869,11 +869,9 @@ void w1_search_process(struct w1_master *dev, u8 search_type)
869 w1_search_devices(dev, search_type, w1_slave_found); 869 w1_search_devices(dev, search_type, w1_slave_found);
870 870
871 list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) { 871 list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
872 if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl) { 872 if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl)
873 w1_slave_detach(sl); 873 w1_slave_detach(sl);
874 874 else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
875 dev->slave_count--;
876 } else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
877 sl->ttl = dev->slave_ttl; 875 sl->ttl = dev->slave_ttl;
878 } 876 }
879 877
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 0fca82021d76..300324bd563c 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -482,8 +482,6 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
482 if (wbc->nr_to_write <= 0) 482 if (wbc->nr_to_write <= 0)
483 break; 483 break;
484 } 484 }
485 if (!list_empty(&sb->s_more_io))
486 wbc->more_io = 1;
487 return; /* Leave any unwritten inodes on s_io */ 485 return; /* Leave any unwritten inodes on s_io */
488} 486}
489 487
diff --git a/fs/namei.c b/fs/namei.c
index 3b993db26cee..73e2e665817a 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1605,7 +1605,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1605 if (S_ISLNK(inode->i_mode)) 1605 if (S_ISLNK(inode->i_mode))
1606 return -ELOOP; 1606 return -ELOOP;
1607 1607
1608 if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE)) 1608 if (S_ISDIR(inode->i_mode) && (acc_mode & MAY_WRITE))
1609 return -EISDIR; 1609 return -EISDIR;
1610 1610
1611 /* 1611 /*
@@ -1620,7 +1620,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1620 return -EACCES; 1620 return -EACCES;
1621 1621
1622 flag &= ~O_TRUNC; 1622 flag &= ~O_TRUNC;
1623 } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE)) 1623 } else if (IS_RDONLY(inode) && (acc_mode & MAY_WRITE))
1624 return -EROFS; 1624 return -EROFS;
1625 1625
1626 error = vfs_permission(nd, acc_mode); 1626 error = vfs_permission(nd, acc_mode);
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index b35069a2aa9e..bd1b9d663fb9 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -115,6 +115,7 @@ struct nfs4_lock_state {
115#define NFS_LOCK_INITIALIZED 1 115#define NFS_LOCK_INITIALIZED 1
116 int ls_flags; 116 int ls_flags;
117 struct nfs_seqid_counter ls_seqid; 117 struct nfs_seqid_counter ls_seqid;
118 struct rpc_sequence ls_sequence;
118 struct nfs_unique_id ls_id; 119 struct nfs_unique_id ls_id;
119 nfs4_stateid ls_stateid; 120 nfs4_stateid ls_stateid;
120 atomic_t ls_count; 121 atomic_t ls_count;
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 23a9a36556bf..5a39c6f78acf 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -509,7 +509,10 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
509 lsp = kzalloc(sizeof(*lsp), GFP_KERNEL); 509 lsp = kzalloc(sizeof(*lsp), GFP_KERNEL);
510 if (lsp == NULL) 510 if (lsp == NULL)
511 return NULL; 511 return NULL;
512 lsp->ls_seqid.sequence = &state->owner->so_sequence; 512 rpc_init_wait_queue(&lsp->ls_sequence.wait, "lock_seqid_waitqueue");
513 spin_lock_init(&lsp->ls_sequence.lock);
514 INIT_LIST_HEAD(&lsp->ls_sequence.list);
515 lsp->ls_seqid.sequence = &lsp->ls_sequence;
513 atomic_set(&lsp->ls_count, 1); 516 atomic_set(&lsp->ls_count, 1);
514 lsp->ls_owner = fl_owner; 517 lsp->ls_owner = fl_owner;
515 spin_lock(&clp->cl_lock); 518 spin_lock(&clp->cl_lock);
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 2d116d2298f8..f917fd25858a 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -388,8 +388,11 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
388 * Round the length of the data which was specified up to 388 * Round the length of the data which was specified up to
389 * the next multiple of XDR units and then compare that 389 * the next multiple of XDR units and then compare that
390 * against the length which was actually received. 390 * against the length which was actually received.
391 * Note that when RPCSEC/GSS (for example) is used, the
392 * data buffer can be padded so dlen might be larger
393 * than required. It must never be smaller.
391 */ 394 */
392 if (dlen != XDR_QUADLEN(len)*4) 395 if (dlen < XDR_QUADLEN(len)*4)
393 return 0; 396 return 0;
394 397
395 if (args->count > max_blocksize) { 398 if (args->count > max_blocksize) {
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 986f9b32083c..b86e3658a0af 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -313,8 +313,11 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
313 * Round the length of the data which was specified up to 313 * Round the length of the data which was specified up to
314 * the next multiple of XDR units and then compare that 314 * the next multiple of XDR units and then compare that
315 * against the length which was actually received. 315 * against the length which was actually received.
316 * Note that when RPCSEC/GSS (for example) is used, the
317 * data buffer can be padded so dlen might be larger
318 * than required. It must never be smaller.
316 */ 319 */
317 if (dlen != XDR_QUADLEN(len)*4) 320 if (dlen < XDR_QUADLEN(len)*4)
318 return 0; 321 return 0;
319 322
320 rqstp->rq_vec[0].iov_base = (void*)p; 323 rqstp->rq_vec[0].iov_base = (void*)p;
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 65c62e1bfd6f..eb97f2897e2b 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -169,7 +169,7 @@ static inline char *task_state(struct task_struct *p, char *buffer)
169 ppid = pid_alive(p) ? 169 ppid = pid_alive(p) ?
170 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; 170 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
171 tpid = pid_alive(p) && p->ptrace ? 171 tpid = pid_alive(p) && p->ptrace ?
172 task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0; 172 task_pid_nr_ns(rcu_dereference(p->parent), ns) : 0;
173 buffer += sprintf(buffer, 173 buffer += sprintf(buffer,
174 "State:\t%s\n" 174 "State:\t%s\n"
175 "Tgid:\t%d\n" 175 "Tgid:\t%d\n"
@@ -464,8 +464,8 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
464 } 464 }
465 465
466 sid = task_session_nr_ns(task, ns); 466 sid = task_session_nr_ns(task, ns);
467 ppid = task_tgid_nr_ns(task->real_parent, ns);
467 pgid = task_pgrp_nr_ns(task, ns); 468 pgid = task_pgrp_nr_ns(task, ns);
468 ppid = task_ppid_nr_ns(task, ns);
469 469
470 unlock_task_sighand(task, &flags); 470 unlock_task_sighand(task, &flags);
471 } 471 }
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 4847eb83fc18..21a1c2b1c5fc 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -261,9 +261,9 @@ xfs_file_readdir(
261#else 261#else
262 262
263struct hack_dirent { 263struct hack_dirent {
264 int namlen;
265 loff_t offset;
266 u64 ino; 264 u64 ino;
265 loff_t offset;
266 int namlen;
267 unsigned int d_type; 267 unsigned int d_type;
268 char name[]; 268 char name[];
269}; 269};
@@ -285,8 +285,10 @@ xfs_hack_filldir(
285{ 285{
286 struct hack_callback *buf = __buf; 286 struct hack_callback *buf = __buf;
287 struct hack_dirent *de = (struct hack_dirent *)(buf->dirent + buf->used); 287 struct hack_dirent *de = (struct hack_dirent *)(buf->dirent + buf->used);
288 unsigned int reclen;
288 289
289 if (buf->used + sizeof(struct hack_dirent) + namlen > buf->len) 290 reclen = ALIGN(sizeof(struct hack_dirent) + namlen, sizeof(u64));
291 if (buf->used + reclen > buf->len)
290 return -EINVAL; 292 return -EINVAL;
291 293
292 de->namlen = namlen; 294 de->namlen = namlen;
@@ -294,7 +296,7 @@ xfs_hack_filldir(
294 de->ino = ino; 296 de->ino = ino;
295 de->d_type = d_type; 297 de->d_type = d_type;
296 memcpy(de->name, name, namlen); 298 memcpy(de->name, name, namlen);
297 buf->used += sizeof(struct hack_dirent) + namlen; 299 buf->used += reclen;
298 return 0; 300 return 0;
299} 301}
300 302
@@ -334,7 +336,8 @@ xfs_file_readdir(
334 offset = filp->f_pos; 336 offset = filp->f_pos;
335 337
336 while (!eof) { 338 while (!eof) {
337 int reclen; 339 unsigned int reclen;
340
338 start_offset = offset; 341 start_offset = offset;
339 342
340 buf.used = 0; 343 buf.used = 0;
@@ -355,7 +358,8 @@ xfs_file_readdir(
355 goto done; 358 goto done;
356 } 359 }
357 360
358 reclen = sizeof(struct hack_dirent) + de->namlen; 361 reclen = ALIGN(sizeof(struct hack_dirent) + de->namlen,
362 sizeof(u64));
359 size -= reclen; 363 size -= reclen;
360 de = (struct hack_dirent *)((char *)de + reclen); 364 de = (struct hack_dirent *)((char *)de + reclen);
361 curr_offset = de->offset /* & 0x7fffffff */; 365 curr_offset = de->offset /* & 0x7fffffff */;
diff --git a/include/asm-arm/arch-pxa/hardware.h b/include/asm-arm/arch-pxa/hardware.h
index ab2d963e742a..e25558faa5a4 100644
--- a/include/asm-arm/arch-pxa/hardware.h
+++ b/include/asm-arm/arch-pxa/hardware.h
@@ -121,38 +121,32 @@
121 121
122#define cpu_is_pxa21x() \ 122#define cpu_is_pxa21x() \
123 ({ \ 123 ({ \
124 unsigned int id = read_cpuid(CPUID_ID); \ 124 __cpu_is_pxa21x(read_cpuid_id()); \
125 __cpu_is_pxa21x(id); \
126 }) 125 })
127 126
128#define cpu_is_pxa25x() \ 127#define cpu_is_pxa25x() \
129 ({ \ 128 ({ \
130 unsigned int id = read_cpuid(CPUID_ID); \ 129 __cpu_is_pxa25x(read_cpuid_id()); \
131 __cpu_is_pxa25x(id); \
132 }) 130 })
133 131
134#define cpu_is_pxa27x() \ 132#define cpu_is_pxa27x() \
135 ({ \ 133 ({ \
136 unsigned int id = read_cpuid(CPUID_ID); \ 134 __cpu_is_pxa27x(read_cpuid_id()); \
137 __cpu_is_pxa27x(id); \
138 }) 135 })
139 136
140#define cpu_is_pxa300() \ 137#define cpu_is_pxa300() \
141 ({ \ 138 ({ \
142 unsigned int id = read_cpuid(CPUID_ID); \ 139 __cpu_is_pxa300(read_cpuid_id()); \
143 __cpu_is_pxa300(id); \
144 }) 140 })
145 141
146#define cpu_is_pxa310() \ 142#define cpu_is_pxa310() \
147 ({ \ 143 ({ \
148 unsigned int id = read_cpuid(CPUID_ID); \ 144 __cpu_is_pxa310(read_cpuid_id()); \
149 __cpu_is_pxa310(id); \
150 }) 145 })
151 146
152#define cpu_is_pxa320() \ 147#define cpu_is_pxa320() \
153 ({ \ 148 ({ \
154 unsigned int id = read_cpuid(CPUID_ID); \ 149 __cpu_is_pxa320(read_cpuid_id()); \
155 __cpu_is_pxa320(id); \
156 }) 150 })
157 151
158/* 152/*
@@ -174,14 +168,12 @@
174 168
175#define cpu_is_pxa2xx() \ 169#define cpu_is_pxa2xx() \
176 ({ \ 170 ({ \
177 unsigned int id = read_cpuid(CPUID_ID); \ 171 __cpu_is_pxa2xx(read_cpuid_id()); \
178 __cpu_is_pxa2xx(id); \
179 }) 172 })
180 173
181#define cpu_is_pxa3xx() \ 174#define cpu_is_pxa3xx() \
182 ({ \ 175 ({ \
183 unsigned int id = read_cpuid(CPUID_ID); \ 176 __cpu_is_pxa3xx(read_cpuid_id()); \
184 __cpu_is_pxa3xx(id); \
185 }) 177 })
186 178
187/* 179/*
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 94ea8c6dc1a4..28425c473e71 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -75,8 +75,21 @@
75#ifndef __ASSEMBLY__ 75#ifndef __ASSEMBLY__
76 76
77#include <linux/linkage.h> 77#include <linux/linkage.h>
78#include <linux/stringify.h>
78#include <linux/irqflags.h> 79#include <linux/irqflags.h>
79 80
81/*
82 * The CPU ID never changes at run time, so we might as well tell the
83 * compiler that it's constant. Use this function to read the CPU ID
84 * rather than directly reading processor_id or read_cpuid() directly.
85 */
86static inline unsigned int read_cpuid_id(void) __attribute_const__;
87
88static inline unsigned int read_cpuid_id(void)
89{
90 return read_cpuid(CPUID_ID);
91}
92
80#define __exception __attribute__((section(".exception.text"))) 93#define __exception __attribute__((section(".exception.text")))
81 94
82struct thread_info; 95struct thread_info;
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
index 6f2d924f4fd6..bd57a7949170 100644
--- a/include/asm-cris/unistd.h
+++ b/include/asm-cris/unistd.h
@@ -358,6 +358,7 @@
358#define __ARCH_WANT_SYS_SIGPENDING 358#define __ARCH_WANT_SYS_SIGPENDING
359#define __ARCH_WANT_SYS_SIGPROCMASK 359#define __ARCH_WANT_SYS_SIGPROCMASK
360#define __ARCH_WANT_SYS_RT_SIGACTION 360#define __ARCH_WANT_SYS_RT_SIGACTION
361#define __ARCH_WANT_SYS_RT_SIGSUSPEND
361 362
362/* 363/*
363 * "Conditional" syscalls 364 * "Conditional" syscalls
diff --git a/include/asm-mips/cacheops.h b/include/asm-mips/cacheops.h
index df7f2deb3b56..256ad2cc6eb8 100644
--- a/include/asm-mips/cacheops.h
+++ b/include/asm-mips/cacheops.h
@@ -64,7 +64,7 @@
64#define Page_Invalidate_T 0x16 64#define Page_Invalidate_T 0x16
65 65
66/* 66/*
67 * R1000-specific cacheops 67 * R10000-specific cacheops
68 * 68 *
69 * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused. 69 * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused.
70 * Most of the _S cacheops are identical to the R4000SC _SD cacheops. 70 * Most of the _S cacheops are identical to the R4000SC _SD cacheops.
diff --git a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h
index 9d528ada3c14..e034c3604111 100644
--- a/include/asm-sh/cacheflush.h
+++ b/include/asm-sh/cacheflush.h
@@ -43,6 +43,12 @@ extern void __flush_purge_region(void *start, int size);
43extern void __flush_invalidate_region(void *start, int size); 43extern void __flush_invalidate_region(void *start, int size);
44#endif 44#endif
45 45
46#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
47static inline void flush_kernel_dcache_page(struct page *page)
48{
49 flush_dcache_page(page);
50}
51
46#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF) 52#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
47extern void copy_to_user_page(struct vm_area_struct *vma, 53extern void copy_to_user_page(struct vm_area_struct *vma,
48 struct page *page, unsigned long vaddr, void *dst, const void *src, 54 struct page *page, unsigned long vaddr, void *dst, const void *src,
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
index f18a1a5c95c0..77c391fa93d6 100644
--- a/include/asm-sh/uaccess.h
+++ b/include/asm-sh/uaccess.h
@@ -73,38 +73,26 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
73/* 73/*
74 * __access_ok: Check if address with size is OK or not. 74 * __access_ok: Check if address with size is OK or not.
75 * 75 *
76 * We do three checks: 76 * Uhhuh, this needs 33-bit arithmetic. We have a carry..
77 * (1) is it user space?
78 * (2) addr + size --> carry?
79 * (3) addr + size >= 0x80000000 (PAGE_OFFSET)
80 * 77 *
81 * (1) (2) (3) | RESULT 78 * sum := addr + size; carry? --> flag = true;
82 * 0 0 0 | ok 79 * if (sum >= addr_limit) flag = true;
83 * 0 0 1 | ok
84 * 0 1 0 | bad
85 * 0 1 1 | bad
86 * 1 0 0 | ok
87 * 1 0 1 | bad
88 * 1 1 0 | bad
89 * 1 1 1 | bad
90 */ 80 */
91static inline int __access_ok(unsigned long addr, unsigned long size) 81static inline int __access_ok(unsigned long addr, unsigned long size)
92{ 82{
93 unsigned long flag, tmp; 83 unsigned long flag, sum;
94 84
95 __asm__("stc r7_bank, %0\n\t" 85 __asm__("clrt\n\t"
96 "mov.l @(8,%0), %0\n\t" 86 "addc %3, %1\n\t"
97 "clrt\n\t" 87 "movt %0\n\t"
98 "addc %2, %1\n\t" 88 "cmp/hi %4, %1\n\t"
99 "and %1, %0\n\t" 89 "rotcl %0"
100 "rotcl %0\n\t" 90 :"=&r" (flag), "=r" (sum)
101 "rotcl %0\n\t" 91 :"1" (addr), "r" (size),
102 "and #3, %0" 92 "r" (current_thread_info()->addr_limit.seg)
103 : "=&z" (flag), "=r" (tmp) 93 :"t");
104 : "r" (addr), "1" (size)
105 : "t");
106
107 return flag == 0; 94 return flag == 0;
95
108} 96}
109#endif /* CONFIG_MMU */ 97#endif /* CONFIG_MMU */
110 98
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 88c81403eb3f..e18017d45758 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -23,6 +23,10 @@
23#ifndef LINUX_I2C_ID_H 23#ifndef LINUX_I2C_ID_H
24#define LINUX_I2C_ID_H 24#define LINUX_I2C_ID_H
25 25
26/* Please note that I2C driver IDs are optional. They are only needed if a
27 legacy chip driver needs to identify a bus or a bus driver needs to
28 identify a legacy client. If you don't need them, just don't set them. */
29
26/* 30/*
27 * ---- Driver types ----------------------------------------------------- 31 * ---- Driver types -----------------------------------------------------
28 */ 32 */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 023656d2f1da..7f2215139e9a 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2322,6 +2322,8 @@
2322#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914 2322#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914
2323#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919 2323#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919
2324#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 2324#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930
2325#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916
2326#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918
2325#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2327#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2326#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2328#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2327#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 2329#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 09a309b7b5d2..b78e0295adf4 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -246,6 +246,15 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
246 device_set_wakeup_enable(dev,val); \ 246 device_set_wakeup_enable(dev,val); \
247 } while(0) 247 } while(0)
248 248
249/*
250 * Global Power Management flags
251 * Used to keep APM and ACPI from both being active
252 */
253extern unsigned int pm_flags;
254
255#define PM_APM 1
256#define PM_ACPI 2
257
249#endif /* __KERNEL__ */ 258#endif /* __KERNEL__ */
250 259
251#endif /* _LINUX_PM_H */ 260#endif /* _LINUX_PM_H */
diff --git a/include/linux/pm_legacy.h b/include/linux/pm_legacy.h
index 514729a44688..446f4f42b952 100644
--- a/include/linux/pm_legacy.h
+++ b/include/linux/pm_legacy.h
@@ -4,10 +4,6 @@
4 4
5#ifdef CONFIG_PM_LEGACY 5#ifdef CONFIG_PM_LEGACY
6 6
7extern int pm_active;
8
9#define PM_IS_ACTIVE() (pm_active != 0)
10
11/* 7/*
12 * Register a device with power management 8 * Register a device with power management
13 */ 9 */
@@ -21,8 +17,6 @@ int __deprecated pm_send_all(pm_request_t rqst, void *data);
21 17
22#else /* CONFIG_PM_LEGACY */ 18#else /* CONFIG_PM_LEGACY */
23 19
24#define PM_IS_ACTIVE() 0
25
26static inline struct pm_dev *pm_register(pm_dev_t type, 20static inline struct pm_dev *pm_register(pm_dev_t type,
27 unsigned long id, 21 unsigned long id,
28 pm_callback callback) 22 pm_callback callback)
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 0a0426c2867d..2a6d62c7d2d1 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -13,7 +13,7 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/mod_devicetable.h> 14#include <linux/mod_devicetable.h>
15 15
16#define PNP_MAX_PORT 24 16#define PNP_MAX_PORT 40
17#define PNP_MAX_MEM 12 17#define PNP_MAX_MEM 12
18#define PNP_MAX_IRQ 2 18#define PNP_MAX_IRQ 2
19#define PNP_MAX_DMA 2 19#define PNP_MAX_DMA 2
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 416e000dfe81..e3ff21dbac53 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -191,8 +191,8 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
191 /* 191 /*
192 * offset and length are unused for chain entry. Clear them. 192 * offset and length are unused for chain entry. Clear them.
193 */ 193 */
194 prv->offset = 0; 194 prv[prv_nents - 1].offset = 0;
195 prv->length = 0; 195 prv[prv_nents - 1].length = 0;
196 196
197 /* 197 /*
198 * Set lowest bit to indicate a link pointer, and make sure to clear 198 * Set lowest bit to indicate a link pointer, and make sure to clear
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ac3d496fbd20..cc14656f8682 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1255,13 +1255,6 @@ struct pid_namespace;
1255 * 1255 *
1256 * set_task_vxid() : assigns a virtual id to a task; 1256 * set_task_vxid() : assigns a virtual id to a task;
1257 * 1257 *
1258 * task_ppid_nr_ns() : the parent's id as seen from the namespace specified.
1259 * the result depends on the namespace and whether the
1260 * task in question is the namespace's init. e.g. for the
1261 * namespace's init this will return 0 when called from
1262 * the namespace of this init, or appropriate id otherwise.
1263 *
1264 *
1265 * see also pid_nr() etc in include/linux/pid.h 1258 * see also pid_nr() etc in include/linux/pid.h
1266 */ 1259 */
1267 1260
@@ -1317,12 +1310,6 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)
1317} 1310}
1318 1311
1319 1312
1320static inline pid_t task_ppid_nr_ns(struct task_struct *tsk,
1321 struct pid_namespace *ns)
1322{
1323 return pid_nr_ns(task_pid(rcu_dereference(tsk->real_parent)), ns);
1324}
1325
1326/** 1313/**
1327 * pid_alive - check that a task structure is not stale 1314 * pid_alive - check that a task structure is not stale
1328 * @p: Task structure to be checked. 1315 * @p: Task structure to be checked.
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index bef7d66601cb..c6148bbf1250 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -62,7 +62,6 @@ struct writeback_control {
62 unsigned for_reclaim:1; /* Invoked from the page allocator */ 62 unsigned for_reclaim:1; /* Invoked from the page allocator */
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65 unsigned more_io:1; /* more io to be dispatched */
66}; 65};
67 66
68/* 67/*
diff --git a/kernel/module.c b/kernel/module.c
index 91fe6958b6e1..c2e3e2e98801 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2214,29 +2214,34 @@ static const char *get_ksymbol(struct module *mod,
2214/* For kallsyms to ask for address resolution. NULL means not found. 2214/* For kallsyms to ask for address resolution. NULL means not found.
2215 We don't lock, as this is used for oops resolution and races are a 2215 We don't lock, as this is used for oops resolution and races are a
2216 lesser concern. */ 2216 lesser concern. */
2217/* FIXME: Risky: returns a pointer into a module w/o lock */
2217const char *module_address_lookup(unsigned long addr, 2218const char *module_address_lookup(unsigned long addr,
2218 unsigned long *size, 2219 unsigned long *size,
2219 unsigned long *offset, 2220 unsigned long *offset,
2220 char **modname) 2221 char **modname)
2221{ 2222{
2222 struct module *mod; 2223 struct module *mod;
2224 const char *ret = NULL;
2223 2225
2226 preempt_disable();
2224 list_for_each_entry(mod, &modules, list) { 2227 list_for_each_entry(mod, &modules, list) {
2225 if (within(addr, mod->module_init, mod->init_size) 2228 if (within(addr, mod->module_init, mod->init_size)
2226 || within(addr, mod->module_core, mod->core_size)) { 2229 || within(addr, mod->module_core, mod->core_size)) {
2227 if (modname) 2230 if (modname)
2228 *modname = mod->name; 2231 *modname = mod->name;
2229 return get_ksymbol(mod, addr, size, offset); 2232 ret = get_ksymbol(mod, addr, size, offset);
2233 break;
2230 } 2234 }
2231 } 2235 }
2232 return NULL; 2236 preempt_enable();
2237 return ret;
2233} 2238}
2234 2239
2235int lookup_module_symbol_name(unsigned long addr, char *symname) 2240int lookup_module_symbol_name(unsigned long addr, char *symname)
2236{ 2241{
2237 struct module *mod; 2242 struct module *mod;
2238 2243
2239 mutex_lock(&module_mutex); 2244 preempt_disable();
2240 list_for_each_entry(mod, &modules, list) { 2245 list_for_each_entry(mod, &modules, list) {
2241 if (within(addr, mod->module_init, mod->init_size) || 2246 if (within(addr, mod->module_init, mod->init_size) ||
2242 within(addr, mod->module_core, mod->core_size)) { 2247 within(addr, mod->module_core, mod->core_size)) {
@@ -2246,12 +2251,12 @@ int lookup_module_symbol_name(unsigned long addr, char *symname)
2246 if (!sym) 2251 if (!sym)
2247 goto out; 2252 goto out;
2248 strlcpy(symname, sym, KSYM_NAME_LEN); 2253 strlcpy(symname, sym, KSYM_NAME_LEN);
2249 mutex_unlock(&module_mutex); 2254 preempt_enable();
2250 return 0; 2255 return 0;
2251 } 2256 }
2252 } 2257 }
2253out: 2258out:
2254 mutex_unlock(&module_mutex); 2259 preempt_enable();
2255 return -ERANGE; 2260 return -ERANGE;
2256} 2261}
2257 2262
@@ -2260,7 +2265,7 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
2260{ 2265{
2261 struct module *mod; 2266 struct module *mod;
2262 2267
2263 mutex_lock(&module_mutex); 2268 preempt_disable();
2264 list_for_each_entry(mod, &modules, list) { 2269 list_for_each_entry(mod, &modules, list) {
2265 if (within(addr, mod->module_init, mod->init_size) || 2270 if (within(addr, mod->module_init, mod->init_size) ||
2266 within(addr, mod->module_core, mod->core_size)) { 2271 within(addr, mod->module_core, mod->core_size)) {
@@ -2273,12 +2278,12 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
2273 strlcpy(modname, mod->name, MODULE_NAME_LEN); 2278 strlcpy(modname, mod->name, MODULE_NAME_LEN);
2274 if (name) 2279 if (name)
2275 strlcpy(name, sym, KSYM_NAME_LEN); 2280 strlcpy(name, sym, KSYM_NAME_LEN);
2276 mutex_unlock(&module_mutex); 2281 preempt_enable();
2277 return 0; 2282 return 0;
2278 } 2283 }
2279 } 2284 }
2280out: 2285out:
2281 mutex_unlock(&module_mutex); 2286 preempt_enable();
2282 return -ERANGE; 2287 return -ERANGE;
2283} 2288}
2284 2289
@@ -2287,7 +2292,7 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
2287{ 2292{
2288 struct module *mod; 2293 struct module *mod;
2289 2294
2290 mutex_lock(&module_mutex); 2295 preempt_disable();
2291 list_for_each_entry(mod, &modules, list) { 2296 list_for_each_entry(mod, &modules, list) {
2292 if (symnum < mod->num_symtab) { 2297 if (symnum < mod->num_symtab) {
2293 *value = mod->symtab[symnum].st_value; 2298 *value = mod->symtab[symnum].st_value;
@@ -2296,12 +2301,12 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
2296 KSYM_NAME_LEN); 2301 KSYM_NAME_LEN);
2297 strlcpy(module_name, mod->name, MODULE_NAME_LEN); 2302 strlcpy(module_name, mod->name, MODULE_NAME_LEN);
2298 *exported = is_exported(name, mod); 2303 *exported = is_exported(name, mod);
2299 mutex_unlock(&module_mutex); 2304 preempt_enable();
2300 return 0; 2305 return 0;
2301 } 2306 }
2302 symnum -= mod->num_symtab; 2307 symnum -= mod->num_symtab;
2303 } 2308 }
2304 mutex_unlock(&module_mutex); 2309 preempt_enable();
2305 return -ERANGE; 2310 return -ERANGE;
2306} 2311}
2307 2312
@@ -2324,6 +2329,7 @@ unsigned long module_kallsyms_lookup_name(const char *name)
2324 unsigned long ret = 0; 2329 unsigned long ret = 0;
2325 2330
2326 /* Don't lock: we're in enough trouble already. */ 2331 /* Don't lock: we're in enough trouble already. */
2332 preempt_disable();
2327 if ((colon = strchr(name, ':')) != NULL) { 2333 if ((colon = strchr(name, ':')) != NULL) {
2328 *colon = '\0'; 2334 *colon = '\0';
2329 if ((mod = find_module(name)) != NULL) 2335 if ((mod = find_module(name)) != NULL)
@@ -2334,6 +2340,7 @@ unsigned long module_kallsyms_lookup_name(const char *name)
2334 if ((ret = mod_find_symname(mod, name)) != 0) 2340 if ((ret = mod_find_symname(mod, name)) != 0)
2335 break; 2341 break;
2336 } 2342 }
2343 preempt_enable();
2337 return ret; 2344 return ret;
2338} 2345}
2339#endif /* CONFIG_KALLSYMS */ 2346#endif /* CONFIG_KALLSYMS */
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 3cdf95b1dc92..f71c9504a5c5 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -28,6 +28,9 @@ BLOCKING_NOTIFIER_HEAD(pm_chain_head);
28 28
29DEFINE_MUTEX(pm_mutex); 29DEFINE_MUTEX(pm_mutex);
30 30
31unsigned int pm_flags;
32EXPORT_SYMBOL(pm_flags);
33
31#ifdef CONFIG_SUSPEND 34#ifdef CONFIG_SUSPEND
32 35
33/* This is just an arbitrary number */ 36/* This is just an arbitrary number */
diff --git a/kernel/power/pm.c b/kernel/power/pm.c
index c50d15266c10..60c73fa670d5 100644
--- a/kernel/power/pm.c
+++ b/kernel/power/pm.c
@@ -27,8 +27,6 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/mutex.h> 28#include <linux/mutex.h>
29 29
30int pm_active;
31
32/* 30/*
33 * Locking notes: 31 * Locking notes:
34 * pm_devs_lock can be a semaphore providing pm ops are not called 32 * pm_devs_lock can be a semaphore providing pm ops are not called
@@ -204,6 +202,4 @@ int pm_send_all(pm_request_t rqst, void *data)
204 202
205EXPORT_SYMBOL(pm_register); 203EXPORT_SYMBOL(pm_register);
206EXPORT_SYMBOL(pm_send_all); 204EXPORT_SYMBOL(pm_send_all);
207EXPORT_SYMBOL(pm_active);
208
209 205
diff --git a/kernel/timer.c b/kernel/timer.c
index d4527dcef1af..26671f4db07f 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -978,7 +978,7 @@ asmlinkage long sys_getppid(void)
978 int pid; 978 int pid;
979 979
980 rcu_read_lock(); 980 rcu_read_lock();
981 pid = task_ppid_nr_ns(current, current->nsproxy->pid_ns); 981 pid = task_tgid_nr_ns(current->real_parent, current->nsproxy->pid_ns);
982 rcu_read_unlock(); 982 rcu_read_unlock();
983 983
984 return pid; 984 return pid;
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 7224a4f07106..e0fda156f021 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -418,9 +418,14 @@ static struct page *alloc_huge_page_private(struct vm_area_struct *vma,
418 if (free_huge_pages > resv_huge_pages) 418 if (free_huge_pages > resv_huge_pages)
419 page = dequeue_huge_page(vma, addr); 419 page = dequeue_huge_page(vma, addr);
420 spin_unlock(&hugetlb_lock); 420 spin_unlock(&hugetlb_lock);
421 if (!page) 421 if (!page) {
422 page = alloc_buddy_huge_page(vma, addr); 422 page = alloc_buddy_huge_page(vma, addr);
423 return page ? page : ERR_PTR(-VM_FAULT_OOM); 423 if (!page) {
424 hugetlb_put_quota(vma->vm_file->f_mapping, 1);
425 return ERR_PTR(-VM_FAULT_OOM);
426 }
427 }
428 return page;
424} 429}
425 430
426static struct page *alloc_huge_page(struct vm_area_struct *vma, 431static struct page *alloc_huge_page(struct vm_area_struct *vma,
@@ -1206,8 +1211,10 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to)
1206 if (hugetlb_get_quota(inode->i_mapping, chg)) 1211 if (hugetlb_get_quota(inode->i_mapping, chg))
1207 return -ENOSPC; 1212 return -ENOSPC;
1208 ret = hugetlb_acct_memory(chg); 1213 ret = hugetlb_acct_memory(chg);
1209 if (ret < 0) 1214 if (ret < 0) {
1215 hugetlb_put_quota(inode->i_mapping, chg);
1210 return ret; 1216 return ret;
1217 }
1211 region_add(&inode->i_mapping->private_list, from, to); 1218 region_add(&inode->i_mapping->private_list, from, to);
1212 return 0; 1219 return 0;
1213} 1220}
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index d55cfcae2ef1..3d3848fa6324 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -558,7 +558,6 @@ static void background_writeout(unsigned long _min_pages)
558 global_page_state(NR_UNSTABLE_NFS) < background_thresh 558 global_page_state(NR_UNSTABLE_NFS) < background_thresh
559 && min_pages <= 0) 559 && min_pages <= 0)
560 break; 560 break;
561 wbc.more_io = 0;
562 wbc.encountered_congestion = 0; 561 wbc.encountered_congestion = 0;
563 wbc.nr_to_write = MAX_WRITEBACK_PAGES; 562 wbc.nr_to_write = MAX_WRITEBACK_PAGES;
564 wbc.pages_skipped = 0; 563 wbc.pages_skipped = 0;
@@ -566,9 +565,8 @@ static void background_writeout(unsigned long _min_pages)
566 min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write; 565 min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
567 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) { 566 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) {
568 /* Wrote less than expected */ 567 /* Wrote less than expected */
569 if (wbc.encountered_congestion || wbc.more_io) 568 congestion_wait(WRITE, HZ/10);
570 congestion_wait(WRITE, HZ/10); 569 if (!wbc.encountered_congestion)
571 else
572 break; 570 break;
573 } 571 }
574 } 572 }
@@ -633,12 +631,11 @@ static void wb_kupdate(unsigned long arg)
633 global_page_state(NR_UNSTABLE_NFS) + 631 global_page_state(NR_UNSTABLE_NFS) +
634 (inodes_stat.nr_inodes - inodes_stat.nr_unused); 632 (inodes_stat.nr_inodes - inodes_stat.nr_unused);
635 while (nr_to_write > 0) { 633 while (nr_to_write > 0) {
636 wbc.more_io = 0;
637 wbc.encountered_congestion = 0; 634 wbc.encountered_congestion = 0;
638 wbc.nr_to_write = MAX_WRITEBACK_PAGES; 635 wbc.nr_to_write = MAX_WRITEBACK_PAGES;
639 writeback_inodes(&wbc); 636 writeback_inodes(&wbc);
640 if (wbc.nr_to_write > 0) { 637 if (wbc.nr_to_write > 0) {
641 if (wbc.encountered_congestion || wbc.more_io) 638 if (wbc.encountered_congestion)
642 congestion_wait(WRITE, HZ/10); 639 congestion_wait(WRITE, HZ/10);
643 else 640 else
644 break; /* All the old data is written */ 641 break; /* All the old data is written */
diff --git a/mm/quicklist.c b/mm/quicklist.c
index ae8189c2799e..3f703f7cb398 100644
--- a/mm/quicklist.c
+++ b/mm/quicklist.c
@@ -26,9 +26,17 @@ DEFINE_PER_CPU(struct quicklist, quicklist)[CONFIG_NR_QUICK];
26static unsigned long max_pages(unsigned long min_pages) 26static unsigned long max_pages(unsigned long min_pages)
27{ 27{
28 unsigned long node_free_pages, max; 28 unsigned long node_free_pages, max;
29 struct zone *zones = NODE_DATA(numa_node_id())->node_zones;
30
31 node_free_pages =
32#ifdef CONFIG_ZONE_DMA
33 zone_page_state(&zones[ZONE_DMA], NR_FREE_PAGES) +
34#endif
35#ifdef CONFIG_ZONE_DMA32
36 zone_page_state(&zones[ZONE_DMA32], NR_FREE_PAGES) +
37#endif
38 zone_page_state(&zones[ZONE_NORMAL], NR_FREE_PAGES);
29 39
30 node_free_pages = node_page_state(numa_node_id(),
31 NR_FREE_PAGES);
32 max = node_free_pages / FRACTION_OF_NODE_MEM; 40 max = node_free_pages / FRACTION_OF_NODE_MEM;
33 return max(max, min_pages); 41 return max(max, min_pages);
34} 42}
diff --git a/sound/oss/msnd.h b/sound/oss/msnd.h
index 05cf7865be5e..d0ca582c4583 100644
--- a/sound/oss/msnd.h
+++ b/sound/oss/msnd.h
@@ -233,8 +233,8 @@ typedef struct multisound_dev {
233 spinlock_t lock; 233 spinlock_t lock;
234 int nresets; 234 int nresets;
235 unsigned long recsrc; 235 unsigned long recsrc;
236 int left_levels[16]; 236 int left_levels[32];
237 int right_levels[16]; 237 int right_levels[32];
238 int mixer_mod_count; 238 int mixer_mod_count;
239 int calibrate_signal; 239 int calibrate_signal;
240 int play_sample_size, play_sample_rate, play_channels; 240 int play_sample_size, play_sample_rate, play_channels;