aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt8
-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/philips/pnx8550/common/time.c109
-rw-r--r--arch/x86/kernel/apm_32.c10
-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/libata-eh.c24
-rw-r--r--drivers/ata/libata-pmp.c12
-rw-r--r--drivers/ata/libata-scsi.c3
-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.c37
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/crypto/padlock-aes.c4
-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/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/pci/quirks.c6
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c14
-rw-r--r--drivers/scsi/qla1280.c2
-rw-r--r--drivers/video/ps3fb.c24
-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-sh/cacheflush.h6
-rw-r--r--include/asm-sh/uaccess.h42
-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--kernel/power/main.c3
-rw-r--r--kernel/power/pm.c4
-rw-r--r--kernel/timer.c2
57 files changed, 444 insertions, 300 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/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/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/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/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/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..264ae60e3fd8 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -872,7 +872,8 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
872 872
873 ata_scsi_sdev_config(sdev); 873 ata_scsi_sdev_config(sdev);
874 874
875 sdev->manage_start_stop = 1; 875 if (dev->class == ATA_DEV_ATA)
876 sdev->manage_start_stop = 1;
876 877
877 if (dev) 878 if (dev)
878 ata_scsi_dev_config(sdev, dev); 879 ata_scsi_dev_config(sdev, dev);
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..b4c674d83769 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -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;
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/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/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/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/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/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/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/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..810eb8fd6500 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"
@@ -426,6 +426,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
426 cgtime = gtime = cputime_zero; 426 cgtime = gtime = cputime_zero;
427 427
428 rcu_read_lock(); 428 rcu_read_lock();
429 ppid = task_tgid_nr_ns(task->real_parent, ns);
429 if (lock_task_sighand(task, &flags)) { 430 if (lock_task_sighand(task, &flags)) {
430 struct signal_struct *sig = task->signal; 431 struct signal_struct *sig = task->signal;
431 432
@@ -465,7 +466,6 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
465 466
466 sid = task_session_nr_ns(task, ns); 467 sid = task_session_nr_ns(task, 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-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/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/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;