diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-12-01 01:54:02 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-12-01 01:54:02 -0500 |
commit | e538af42e416ac17368593370f7e1f5a71d55197 (patch) | |
tree | 507b90ccb700de4f564cc1a2def19658fe054a0c | |
parent | 2226340eb8df9c42f9fca74582d08d5117fc0cec (diff) | |
parent | 5666c0947ede0432ba5148570aa66ffb9febff5b (diff) |
Merge branch 'master'
112 files changed, 1134 insertions, 645 deletions
diff --git a/Documentation/usb/error-codes.txt b/Documentation/usb/error-codes.txt index 1e36f1661cd0..867f4c38f356 100644 --- a/Documentation/usb/error-codes.txt +++ b/Documentation/usb/error-codes.txt | |||
@@ -46,8 +46,9 @@ USB-specific: | |||
46 | 46 | ||
47 | -EMSGSIZE (a) endpoint maxpacket size is zero; it is not usable | 47 | -EMSGSIZE (a) endpoint maxpacket size is zero; it is not usable |
48 | in the current interface altsetting. | 48 | in the current interface altsetting. |
49 | (b) ISO packet is biger than endpoint maxpacket | 49 | (b) ISO packet is larger than the endpoint maxpacket. |
50 | (c) requested data transfer size is invalid (negative) | 50 | (c) requested data transfer length is invalid: negative |
51 | or too large for the host controller. | ||
51 | 52 | ||
52 | -ENOSPC This request would overcommit the usb bandwidth reserved | 53 | -ENOSPC This request would overcommit the usb bandwidth reserved |
53 | for periodic transfers (interrupt, isochronous). | 54 | for periodic transfers (interrupt, isochronous). |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 15 | 3 | SUBLEVEL = 15 |
4 | EXTRAVERSION =-rc3 | 4 | EXTRAVERSION =-rc4 |
5 | NAME=Affluent Albatross | 5 | NAME=Affluent Albatross |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index cc5d7ac5b2e7..22c8675c79f4 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c | |||
@@ -2009,7 +2009,7 @@ static void ack_edge_ioapic_vector(unsigned int vector) | |||
2009 | { | 2009 | { |
2010 | int irq = vector_to_irq(vector); | 2010 | int irq = vector_to_irq(vector); |
2011 | 2011 | ||
2012 | move_irq(vector); | 2012 | move_native_irq(vector); |
2013 | ack_edge_ioapic_irq(irq); | 2013 | ack_edge_ioapic_irq(irq); |
2014 | } | 2014 | } |
2015 | 2015 | ||
@@ -2024,7 +2024,7 @@ static void end_level_ioapic_vector (unsigned int vector) | |||
2024 | { | 2024 | { |
2025 | int irq = vector_to_irq(vector); | 2025 | int irq = vector_to_irq(vector); |
2026 | 2026 | ||
2027 | move_irq(vector); | 2027 | move_native_irq(vector); |
2028 | end_level_ioapic_irq(irq); | 2028 | end_level_ioapic_irq(irq); |
2029 | } | 2029 | } |
2030 | 2030 | ||
diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c index 350ea6680f63..2afe0f8d555a 100644 --- a/arch/i386/kernel/reboot.c +++ b/arch/i386/kernel/reboot.c | |||
@@ -111,6 +111,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
111 | DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2400"), | 111 | DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2400"), |
112 | }, | 112 | }, |
113 | }, | 113 | }, |
114 | { /* Handle problems with rebooting on HP nc6120 */ | ||
115 | .callback = set_bios_reboot, | ||
116 | .ident = "HP Compaq nc6120", | ||
117 | .matches = { | ||
118 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
119 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nc6120"), | ||
120 | }, | ||
121 | }, | ||
114 | { } | 122 | { } |
115 | }; | 123 | }; |
116 | 124 | ||
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c index 01572814abe4..5db9d3bcbbcb 100644 --- a/arch/ia64/kernel/ia64_ksyms.c +++ b/arch/ia64/kernel/ia64_ksyms.c | |||
@@ -42,6 +42,7 @@ EXPORT_SYMBOL(clear_page); | |||
42 | 42 | ||
43 | #ifdef CONFIG_VIRTUAL_MEM_MAP | 43 | #ifdef CONFIG_VIRTUAL_MEM_MAP |
44 | #include <linux/bootmem.h> | 44 | #include <linux/bootmem.h> |
45 | EXPORT_SYMBOL(min_low_pfn); /* defined by bootmem.c, but not exported by generic code */ | ||
45 | EXPORT_SYMBOL(max_low_pfn); /* defined by bootmem.c, but not exported by generic code */ | 46 | EXPORT_SYMBOL(max_low_pfn); /* defined by bootmem.c, but not exported by generic code */ |
46 | #endif | 47 | #endif |
47 | 48 | ||
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 801eeaeaf3de..2895d6e6062f 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c | |||
@@ -740,7 +740,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, | |||
740 | switch(val) { | 740 | switch(val) { |
741 | case DIE_BREAK: | 741 | case DIE_BREAK: |
742 | /* err is break number from ia64_bad_break() */ | 742 | /* err is break number from ia64_bad_break() */ |
743 | if (args->err == 0x80200 || args->err == 0x80300) | 743 | if (args->err == 0x80200 || args->err == 0x80300 || args->err == 0) |
744 | if (pre_kprobes_handler(args)) | 744 | if (pre_kprobes_handler(args)) |
745 | ret = NOTIFY_STOP; | 745 | ret = NOTIFY_STOP; |
746 | break; | 746 | break; |
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index fba5fdd1f968..d3e0ecb56d62 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c | |||
@@ -132,24 +132,6 @@ __kprobes ia64_bad_break (unsigned long break_num, struct pt_regs *regs) | |||
132 | siginfo_t siginfo; | 132 | siginfo_t siginfo; |
133 | int sig, code; | 133 | int sig, code; |
134 | 134 | ||
135 | /* break.b always sets cr.iim to 0, which causes problems for | ||
136 | * debuggers. Get the real break number from the original instruction, | ||
137 | * but only for kernel code. User space break.b is left alone, to | ||
138 | * preserve the existing behaviour. All break codings have the same | ||
139 | * format, so there is no need to check the slot type. | ||
140 | */ | ||
141 | if (break_num == 0 && !user_mode(regs)) { | ||
142 | struct ia64_psr *ipsr = ia64_psr(regs); | ||
143 | unsigned long *bundle = (unsigned long *)regs->cr_iip; | ||
144 | unsigned long slot; | ||
145 | switch (ipsr->ri) { | ||
146 | case 0: slot = (bundle[0] >> 5); break; | ||
147 | case 1: slot = (bundle[0] >> 46) | (bundle[1] << 18); break; | ||
148 | default: slot = (bundle[1] >> 23); break; | ||
149 | } | ||
150 | break_num = ((slot >> 36 & 1) << 20) | (slot >> 6 & 0xfffff); | ||
151 | } | ||
152 | |||
153 | /* SIGILL, SIGFPE, SIGSEGV, and SIGBUS want these field initialized: */ | 135 | /* SIGILL, SIGFPE, SIGSEGV, and SIGBUS want these field initialized: */ |
154 | siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri); | 136 | siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri); |
155 | siginfo.si_imm = break_num; | 137 | siginfo.si_imm = break_num; |
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index af4d1bc9a2eb..94db25708456 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -163,15 +163,13 @@ EXPORT_SYMBOL(giveup_altivec); | |||
163 | EXPORT_SYMBOL(giveup_spe); | 163 | EXPORT_SYMBOL(giveup_spe); |
164 | #endif /* CONFIG_SPE */ | 164 | #endif /* CONFIG_SPE */ |
165 | 165 | ||
166 | #ifdef CONFIG_PPC64 | 166 | #ifndef CONFIG_PPC64 |
167 | EXPORT_SYMBOL(__flush_icache_range); | ||
168 | #else | ||
169 | EXPORT_SYMBOL(flush_instruction_cache); | 167 | EXPORT_SYMBOL(flush_instruction_cache); |
170 | EXPORT_SYMBOL(flush_icache_range); | ||
171 | EXPORT_SYMBOL(flush_tlb_kernel_range); | 168 | EXPORT_SYMBOL(flush_tlb_kernel_range); |
172 | EXPORT_SYMBOL(flush_tlb_page); | 169 | EXPORT_SYMBOL(flush_tlb_page); |
173 | EXPORT_SYMBOL(_tlbie); | 170 | EXPORT_SYMBOL(_tlbie); |
174 | #endif | 171 | #endif |
172 | EXPORT_SYMBOL(__flush_icache_range); | ||
175 | EXPORT_SYMBOL(flush_dcache_range); | 173 | EXPORT_SYMBOL(flush_dcache_range); |
176 | 174 | ||
177 | #ifdef CONFIG_SMP | 175 | #ifdef CONFIG_SMP |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index a5a7542a8ff3..105d5609ff57 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -201,6 +201,28 @@ int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs) | |||
201 | } | 201 | } |
202 | #endif /* CONFIG_SPE */ | 202 | #endif /* CONFIG_SPE */ |
203 | 203 | ||
204 | /* | ||
205 | * If we are doing lazy switching of CPU state (FP, altivec or SPE), | ||
206 | * and the current task has some state, discard it. | ||
207 | */ | ||
208 | static inline void discard_lazy_cpu_state(void) | ||
209 | { | ||
210 | #ifndef CONFIG_SMP | ||
211 | preempt_disable(); | ||
212 | if (last_task_used_math == current) | ||
213 | last_task_used_math = NULL; | ||
214 | #ifdef CONFIG_ALTIVEC | ||
215 | if (last_task_used_altivec == current) | ||
216 | last_task_used_altivec = NULL; | ||
217 | #endif /* CONFIG_ALTIVEC */ | ||
218 | #ifdef CONFIG_SPE | ||
219 | if (last_task_used_spe == current) | ||
220 | last_task_used_spe = NULL; | ||
221 | #endif | ||
222 | preempt_enable(); | ||
223 | #endif /* CONFIG_SMP */ | ||
224 | } | ||
225 | |||
204 | int set_dabr(unsigned long dabr) | 226 | int set_dabr(unsigned long dabr) |
205 | { | 227 | { |
206 | if (ppc_md.set_dabr) | 228 | if (ppc_md.set_dabr) |
@@ -434,19 +456,7 @@ void show_regs(struct pt_regs * regs) | |||
434 | void exit_thread(void) | 456 | void exit_thread(void) |
435 | { | 457 | { |
436 | kprobe_flush_task(current); | 458 | kprobe_flush_task(current); |
437 | 459 | discard_lazy_cpu_state(); | |
438 | #ifndef CONFIG_SMP | ||
439 | if (last_task_used_math == current) | ||
440 | last_task_used_math = NULL; | ||
441 | #ifdef CONFIG_ALTIVEC | ||
442 | if (last_task_used_altivec == current) | ||
443 | last_task_used_altivec = NULL; | ||
444 | #endif /* CONFIG_ALTIVEC */ | ||
445 | #ifdef CONFIG_SPE | ||
446 | if (last_task_used_spe == current) | ||
447 | last_task_used_spe = NULL; | ||
448 | #endif | ||
449 | #endif /* CONFIG_SMP */ | ||
450 | } | 460 | } |
451 | 461 | ||
452 | void flush_thread(void) | 462 | void flush_thread(void) |
@@ -458,18 +468,7 @@ void flush_thread(void) | |||
458 | t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT); | 468 | t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT); |
459 | #endif | 469 | #endif |
460 | 470 | ||
461 | #ifndef CONFIG_SMP | 471 | discard_lazy_cpu_state(); |
462 | if (last_task_used_math == current) | ||
463 | last_task_used_math = NULL; | ||
464 | #ifdef CONFIG_ALTIVEC | ||
465 | if (last_task_used_altivec == current) | ||
466 | last_task_used_altivec = NULL; | ||
467 | #endif /* CONFIG_ALTIVEC */ | ||
468 | #ifdef CONFIG_SPE | ||
469 | if (last_task_used_spe == current) | ||
470 | last_task_used_spe = NULL; | ||
471 | #endif | ||
472 | #endif /* CONFIG_SMP */ | ||
473 | 472 | ||
474 | #ifdef CONFIG_PPC64 /* for now */ | 473 | #ifdef CONFIG_PPC64 /* for now */ |
475 | if (current->thread.dabr) { | 474 | if (current->thread.dabr) { |
@@ -635,18 +634,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) | |||
635 | } | 634 | } |
636 | #endif | 635 | #endif |
637 | 636 | ||
638 | #ifndef CONFIG_SMP | 637 | discard_lazy_cpu_state(); |
639 | if (last_task_used_math == current) | ||
640 | last_task_used_math = NULL; | ||
641 | #ifdef CONFIG_ALTIVEC | ||
642 | if (last_task_used_altivec == current) | ||
643 | last_task_used_altivec = NULL; | ||
644 | #endif | ||
645 | #ifdef CONFIG_SPE | ||
646 | if (last_task_used_spe == current) | ||
647 | last_task_used_spe = NULL; | ||
648 | #endif | ||
649 | #endif /* CONFIG_SMP */ | ||
650 | memset(current->thread.fpr, 0, sizeof(current->thread.fpr)); | 638 | memset(current->thread.fpr, 0, sizeof(current->thread.fpr)); |
651 | current->thread.fpscr.val = 0; | 639 | current->thread.fpscr.val = 0; |
652 | #ifdef CONFIG_ALTIVEC | 640 | #ifdef CONFIG_ALTIVEC |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 4ce0105c308e..bcdc209dca85 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -265,7 +265,7 @@ static int __init call_prom_ret(const char *service, int nargs, int nret, | |||
265 | va_end(list); | 265 | va_end(list); |
266 | 266 | ||
267 | for (i = 0; i < nret; i++) | 267 | for (i = 0; i < nret; i++) |
268 | rets[nargs+i] = 0; | 268 | args.args[nargs+i] = 0; |
269 | 269 | ||
270 | if (enter_prom(&args, RELOC(prom_entry)) < 0) | 270 | if (enter_prom(&args, RELOC(prom_entry)) < 0) |
271 | return PROM_ERROR; | 271 | return PROM_ERROR; |
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index 66073f775193..bb6a5c6a64be 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c | |||
@@ -184,7 +184,7 @@ EXPORT_SYMBOL(kernel_thread); | |||
184 | 184 | ||
185 | EXPORT_SYMBOL(flush_instruction_cache); | 185 | EXPORT_SYMBOL(flush_instruction_cache); |
186 | EXPORT_SYMBOL(giveup_fpu); | 186 | EXPORT_SYMBOL(giveup_fpu); |
187 | EXPORT_SYMBOL(flush_icache_range); | 187 | EXPORT_SYMBOL(__flush_icache_range); |
188 | EXPORT_SYMBOL(flush_dcache_range); | 188 | EXPORT_SYMBOL(flush_dcache_range); |
189 | EXPORT_SYMBOL(flush_icache_user_range); | 189 | EXPORT_SYMBOL(flush_icache_user_range); |
190 | EXPORT_SYMBOL(flush_dcache_page); | 190 | EXPORT_SYMBOL(flush_dcache_page); |
diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c index cb1c7b92f8c6..25cbdc8d2941 100644 --- a/arch/ppc/kernel/process.c +++ b/arch/ppc/kernel/process.c | |||
@@ -417,6 +417,7 @@ void show_regs(struct pt_regs * regs) | |||
417 | 417 | ||
418 | void exit_thread(void) | 418 | void exit_thread(void) |
419 | { | 419 | { |
420 | preempt_disable(); | ||
420 | if (last_task_used_math == current) | 421 | if (last_task_used_math == current) |
421 | last_task_used_math = NULL; | 422 | last_task_used_math = NULL; |
422 | if (last_task_used_altivec == current) | 423 | if (last_task_used_altivec == current) |
@@ -425,10 +426,12 @@ void exit_thread(void) | |||
425 | if (last_task_used_spe == current) | 426 | if (last_task_used_spe == current) |
426 | last_task_used_spe = NULL; | 427 | last_task_used_spe = NULL; |
427 | #endif | 428 | #endif |
429 | preempt_enable(); | ||
428 | } | 430 | } |
429 | 431 | ||
430 | void flush_thread(void) | 432 | void flush_thread(void) |
431 | { | 433 | { |
434 | preempt_disable(); | ||
432 | if (last_task_used_math == current) | 435 | if (last_task_used_math == current) |
433 | last_task_used_math = NULL; | 436 | last_task_used_math = NULL; |
434 | if (last_task_used_altivec == current) | 437 | if (last_task_used_altivec == current) |
@@ -437,6 +440,7 @@ void flush_thread(void) | |||
437 | if (last_task_used_spe == current) | 440 | if (last_task_used_spe == current) |
438 | last_task_used_spe = NULL; | 441 | last_task_used_spe = NULL; |
439 | #endif | 442 | #endif |
443 | preempt_enable(); | ||
440 | } | 444 | } |
441 | 445 | ||
442 | void | 446 | void |
@@ -535,6 +539,7 @@ void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp) | |||
535 | regs->nip = nip; | 539 | regs->nip = nip; |
536 | regs->gpr[1] = sp; | 540 | regs->gpr[1] = sp; |
537 | regs->msr = MSR_USER; | 541 | regs->msr = MSR_USER; |
542 | preempt_disable(); | ||
538 | if (last_task_used_math == current) | 543 | if (last_task_used_math == current) |
539 | last_task_used_math = NULL; | 544 | last_task_used_math = NULL; |
540 | if (last_task_used_altivec == current) | 545 | if (last_task_used_altivec == current) |
@@ -543,6 +548,7 @@ void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp) | |||
543 | if (last_task_used_spe == current) | 548 | if (last_task_used_spe == current) |
544 | last_task_used_spe = NULL; | 549 | last_task_used_spe = NULL; |
545 | #endif | 550 | #endif |
551 | preempt_enable(); | ||
546 | memset(current->thread.fpr, 0, sizeof(current->thread.fpr)); | 552 | memset(current->thread.fpr, 0, sizeof(current->thread.fpr)); |
547 | current->thread.fpscr.val = 0; | 553 | current->thread.fpscr.val = 0; |
548 | #ifdef CONFIG_ALTIVEC | 554 | #ifdef CONFIG_ALTIVEC |
diff --git a/arch/sparc64/mm/generic.c b/arch/sparc64/mm/generic.c index d9396c1721cd..580b63da836b 100644 --- a/arch/sparc64/mm/generic.c +++ b/arch/sparc64/mm/generic.c | |||
@@ -77,6 +77,7 @@ static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, | |||
77 | BUG_ON(!pte_none(*pte)); | 77 | BUG_ON(!pte_none(*pte)); |
78 | set_pte_at(mm, address, pte, entry); | 78 | set_pte_at(mm, address, pte, entry); |
79 | address += PAGE_SIZE; | 79 | address += PAGE_SIZE; |
80 | pte_val(entry) += PAGE_SIZE; | ||
80 | pte++; | 81 | pte++; |
81 | } while (address < curend); | 82 | } while (address < curend); |
82 | } while (address < end); | 83 | } while (address < end); |
diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig index 489de81ea609..01a9f1cb7743 100644 --- a/drivers/atm/Kconfig +++ b/drivers/atm/Kconfig | |||
@@ -5,6 +5,13 @@ | |||
5 | menu "ATM drivers" | 5 | menu "ATM drivers" |
6 | depends on NETDEVICES && ATM | 6 | depends on NETDEVICES && ATM |
7 | 7 | ||
8 | config ATM_DUMMY | ||
9 | tristate "Dummy ATM driver" | ||
10 | depends on ATM | ||
11 | help | ||
12 | Dummy ATM driver. Useful for proxy signalling, testing, | ||
13 | and development. If unsure, say N. | ||
14 | |||
8 | config ATM_TCP | 15 | config ATM_TCP |
9 | tristate "ATM over TCP" | 16 | tristate "ATM over TCP" |
10 | depends on INET && ATM | 17 | depends on INET && ATM |
diff --git a/drivers/atm/Makefile b/drivers/atm/Makefile index 5b77188527a9..b5077ce8cb40 100644 --- a/drivers/atm/Makefile +++ b/drivers/atm/Makefile | |||
@@ -31,6 +31,7 @@ ifeq ($(CONFIG_ATM_IDT77252_USE_SUNI),y) | |||
31 | obj-$(CONFIG_ATM_IDT77252) += suni.o | 31 | obj-$(CONFIG_ATM_IDT77252) += suni.o |
32 | endif | 32 | endif |
33 | 33 | ||
34 | obj-$(CONFIG_ATM_DUMMY) += adummy.o | ||
34 | obj-$(CONFIG_ATM_TCP) += atmtcp.o | 35 | obj-$(CONFIG_ATM_TCP) += atmtcp.o |
35 | obj-$(CONFIG_ATM_FIRESTREAM) += firestream.o | 36 | obj-$(CONFIG_ATM_FIRESTREAM) += firestream.o |
36 | obj-$(CONFIG_ATM_LANAI) += lanai.o | 37 | obj-$(CONFIG_ATM_LANAI) += lanai.o |
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c new file mode 100644 index 000000000000..d15c194be44a --- /dev/null +++ b/drivers/atm/adummy.c | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | * adummy.c: a dummy ATM driver | ||
3 | */ | ||
4 | |||
5 | #include <linux/config.h> | ||
6 | #include <linux/module.h> | ||
7 | #include <linux/version.h> | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/skbuff.h> | ||
10 | #include <linux/pci.h> | ||
11 | #include <linux/errno.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/string.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/mm.h> | ||
17 | #include <linux/sched.h> | ||
18 | #include <linux/timer.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <asm/io.h> | ||
21 | #include <asm/byteorder.h> | ||
22 | #include <asm/uaccess.h> | ||
23 | |||
24 | #include <linux/atmdev.h> | ||
25 | #include <linux/atm.h> | ||
26 | #include <linux/sonet.h> | ||
27 | |||
28 | /* version definition */ | ||
29 | |||
30 | #define DRV_VERSION "1.0" | ||
31 | |||
32 | #define DEV_LABEL "adummy" | ||
33 | |||
34 | #define ADUMMY_DEV(dev) ((struct adummy_dev *) (dev)->dev_data) | ||
35 | |||
36 | struct adummy_dev { | ||
37 | struct atm_dev *atm_dev; | ||
38 | |||
39 | struct list_head entry; | ||
40 | }; | ||
41 | |||
42 | /* globals */ | ||
43 | |||
44 | static LIST_HEAD(adummy_devs); | ||
45 | |||
46 | static int __init | ||
47 | adummy_start(struct atm_dev *dev) | ||
48 | { | ||
49 | dev->ci_range.vpi_bits = 4; | ||
50 | dev->ci_range.vci_bits = 12; | ||
51 | |||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | static int | ||
56 | adummy_open(struct atm_vcc *vcc) | ||
57 | { | ||
58 | short vpi = vcc->vpi; | ||
59 | int vci = vcc->vci; | ||
60 | |||
61 | if (vci == ATM_VCI_UNSPEC || vpi == ATM_VPI_UNSPEC) | ||
62 | return 0; | ||
63 | |||
64 | set_bit(ATM_VF_ADDR, &vcc->flags); | ||
65 | set_bit(ATM_VF_READY, &vcc->flags); | ||
66 | |||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static void | ||
71 | adummy_close(struct atm_vcc *vcc) | ||
72 | { | ||
73 | clear_bit(ATM_VF_READY, &vcc->flags); | ||
74 | clear_bit(ATM_VF_ADDR, &vcc->flags); | ||
75 | } | ||
76 | |||
77 | static int | ||
78 | adummy_send(struct atm_vcc *vcc, struct sk_buff *skb) | ||
79 | { | ||
80 | if (vcc->pop) | ||
81 | vcc->pop(vcc, skb); | ||
82 | else | ||
83 | dev_kfree_skb_any(skb); | ||
84 | atomic_inc(&vcc->stats->tx); | ||
85 | |||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static int | ||
90 | adummy_proc_read(struct atm_dev *dev, loff_t *pos, char *page) | ||
91 | { | ||
92 | int left = *pos; | ||
93 | |||
94 | if (!left--) | ||
95 | return sprintf(page, "version %s\n", DRV_VERSION); | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static struct atmdev_ops adummy_ops = | ||
101 | { | ||
102 | .open = adummy_open, | ||
103 | .close = adummy_close, | ||
104 | .send = adummy_send, | ||
105 | .proc_read = adummy_proc_read, | ||
106 | .owner = THIS_MODULE | ||
107 | }; | ||
108 | |||
109 | static int __init adummy_init(void) | ||
110 | { | ||
111 | struct atm_dev *atm_dev; | ||
112 | struct adummy_dev *adummy_dev; | ||
113 | int err = 0; | ||
114 | |||
115 | printk(KERN_ERR "adummy: version %s\n", DRV_VERSION); | ||
116 | |||
117 | adummy_dev = (struct adummy_dev *) kmalloc(sizeof(struct adummy_dev), | ||
118 | GFP_KERNEL); | ||
119 | if (!adummy_dev) { | ||
120 | printk(KERN_ERR DEV_LABEL ": kmalloc() failed\n"); | ||
121 | err = -ENOMEM; | ||
122 | goto out; | ||
123 | } | ||
124 | memset(adummy_dev, 0, sizeof(struct adummy_dev)); | ||
125 | |||
126 | atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, 0); | ||
127 | if (!atm_dev) { | ||
128 | printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n"); | ||
129 | err = -ENODEV; | ||
130 | goto out_kfree; | ||
131 | } | ||
132 | |||
133 | adummy_dev->atm_dev = atm_dev; | ||
134 | atm_dev->dev_data = adummy_dev; | ||
135 | |||
136 | if (adummy_start(atm_dev)) { | ||
137 | printk(KERN_ERR DEV_LABEL ": adummy_start() failed\n"); | ||
138 | err = -ENODEV; | ||
139 | goto out_unregister; | ||
140 | } | ||
141 | |||
142 | list_add(&adummy_dev->entry, &adummy_devs); | ||
143 | out: | ||
144 | return err; | ||
145 | |||
146 | out_unregister: | ||
147 | atm_dev_deregister(atm_dev); | ||
148 | out_kfree: | ||
149 | kfree(adummy_dev); | ||
150 | goto out; | ||
151 | } | ||
152 | |||
153 | static void __exit adummy_cleanup(void) | ||
154 | { | ||
155 | struct adummy_dev *adummy_dev, *next; | ||
156 | |||
157 | list_for_each_entry_safe(adummy_dev, next, &adummy_devs, entry) { | ||
158 | atm_dev_deregister(adummy_dev->atm_dev); | ||
159 | kfree(adummy_dev); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | module_init(adummy_init); | ||
164 | module_exit(adummy_cleanup); | ||
165 | |||
166 | MODULE_AUTHOR("chas williams <chas@cmf.nrl.navy.mil>"); | ||
167 | MODULE_DESCRIPTION("dummy ATM driver"); | ||
168 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/atm/atmdev_init.c b/drivers/atm/atmdev_init.c deleted file mode 100644 index 0e09e5c28e3f..000000000000 --- a/drivers/atm/atmdev_init.c +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* drivers/atm/atmdev_init.c - ATM device driver initialization */ | ||
2 | |||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | ||
4 | |||
5 | |||
6 | #include <linux/config.h> | ||
7 | #include <linux/init.h> | ||
8 | |||
9 | |||
10 | #ifdef CONFIG_ATM_ZATM | ||
11 | extern int zatm_detect(void); | ||
12 | #endif | ||
13 | #ifdef CONFIG_ATM_AMBASSADOR | ||
14 | extern int amb_detect(void); | ||
15 | #endif | ||
16 | #ifdef CONFIG_ATM_HORIZON | ||
17 | extern int hrz_detect(void); | ||
18 | #endif | ||
19 | #ifdef CONFIG_ATM_FORE200E | ||
20 | extern int fore200e_detect(void); | ||
21 | #endif | ||
22 | #ifdef CONFIG_ATM_LANAI | ||
23 | extern int lanai_detect(void); | ||
24 | #endif | ||
25 | |||
26 | |||
27 | /* | ||
28 | * For historical reasons, atmdev_init returns the number of devices found. | ||
29 | * Note that some detections may not go via atmdev_init (e.g. eni.c), so this | ||
30 | * number is meaningless. | ||
31 | */ | ||
32 | |||
33 | int __init atmdev_init(void) | ||
34 | { | ||
35 | int devs; | ||
36 | |||
37 | devs = 0; | ||
38 | #ifdef CONFIG_ATM_ZATM | ||
39 | devs += zatm_detect(); | ||
40 | #endif | ||
41 | #ifdef CONFIG_ATM_AMBASSADOR | ||
42 | devs += amb_detect(); | ||
43 | #endif | ||
44 | #ifdef CONFIG_ATM_HORIZON | ||
45 | devs += hrz_detect(); | ||
46 | #endif | ||
47 | #ifdef CONFIG_ATM_FORE200E | ||
48 | devs += fore200e_detect(); | ||
49 | #endif | ||
50 | #ifdef CONFIG_ATM_LANAI | ||
51 | devs += lanai_detect(); | ||
52 | #endif | ||
53 | return devs; | ||
54 | } | ||
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c index 57f1810fdccd..fc518d85543d 100644 --- a/drivers/atm/atmtcp.c +++ b/drivers/atm/atmtcp.c | |||
@@ -246,10 +246,6 @@ static void atmtcp_c_close(struct atm_vcc *vcc) | |||
246 | { | 246 | { |
247 | struct atm_dev *atmtcp_dev; | 247 | struct atm_dev *atmtcp_dev; |
248 | struct atmtcp_dev_data *dev_data; | 248 | struct atmtcp_dev_data *dev_data; |
249 | struct sock *s; | ||
250 | struct hlist_node *node; | ||
251 | struct atm_vcc *walk; | ||
252 | int i; | ||
253 | 249 | ||
254 | atmtcp_dev = (struct atm_dev *) vcc->dev_data; | 250 | atmtcp_dev = (struct atm_dev *) vcc->dev_data; |
255 | dev_data = PRIV(atmtcp_dev); | 251 | dev_data = PRIV(atmtcp_dev); |
@@ -257,20 +253,8 @@ static void atmtcp_c_close(struct atm_vcc *vcc) | |||
257 | if (dev_data->persist) return; | 253 | if (dev_data->persist) return; |
258 | atmtcp_dev->dev_data = NULL; | 254 | atmtcp_dev->dev_data = NULL; |
259 | kfree(dev_data); | 255 | kfree(dev_data); |
260 | shutdown_atm_dev(atmtcp_dev); | 256 | atm_dev_deregister(atmtcp_dev); |
261 | vcc->dev_data = NULL; | 257 | vcc->dev_data = NULL; |
262 | read_lock(&vcc_sklist_lock); | ||
263 | for(i = 0; i < VCC_HTABLE_SIZE; ++i) { | ||
264 | struct hlist_head *head = &vcc_hash[i]; | ||
265 | |||
266 | sk_for_each(s, node, head) { | ||
267 | walk = atm_sk(s); | ||
268 | if (walk->dev != atmtcp_dev) | ||
269 | continue; | ||
270 | wake_up(s->sk_sleep); | ||
271 | } | ||
272 | } | ||
273 | read_unlock(&vcc_sklist_lock); | ||
274 | module_put(THIS_MODULE); | 258 | module_put(THIS_MODULE); |
275 | } | 259 | } |
276 | 260 | ||
@@ -450,7 +434,7 @@ static int atmtcp_remove_persistent(int itf) | |||
450 | if (PRIV(dev)->vcc) return 0; | 434 | if (PRIV(dev)->vcc) return 0; |
451 | kfree(dev_data); | 435 | kfree(dev_data); |
452 | atm_dev_put(dev); | 436 | atm_dev_put(dev); |
453 | shutdown_atm_dev(dev); | 437 | atm_dev_deregister(dev); |
454 | return 0; | 438 | return 0; |
455 | } | 439 | } |
456 | 440 | ||
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c index 51ec14787293..69f4c7ce9a63 100644 --- a/drivers/atm/lanai.c +++ b/drivers/atm/lanai.c | |||
@@ -39,7 +39,7 @@ | |||
39 | * o lanai_change_qos() isn't written yet | 39 | * o lanai_change_qos() isn't written yet |
40 | * | 40 | * |
41 | * o There aren't any ioctl's yet -- I'd like to eventually support | 41 | * o There aren't any ioctl's yet -- I'd like to eventually support |
42 | * setting loopback and LED modes that way. (see lanai_ioctl) | 42 | * setting loopback and LED modes that way. |
43 | * | 43 | * |
44 | * o If the segmentation engine or DMA gets shut down we should restart | 44 | * o If the segmentation engine or DMA gets shut down we should restart |
45 | * card as per section 17.0i. (see lanai_reset) | 45 | * card as per section 17.0i. (see lanai_reset) |
@@ -305,7 +305,7 @@ struct lanai_dev { | |||
305 | * vci with their bit set | 305 | * vci with their bit set |
306 | */ | 306 | */ |
307 | static void vci_bitfield_iterate(struct lanai_dev *lanai, | 307 | static void vci_bitfield_iterate(struct lanai_dev *lanai, |
308 | /*const*/ unsigned long *lp, | 308 | const unsigned long *lp, |
309 | void (*func)(struct lanai_dev *,vci_t vci)) | 309 | void (*func)(struct lanai_dev *,vci_t vci)) |
310 | { | 310 | { |
311 | vci_t vci = find_first_bit(lp, NUM_VCI); | 311 | vci_t vci = find_first_bit(lp, NUM_VCI); |
@@ -951,7 +951,7 @@ static int __devinit eeprom_read(struct lanai_dev *lanai) | |||
951 | /* read a big-endian 4-byte value out of eeprom */ | 951 | /* read a big-endian 4-byte value out of eeprom */ |
952 | static inline u32 eeprom_be4(const struct lanai_dev *lanai, int address) | 952 | static inline u32 eeprom_be4(const struct lanai_dev *lanai, int address) |
953 | { | 953 | { |
954 | return be32_to_cpup((u32 *) (&lanai->eeprom[address])); | 954 | return be32_to_cpup((const u32 *) &lanai->eeprom[address]); |
955 | } | 955 | } |
956 | 956 | ||
957 | /* Checksum/validate EEPROM contents */ | 957 | /* Checksum/validate EEPROM contents */ |
@@ -1160,7 +1160,7 @@ static inline int vcc_tx_space(const struct lanai_vcc *lvcc, int endptr) | |||
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | /* test if VCC is currently backlogged */ | 1162 | /* test if VCC is currently backlogged */ |
1163 | static inline int vcc_is_backlogged(/*const*/ struct lanai_vcc *lvcc) | 1163 | static inline int vcc_is_backlogged(const struct lanai_vcc *lvcc) |
1164 | { | 1164 | { |
1165 | return !skb_queue_empty(&lvcc->tx.backlog); | 1165 | return !skb_queue_empty(&lvcc->tx.backlog); |
1166 | } | 1166 | } |
@@ -1395,7 +1395,8 @@ static void vcc_rx_aal5(struct lanai_vcc *lvcc, int endptr) | |||
1395 | { | 1395 | { |
1396 | int size; | 1396 | int size; |
1397 | struct sk_buff *skb; | 1397 | struct sk_buff *skb; |
1398 | /*const*/ u32 *x, *end = &lvcc->rx.buf.start[endptr * 4]; | 1398 | const u32 *x; |
1399 | u32 *end = &lvcc->rx.buf.start[endptr * 4]; | ||
1399 | int n = ((unsigned long) end) - ((unsigned long) lvcc->rx.buf.ptr); | 1400 | int n = ((unsigned long) end) - ((unsigned long) lvcc->rx.buf.ptr); |
1400 | if (n < 0) | 1401 | if (n < 0) |
1401 | n += lanai_buf_size(&lvcc->rx.buf); | 1402 | n += lanai_buf_size(&lvcc->rx.buf); |
@@ -2111,7 +2112,7 @@ static int lanai_normalize_ci(struct lanai_dev *lanai, | |||
2111 | * shifted by that much as we compute | 2112 | * shifted by that much as we compute |
2112 | * | 2113 | * |
2113 | */ | 2114 | */ |
2114 | static int pcr_to_cbricg(/*const*/ struct atm_qos *qos) | 2115 | static int pcr_to_cbricg(const struct atm_qos *qos) |
2115 | { | 2116 | { |
2116 | int rounddown = 0; /* 1 = Round PCR down, i.e. round ICG _up_ */ | 2117 | int rounddown = 0; /* 1 = Round PCR down, i.e. round ICG _up_ */ |
2117 | int x, icg, pcr = atm_pcr_goal(&qos->txtp); | 2118 | int x, icg, pcr = atm_pcr_goal(&qos->txtp); |
@@ -2434,93 +2435,6 @@ static int lanai_open(struct atm_vcc *atmvcc) | |||
2434 | return result; | 2435 | return result; |
2435 | } | 2436 | } |
2436 | 2437 | ||
2437 | #if 0 | ||
2438 | /* ioctl operations for card */ | ||
2439 | /* NOTE: these are all DEBUGGING ONLY currently */ | ||
2440 | static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void __user *arg) | ||
2441 | { | ||
2442 | int result = 0; | ||
2443 | struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data; | ||
2444 | switch(cmd) { | ||
2445 | case 2106275: | ||
2446 | shutdown_atm_dev(atmdev); | ||
2447 | return 0; | ||
2448 | case 2200000: { | ||
2449 | unsigned long flags; | ||
2450 | spin_lock_irqsave(&lanai->servicelock, flags); | ||
2451 | run_service(lanai); | ||
2452 | spin_unlock_irqrestore(&lanai->servicelock, flags); | ||
2453 | return 0; } | ||
2454 | case 2200002: | ||
2455 | get_statistics(lanai); | ||
2456 | return 0; | ||
2457 | case 2200003: { | ||
2458 | unsigned int i; | ||
2459 | for (i = 0; i <= 0x5C ; i += 4) { | ||
2460 | if (i==0x48) /* Write-only butt reg */ | ||
2461 | continue; | ||
2462 | printk(KERN_CRIT DEV_LABEL " 0x%02X: " | ||
2463 | "0x%08X\n", i, | ||
2464 | (unsigned int) readl(lanai->base + i)); | ||
2465 | barrier(); mb(); | ||
2466 | pcistatus_check(lanai, 0); | ||
2467 | barrier(); mb(); | ||
2468 | } | ||
2469 | return 0; } | ||
2470 | case 2200004: { | ||
2471 | u8 b; | ||
2472 | u16 w; | ||
2473 | u32 dw; | ||
2474 | struct pci_dev *pci = lanai->pci; | ||
2475 | (void) pci_read_config_word(pci, PCI_VENDOR_ID, &w); | ||
2476 | DPRINTK("vendor = 0x%X\n", (unsigned int) w); | ||
2477 | (void) pci_read_config_word(pci, PCI_DEVICE_ID, &w); | ||
2478 | DPRINTK("device = 0x%X\n", (unsigned int) w); | ||
2479 | (void) pci_read_config_word(pci, PCI_COMMAND, &w); | ||
2480 | DPRINTK("command = 0x%X\n", (unsigned int) w); | ||
2481 | (void) pci_read_config_word(pci, PCI_STATUS, &w); | ||
2482 | DPRINTK("status = 0x%X\n", (unsigned int) w); | ||
2483 | (void) pci_read_config_dword(pci, | ||
2484 | PCI_CLASS_REVISION, &dw); | ||
2485 | DPRINTK("class/revision = 0x%X\n", (unsigned int) dw); | ||
2486 | (void) pci_read_config_byte(pci, | ||
2487 | PCI_CACHE_LINE_SIZE, &b); | ||
2488 | DPRINTK("cache line size = 0x%X\n", (unsigned int) b); | ||
2489 | (void) pci_read_config_byte(pci, PCI_LATENCY_TIMER, &b); | ||
2490 | DPRINTK("latency = %d (0x%X)\n", | ||
2491 | (int) b, (unsigned int) b); | ||
2492 | (void) pci_read_config_byte(pci, PCI_HEADER_TYPE, &b); | ||
2493 | DPRINTK("header type = 0x%X\n", (unsigned int) b); | ||
2494 | (void) pci_read_config_byte(pci, PCI_BIST, &b); | ||
2495 | DPRINTK("bist = 0x%X\n", (unsigned int) b); | ||
2496 | /* skipping a few here */ | ||
2497 | (void) pci_read_config_byte(pci, | ||
2498 | PCI_INTERRUPT_LINE, &b); | ||
2499 | DPRINTK("pci_int_line = 0x%X\n", (unsigned int) b); | ||
2500 | (void) pci_read_config_byte(pci, | ||
2501 | PCI_INTERRUPT_PIN, &b); | ||
2502 | DPRINTK("pci_int_pin = 0x%X\n", (unsigned int) b); | ||
2503 | (void) pci_read_config_byte(pci, PCI_MIN_GNT, &b); | ||
2504 | DPRINTK("min_gnt = 0x%X\n", (unsigned int) b); | ||
2505 | (void) pci_read_config_byte(pci, PCI_MAX_LAT, &b); | ||
2506 | DPRINTK("max_lat = 0x%X\n", (unsigned int) b); } | ||
2507 | return 0; | ||
2508 | #ifdef USE_POWERDOWN | ||
2509 | case 2200005: | ||
2510 | DPRINTK("Coming out of powerdown\n"); | ||
2511 | lanai->conf1 &= ~CONFIG1_POWERDOWN; | ||
2512 | conf1_write(lanai); | ||
2513 | return 0; | ||
2514 | #endif | ||
2515 | default: | ||
2516 | result = -ENOIOCTLCMD; | ||
2517 | } | ||
2518 | return result; | ||
2519 | } | ||
2520 | #else /* !0 */ | ||
2521 | #define lanai_ioctl NULL | ||
2522 | #endif /* 0 */ | ||
2523 | |||
2524 | static int lanai_send(struct atm_vcc *atmvcc, struct sk_buff *skb) | 2438 | static int lanai_send(struct atm_vcc *atmvcc, struct sk_buff *skb) |
2525 | { | 2439 | { |
2526 | struct lanai_vcc *lvcc = (struct lanai_vcc *) atmvcc->dev_data; | 2440 | struct lanai_vcc *lvcc = (struct lanai_vcc *) atmvcc->dev_data; |
@@ -2678,7 +2592,6 @@ static const struct atmdev_ops ops = { | |||
2678 | .dev_close = lanai_dev_close, | 2592 | .dev_close = lanai_dev_close, |
2679 | .open = lanai_open, | 2593 | .open = lanai_open, |
2680 | .close = lanai_close, | 2594 | .close = lanai_close, |
2681 | .ioctl = lanai_ioctl, | ||
2682 | .getsockopt = NULL, | 2595 | .getsockopt = NULL, |
2683 | .setsockopt = NULL, | 2596 | .setsockopt = NULL, |
2684 | .send = lanai_send, | 2597 | .send = lanai_send, |
@@ -2760,6 +2673,7 @@ static void __exit lanai_module_exit(void) | |||
2760 | * gone, so there isn't much to do | 2673 | * gone, so there isn't much to do |
2761 | */ | 2674 | */ |
2762 | DPRINTK("cleanup_module()\n"); | 2675 | DPRINTK("cleanup_module()\n"); |
2676 | pci_unregister_driver(&lanai_driver); | ||
2763 | } | 2677 | } |
2764 | 2678 | ||
2765 | module_init(lanai_module_init); | 2679 | module_init(lanai_module_init); |
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c index bdd168d88f49..bd958d69a2ac 100644 --- a/drivers/char/drm/drm_context.c +++ b/drivers/char/drm/drm_context.c | |||
@@ -432,7 +432,10 @@ int drm_addctx(struct inode *inode, struct file *filp, | |||
432 | 432 | ||
433 | if (ctx.handle != DRM_KERNEL_CONTEXT) { | 433 | if (ctx.handle != DRM_KERNEL_CONTEXT) { |
434 | if (dev->driver->context_ctor) | 434 | if (dev->driver->context_ctor) |
435 | dev->driver->context_ctor(dev, ctx.handle); | 435 | if (!dev->driver->context_ctor(dev, ctx.handle)) { |
436 | DRM_DEBUG( "Running out of ctxs or memory.\n"); | ||
437 | return -ENOMEM; | ||
438 | } | ||
436 | } | 439 | } |
437 | 440 | ||
438 | ctx_entry = drm_alloc(sizeof(*ctx_entry), DRM_MEM_CTXLIST); | 441 | ctx_entry = drm_alloc(sizeof(*ctx_entry), DRM_MEM_CTXLIST); |
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index 4be59dbb78c4..1ba072630361 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c | |||
@@ -193,6 +193,7 @@ static const u8 W83792D_REG_LEVELS[3][4] = { | |||
193 | 0xE2 } /* (bit3-0) SmartFanII: Fan3 Level 3 */ | 193 | 0xE2 } /* (bit3-0) SmartFanII: Fan3 Level 3 */ |
194 | }; | 194 | }; |
195 | 195 | ||
196 | #define W83792D_REG_GPIO_EN 0x1A | ||
196 | #define W83792D_REG_CONFIG 0x40 | 197 | #define W83792D_REG_CONFIG 0x40 |
197 | #define W83792D_REG_VID_FANDIV 0x47 | 198 | #define W83792D_REG_VID_FANDIV 0x47 |
198 | #define W83792D_REG_CHIPID 0x49 | 199 | #define W83792D_REG_CHIPID 0x49 |
@@ -257,7 +258,7 @@ DIV_TO_REG(long val) | |||
257 | { | 258 | { |
258 | int i; | 259 | int i; |
259 | val = SENSORS_LIMIT(val, 1, 128) >> 1; | 260 | val = SENSORS_LIMIT(val, 1, 128) >> 1; |
260 | for (i = 0; i < 6; i++) { | 261 | for (i = 0; i < 7; i++) { |
261 | if (val == 0) | 262 | if (val == 0) |
262 | break; | 263 | break; |
263 | val >>= 1; | 264 | val >>= 1; |
@@ -1282,8 +1283,8 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1282 | w83792d_init_client(new_client); | 1283 | w83792d_init_client(new_client); |
1283 | 1284 | ||
1284 | /* A few vars need to be filled upon startup */ | 1285 | /* A few vars need to be filled upon startup */ |
1285 | for (i = 1; i <= 7; i++) { | 1286 | for (i = 0; i < 7; i++) { |
1286 | data->fan_min[i - 1] = w83792d_read_value(new_client, | 1287 | data->fan_min[i] = w83792d_read_value(new_client, |
1287 | W83792D_REG_FAN_MIN[i]); | 1288 | W83792D_REG_FAN_MIN[i]); |
1288 | } | 1289 | } |
1289 | 1290 | ||
@@ -1306,10 +1307,20 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1306 | device_create_file_fan(new_client, 1); | 1307 | device_create_file_fan(new_client, 1); |
1307 | device_create_file_fan(new_client, 2); | 1308 | device_create_file_fan(new_client, 2); |
1308 | device_create_file_fan(new_client, 3); | 1309 | device_create_file_fan(new_client, 3); |
1309 | device_create_file_fan(new_client, 4); | 1310 | |
1310 | device_create_file_fan(new_client, 5); | 1311 | /* Read GPIO enable register to check if pins for fan 4,5 are used as |
1311 | device_create_file_fan(new_client, 6); | 1312 | GPIO */ |
1312 | device_create_file_fan(new_client, 7); | 1313 | val1 = w83792d_read_value(new_client, W83792D_REG_GPIO_EN); |
1314 | if (!(val1 & 0x40)) | ||
1315 | device_create_file_fan(new_client, 4); | ||
1316 | if (!(val1 & 0x20)) | ||
1317 | device_create_file_fan(new_client, 5); | ||
1318 | |||
1319 | val1 = w83792d_read_value(new_client, W83792D_REG_PIN); | ||
1320 | if (val1 & 0x40) | ||
1321 | device_create_file_fan(new_client, 6); | ||
1322 | if (val1 & 0x04) | ||
1323 | device_create_file_fan(new_client, 7); | ||
1313 | 1324 | ||
1314 | device_create_file_temp1(new_client); /* Temp1 */ | 1325 | device_create_file_temp1(new_client); /* Temp1 */ |
1315 | device_create_file_temp_add(new_client, 2); /* Temp2 */ | 1326 | device_create_file_temp_add(new_client, 2); /* Temp2 */ |
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 74022316fc63..65c2ec5c421b 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -91,9 +91,9 @@ static int mfcounter = 0; | |||
91 | * Public data... | 91 | * Public data... |
92 | */ | 92 | */ |
93 | int mpt_lan_index = -1; | 93 | int mpt_lan_index = -1; |
94 | static int mpt_stm_index = -1; | 94 | int mpt_stm_index = -1; |
95 | 95 | ||
96 | static struct proc_dir_entry *mpt_proc_root_dir; | 96 | struct proc_dir_entry *mpt_proc_root_dir; |
97 | 97 | ||
98 | #define WHOINIT_UNKNOWN 0xAA | 98 | #define WHOINIT_UNKNOWN 0xAA |
99 | 99 | ||
@@ -6271,6 +6271,7 @@ EXPORT_SYMBOL(mpt_resume); | |||
6271 | EXPORT_SYMBOL(mpt_suspend); | 6271 | EXPORT_SYMBOL(mpt_suspend); |
6272 | #endif | 6272 | #endif |
6273 | EXPORT_SYMBOL(ioc_list); | 6273 | EXPORT_SYMBOL(ioc_list); |
6274 | EXPORT_SYMBOL(mpt_proc_root_dir); | ||
6274 | EXPORT_SYMBOL(mpt_register); | 6275 | EXPORT_SYMBOL(mpt_register); |
6275 | EXPORT_SYMBOL(mpt_deregister); | 6276 | EXPORT_SYMBOL(mpt_deregister); |
6276 | EXPORT_SYMBOL(mpt_event_register); | 6277 | EXPORT_SYMBOL(mpt_event_register); |
@@ -6288,6 +6289,7 @@ EXPORT_SYMBOL(mpt_verify_adapter); | |||
6288 | EXPORT_SYMBOL(mpt_GetIocState); | 6289 | EXPORT_SYMBOL(mpt_GetIocState); |
6289 | EXPORT_SYMBOL(mpt_print_ioc_summary); | 6290 | EXPORT_SYMBOL(mpt_print_ioc_summary); |
6290 | EXPORT_SYMBOL(mpt_lan_index); | 6291 | EXPORT_SYMBOL(mpt_lan_index); |
6292 | EXPORT_SYMBOL(mpt_stm_index); | ||
6291 | EXPORT_SYMBOL(mpt_HardResetHandler); | 6293 | EXPORT_SYMBOL(mpt_HardResetHandler); |
6292 | EXPORT_SYMBOL(mpt_config); | 6294 | EXPORT_SYMBOL(mpt_config); |
6293 | EXPORT_SYMBOL(mpt_toolbox); | 6295 | EXPORT_SYMBOL(mpt_toolbox); |
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 8ad277a9afa1..5f5b3fb5b4d7 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h | |||
@@ -1006,8 +1006,10 @@ extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); | |||
1006 | * Public data decl's... | 1006 | * Public data decl's... |
1007 | */ | 1007 | */ |
1008 | extern struct list_head ioc_list; | 1008 | extern struct list_head ioc_list; |
1009 | extern struct proc_dir_entry *mpt_proc_root_dir; | ||
1009 | 1010 | ||
1010 | extern int mpt_lan_index; /* needed by mptlan.c */ | 1011 | extern int mpt_lan_index; /* needed by mptlan.c */ |
1012 | extern int mpt_stm_index; /* needed by mptstm.c */ | ||
1011 | 1013 | ||
1012 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1014 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1013 | #endif /* } __KERNEL__ */ | 1015 | #endif /* } __KERNEL__ */ |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 143f01a4c170..69c04945591f 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * (C) 2000 Red Hat. GPL'd | 5 | * (C) 2000 Red Hat. GPL'd |
6 | * | 6 | * |
7 | * $Id: cfi_cmdset_0001.c,v 1.185 2005/11/07 11:14:22 gleixner Exp $ | 7 | * $Id: cfi_cmdset_0001.c,v 1.186 2005/11/23 22:07:52 nico Exp $ |
8 | * | 8 | * |
9 | * | 9 | * |
10 | * 10/10/2000 Nicolas Pitre <nico@cam.org> | 10 | * 10/10/2000 Nicolas Pitre <nico@cam.org> |
@@ -644,9 +644,8 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr | |||
644 | * | 644 | * |
645 | * - contension arbitration is handled in the owner's context. | 645 | * - contension arbitration is handled in the owner's context. |
646 | * | 646 | * |
647 | * The 'shared' struct can be read when its lock is taken. | 647 | * The 'shared' struct can be read and/or written only when |
648 | * However any writes to it can only be made when the current | 648 | * its lock is taken. |
649 | * owner's lock is also held. | ||
650 | */ | 649 | */ |
651 | struct flchip_shared *shared = chip->priv; | 650 | struct flchip_shared *shared = chip->priv; |
652 | struct flchip *contender; | 651 | struct flchip *contender; |
@@ -675,14 +674,13 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr | |||
675 | } | 674 | } |
676 | timeo = jiffies + HZ; | 675 | timeo = jiffies + HZ; |
677 | spin_lock(&shared->lock); | 676 | spin_lock(&shared->lock); |
677 | spin_unlock(contender->mutex); | ||
678 | } | 678 | } |
679 | 679 | ||
680 | /* We now own it */ | 680 | /* We now own it */ |
681 | shared->writing = chip; | 681 | shared->writing = chip; |
682 | if (mode == FL_ERASING) | 682 | if (mode == FL_ERASING) |
683 | shared->erasing = chip; | 683 | shared->erasing = chip; |
684 | if (contender && contender != chip) | ||
685 | spin_unlock(contender->mutex); | ||
686 | spin_unlock(&shared->lock); | 684 | spin_unlock(&shared->lock); |
687 | } | 685 | } |
688 | 686 | ||
diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c index 90eb30e06b7c..e636aa86bc24 100644 --- a/drivers/mtd/chips/cfi_probe.c +++ b/drivers/mtd/chips/cfi_probe.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | Common Flash Interface probe code. | 2 | Common Flash Interface probe code. |
3 | (C) 2000 Red Hat. GPL'd. | 3 | (C) 2000 Red Hat. GPL'd. |
4 | $Id: cfi_probe.c,v 1.84 2005/11/07 11:14:23 gleixner Exp $ | 4 | $Id: cfi_probe.c,v 1.86 2005/11/29 14:48:31 gleixner Exp $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
@@ -230,8 +230,8 @@ static int __xipram cfi_chip_setup(struct map_info *map, | |||
230 | cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL); | 230 | cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL); |
231 | cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL); | 231 | cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL); |
232 | cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL); | 232 | cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL); |
233 | cfi->mfr = cfi_read_query(map, base); | 233 | cfi->mfr = cfi_read_query16(map, base); |
234 | cfi->id = cfi_read_query(map, base + ofs_factor); | 234 | cfi->id = cfi_read_query16(map, base + ofs_factor); |
235 | 235 | ||
236 | /* Put it back into Read Mode */ | 236 | /* Put it back into Read Mode */ |
237 | cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); | 237 | cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); |
@@ -426,7 +426,7 @@ static struct mtd_chip_driver cfi_chipdrv = { | |||
426 | .module = THIS_MODULE | 426 | .module = THIS_MODULE |
427 | }; | 427 | }; |
428 | 428 | ||
429 | int __init cfi_probe_init(void) | 429 | static int __init cfi_probe_init(void) |
430 | { | 430 | { |
431 | register_mtd_chip_driver(&cfi_chipdrv); | 431 | register_mtd_chip_driver(&cfi_chipdrv); |
432 | return 0; | 432 | return 0; |
diff --git a/drivers/mtd/chips/sharp.c b/drivers/mtd/chips/sharp.c index 2d26bdef82d5..36f61a6a766e 100644 --- a/drivers/mtd/chips/sharp.c +++ b/drivers/mtd/chips/sharp.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright 2000,2001 David A. Schleef <ds@schleef.org> | 4 | * Copyright 2000,2001 David A. Schleef <ds@schleef.org> |
5 | * 2000,2001 Lineo, Inc. | 5 | * 2000,2001 Lineo, Inc. |
6 | * | 6 | * |
7 | * $Id: sharp.c,v 1.16 2005/11/07 11:14:23 gleixner Exp $ | 7 | * $Id: sharp.c,v 1.17 2005/11/29 14:28:28 gleixner Exp $ |
8 | * | 8 | * |
9 | * Devices supported: | 9 | * Devices supported: |
10 | * LH28F016SCT Symmetrical block flash memory, 2Mx8 | 10 | * LH28F016SCT Symmetrical block flash memory, 2Mx8 |
@@ -160,22 +160,28 @@ struct mtd_info *sharp_probe(struct map_info *map) | |||
160 | return mtd; | 160 | return mtd; |
161 | } | 161 | } |
162 | 162 | ||
163 | static inline void sharp_send_cmd(struct map_info *map, unsigned long cmd, unsigned long adr) | ||
164 | { | ||
165 | map_word map_cmd; | ||
166 | map_cmd.x[0] = cmd; | ||
167 | map_write(map, map_cmd, adr); | ||
168 | } | ||
169 | |||
163 | static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) | 170 | static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) |
164 | { | 171 | { |
165 | unsigned long tmp; | 172 | map_word tmp, read0, read4; |
166 | unsigned long base = 0; | 173 | unsigned long base = 0; |
167 | u32 read0, read4; | ||
168 | int width = 4; | 174 | int width = 4; |
169 | 175 | ||
170 | tmp = map_read32(map, base+0); | 176 | tmp = map_read(map, base+0); |
171 | 177 | ||
172 | map_write32(map, CMD_READ_ID, base+0); | 178 | sharp_send_cmd(map, CMD_READ_ID, base+0); |
173 | 179 | ||
174 | read0=map_read32(map, base+0); | 180 | read0 = map_read(map, base+0); |
175 | read4=map_read32(map, base+4); | 181 | read4 = map_read(map, base+4); |
176 | if(read0 == 0x89898989){ | 182 | if(read0.x[0] == 0x89898989){ |
177 | printk("Looks like sharp flash\n"); | 183 | printk("Looks like sharp flash\n"); |
178 | switch(read4){ | 184 | switch(read4.x[0]){ |
179 | case 0xaaaaaaaa: | 185 | case 0xaaaaaaaa: |
180 | case 0xa0a0a0a0: | 186 | case 0xa0a0a0a0: |
181 | /* aa - LH28F016SCT-L95 2Mx8, 32 64k blocks*/ | 187 | /* aa - LH28F016SCT-L95 2Mx8, 32 64k blocks*/ |
@@ -197,16 +203,16 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) | |||
197 | return width; | 203 | return width; |
198 | #endif | 204 | #endif |
199 | default: | 205 | default: |
200 | printk("Sort-of looks like sharp flash, 0x%08x 0x%08x\n", | 206 | printk("Sort-of looks like sharp flash, 0x%08lx 0x%08lx\n", |
201 | read0,read4); | 207 | read0.x[0], read4.x[0]); |
202 | } | 208 | } |
203 | }else if((map_read32(map, base+0) == CMD_READ_ID)){ | 209 | }else if((map_read(map, base+0).x[0] == CMD_READ_ID)){ |
204 | /* RAM, probably */ | 210 | /* RAM, probably */ |
205 | printk("Looks like RAM\n"); | 211 | printk("Looks like RAM\n"); |
206 | map_write32(map, tmp, base+0); | 212 | map_write(map, tmp, base+0); |
207 | }else{ | 213 | }else{ |
208 | printk("Doesn't look like sharp flash, 0x%08x 0x%08x\n", | 214 | printk("Doesn't look like sharp flash, 0x%08lx 0x%08lx\n", |
209 | read0,read4); | 215 | read0.x[0], read4.x[0]); |
210 | } | 216 | } |
211 | 217 | ||
212 | return 0; | 218 | return 0; |
@@ -215,7 +221,8 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) | |||
215 | /* This function returns with the chip->mutex lock held. */ | 221 | /* This function returns with the chip->mutex lock held. */ |
216 | static int sharp_wait(struct map_info *map, struct flchip *chip) | 222 | static int sharp_wait(struct map_info *map, struct flchip *chip) |
217 | { | 223 | { |
218 | int status, i; | 224 | int i; |
225 | map_word status; | ||
219 | unsigned long timeo = jiffies + HZ; | 226 | unsigned long timeo = jiffies + HZ; |
220 | DECLARE_WAITQUEUE(wait, current); | 227 | DECLARE_WAITQUEUE(wait, current); |
221 | int adr = 0; | 228 | int adr = 0; |
@@ -225,12 +232,12 @@ retry: | |||
225 | 232 | ||
226 | switch(chip->state){ | 233 | switch(chip->state){ |
227 | case FL_READY: | 234 | case FL_READY: |
228 | map_write32(map,CMD_READ_STATUS,adr); | 235 | sharp_send_cmd(map, CMD_READ_STATUS, adr); |
229 | chip->state = FL_STATUS; | 236 | chip->state = FL_STATUS; |
230 | case FL_STATUS: | 237 | case FL_STATUS: |
231 | for(i=0;i<100;i++){ | 238 | for(i=0;i<100;i++){ |
232 | status = map_read32(map,adr); | 239 | status = map_read(map, adr); |
233 | if((status & SR_READY)==SR_READY) | 240 | if((status.x[0] & SR_READY)==SR_READY) |
234 | break; | 241 | break; |
235 | udelay(1); | 242 | udelay(1); |
236 | } | 243 | } |
@@ -254,7 +261,7 @@ retry: | |||
254 | goto retry; | 261 | goto retry; |
255 | } | 262 | } |
256 | 263 | ||
257 | map_write32(map,CMD_RESET, adr); | 264 | sharp_send_cmd(map, CMD_RESET, adr); |
258 | 265 | ||
259 | chip->state = FL_READY; | 266 | chip->state = FL_READY; |
260 | 267 | ||
@@ -351,37 +358,39 @@ static int sharp_write_oneword(struct map_info *map, struct flchip *chip, | |||
351 | int timeo; | 358 | int timeo; |
352 | int try; | 359 | int try; |
353 | int i; | 360 | int i; |
354 | int status = 0; | 361 | map_word data, status; |
355 | 362 | ||
363 | status.x[0] = 0; | ||
356 | ret = sharp_wait(map,chip); | 364 | ret = sharp_wait(map,chip); |
357 | 365 | ||
358 | for(try=0;try<10;try++){ | 366 | for(try=0;try<10;try++){ |
359 | map_write32(map,CMD_BYTE_WRITE,adr); | 367 | sharp_send_cmd(map, CMD_BYTE_WRITE, adr); |
360 | /* cpu_to_le32 -> hack to fix the writel be->le conversion */ | 368 | /* cpu_to_le32 -> hack to fix the writel be->le conversion */ |
361 | map_write32(map,cpu_to_le32(datum),adr); | 369 | data.x[0] = cpu_to_le32(datum); |
370 | map_write(map, data, adr); | ||
362 | 371 | ||
363 | chip->state = FL_WRITING; | 372 | chip->state = FL_WRITING; |
364 | 373 | ||
365 | timeo = jiffies + (HZ/2); | 374 | timeo = jiffies + (HZ/2); |
366 | 375 | ||
367 | map_write32(map,CMD_READ_STATUS,adr); | 376 | sharp_send_cmd(map, CMD_READ_STATUS, adr); |
368 | for(i=0;i<100;i++){ | 377 | for(i=0;i<100;i++){ |
369 | status = map_read32(map,adr); | 378 | status = map_read(map, adr); |
370 | if((status & SR_READY)==SR_READY) | 379 | if((status.x[0] & SR_READY) == SR_READY) |
371 | break; | 380 | break; |
372 | } | 381 | } |
373 | if(i==100){ | 382 | if(i==100){ |
374 | printk("sharp: timed out writing\n"); | 383 | printk("sharp: timed out writing\n"); |
375 | } | 384 | } |
376 | 385 | ||
377 | if(!(status&SR_ERRORS)) | 386 | if(!(status.x[0] & SR_ERRORS)) |
378 | break; | 387 | break; |
379 | 388 | ||
380 | printk("sharp: error writing byte at addr=%08lx status=%08x\n",adr,status); | 389 | printk("sharp: error writing byte at addr=%08lx status=%08lx\n", adr, status.x[0]); |
381 | 390 | ||
382 | map_write32(map,CMD_CLEAR_STATUS,adr); | 391 | sharp_send_cmd(map, CMD_CLEAR_STATUS, adr); |
383 | } | 392 | } |
384 | map_write32(map,CMD_RESET,adr); | 393 | sharp_send_cmd(map, CMD_RESET, adr); |
385 | chip->state = FL_READY; | 394 | chip->state = FL_READY; |
386 | 395 | ||
387 | wake_up(&chip->wq); | 396 | wake_up(&chip->wq); |
@@ -434,18 +443,18 @@ static int sharp_do_wait_for_ready(struct map_info *map, struct flchip *chip, | |||
434 | { | 443 | { |
435 | int ret; | 444 | int ret; |
436 | unsigned long timeo; | 445 | unsigned long timeo; |
437 | int status; | 446 | map_word status; |
438 | DECLARE_WAITQUEUE(wait, current); | 447 | DECLARE_WAITQUEUE(wait, current); |
439 | 448 | ||
440 | map_write32(map,CMD_READ_STATUS,adr); | 449 | sharp_send_cmd(map, CMD_READ_STATUS, adr); |
441 | status = map_read32(map,adr); | 450 | status = map_read(map, adr); |
442 | 451 | ||
443 | timeo = jiffies + HZ; | 452 | timeo = jiffies + HZ; |
444 | 453 | ||
445 | while(time_before(jiffies, timeo)){ | 454 | while(time_before(jiffies, timeo)){ |
446 | map_write32(map,CMD_READ_STATUS,adr); | 455 | sharp_send_cmd(map, CMD_READ_STATUS, adr); |
447 | status = map_read32(map,adr); | 456 | status = map_read(map, adr); |
448 | if((status & SR_READY)==SR_READY){ | 457 | if((status.x[0] & SR_READY)==SR_READY){ |
449 | ret = 0; | 458 | ret = 0; |
450 | goto out; | 459 | goto out; |
451 | } | 460 | } |
@@ -476,7 +485,7 @@ static int sharp_erase_oneblock(struct map_info *map, struct flchip *chip, | |||
476 | { | 485 | { |
477 | int ret; | 486 | int ret; |
478 | //int timeo; | 487 | //int timeo; |
479 | int status; | 488 | map_word status; |
480 | //int i; | 489 | //int i; |
481 | 490 | ||
482 | //printk("sharp_erase_oneblock()\n"); | 491 | //printk("sharp_erase_oneblock()\n"); |
@@ -486,26 +495,26 @@ static int sharp_erase_oneblock(struct map_info *map, struct flchip *chip, | |||
486 | sharp_unlock_oneblock(map,chip,adr); | 495 | sharp_unlock_oneblock(map,chip,adr); |
487 | #endif | 496 | #endif |
488 | 497 | ||
489 | map_write32(map,CMD_BLOCK_ERASE_1,adr); | 498 | sharp_send_cmd(map, CMD_BLOCK_ERASE_1, adr); |
490 | map_write32(map,CMD_BLOCK_ERASE_2,adr); | 499 | sharp_send_cmd(map, CMD_BLOCK_ERASE_2, adr); |
491 | 500 | ||
492 | chip->state = FL_ERASING; | 501 | chip->state = FL_ERASING; |
493 | 502 | ||
494 | ret = sharp_do_wait_for_ready(map,chip,adr); | 503 | ret = sharp_do_wait_for_ready(map,chip,adr); |
495 | if(ret<0)return ret; | 504 | if(ret<0)return ret; |
496 | 505 | ||
497 | map_write32(map,CMD_READ_STATUS,adr); | 506 | sharp_send_cmd(map, CMD_READ_STATUS, adr); |
498 | status = map_read32(map,adr); | 507 | status = map_read(map, adr); |
499 | 508 | ||
500 | if(!(status&SR_ERRORS)){ | 509 | if(!(status.x[0] & SR_ERRORS)){ |
501 | map_write32(map,CMD_RESET,adr); | 510 | sharp_send_cmd(map, CMD_RESET, adr); |
502 | chip->state = FL_READY; | 511 | chip->state = FL_READY; |
503 | //spin_unlock_bh(chip->mutex); | 512 | //spin_unlock_bh(chip->mutex); |
504 | return 0; | 513 | return 0; |
505 | } | 514 | } |
506 | 515 | ||
507 | printk("sharp: error erasing block at addr=%08lx status=%08x\n",adr,status); | 516 | printk("sharp: error erasing block at addr=%08lx status=%08lx\n", adr, status.x[0]); |
508 | map_write32(map,CMD_CLEAR_STATUS,adr); | 517 | sharp_send_cmd(map, CMD_CLEAR_STATUS, adr); |
509 | 518 | ||
510 | //spin_unlock_bh(chip->mutex); | 519 | //spin_unlock_bh(chip->mutex); |
511 | 520 | ||
@@ -517,20 +526,20 @@ static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip, | |||
517 | unsigned long adr) | 526 | unsigned long adr) |
518 | { | 527 | { |
519 | int i; | 528 | int i; |
520 | int status; | 529 | map_word status; |
521 | 530 | ||
522 | map_write32(map,CMD_CLEAR_BLOCK_LOCKS_1,adr); | 531 | sharp_send_cmd(map, CMD_CLEAR_BLOCK_LOCKS_1, adr); |
523 | map_write32(map,CMD_CLEAR_BLOCK_LOCKS_2,adr); | 532 | sharp_send_cmd(map, CMD_CLEAR_BLOCK_LOCKS_2, adr); |
524 | 533 | ||
525 | udelay(100); | 534 | udelay(100); |
526 | 535 | ||
527 | status = map_read32(map,adr); | 536 | status = map_read(map, adr); |
528 | printk("status=%08x\n",status); | 537 | printk("status=%08lx\n", status.x[0]); |
529 | 538 | ||
530 | for(i=0;i<1000;i++){ | 539 | for(i=0;i<1000;i++){ |
531 | //map_write32(map,CMD_READ_STATUS,adr); | 540 | //sharp_send_cmd(map, CMD_READ_STATUS, adr); |
532 | status = map_read32(map,adr); | 541 | status = map_read(map, adr); |
533 | if((status & SR_READY)==SR_READY) | 542 | if((status.x[0] & SR_READY) == SR_READY) |
534 | break; | 543 | break; |
535 | udelay(100); | 544 | udelay(100); |
536 | } | 545 | } |
@@ -538,14 +547,14 @@ static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip, | |||
538 | printk("sharp: timed out unlocking block\n"); | 547 | printk("sharp: timed out unlocking block\n"); |
539 | } | 548 | } |
540 | 549 | ||
541 | if(!(status&SR_ERRORS)){ | 550 | if(!(status.x[0] & SR_ERRORS)){ |
542 | map_write32(map,CMD_RESET,adr); | 551 | sharp_send_cmd(map, CMD_RESET, adr); |
543 | chip->state = FL_READY; | 552 | chip->state = FL_READY; |
544 | return; | 553 | return; |
545 | } | 554 | } |
546 | 555 | ||
547 | printk("sharp: error unlocking block at addr=%08lx status=%08x\n",adr,status); | 556 | printk("sharp: error unlocking block at addr=%08lx status=%08lx\n", adr, status.x[0]); |
548 | map_write32(map,CMD_CLEAR_STATUS,adr); | 557 | sharp_send_cmd(map, CMD_CLEAR_STATUS, adr); |
549 | } | 558 | } |
550 | #endif | 559 | #endif |
551 | 560 | ||
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index 0aaa0ced9aba..7ff403b2a0a0 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: block2mtd.c,v 1.29 2005/11/07 11:14:24 gleixner Exp $ | 2 | * $Id: block2mtd.c,v 1.30 2005/11/29 14:48:32 gleixner Exp $ |
3 | * | 3 | * |
4 | * block2mtd.c - create an mtd from a block device | 4 | * block2mtd.c - create an mtd from a block device |
5 | * | 5 | * |
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/mtd/mtd.h> | 19 | #include <linux/mtd/mtd.h> |
20 | #include <linux/buffer_head.h> | 20 | #include <linux/buffer_head.h> |
21 | 21 | ||
22 | #define VERSION "$Revision: 1.29 $" | 22 | #define VERSION "$Revision: 1.30 $" |
23 | 23 | ||
24 | 24 | ||
25 | #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) | 25 | #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) |
@@ -40,7 +40,7 @@ static LIST_HEAD(blkmtd_device_list); | |||
40 | 40 | ||
41 | 41 | ||
42 | #define PAGE_READAHEAD 64 | 42 | #define PAGE_READAHEAD 64 |
43 | void cache_readahead(struct address_space *mapping, int index) | 43 | static void cache_readahead(struct address_space *mapping, int index) |
44 | { | 44 | { |
45 | filler_t *filler = (filler_t*)mapping->a_ops->readpage; | 45 | filler_t *filler = (filler_t*)mapping->a_ops->readpage; |
46 | int i, pagei; | 46 | int i, pagei; |
diff --git a/drivers/mtd/devices/ms02-nv.c b/drivers/mtd/devices/ms02-nv.c index f5026cee087f..0ff2e4378244 100644 --- a/drivers/mtd/devices/ms02-nv.c +++ b/drivers/mtd/devices/ms02-nv.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * as published by the Free Software Foundation; either version | 6 | * as published by the Free Software Foundation; either version |
7 | * 2 of the License, or (at your option) any later version. | 7 | * 2 of the License, or (at your option) any later version. |
8 | * | 8 | * |
9 | * $Id: ms02-nv.c,v 1.10 2005/06/20 12:24:41 macro Exp $ | 9 | * $Id: ms02-nv.c,v 1.11 2005/11/14 13:41:47 macro Exp $ |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
@@ -293,13 +293,13 @@ static int __init ms02nv_init(void) | |||
293 | 293 | ||
294 | switch (mips_machtype) { | 294 | switch (mips_machtype) { |
295 | case MACH_DS5000_200: | 295 | case MACH_DS5000_200: |
296 | csr = (volatile u32 *)KN02_CSR_BASE; | 296 | csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE + KN02_CSR); |
297 | if (*csr & KN02_CSR_BNK32M) | 297 | if (*csr & KN02_CSR_BNK32M) |
298 | stride = 2; | 298 | stride = 2; |
299 | break; | 299 | break; |
300 | case MACH_DS5000_2X0: | 300 | case MACH_DS5000_2X0: |
301 | case MACH_DS5900: | 301 | case MACH_DS5900: |
302 | csr = (volatile u32 *)KN03_MCR_BASE; | 302 | csr = (volatile u32 *)CKSEG1ADDR(KN03_SLOT_BASE + IOASIC_MCR); |
303 | if (*csr & KN03_MCR_BNK32M) | 303 | if (*csr & KN03_MCR_BNK32M) |
304 | stride = 2; | 304 | stride = 2; |
305 | break; | 305 | break; |
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index de7e231d6d18..8a878b34eca0 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* This version ported to the Linux-MTD system by dwmw2@infradead.org | 1 | /* This version ported to the Linux-MTD system by dwmw2@infradead.org |
2 | * $Id: ftl.c,v 1.58 2005/11/07 11:14:19 gleixner Exp $ | 2 | * $Id: ftl.c,v 1.59 2005/11/29 14:48:31 gleixner Exp $ |
3 | * | 3 | * |
4 | * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 4 | * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br> |
5 | * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups | 5 | * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups |
@@ -1084,9 +1084,9 @@ struct mtd_blktrans_ops ftl_tr = { | |||
1084 | .owner = THIS_MODULE, | 1084 | .owner = THIS_MODULE, |
1085 | }; | 1085 | }; |
1086 | 1086 | ||
1087 | int init_ftl(void) | 1087 | static int init_ftl(void) |
1088 | { | 1088 | { |
1089 | DEBUG(0, "$Id: ftl.c,v 1.58 2005/11/07 11:14:19 gleixner Exp $\n"); | 1089 | DEBUG(0, "$Id: ftl.c,v 1.59 2005/11/29 14:48:31 gleixner Exp $\n"); |
1090 | 1090 | ||
1091 | return register_mtd_blktrans(&ftl_tr); | 1091 | return register_mtd_blktrans(&ftl_tr); |
1092 | } | 1092 | } |
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 846a533323a8..452ccd5037c3 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -538,12 +538,6 @@ config MTD_MPC1211 | |||
538 | This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02). | 538 | This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02). |
539 | If you have such a board, say 'Y'. | 539 | If you have such a board, say 'Y'. |
540 | 540 | ||
541 | config MTD_PQ2FADS | ||
542 | tristate "JEDEC flash SIMM mapped on PQ2FADS and 8272ADS boards" | ||
543 | depends on (ADS8272 || PQ2FADS) && MTD_PARTITIONS && MTD_JEDECPROBE && MTD_PHYSMAP && MTD_CFI_GEOMETRY && MTD_CFI_INTELEXT | ||
544 | help | ||
545 | This enables access to flash SIMM on PQ2FADS-like boards | ||
546 | |||
547 | config MTD_OMAP_NOR | 541 | config MTD_OMAP_NOR |
548 | tristate "TI OMAP board mappings" | 542 | tristate "TI OMAP board mappings" |
549 | depends on MTD_CFI && ARCH_OMAP | 543 | depends on MTD_CFI && ARCH_OMAP |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 7d9e940a1dcd..2f7e254912f0 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
@@ -70,6 +70,5 @@ obj-$(CONFIG_MTD_DMV182) += dmv182.o | |||
70 | obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o | 70 | obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o |
71 | obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o | 71 | obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o |
72 | obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o | 72 | obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o |
73 | obj-$(CONFIG_MTD_PQ2FADS) += pq2fads.o | ||
74 | obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o | 73 | obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o |
75 | obj-$(CONFIG_MTD_TQM834x) += tqm834x.o | 74 | obj-$(CONFIG_MTD_TQM834x) += tqm834x.o |
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index a59f8027903c..986c58628390 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ixp4xx.c,v 1.12 2005/11/07 11:14:27 gleixner Exp $ | 2 | * $Id: ixp4xx.c,v 1.13 2005/11/16 16:23:21 dvrabel Exp $ |
3 | * | 3 | * |
4 | * drivers/mtd/maps/ixp4xx.c | 4 | * drivers/mtd/maps/ixp4xx.c |
5 | * | 5 | * |
@@ -34,10 +34,55 @@ | |||
34 | 34 | ||
35 | #include <linux/reboot.h> | 35 | #include <linux/reboot.h> |
36 | 36 | ||
37 | /* | ||
38 | * Read/write a 16 bit word from flash address 'addr'. | ||
39 | * | ||
40 | * When the cpu is in little-endian mode it swizzles the address lines | ||
41 | * ('address coherency') so we need to undo the swizzling to ensure commands | ||
42 | * and the like end up on the correct flash address. | ||
43 | * | ||
44 | * To further complicate matters, due to the way the expansion bus controller | ||
45 | * handles 32 bit reads, the byte stream ABCD is stored on the flash as: | ||
46 | * D15 D0 | ||
47 | * +---+---+ | ||
48 | * | A | B | 0 | ||
49 | * +---+---+ | ||
50 | * | C | D | 2 | ||
51 | * +---+---+ | ||
52 | * This means that on LE systems each 16 bit word must be swapped. Note that | ||
53 | * this requires CONFIG_MTD_CFI_BE_BYTE_SWAP to be enabled to 'unswap' the CFI | ||
54 | * data and other flash commands which are always in D7-D0. | ||
55 | */ | ||
37 | #ifndef __ARMEB__ | 56 | #ifndef __ARMEB__ |
57 | #ifndef CONFIG_MTD_CFI_BE_BYTE_SWAP | ||
58 | # error CONFIG_MTD_CFI_BE_BYTE_SWAP required | ||
59 | #endif | ||
60 | |||
61 | static inline u16 flash_read16(void __iomem *addr) | ||
62 | { | ||
63 | return be16_to_cpu(__raw_readw((void __iomem *)((unsigned long)addr ^ 0x2))); | ||
64 | } | ||
65 | |||
66 | static inline void flash_write16(u16 d, void __iomem *addr) | ||
67 | { | ||
68 | __raw_writew(cpu_to_be16(d), (void __iomem *)((unsigned long)addr ^ 0x2)); | ||
69 | } | ||
70 | |||
38 | #define BYTE0(h) ((h) & 0xFF) | 71 | #define BYTE0(h) ((h) & 0xFF) |
39 | #define BYTE1(h) (((h) >> 8) & 0xFF) | 72 | #define BYTE1(h) (((h) >> 8) & 0xFF) |
73 | |||
40 | #else | 74 | #else |
75 | |||
76 | static inline u16 flash_read16(const void __iomem *addr) | ||
77 | { | ||
78 | return __raw_readw(addr); | ||
79 | } | ||
80 | |||
81 | static inline void flash_write16(u16 d, void __iomem *addr) | ||
82 | { | ||
83 | __raw_writew(d, addr); | ||
84 | } | ||
85 | |||
41 | #define BYTE0(h) (((h) >> 8) & 0xFF) | 86 | #define BYTE0(h) (((h) >> 8) & 0xFF) |
42 | #define BYTE1(h) ((h) & 0xFF) | 87 | #define BYTE1(h) ((h) & 0xFF) |
43 | #endif | 88 | #endif |
@@ -45,7 +90,7 @@ | |||
45 | static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) | 90 | static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) |
46 | { | 91 | { |
47 | map_word val; | 92 | map_word val; |
48 | val.x[0] = le16_to_cpu(readw(map->virt + ofs)); | 93 | val.x[0] = flash_read16(map->virt + ofs); |
49 | return val; | 94 | return val; |
50 | } | 95 | } |
51 | 96 | ||
@@ -57,19 +102,28 @@ static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) | |||
57 | static void ixp4xx_copy_from(struct map_info *map, void *to, | 102 | static void ixp4xx_copy_from(struct map_info *map, void *to, |
58 | unsigned long from, ssize_t len) | 103 | unsigned long from, ssize_t len) |
59 | { | 104 | { |
60 | int i; | ||
61 | u8 *dest = (u8 *) to; | 105 | u8 *dest = (u8 *) to; |
62 | void __iomem *src = map->virt + from; | 106 | void __iomem *src = map->virt + from; |
63 | u16 data; | ||
64 | 107 | ||
65 | for (i = 0; i < (len / 2); i++) { | 108 | if (len <= 0) |
66 | data = le16_to_cpu(readw(src + 2*i)); | 109 | return; |
67 | dest[i * 2] = BYTE0(data); | 110 | |
68 | dest[i * 2 + 1] = BYTE1(data); | 111 | if (from & 1) { |
112 | *dest++ = BYTE1(flash_read16(src)); | ||
113 | src++; | ||
114 | --len; | ||
69 | } | 115 | } |
70 | 116 | ||
71 | if (len & 1) | 117 | while (len >= 2) { |
72 | dest[len - 1] = BYTE0(le16_to_cpu(readw(src + 2*i))); | 118 | u16 data = flash_read16(src); |
119 | *dest++ = BYTE0(data); | ||
120 | *dest++ = BYTE1(data); | ||
121 | src += 2; | ||
122 | len -= 2; | ||
123 | } | ||
124 | |||
125 | if (len > 0) | ||
126 | *dest++ = BYTE0(flash_read16(src)); | ||
73 | } | 127 | } |
74 | 128 | ||
75 | /* | 129 | /* |
@@ -79,7 +133,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to, | |||
79 | static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) | 133 | static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) |
80 | { | 134 | { |
81 | if (!(adr & 1)) | 135 | if (!(adr & 1)) |
82 | writew(cpu_to_le16(d.x[0]), map->virt + adr); | 136 | flash_write16(d.x[0], map->virt + adr); |
83 | } | 137 | } |
84 | 138 | ||
85 | /* | 139 | /* |
@@ -87,7 +141,7 @@ static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long | |||
87 | */ | 141 | */ |
88 | static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) | 142 | static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) |
89 | { | 143 | { |
90 | writew(cpu_to_le16(d.x[0]), map->virt + adr); | 144 | flash_write16(d.x[0], map->virt + adr); |
91 | } | 145 | } |
92 | 146 | ||
93 | struct ixp4xx_flash_info { | 147 | struct ixp4xx_flash_info { |
diff --git a/drivers/mtd/maps/nettel.c b/drivers/mtd/maps/nettel.c index f00ee7e54dba..632eb2aa968f 100644 --- a/drivers/mtd/maps/nettel.c +++ b/drivers/mtd/maps/nettel.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * (C) Copyright 2000-2001, Greg Ungerer (gerg@snapgear.com) | 6 | * (C) Copyright 2000-2001, Greg Ungerer (gerg@snapgear.com) |
7 | * (C) Copyright 2001-2002, SnapGear (www.snapgear.com) | 7 | * (C) Copyright 2001-2002, SnapGear (www.snapgear.com) |
8 | * | 8 | * |
9 | * $Id: nettel.c,v 1.11 2005/11/07 11:14:27 gleixner Exp $ | 9 | * $Id: nettel.c,v 1.12 2005/11/29 14:30:00 gleixner Exp $ |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /****************************************************************************/ | 12 | /****************************************************************************/ |
@@ -479,7 +479,7 @@ void __exit nettel_cleanup(void) | |||
479 | } | 479 | } |
480 | if (nettel_intel_map.virt) { | 480 | if (nettel_intel_map.virt) { |
481 | iounmap(nettel_intel_map.virt); | 481 | iounmap(nettel_intel_map.virt); |
482 | nettel_intel_map.virt = 0; | 482 | nettel_intel_map.virt = NULL; |
483 | } | 483 | } |
484 | #endif | 484 | #endif |
485 | } | 485 | } |
diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c index 8b3570b09095..21822c2edbe4 100644 --- a/drivers/mtd/maps/pci.c +++ b/drivers/mtd/maps/pci.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | * | 9 | * |
10 | * $Id: pci.c,v 1.13 2005/11/07 11:14:27 gleixner Exp $ | 10 | * $Id: pci.c,v 1.14 2005/11/17 08:20:27 dwmw2 Exp $ |
11 | * | 11 | * |
12 | * Generic PCI memory map driver. We support the following boards: | 12 | * Generic PCI memory map driver. We support the following boards: |
13 | * - Intel IQ80310 ATU. | 13 | * - Intel IQ80310 ATU. |
@@ -102,7 +102,7 @@ static void mtd_pci_copyto(struct map_info *_map, unsigned long to, const void * | |||
102 | memcpy_toio(map->base + map->translate(map, to), from, len); | 102 | memcpy_toio(map->base + map->translate(map, to), from, len); |
103 | } | 103 | } |
104 | 104 | ||
105 | static struct map_info mtd_pci_map = { | 105 | static const struct map_info mtd_pci_map = { |
106 | .phys = NO_XIP, | 106 | .phys = NO_XIP, |
107 | .copy_from = mtd_pci_copyfrom, | 107 | .copy_from = mtd_pci_copyfrom, |
108 | .copy_to = mtd_pci_copyto, | 108 | .copy_to = mtd_pci_copyto, |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 9ee760f97bc6..f49ebc3c4606 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: physmap.c,v 1.38 2005/11/07 11:14:28 gleixner Exp $ | 2 | * $Id: physmap.c,v 1.39 2005/11/29 14:49:36 gleixner Exp $ |
3 | * | 3 | * |
4 | * Normal mappings of chips in physical memory | 4 | * Normal mappings of chips in physical memory |
5 | * | 5 | * |
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/mtd/map.h> | 19 | #include <linux/mtd/map.h> |
20 | #include <linux/config.h> | 20 | #include <linux/config.h> |
21 | #include <linux/mtd/partitions.h> | 21 | #include <linux/mtd/partitions.h> |
22 | #include <linux/mtd/physmap.h> | ||
22 | 23 | ||
23 | static struct mtd_info *mymtd; | 24 | static struct mtd_info *mymtd; |
24 | 25 | ||
diff --git a/drivers/mtd/maps/sc520cdp.c b/drivers/mtd/maps/sc520cdp.c index 6fb9f3c57aab..ed92afadd8a9 100644 --- a/drivers/mtd/maps/sc520cdp.c +++ b/drivers/mtd/maps/sc520cdp.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
18 | * | 18 | * |
19 | * $Id: sc520cdp.c,v 1.22 2005/11/07 11:14:28 gleixner Exp $ | 19 | * $Id: sc520cdp.c,v 1.23 2005/11/17 08:20:27 dwmw2 Exp $ |
20 | * | 20 | * |
21 | * | 21 | * |
22 | * The SC520CDP is an evaluation board for the Elan SC520 processor available | 22 | * The SC520CDP is an evaluation board for the Elan SC520 processor available |
@@ -164,7 +164,7 @@ struct sc520_par_table | |||
164 | unsigned long default_address; | 164 | unsigned long default_address; |
165 | }; | 165 | }; |
166 | 166 | ||
167 | static struct sc520_par_table par_table[NUM_FLASH_BANKS] = | 167 | static const struct sc520_par_table par_table[NUM_FLASH_BANKS] = |
168 | { | 168 | { |
169 | { /* Flash Bank #0: selected by ROMCS0 */ | 169 | { /* Flash Bank #0: selected by ROMCS0 */ |
170 | SC520_PAR_ROMCS0, | 170 | SC520_PAR_ROMCS0, |
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index de4500395300..a0af92cc7efd 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c | |||
@@ -1486,7 +1486,7 @@ ns_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len) | |||
1486 | /* | 1486 | /* |
1487 | * Module initialization function | 1487 | * Module initialization function |
1488 | */ | 1488 | */ |
1489 | int __init ns_init_module(void) | 1489 | static int __init ns_init_module(void) |
1490 | { | 1490 | { |
1491 | struct nand_chip *chip; | 1491 | struct nand_chip *chip; |
1492 | struct nandsim *nand; | 1492 | struct nandsim *nand; |
diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c index 0ab8d29caeea..20ce212638fc 100644 --- a/drivers/mtd/rfd_ftl.c +++ b/drivers/mtd/rfd_ftl.c | |||
@@ -30,11 +30,9 @@ MODULE_PARM_DESC(block_size, "Block size to use by RFD, defaults to erase unit s | |||
30 | 30 | ||
31 | #define PREFIX "rfd_ftl: " | 31 | #define PREFIX "rfd_ftl: " |
32 | 32 | ||
33 | /* Major device # for FTL device */ | 33 | /* This major has been assigned by device@lanana.org */ |
34 | |||
35 | /* A request for this major has been sent to device@lanana.org */ | ||
36 | #ifndef RFD_FTL_MAJOR | 34 | #ifndef RFD_FTL_MAJOR |
37 | #define RFD_FTL_MAJOR 95 | 35 | #define RFD_FTL_MAJOR 256 |
38 | #endif | 36 | #endif |
39 | 37 | ||
40 | /* Maximum number of partitions in an FTL region */ | 38 | /* Maximum number of partitions in an FTL region */ |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index dfea346b00a5..f9792528e33f 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -380,23 +380,23 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *)) | |||
380 | 380 | ||
381 | spin_lock_irqsave(&adapter->lock, flags); | 381 | spin_lock_irqsave(&adapter->lock, flags); |
382 | scb = mega_build_cmd(adapter, scmd, &busy); | 382 | scb = mega_build_cmd(adapter, scmd, &busy); |
383 | if (!scb) | ||
384 | goto out; | ||
383 | 385 | ||
384 | if(scb) { | 386 | scb->state |= SCB_PENDQ; |
385 | scb->state |= SCB_PENDQ; | 387 | list_add_tail(&scb->list, &adapter->pending_list); |
386 | list_add_tail(&scb->list, &adapter->pending_list); | ||
387 | 388 | ||
388 | /* | 389 | /* |
389 | * Check if the HBA is in quiescent state, e.g., during a | 390 | * Check if the HBA is in quiescent state, e.g., during a |
390 | * delete logical drive opertion. If it is, don't run | 391 | * delete logical drive opertion. If it is, don't run |
391 | * the pending_list. | 392 | * the pending_list. |
392 | */ | 393 | */ |
393 | if(atomic_read(&adapter->quiescent) == 0) { | 394 | if (atomic_read(&adapter->quiescent) == 0) |
394 | mega_runpendq(adapter); | 395 | mega_runpendq(adapter); |
395 | } | ||
396 | return 0; | ||
397 | } | ||
398 | spin_unlock_irqrestore(&adapter->lock, flags); | ||
399 | 396 | ||
397 | busy = 0; | ||
398 | out: | ||
399 | spin_unlock_irqrestore(&adapter->lock, flags); | ||
400 | return busy; | 400 | return busy; |
401 | } | 401 | } |
402 | 402 | ||
@@ -4677,7 +4677,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
4677 | 4677 | ||
4678 | adapter->flag = flag; | 4678 | adapter->flag = flag; |
4679 | spin_lock_init(&adapter->lock); | 4679 | spin_lock_init(&adapter->lock); |
4680 | scsi_assign_lock(host, &adapter->lock); | ||
4681 | 4680 | ||
4682 | host->cmd_per_lun = max_cmd_per_lun; | 4681 | host->cmd_per_lun = max_cmd_per_lun; |
4683 | host->max_sectors = max_sectors_per_io; | 4682 | host->max_sectors = max_sectors_per_io; |
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index 79861ee12a29..9d59dc62e6d2 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -787,6 +787,9 @@ static const struct usb_device_id cxacru_usb_ids[] = { | |||
787 | { /* V = Conexant P = ADSL modem (Hasbani project) */ | 787 | { /* V = Conexant P = ADSL modem (Hasbani project) */ |
788 | USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00 | 788 | USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00 |
789 | }, | 789 | }, |
790 | { /* V = Conexant P = ADSL modem (Well PTI-800 */ | ||
791 | USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00 | ||
792 | }, | ||
790 | { /* V = Conexant P = ADSL modem */ | 793 | { /* V = Conexant P = ADSL modem */ |
791 | USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00 | 794 | USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00 |
792 | }, | 795 | }, |
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index c466739428b2..2e6593e6c1bd 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -879,7 +879,7 @@ static int usbatm_atm_init(struct usbatm_data *instance) | |||
879 | 879 | ||
880 | fail: | 880 | fail: |
881 | instance->atm_dev = NULL; | 881 | instance->atm_dev = NULL; |
882 | shutdown_atm_dev(atm_dev); /* usbatm_atm_dev_close will eventually be called */ | 882 | atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */ |
883 | return ret; | 883 | return ret; |
884 | } | 884 | } |
885 | 885 | ||
@@ -1164,7 +1164,7 @@ void usbatm_usb_disconnect(struct usb_interface *intf) | |||
1164 | 1164 | ||
1165 | /* ATM finalize */ | 1165 | /* ATM finalize */ |
1166 | if (instance->atm_dev) | 1166 | if (instance->atm_dev) |
1167 | shutdown_atm_dev(instance->atm_dev); | 1167 | atm_dev_deregister(instance->atm_dev); |
1168 | 1168 | ||
1169 | usbatm_put_instance(instance); /* taken in usbatm_usb_probe */ | 1169 | usbatm_put_instance(instance); /* taken in usbatm_usb_probe */ |
1170 | } | 1170 | } |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 5131d88e8c5b..29b5b2a6e183 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -219,6 +219,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) | |||
219 | goto done; | 219 | goto done; |
220 | } | 220 | } |
221 | } | 221 | } |
222 | synchronize_irq(dev->irq); | ||
222 | 223 | ||
223 | /* FIXME until the generic PM interfaces change a lot more, this | 224 | /* FIXME until the generic PM interfaces change a lot more, this |
224 | * can't use PCI D1 and D2 states. For example, the confusion | 225 | * can't use PCI D1 and D2 states. For example, the confusion |
@@ -392,7 +393,7 @@ int usb_hcd_pci_resume (struct pci_dev *dev) | |||
392 | 393 | ||
393 | dev->dev.power.power_state = PMSG_ON; | 394 | dev->dev.power.power_state = PMSG_ON; |
394 | 395 | ||
395 | hcd->saw_irq = 0; | 396 | clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); |
396 | 397 | ||
397 | if (hcd->driver->resume) { | 398 | if (hcd->driver->resume) { |
398 | retval = hcd->driver->resume(hcd); | 399 | retval = hcd->driver->resume(hcd); |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 5e5f65a475ab..da24c31ee00d 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1315,11 +1315,12 @@ static int hcd_unlink_urb (struct urb *urb, int status) | |||
1315 | * finish unlinking the initial failed usb_set_address() | 1315 | * finish unlinking the initial failed usb_set_address() |
1316 | * or device descriptor fetch. | 1316 | * or device descriptor fetch. |
1317 | */ | 1317 | */ |
1318 | if (!hcd->saw_irq && hcd->self.root_hub != urb->dev) { | 1318 | if (!test_bit(HCD_FLAG_SAW_IRQ, &hcd->flags) |
1319 | && hcd->self.root_hub != urb->dev) { | ||
1319 | dev_warn (hcd->self.controller, "Unlink after no-IRQ? " | 1320 | dev_warn (hcd->self.controller, "Unlink after no-IRQ? " |
1320 | "Controller is probably using the wrong IRQ." | 1321 | "Controller is probably using the wrong IRQ." |
1321 | "\n"); | 1322 | "\n"); |
1322 | hcd->saw_irq = 1; | 1323 | set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); |
1323 | } | 1324 | } |
1324 | 1325 | ||
1325 | urb->status = status; | 1326 | urb->status = status; |
@@ -1649,13 +1650,15 @@ irqreturn_t usb_hcd_irq (int irq, void *__hcd, struct pt_regs * r) | |||
1649 | struct usb_hcd *hcd = __hcd; | 1650 | struct usb_hcd *hcd = __hcd; |
1650 | int start = hcd->state; | 1651 | int start = hcd->state; |
1651 | 1652 | ||
1652 | if (start == HC_STATE_HALT) | 1653 | if (unlikely(start == HC_STATE_HALT || |
1654 | !test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) | ||
1653 | return IRQ_NONE; | 1655 | return IRQ_NONE; |
1654 | if (hcd->driver->irq (hcd, r) == IRQ_NONE) | 1656 | if (hcd->driver->irq (hcd, r) == IRQ_NONE) |
1655 | return IRQ_NONE; | 1657 | return IRQ_NONE; |
1656 | 1658 | ||
1657 | hcd->saw_irq = 1; | 1659 | set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); |
1658 | if (hcd->state == HC_STATE_HALT) | 1660 | |
1661 | if (unlikely(hcd->state == HC_STATE_HALT)) | ||
1659 | usb_hc_died (hcd); | 1662 | usb_hc_died (hcd); |
1660 | return IRQ_HANDLED; | 1663 | return IRQ_HANDLED; |
1661 | } | 1664 | } |
@@ -1768,6 +1771,8 @@ int usb_add_hcd(struct usb_hcd *hcd, | |||
1768 | 1771 | ||
1769 | dev_info(hcd->self.controller, "%s\n", hcd->product_desc); | 1772 | dev_info(hcd->self.controller, "%s\n", hcd->product_desc); |
1770 | 1773 | ||
1774 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
1775 | |||
1771 | /* till now HC has been in an indeterminate state ... */ | 1776 | /* till now HC has been in an indeterminate state ... */ |
1772 | if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0) { | 1777 | if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0) { |
1773 | dev_err(hcd->self.controller, "can't reset\n"); | 1778 | dev_err(hcd->self.controller, "can't reset\n"); |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 24a62a2ff86d..c8a1b350e2cf 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -72,7 +72,12 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */ | |||
72 | * hardware info/state | 72 | * hardware info/state |
73 | */ | 73 | */ |
74 | const struct hc_driver *driver; /* hw-specific hooks */ | 74 | const struct hc_driver *driver; /* hw-specific hooks */ |
75 | unsigned saw_irq : 1; | 75 | |
76 | /* Flags that need to be manipulated atomically */ | ||
77 | unsigned long flags; | ||
78 | #define HCD_FLAG_HW_ACCESSIBLE 0x00000001 | ||
79 | #define HCD_FLAG_SAW_IRQ 0x00000002 | ||
80 | |||
76 | unsigned can_wakeup:1; /* hw supports wakeup? */ | 81 | unsigned can_wakeup:1; /* hw supports wakeup? */ |
77 | unsigned remote_wakeup:1;/* sw should use wakeup? */ | 82 | unsigned remote_wakeup:1;/* sw should use wakeup? */ |
78 | unsigned rh_registered:1;/* is root hub registered? */ | 83 | unsigned rh_registered:1;/* is root hub registered? */ |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 441c26064b44..13f73a836e45 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -121,8 +121,8 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) | |||
121 | return 0; | 121 | return 0; |
122 | } | 122 | } |
123 | 123 | ||
124 | /* called by khubd or root hub (re)init threads; leaves HC in halt state */ | 124 | /* called during probe() after chip reset completes */ |
125 | static int ehci_pci_reset(struct usb_hcd *hcd) | 125 | static int ehci_pci_setup(struct usb_hcd *hcd) |
126 | { | 126 | { |
127 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 127 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
128 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | 128 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); |
@@ -141,6 +141,11 @@ static int ehci_pci_reset(struct usb_hcd *hcd) | |||
141 | if (retval) | 141 | if (retval) |
142 | return retval; | 142 | return retval; |
143 | 143 | ||
144 | /* data structure init */ | ||
145 | retval = ehci_init(hcd); | ||
146 | if (retval) | ||
147 | return retval; | ||
148 | |||
144 | /* NOTE: only the parts below this line are PCI-specific */ | 149 | /* NOTE: only the parts below this line are PCI-specific */ |
145 | 150 | ||
146 | switch (pdev->vendor) { | 151 | switch (pdev->vendor) { |
@@ -154,7 +159,8 @@ static int ehci_pci_reset(struct usb_hcd *hcd) | |||
154 | /* AMD8111 EHCI doesn't work, according to AMD errata */ | 159 | /* AMD8111 EHCI doesn't work, according to AMD errata */ |
155 | if (pdev->device == 0x7463) { | 160 | if (pdev->device == 0x7463) { |
156 | ehci_info(ehci, "ignoring AMD8111 (errata)\n"); | 161 | ehci_info(ehci, "ignoring AMD8111 (errata)\n"); |
157 | return -EIO; | 162 | retval = -EIO; |
163 | goto done; | ||
158 | } | 164 | } |
159 | break; | 165 | break; |
160 | case PCI_VENDOR_ID_NVIDIA: | 166 | case PCI_VENDOR_ID_NVIDIA: |
@@ -207,9 +213,8 @@ static int ehci_pci_reset(struct usb_hcd *hcd) | |||
207 | /* REVISIT: per-port wake capability (PCI 0x62) currently unused */ | 213 | /* REVISIT: per-port wake capability (PCI 0x62) currently unused */ |
208 | 214 | ||
209 | retval = ehci_pci_reinit(ehci, pdev); | 215 | retval = ehci_pci_reinit(ehci, pdev); |
210 | 216 | done: | |
211 | /* finish init */ | 217 | return retval; |
212 | return ehci_init(hcd); | ||
213 | } | 218 | } |
214 | 219 | ||
215 | /*-------------------------------------------------------------------------*/ | 220 | /*-------------------------------------------------------------------------*/ |
@@ -228,14 +233,36 @@ static int ehci_pci_reset(struct usb_hcd *hcd) | |||
228 | static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message) | 233 | static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message) |
229 | { | 234 | { |
230 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 235 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
236 | unsigned long flags; | ||
237 | int rc = 0; | ||
231 | 238 | ||
232 | if (time_before(jiffies, ehci->next_statechange)) | 239 | if (time_before(jiffies, ehci->next_statechange)) |
233 | msleep(10); | 240 | msleep(10); |
234 | 241 | ||
242 | /* Root hub was already suspended. Disable irq emission and | ||
243 | * mark HW unaccessible, bail out if RH has been resumed. Use | ||
244 | * the spinlock to properly synchronize with possible pending | ||
245 | * RH suspend or resume activity. | ||
246 | * | ||
247 | * This is still racy as hcd->state is manipulated outside of | ||
248 | * any locks =P But that will be a different fix. | ||
249 | */ | ||
250 | spin_lock_irqsave (&ehci->lock, flags); | ||
251 | if (hcd->state != HC_STATE_SUSPENDED) { | ||
252 | rc = -EINVAL; | ||
253 | goto bail; | ||
254 | } | ||
255 | writel (0, &ehci->regs->intr_enable); | ||
256 | (void)readl(&ehci->regs->intr_enable); | ||
257 | |||
258 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
259 | bail: | ||
260 | spin_unlock_irqrestore (&ehci->lock, flags); | ||
261 | |||
235 | // could save FLADJ in case of Vaux power loss | 262 | // could save FLADJ in case of Vaux power loss |
236 | // ... we'd only use it to handle clock skew | 263 | // ... we'd only use it to handle clock skew |
237 | 264 | ||
238 | return 0; | 265 | return rc; |
239 | } | 266 | } |
240 | 267 | ||
241 | static int ehci_pci_resume(struct usb_hcd *hcd) | 268 | static int ehci_pci_resume(struct usb_hcd *hcd) |
@@ -251,6 +278,9 @@ static int ehci_pci_resume(struct usb_hcd *hcd) | |||
251 | if (time_before(jiffies, ehci->next_statechange)) | 278 | if (time_before(jiffies, ehci->next_statechange)) |
252 | msleep(100); | 279 | msleep(100); |
253 | 280 | ||
281 | /* Mark hardware accessible again as we are out of D3 state by now */ | ||
282 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
283 | |||
254 | /* If CF is clear, we lost PCI Vaux power and need to restart. */ | 284 | /* If CF is clear, we lost PCI Vaux power and need to restart. */ |
255 | if (readl(&ehci->regs->configured_flag) != FLAG_CF) | 285 | if (readl(&ehci->regs->configured_flag) != FLAG_CF) |
256 | goto restart; | 286 | goto restart; |
@@ -319,7 +349,7 @@ static const struct hc_driver ehci_pci_hc_driver = { | |||
319 | /* | 349 | /* |
320 | * basic lifecycle operations | 350 | * basic lifecycle operations |
321 | */ | 351 | */ |
322 | .reset = ehci_pci_reset, | 352 | .reset = ehci_pci_setup, |
323 | .start = ehci_run, | 353 | .start = ehci_run, |
324 | #ifdef CONFIG_PM | 354 | #ifdef CONFIG_PM |
325 | .suspend = ehci_pci_suspend, | 355 | .suspend = ehci_pci_suspend, |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 5bb872c3496d..bf03ec0d8ee2 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -912,6 +912,7 @@ submit_async ( | |||
912 | int epnum; | 912 | int epnum; |
913 | unsigned long flags; | 913 | unsigned long flags; |
914 | struct ehci_qh *qh = NULL; | 914 | struct ehci_qh *qh = NULL; |
915 | int rc = 0; | ||
915 | 916 | ||
916 | qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list); | 917 | qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list); |
917 | epnum = ep->desc.bEndpointAddress; | 918 | epnum = ep->desc.bEndpointAddress; |
@@ -926,21 +927,28 @@ submit_async ( | |||
926 | #endif | 927 | #endif |
927 | 928 | ||
928 | spin_lock_irqsave (&ehci->lock, flags); | 929 | spin_lock_irqsave (&ehci->lock, flags); |
930 | if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, | ||
931 | &ehci_to_hcd(ehci)->flags))) { | ||
932 | rc = -ESHUTDOWN; | ||
933 | goto done; | ||
934 | } | ||
935 | |||
929 | qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv); | 936 | qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv); |
937 | if (unlikely(qh == NULL)) { | ||
938 | rc = -ENOMEM; | ||
939 | goto done; | ||
940 | } | ||
930 | 941 | ||
931 | /* Control/bulk operations through TTs don't need scheduling, | 942 | /* Control/bulk operations through TTs don't need scheduling, |
932 | * the HC and TT handle it when the TT has a buffer ready. | 943 | * the HC and TT handle it when the TT has a buffer ready. |
933 | */ | 944 | */ |
934 | if (likely (qh != NULL)) { | 945 | if (likely (qh->qh_state == QH_STATE_IDLE)) |
935 | if (likely (qh->qh_state == QH_STATE_IDLE)) | 946 | qh_link_async (ehci, qh_get (qh)); |
936 | qh_link_async (ehci, qh_get (qh)); | 947 | done: |
937 | } | ||
938 | spin_unlock_irqrestore (&ehci->lock, flags); | 948 | spin_unlock_irqrestore (&ehci->lock, flags); |
939 | if (unlikely (qh == NULL)) { | 949 | if (unlikely (qh == NULL)) |
940 | qtd_list_free (ehci, urb, qtd_list); | 950 | qtd_list_free (ehci, urb, qtd_list); |
941 | return -ENOMEM; | 951 | return rc; |
942 | } | ||
943 | return 0; | ||
944 | } | 952 | } |
945 | 953 | ||
946 | /*-------------------------------------------------------------------------*/ | 954 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index f0c8aa1ccd5d..57e77374d228 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -602,6 +602,12 @@ static int intr_submit ( | |||
602 | 602 | ||
603 | spin_lock_irqsave (&ehci->lock, flags); | 603 | spin_lock_irqsave (&ehci->lock, flags); |
604 | 604 | ||
605 | if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, | ||
606 | &ehci_to_hcd(ehci)->flags))) { | ||
607 | status = -ESHUTDOWN; | ||
608 | goto done; | ||
609 | } | ||
610 | |||
605 | /* get qh and force any scheduling errors */ | 611 | /* get qh and force any scheduling errors */ |
606 | INIT_LIST_HEAD (&empty); | 612 | INIT_LIST_HEAD (&empty); |
607 | qh = qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv); | 613 | qh = qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv); |
@@ -1456,7 +1462,11 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, | |||
1456 | 1462 | ||
1457 | /* schedule ... need to lock */ | 1463 | /* schedule ... need to lock */ |
1458 | spin_lock_irqsave (&ehci->lock, flags); | 1464 | spin_lock_irqsave (&ehci->lock, flags); |
1459 | status = iso_stream_schedule (ehci, urb, stream); | 1465 | if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, |
1466 | &ehci_to_hcd(ehci)->flags))) | ||
1467 | status = -ESHUTDOWN; | ||
1468 | else | ||
1469 | status = iso_stream_schedule (ehci, urb, stream); | ||
1460 | if (likely (status == 0)) | 1470 | if (likely (status == 0)) |
1461 | itd_link_urb (ehci, urb, ehci->periodic_size << 3, stream); | 1471 | itd_link_urb (ehci, urb, ehci->periodic_size << 3, stream); |
1462 | spin_unlock_irqrestore (&ehci->lock, flags); | 1472 | spin_unlock_irqrestore (&ehci->lock, flags); |
@@ -1815,7 +1825,11 @@ static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb, | |||
1815 | 1825 | ||
1816 | /* schedule ... need to lock */ | 1826 | /* schedule ... need to lock */ |
1817 | spin_lock_irqsave (&ehci->lock, flags); | 1827 | spin_lock_irqsave (&ehci->lock, flags); |
1818 | status = iso_stream_schedule (ehci, urb, stream); | 1828 | if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, |
1829 | &ehci_to_hcd(ehci)->flags))) | ||
1830 | status = -ESHUTDOWN; | ||
1831 | else | ||
1832 | status = iso_stream_schedule (ehci, urb, stream); | ||
1819 | if (status == 0) | 1833 | if (status == 0) |
1820 | sitd_link_urb (ehci, urb, ehci->periodic_size << 3, stream); | 1834 | sitd_link_urb (ehci, urb, ehci->periodic_size << 3, stream); |
1821 | spin_unlock_irqrestore (&ehci->lock, flags); | 1835 | spin_unlock_irqrestore (&ehci->lock, flags); |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 5c0c6c8a7a82..bf1d9abc07ac 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -115,7 +115,7 @@ | |||
115 | 115 | ||
116 | /*-------------------------------------------------------------------------*/ | 116 | /*-------------------------------------------------------------------------*/ |
117 | 117 | ||
118 | // #define OHCI_VERBOSE_DEBUG /* not always helpful */ | 118 | #undef OHCI_VERBOSE_DEBUG /* not always helpful */ |
119 | 119 | ||
120 | /* For initializing controller (mask in an HCFS mode too) */ | 120 | /* For initializing controller (mask in an HCFS mode too) */ |
121 | #define OHCI_CONTROL_INIT OHCI_CTRL_CBSR | 121 | #define OHCI_CONTROL_INIT OHCI_CTRL_CBSR |
@@ -253,6 +253,10 @@ static int ohci_urb_enqueue ( | |||
253 | spin_lock_irqsave (&ohci->lock, flags); | 253 | spin_lock_irqsave (&ohci->lock, flags); |
254 | 254 | ||
255 | /* don't submit to a dead HC */ | 255 | /* don't submit to a dead HC */ |
256 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { | ||
257 | retval = -ENODEV; | ||
258 | goto fail; | ||
259 | } | ||
256 | if (!HC_IS_RUNNING(hcd->state)) { | 260 | if (!HC_IS_RUNNING(hcd->state)) { |
257 | retval = -ENODEV; | 261 | retval = -ENODEV; |
258 | goto fail; | 262 | goto fail; |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index e01e77bc324b..72e3b12a1926 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -53,6 +53,11 @@ static int ohci_bus_suspend (struct usb_hcd *hcd) | |||
53 | 53 | ||
54 | spin_lock_irqsave (&ohci->lock, flags); | 54 | spin_lock_irqsave (&ohci->lock, flags); |
55 | 55 | ||
56 | if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) { | ||
57 | spin_unlock_irqrestore (&ohci->lock, flags); | ||
58 | return -ESHUTDOWN; | ||
59 | } | ||
60 | |||
56 | ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); | 61 | ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); |
57 | switch (ohci->hc_control & OHCI_CTRL_HCFS) { | 62 | switch (ohci->hc_control & OHCI_CTRL_HCFS) { |
58 | case OHCI_USB_RESUME: | 63 | case OHCI_USB_RESUME: |
@@ -140,11 +145,19 @@ static int ohci_bus_resume (struct usb_hcd *hcd) | |||
140 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 145 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
141 | u32 temp, enables; | 146 | u32 temp, enables; |
142 | int status = -EINPROGRESS; | 147 | int status = -EINPROGRESS; |
148 | unsigned long flags; | ||
143 | 149 | ||
144 | if (time_before (jiffies, ohci->next_statechange)) | 150 | if (time_before (jiffies, ohci->next_statechange)) |
145 | msleep(5); | 151 | msleep(5); |
146 | 152 | ||
147 | spin_lock_irq (&ohci->lock); | 153 | spin_lock_irqsave (&ohci->lock, flags); |
154 | |||
155 | if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) { | ||
156 | spin_unlock_irqrestore (&ohci->lock, flags); | ||
157 | return -ESHUTDOWN; | ||
158 | } | ||
159 | |||
160 | |||
148 | ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); | 161 | ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); |
149 | 162 | ||
150 | if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { | 163 | if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { |
@@ -179,7 +192,7 @@ static int ohci_bus_resume (struct usb_hcd *hcd) | |||
179 | ohci_dbg (ohci, "lost power\n"); | 192 | ohci_dbg (ohci, "lost power\n"); |
180 | status = -EBUSY; | 193 | status = -EBUSY; |
181 | } | 194 | } |
182 | spin_unlock_irq (&ohci->lock); | 195 | spin_unlock_irqrestore (&ohci->lock, flags); |
183 | if (status == -EBUSY) { | 196 | if (status == -EBUSY) { |
184 | (void) ohci_init (ohci); | 197 | (void) ohci_init (ohci); |
185 | return ohci_restart (ohci); | 198 | return ohci_restart (ohci); |
@@ -297,8 +310,8 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf) | |||
297 | /* handle autosuspended root: finish resuming before | 310 | /* handle autosuspended root: finish resuming before |
298 | * letting khubd or root hub timer see state changes. | 311 | * letting khubd or root hub timer see state changes. |
299 | */ | 312 | */ |
300 | if ((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER | 313 | if (unlikely((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER |
301 | || !HC_IS_RUNNING(hcd->state)) { | 314 | || !HC_IS_RUNNING(hcd->state))) { |
302 | can_suspend = 0; | 315 | can_suspend = 0; |
303 | goto done; | 316 | goto done; |
304 | } | 317 | } |
@@ -508,6 +521,9 @@ static int ohci_hub_control ( | |||
508 | u32 temp; | 521 | u32 temp; |
509 | int retval = 0; | 522 | int retval = 0; |
510 | 523 | ||
524 | if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) | ||
525 | return -ESHUTDOWN; | ||
526 | |||
511 | switch (typeReq) { | 527 | switch (typeReq) { |
512 | case ClearHubFeature: | 528 | case ClearHubFeature: |
513 | switch (wValue) { | 529 | switch (wValue) { |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 5f22e6590cd1..1b09dde068e1 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -105,13 +105,36 @@ ohci_pci_start (struct usb_hcd *hcd) | |||
105 | 105 | ||
106 | static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) | 106 | static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) |
107 | { | 107 | { |
108 | /* root hub was already suspended */ | 108 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
109 | return 0; | 109 | unsigned long flags; |
110 | int rc = 0; | ||
111 | |||
112 | /* Root hub was already suspended. Disable irq emission and | ||
113 | * mark HW unaccessible, bail out if RH has been resumed. Use | ||
114 | * the spinlock to properly synchronize with possible pending | ||
115 | * RH suspend or resume activity. | ||
116 | * | ||
117 | * This is still racy as hcd->state is manipulated outside of | ||
118 | * any locks =P But that will be a different fix. | ||
119 | */ | ||
120 | spin_lock_irqsave (&ohci->lock, flags); | ||
121 | if (hcd->state != HC_STATE_SUSPENDED) { | ||
122 | rc = -EINVAL; | ||
123 | goto bail; | ||
124 | } | ||
125 | ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); | ||
126 | (void)ohci_readl(ohci, &ohci->regs->intrdisable); | ||
127 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
128 | bail: | ||
129 | spin_unlock_irqrestore (&ohci->lock, flags); | ||
130 | |||
131 | return rc; | ||
110 | } | 132 | } |
111 | 133 | ||
112 | 134 | ||
113 | static int ohci_pci_resume (struct usb_hcd *hcd) | 135 | static int ohci_pci_resume (struct usb_hcd *hcd) |
114 | { | 136 | { |
137 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
115 | usb_hcd_resume_root_hub(hcd); | 138 | usb_hcd_resume_root_hub(hcd); |
116 | return 0; | 139 | return 0; |
117 | } | 140 | } |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index d33ce3982a5f..ed550132db0b 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -717,6 +717,7 @@ static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message) | |||
717 | * at the source, so we must turn off PIRQ. | 717 | * at the source, so we must turn off PIRQ. |
718 | */ | 718 | */ |
719 | pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); | 719 | pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); |
720 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
720 | uhci->hc_inaccessible = 1; | 721 | uhci->hc_inaccessible = 1; |
721 | hcd->poll_rh = 0; | 722 | hcd->poll_rh = 0; |
722 | 723 | ||
@@ -733,6 +734,11 @@ static int uhci_resume(struct usb_hcd *hcd) | |||
733 | 734 | ||
734 | dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__); | 735 | dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__); |
735 | 736 | ||
737 | /* We aren't in D3 state anymore, we do that even if dead as I | ||
738 | * really don't want to keep a stale HCD_FLAG_HW_ACCESSIBLE=0 | ||
739 | */ | ||
740 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
741 | |||
736 | if (uhci->rh_state == UHCI_RH_RESET) /* Dead */ | 742 | if (uhci->rh_state == UHCI_RH_RESET) /* Dead */ |
737 | return 0; | 743 | return 0; |
738 | spin_lock_irq(&uhci->lock); | 744 | spin_lock_irq(&uhci->lock); |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 25b6ca6ad081..3e470c8b4193 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -534,6 +534,12 @@ config FB_SUN3 | |||
534 | bool "Sun3 framebuffer support" | 534 | bool "Sun3 framebuffer support" |
535 | depends on (FB = y) && (SUN3 || SUN3X) && BROKEN | 535 | depends on (FB = y) && (SUN3 || SUN3X) && BROKEN |
536 | 536 | ||
537 | config FB_SBUS | ||
538 | bool "SBUS and UPA framebuffers" | ||
539 | depends on (FB = y) && (SPARC32 || SPARC64) | ||
540 | help | ||
541 | Say Y if you want support for SBUS or UPA based frame buffer device. | ||
542 | |||
537 | config FB_BW2 | 543 | config FB_BW2 |
538 | bool "BWtwo support" | 544 | bool "BWtwo support" |
539 | depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) | 545 | depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) |
@@ -546,6 +552,7 @@ config FB_BW2 | |||
546 | config FB_CG3 | 552 | config FB_CG3 |
547 | bool "CGthree support" | 553 | bool "CGthree support" |
548 | depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) | 554 | depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) |
555 | select FB_CFB_FILLRECT | ||
549 | select FB_CFB_COPYAREA | 556 | select FB_CFB_COPYAREA |
550 | select FB_CFB_IMAGEBLIT | 557 | select FB_CFB_IMAGEBLIT |
551 | help | 558 | help |
@@ -1210,12 +1217,6 @@ config FB_AU1100 | |||
1210 | 1217 | ||
1211 | source "drivers/video/geode/Kconfig" | 1218 | source "drivers/video/geode/Kconfig" |
1212 | 1219 | ||
1213 | config FB_SBUS | ||
1214 | bool "SBUS and UPA framebuffers" | ||
1215 | depends on (FB = y) && (SPARC32 || SPARC64) | ||
1216 | help | ||
1217 | Say Y if you want support for SBUS or UPA based frame buffer device. | ||
1218 | |||
1219 | config FB_FFB | 1220 | config FB_FFB |
1220 | bool "Creator/Creator3D/Elite3D support" | 1221 | bool "Creator/Creator3D/Elite3D support" |
1221 | depends on FB_SBUS && SPARC64 | 1222 | depends on FB_SBUS && SPARC64 |
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index 2858c5c8ba3c..e0dbdfc0c8b4 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
@@ -404,7 +404,7 @@ struct cirrusfb_info { | |||
404 | struct cirrusfb_regs currentmode; | 404 | struct cirrusfb_regs currentmode; |
405 | int blank_mode; | 405 | int blank_mode; |
406 | 406 | ||
407 | u32 pseudo_palette[17]; | 407 | u32 pseudo_palette[16]; |
408 | struct { u8 red, green, blue, pad; } palette[256]; | 408 | struct { u8 red, green, blue, pad; } palette[256]; |
409 | 409 | ||
410 | #ifdef CONFIG_ZORRO | 410 | #ifdef CONFIG_ZORRO |
@@ -1603,14 +1603,14 @@ static int cirrusfb_setcolreg (unsigned regno, unsigned red, unsigned green, | |||
1603 | 1603 | ||
1604 | switch (info->var.bits_per_pixel) { | 1604 | switch (info->var.bits_per_pixel) { |
1605 | case 8: | 1605 | case 8: |
1606 | ((u8*)(info->pseudo_palette))[regno] = v; | 1606 | cinfo->pseudo_palette[regno] = v; |
1607 | break; | 1607 | break; |
1608 | case 16: | 1608 | case 16: |
1609 | ((u16*)(info->pseudo_palette))[regno] = v; | 1609 | cinfo->pseudo_palette[regno] = v; |
1610 | break; | 1610 | break; |
1611 | case 24: | 1611 | case 24: |
1612 | case 32: | 1612 | case 32: |
1613 | ((u32*)(info->pseudo_palette))[regno] = v; | 1613 | cinfo->pseudo_palette[regno] = v; |
1614 | break; | 1614 | break; |
1615 | } | 1615 | } |
1616 | return 0; | 1616 | return 0; |
@@ -2020,18 +2020,21 @@ static void cirrusfb_prim_fillrect(struct cirrusfb_info *cinfo, | |||
2020 | const struct fb_fillrect *region) | 2020 | const struct fb_fillrect *region) |
2021 | { | 2021 | { |
2022 | int m; /* bytes per pixel */ | 2022 | int m; /* bytes per pixel */ |
2023 | u32 color = (cinfo->info->fix.visual == FB_VISUAL_TRUECOLOR) ? | ||
2024 | cinfo->pseudo_palette[region->color] : region->color; | ||
2025 | |||
2023 | if(cinfo->info->var.bits_per_pixel == 1) { | 2026 | if(cinfo->info->var.bits_per_pixel == 1) { |
2024 | cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, | 2027 | cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, |
2025 | region->dx / 8, region->dy, | 2028 | region->dx / 8, region->dy, |
2026 | region->width / 8, region->height, | 2029 | region->width / 8, region->height, |
2027 | region->color, | 2030 | color, |
2028 | cinfo->currentmode.line_length); | 2031 | cinfo->currentmode.line_length); |
2029 | } else { | 2032 | } else { |
2030 | m = ( cinfo->info->var.bits_per_pixel + 7 ) / 8; | 2033 | m = ( cinfo->info->var.bits_per_pixel + 7 ) / 8; |
2031 | cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, | 2034 | cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, |
2032 | region->dx * m, region->dy, | 2035 | region->dx * m, region->dy, |
2033 | region->width * m, region->height, | 2036 | region->width * m, region->height, |
2034 | region->color, | 2037 | color, |
2035 | cinfo->currentmode.line_length); | 2038 | cinfo->currentmode.line_length); |
2036 | } | 2039 | } |
2037 | return; | 2040 | return; |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 6bded10c0d50..943ef9b82244 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,10 +1,12 @@ | |||
1 | Version 1.39 | 1 | Version 1.39 |
2 | ------------ | 2 | ------------ |
3 | Defer close of a file handle slightly if pending writes depend on that file handle | 3 | Defer close of a file handle slightly if pending writes depend on that handle |
4 | (this reduces the EBADF bad file handle errors that can be logged under heavy | 4 | (this reduces the EBADF bad file handle errors that can be logged under heavy |
5 | stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2 | 5 | stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2 |
6 | Fix SFU style symlinks and mknod needed for servers which do not support the CIFS | 6 | Fix SFU style symlinks and mknod needed for servers which do not support the |
7 | Unix Extensions. Fix setfacl/getfacl on bigendian. | 7 | CIFS Unix Extensions. Fix setfacl/getfacl on bigendian. Timeout negative |
8 | dentries so files that the client sees as deleted but that later get created | ||
9 | on the server will be recognized. Add client side permission check on setattr. | ||
8 | 10 | ||
9 | Version 1.38 | 11 | Version 1.38 |
10 | ------------ | 12 | ------------ |
diff --git a/fs/cifs/README b/fs/cifs/README index bb90941826ad..e5d09a2fc7a5 100644 --- a/fs/cifs/README +++ b/fs/cifs/README | |||
@@ -278,7 +278,9 @@ A partial list of the supported mount options follows: | |||
278 | (such as Windows), permissions can also be checked at the | 278 | (such as Windows), permissions can also be checked at the |
279 | client, and a crude form of client side permission checking | 279 | client, and a crude form of client side permission checking |
280 | can be enabled by specifying file_mode and dir_mode on | 280 | can be enabled by specifying file_mode and dir_mode on |
281 | the client | 281 | the client. Note that the mount.cifs helper must be |
282 | at version 1.10 or higher to support specifying the uid | ||
283 | (or gid) in non-numberic form. | ||
282 | gid If CIFS Unix extensions are not supported by the server | 284 | gid If CIFS Unix extensions are not supported by the server |
283 | this overrides the default gid for inodes. | 285 | this overrides the default gid for inodes. |
284 | file_mode If CIFS Unix extensions are not supported by the server | 286 | file_mode If CIFS Unix extensions are not supported by the server |
@@ -345,7 +347,10 @@ A partial list of the supported mount options follows: | |||
345 | client system. It is typically only needed when the server | 347 | client system. It is typically only needed when the server |
346 | supports the CIFS Unix Extensions but the UIDs/GIDs on the | 348 | supports the CIFS Unix Extensions but the UIDs/GIDs on the |
347 | client and server system do not match closely enough to allow | 349 | client and server system do not match closely enough to allow |
348 | access by the user doing the mount. | 350 | access by the user doing the mount, but it may be useful with |
351 | non CIFS Unix Extension mounts for cases in which the default | ||
352 | mode is specified on the mount but is not to be enforced on the | ||
353 | client (e.g. perhaps when MultiUserMount is enabled) | ||
349 | Note that this does not affect the normal ACL check on the | 354 | Note that this does not affect the normal ACL check on the |
350 | target machine done by the server software (of the server | 355 | target machine done by the server software (of the server |
351 | ACL against the user name provided at mount time). | 356 | ACL against the user name provided at mount time). |
@@ -368,15 +373,21 @@ A partial list of the supported mount options follows: | |||
368 | setuids If the CIFS Unix extensions are negotiated with the server | 373 | setuids If the CIFS Unix extensions are negotiated with the server |
369 | the client will attempt to set the effective uid and gid of | 374 | the client will attempt to set the effective uid and gid of |
370 | the local process on newly created files, directories, and | 375 | the local process on newly created files, directories, and |
371 | devices (create, mkdir, mknod). | 376 | devices (create, mkdir, mknod). If the CIFS Unix Extensions |
377 | are not negotiated, for newly created files and directories | ||
378 | instead of using the default uid and gid specified on the | ||
379 | the mount, cache the new file's uid and gid locally which means | ||
380 | that the uid for the file can change when the inode is | ||
381 | reloaded (or the user remounts the share). | ||
372 | nosetuids The client will not attempt to set the uid and gid on | 382 | nosetuids The client will not attempt to set the uid and gid on |
373 | on newly created files, directories, and devices (create, | 383 | on newly created files, directories, and devices (create, |
374 | mkdir, mknod) which will result in the server setting the | 384 | mkdir, mknod) which will result in the server setting the |
375 | uid and gid to the default (usually the server uid of the | 385 | uid and gid to the default (usually the server uid of the |
376 | user who mounted the share). Letting the server (rather than | 386 | user who mounted the share). Letting the server (rather than |
377 | the client) set the uid and gid is the default. This | 387 | the client) set the uid and gid is the default. If the CIFS |
378 | parameter has no effect if the CIFS Unix Extensions are not | 388 | Unix Extensions are not negotiated then the uid and gid for |
379 | negotiated. | 389 | new files will appear to be the uid (gid) of the mounter or the |
390 | uid (gid) parameter specified on the mount. | ||
380 | netbiosname When mounting to servers via port 139, specifies the RFC1001 | 391 | netbiosname When mounting to servers via port 139, specifies the RFC1001 |
381 | source name to use to represent the client netbios machine | 392 | source name to use to represent the client netbios machine |
382 | name when doing the RFC1001 netbios session initialize. | 393 | name when doing the RFC1001 netbios session initialize. |
@@ -418,6 +429,13 @@ A partial list of the supported mount options follows: | |||
418 | byte range locks). | 429 | byte range locks). |
419 | remount remount the share (often used to change from ro to rw mounts | 430 | remount remount the share (often used to change from ro to rw mounts |
420 | or vice versa) | 431 | or vice versa) |
432 | sfu When the CIFS Unix Extensions are not negotiated, attempt to | ||
433 | create device files and fifos in a format compatible with | ||
434 | Services for Unix (SFU). In addition retrieve bits 10-12 | ||
435 | of the mode via the SETFILEBITS extended attribute (as | ||
436 | SFU does). In the future the bottom 9 bits of the mode | ||
437 | mode also will be emulated using queries of the security | ||
438 | descriptor (ACL). | ||
421 | 439 | ||
422 | The mount.cifs mount helper also accepts a few mount options before -o | 440 | The mount.cifs mount helper also accepts a few mount options before -o |
423 | including: | 441 | including: |
diff --git a/fs/cifs/TODO b/fs/cifs/TODO index c909298d11ed..fc34c74ec4be 100644 --- a/fs/cifs/TODO +++ b/fs/cifs/TODO | |||
@@ -1,4 +1,4 @@ | |||
1 | version 1.37 October 9, 2005 | 1 | Version 1.39 November 30, 2005 |
2 | 2 | ||
3 | A Partial List of Missing Features | 3 | A Partial List of Missing Features |
4 | ================================== | 4 | ================================== |
@@ -58,7 +58,7 @@ o) Improve performance of readpages by sending more than one read | |||
58 | at a time when 8 pages or more are requested. In conjuntion | 58 | at a time when 8 pages or more are requested. In conjuntion |
59 | add support for async_cifs_readpages. | 59 | add support for async_cifs_readpages. |
60 | 60 | ||
61 | p) Add support for storing symlink and fifo info to Windows servers | 61 | p) Add support for storing symlink info to Windows servers |
62 | in the Extended Attribute format their SFU clients would recognize. | 62 | in the Extended Attribute format their SFU clients would recognize. |
63 | 63 | ||
64 | q) Finish fcntl D_NOTIFY support so kde and gnome file list windows | 64 | q) Finish fcntl D_NOTIFY support so kde and gnome file list windows |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 51548ed2e9cc..2a13a2bac8f1 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
33 | #include <linux/vfs.h> | 33 | #include <linux/vfs.h> |
34 | #include <linux/mempool.h> | 34 | #include <linux/mempool.h> |
35 | #include <linux/delay.h> | ||
35 | #include "cifsfs.h" | 36 | #include "cifsfs.h" |
36 | #include "cifspdu.h" | 37 | #include "cifspdu.h" |
37 | #define DECLARE_GLOBALS_HERE | 38 | #define DECLARE_GLOBALS_HERE |
@@ -429,6 +430,11 @@ static void cifs_umount_begin(struct super_block * sblock) | |||
429 | { | 430 | { |
430 | cFYI(1,("wake up tasks now - umount begin not complete")); | 431 | cFYI(1,("wake up tasks now - umount begin not complete")); |
431 | wake_up_all(&tcon->ses->server->request_q); | 432 | wake_up_all(&tcon->ses->server->request_q); |
433 | wake_up_all(&tcon->ses->server->response_q); | ||
434 | msleep(1); /* yield */ | ||
435 | /* we have to kick the requests once more */ | ||
436 | wake_up_all(&tcon->ses->server->response_q); | ||
437 | msleep(1); | ||
432 | } | 438 | } |
433 | /* BB FIXME - finish add checks for tidStatus BB */ | 439 | /* BB FIXME - finish add checks for tidStatus BB */ |
434 | 440 | ||
@@ -895,6 +901,9 @@ static int cifs_oplock_thread(void * dummyarg) | |||
895 | 901 | ||
896 | static int cifs_dnotify_thread(void * dummyarg) | 902 | static int cifs_dnotify_thread(void * dummyarg) |
897 | { | 903 | { |
904 | struct list_head *tmp; | ||
905 | struct cifsSesInfo *ses; | ||
906 | |||
898 | daemonize("cifsdnotifyd"); | 907 | daemonize("cifsdnotifyd"); |
899 | allow_signal(SIGTERM); | 908 | allow_signal(SIGTERM); |
900 | 909 | ||
@@ -903,7 +912,19 @@ static int cifs_dnotify_thread(void * dummyarg) | |||
903 | if(try_to_freeze()) | 912 | if(try_to_freeze()) |
904 | continue; | 913 | continue; |
905 | set_current_state(TASK_INTERRUPTIBLE); | 914 | set_current_state(TASK_INTERRUPTIBLE); |
906 | schedule_timeout(39*HZ); | 915 | schedule_timeout(15*HZ); |
916 | read_lock(&GlobalSMBSeslock); | ||
917 | /* check if any stuck requests that need | ||
918 | to be woken up and wakeq so the | ||
919 | thread can wake up and error out */ | ||
920 | list_for_each(tmp, &GlobalSMBSessionList) { | ||
921 | ses = list_entry(tmp, struct cifsSesInfo, | ||
922 | cifsSessionList); | ||
923 | if(ses && ses->server && | ||
924 | atomic_read(&ses->server->inFlight)) | ||
925 | wake_up_all(&ses->server->response_q); | ||
926 | } | ||
927 | read_unlock(&GlobalSMBSeslock); | ||
907 | } while(!signal_pending(current)); | 928 | } while(!signal_pending(current)); |
908 | complete_and_exit (&cifs_dnotify_exited, 0); | 929 | complete_and_exit (&cifs_dnotify_exited, 0); |
909 | } | 930 | } |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index d179b0c3eee4..6867e556d37e 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -90,6 +90,18 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
90 | check for tcp and smb session status done differently | 90 | check for tcp and smb session status done differently |
91 | for those three - in the calling routine */ | 91 | for those three - in the calling routine */ |
92 | if(tcon) { | 92 | if(tcon) { |
93 | if(tcon->tidStatus == CifsExiting) { | ||
94 | /* only tree disconnect, open, and write, | ||
95 | (and ulogoff which does not have tcon) | ||
96 | are allowed as we start force umount */ | ||
97 | if((smb_command != SMB_COM_WRITE_ANDX) && | ||
98 | (smb_command != SMB_COM_OPEN_ANDX) && | ||
99 | (smb_command != SMB_COM_TREE_DISCONNECT)) { | ||
100 | cFYI(1,("can not send cmd %d while umounting", | ||
101 | smb_command)); | ||
102 | return -ENODEV; | ||
103 | } | ||
104 | } | ||
93 | if((tcon->ses) && (tcon->ses->status != CifsExiting) && | 105 | if((tcon->ses) && (tcon->ses->status != CifsExiting) && |
94 | (tcon->ses->server)){ | 106 | (tcon->ses->server)){ |
95 | struct nls_table *nls_codepage; | 107 | struct nls_table *nls_codepage; |
@@ -187,6 +199,19 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
187 | check for tcp and smb session status done differently | 199 | check for tcp and smb session status done differently |
188 | for those three - in the calling routine */ | 200 | for those three - in the calling routine */ |
189 | if(tcon) { | 201 | if(tcon) { |
202 | if(tcon->tidStatus == CifsExiting) { | ||
203 | /* only tree disconnect, open, and write, | ||
204 | (and ulogoff which does not have tcon) | ||
205 | are allowed as we start force umount */ | ||
206 | if((smb_command != SMB_COM_WRITE_ANDX) && | ||
207 | (smb_command != SMB_COM_OPEN_ANDX) && | ||
208 | (smb_command != SMB_COM_TREE_DISCONNECT)) { | ||
209 | cFYI(1,("can not send cmd %d while umounting", | ||
210 | smb_command)); | ||
211 | return -ENODEV; | ||
212 | } | ||
213 | } | ||
214 | |||
190 | if((tcon->ses) && (tcon->ses->status != CifsExiting) && | 215 | if((tcon->ses) && (tcon->ses->status != CifsExiting) && |
191 | (tcon->ses->server)){ | 216 | (tcon->ses->server)){ |
192 | struct nls_table *nls_codepage; | 217 | struct nls_table *nls_codepage; |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 16b21522e8fe..32cc96cafa3e 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -228,8 +228,15 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
228 | else { | 228 | else { |
229 | rc = cifs_get_inode_info(&newinode, full_path, | 229 | rc = cifs_get_inode_info(&newinode, full_path, |
230 | buf, inode->i_sb,xid); | 230 | buf, inode->i_sb,xid); |
231 | if(newinode) | 231 | if(newinode) { |
232 | newinode->i_mode = mode; | 232 | newinode->i_mode = mode; |
233 | if((oplock & CIFS_CREATE_ACTION) && | ||
234 | (cifs_sb->mnt_cifs_flags & | ||
235 | CIFS_MOUNT_SET_UID)) { | ||
236 | newinode->i_uid = current->fsuid; | ||
237 | newinode->i_gid = current->fsgid; | ||
238 | } | ||
239 | } | ||
233 | } | 240 | } |
234 | 241 | ||
235 | if (rc != 0) { | 242 | if (rc != 0) { |
@@ -465,12 +472,20 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name | |||
465 | direntry->d_op = &cifs_dentry_ops; | 472 | direntry->d_op = &cifs_dentry_ops; |
466 | d_add(direntry, newInode); | 473 | d_add(direntry, newInode); |
467 | 474 | ||
468 | /* since paths are not looked up by component - the parent directories are presumed to be good here */ | 475 | /* since paths are not looked up by component - the parent |
476 | directories are presumed to be good here */ | ||
469 | renew_parental_timestamps(direntry); | 477 | renew_parental_timestamps(direntry); |
470 | 478 | ||
471 | } else if (rc == -ENOENT) { | 479 | } else if (rc == -ENOENT) { |
472 | rc = 0; | 480 | rc = 0; |
481 | direntry->d_time = jiffies; | ||
482 | if (pTcon->nocase) | ||
483 | direntry->d_op = &cifs_ci_dentry_ops; | ||
484 | else | ||
485 | direntry->d_op = &cifs_dentry_ops; | ||
473 | d_add(direntry, NULL); | 486 | d_add(direntry, NULL); |
487 | /* if it was once a directory (but how can we tell?) we could do | ||
488 | shrink_dcache_parent(direntry); */ | ||
474 | } else { | 489 | } else { |
475 | cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s", | 490 | cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s", |
476 | rc,full_path)); | 491 | rc,full_path)); |
@@ -489,21 +504,20 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) | |||
489 | { | 504 | { |
490 | int isValid = 1; | 505 | int isValid = 1; |
491 | 506 | ||
492 | /* lock_kernel(); *//* surely we do not want to lock the kernel for a whole network round trip which could take seconds */ | ||
493 | |||
494 | if (direntry->d_inode) { | 507 | if (direntry->d_inode) { |
495 | if (cifs_revalidate(direntry)) { | 508 | if (cifs_revalidate(direntry)) { |
496 | /* unlock_kernel(); */ | ||
497 | return 0; | 509 | return 0; |
498 | } | 510 | } |
499 | } else { | 511 | } else { |
500 | cFYI(1, | 512 | cFYI(1, ("neg dentry 0x%p name = %s", |
501 | ("In cifs_d_revalidate with no inode but name = %s and dentry 0x%p", | 513 | direntry, direntry->d_name.name)); |
502 | direntry->d_name.name, direntry)); | 514 | if(time_after(jiffies, direntry->d_time + HZ) || |
515 | !lookupCacheEnabled) { | ||
516 | d_drop(direntry); | ||
517 | isValid = 0; | ||
518 | } | ||
503 | } | 519 | } |
504 | 520 | ||
505 | /* unlock_kernel(); */ | ||
506 | |||
507 | return isValid; | 521 | return isValid; |
508 | } | 522 | } |
509 | 523 | ||
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 05b525812adb..411c1f7f84da 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -710,7 +710,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
710 | char *full_path = NULL; | 710 | char *full_path = NULL; |
711 | struct inode *newinode = NULL; | 711 | struct inode *newinode = NULL; |
712 | 712 | ||
713 | cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p ", mode, inode)); | 713 | cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p", mode, inode)); |
714 | 714 | ||
715 | xid = GetXid(); | 715 | xid = GetXid(); |
716 | 716 | ||
@@ -768,6 +768,17 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
768 | /* BB to be implemented via Windows secrty descriptors | 768 | /* BB to be implemented via Windows secrty descriptors |
769 | eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, | 769 | eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, |
770 | -1, -1, local_nls); */ | 770 | -1, -1, local_nls); */ |
771 | if(direntry->d_inode) { | ||
772 | direntry->d_inode->i_mode = mode; | ||
773 | direntry->d_inode->i_mode |= S_IFDIR; | ||
774 | if(cifs_sb->mnt_cifs_flags & | ||
775 | CIFS_MOUNT_SET_UID) { | ||
776 | direntry->d_inode->i_uid = | ||
777 | current->fsuid; | ||
778 | direntry->d_inode->i_gid = | ||
779 | current->fsgid; | ||
780 | } | ||
781 | } | ||
771 | } | 782 | } |
772 | } | 783 | } |
773 | kfree(full_path); | 784 | kfree(full_path); |
@@ -1039,14 +1050,20 @@ int cifs_revalidate(struct dentry *direntry) | |||
1039 | filemap_fdatawrite(direntry->d_inode->i_mapping); | 1050 | filemap_fdatawrite(direntry->d_inode->i_mapping); |
1040 | } | 1051 | } |
1041 | if (invalidate_inode) { | 1052 | if (invalidate_inode) { |
1042 | if (direntry->d_inode->i_mapping) | 1053 | /* shrink_dcache not necessary now that cifs dentry ops |
1043 | filemap_fdatawait(direntry->d_inode->i_mapping); | 1054 | are exported for negative dentries */ |
1044 | /* may eventually have to do this for open files too */ | 1055 | /* if(S_ISDIR(direntry->d_inode->i_mode)) |
1045 | if (list_empty(&(cifsInode->openFileList))) { | 1056 | shrink_dcache_parent(direntry); */ |
1046 | /* Has changed on server - flush read ahead pages */ | 1057 | if (S_ISREG(direntry->d_inode->i_mode)) { |
1047 | cFYI(1, ("Invalidating read ahead data on " | 1058 | if (direntry->d_inode->i_mapping) |
1048 | "closed file")); | 1059 | filemap_fdatawait(direntry->d_inode->i_mapping); |
1049 | invalidate_remote_inode(direntry->d_inode); | 1060 | /* may eventually have to do this for open files too */ |
1061 | if (list_empty(&(cifsInode->openFileList))) { | ||
1062 | /* changed on server - flush read ahead pages */ | ||
1063 | cFYI(1, ("Invalidating read ahead data on " | ||
1064 | "closed file")); | ||
1065 | invalidate_remote_inode(direntry->d_inode); | ||
1066 | } | ||
1050 | } | 1067 | } |
1051 | } | 1068 | } |
1052 | /* up(&direntry->d_inode->i_sem); */ | 1069 | /* up(&direntry->d_inode->i_sem); */ |
@@ -1105,9 +1122,20 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1105 | 1122 | ||
1106 | cFYI(1, ("In cifs_setattr, name = %s attrs->iavalid 0x%x ", | 1123 | cFYI(1, ("In cifs_setattr, name = %s attrs->iavalid 0x%x ", |
1107 | direntry->d_name.name, attrs->ia_valid)); | 1124 | direntry->d_name.name, attrs->ia_valid)); |
1125 | |||
1108 | cifs_sb = CIFS_SB(direntry->d_inode->i_sb); | 1126 | cifs_sb = CIFS_SB(direntry->d_inode->i_sb); |
1109 | pTcon = cifs_sb->tcon; | 1127 | pTcon = cifs_sb->tcon; |
1110 | 1128 | ||
1129 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { | ||
1130 | /* check if we have permission to change attrs */ | ||
1131 | rc = inode_change_ok(direntry->d_inode, attrs); | ||
1132 | if(rc < 0) { | ||
1133 | FreeXid(xid); | ||
1134 | return rc; | ||
1135 | } else | ||
1136 | rc = 0; | ||
1137 | } | ||
1138 | |||
1111 | down(&direntry->d_sb->s_vfs_rename_sem); | 1139 | down(&direntry->d_sb->s_vfs_rename_sem); |
1112 | full_path = build_path_from_dentry(direntry); | 1140 | full_path = build_path_from_dentry(direntry); |
1113 | up(&direntry->d_sb->s_vfs_rename_sem); | 1141 | up(&direntry->d_sb->s_vfs_rename_sem); |
@@ -1147,7 +1175,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1147 | 1 /* 45 seconds */); | 1175 | 1 /* 45 seconds */); |
1148 | cFYI(1,("Wrt seteof rc %d", rc)); | 1176 | cFYI(1,("Wrt seteof rc %d", rc)); |
1149 | } | 1177 | } |
1150 | } | 1178 | } else |
1179 | rc = -EINVAL; | ||
1180 | |||
1151 | if (rc != 0) { | 1181 | if (rc != 0) { |
1152 | /* Set file size by pathname rather than by handle | 1182 | /* Set file size by pathname rather than by handle |
1153 | either because no valid, writeable file handle for | 1183 | either because no valid, writeable file handle for |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index ca27a82c54cd..94baf6c8ecbd 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -397,12 +397,12 @@ checkSMBhdr(struct smb_hdr *smb, __u16 mid) | |||
397 | if(smb->Command == SMB_COM_LOCKING_ANDX) | 397 | if(smb->Command == SMB_COM_LOCKING_ANDX) |
398 | return 0; | 398 | return 0; |
399 | else | 399 | else |
400 | cERROR(1, ("Rcvd Request not response ")); | 400 | cERROR(1, ("Rcvd Request not response")); |
401 | } | 401 | } |
402 | } else { /* bad signature or mid */ | 402 | } else { /* bad signature or mid */ |
403 | if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) | 403 | if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) |
404 | cERROR(1, | 404 | cERROR(1, |
405 | ("Bad protocol string signature header %x ", | 405 | ("Bad protocol string signature header %x", |
406 | *(unsigned int *) smb->Protocol)); | 406 | *(unsigned int *) smb->Protocol)); |
407 | if (mid != smb->Mid) | 407 | if (mid != smb->Mid) |
408 | cERROR(1, ("Mids do not match")); | 408 | cERROR(1, ("Mids do not match")); |
@@ -417,7 +417,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length) | |||
417 | __u32 len = smb->smb_buf_length; | 417 | __u32 len = smb->smb_buf_length; |
418 | __u32 clc_len; /* calculated length */ | 418 | __u32 clc_len; /* calculated length */ |
419 | cFYI(0, | 419 | cFYI(0, |
420 | ("Entering checkSMB with Length: %x, smb_buf_length: %x ", | 420 | ("Entering checkSMB with Length: %x, smb_buf_length: %x", |
421 | length, len)); | 421 | length, len)); |
422 | if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) || | 422 | if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) || |
423 | (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4)) { | 423 | (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4)) { |
@@ -451,9 +451,16 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length) | |||
451 | cERROR(1, ("bad smb size detected for Mid=%d", smb->Mid)); | 451 | cERROR(1, ("bad smb size detected for Mid=%d", smb->Mid)); |
452 | /* Windows XP can return a few bytes too much, presumably | 452 | /* Windows XP can return a few bytes too much, presumably |
453 | an illegal pad, at the end of byte range lock responses | 453 | an illegal pad, at the end of byte range lock responses |
454 | so we allow for up to eight byte pad, as long as actual | 454 | so we allow for that three byte pad, as long as actual |
455 | received length is as long or longer than calculated length */ | 455 | received length is as long or longer than calculated length */ |
456 | if((4+len > clc_len) && (len <= clc_len + 3)) | 456 | /* We have now had to extend this more, since there is a |
457 | case in which it needs to be bigger still to handle a | ||
458 | malformed response to transact2 findfirst from WinXP when | ||
459 | access denied is returned and thus bcc and wct are zero | ||
460 | but server says length is 0x21 bytes too long as if the server | ||
461 | forget to reset the smb rfc1001 length when it reset the | ||
462 | wct and bcc to minimum size and drop the t2 parms and data */ | ||
463 | if((4+len > clc_len) && (len <= clc_len + 512)) | ||
457 | return 0; | 464 | return 0; |
458 | else | 465 | else |
459 | return 1; | 466 | return 1; |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index f7814689844b..5de74d216fdd 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -330,7 +330,7 @@ static const struct { | |||
330 | ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, { | 330 | ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, { |
331 | ERRSRV, 2241, NT_STATUS_INVALID_LOGON_HOURS}, { | 331 | ERRSRV, 2241, NT_STATUS_INVALID_LOGON_HOURS}, { |
332 | ERRSRV, 2240, NT_STATUS_INVALID_WORKSTATION}, { | 332 | ERRSRV, 2240, NT_STATUS_INVALID_WORKSTATION}, { |
333 | ERRSRV, 2242, NT_STATUS_PASSWORD_EXPIRED}, { | 333 | ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_EXPIRED}, { |
334 | ERRSRV, 2239, NT_STATUS_ACCOUNT_DISABLED}, { | 334 | ERRSRV, 2239, NT_STATUS_ACCOUNT_DISABLED}, { |
335 | ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, { | 335 | ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, { |
336 | ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, { | 336 | ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, { |
@@ -676,7 +676,7 @@ static const struct { | |||
676 | ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, { | 676 | ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, { |
677 | ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, { | 677 | ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, { |
678 | ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, { | 678 | ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, { |
679 | ERRSRV, 2242, NT_STATUS_PASSWORD_MUST_CHANGE}, { | 679 | ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_MUST_CHANGE}, { |
680 | ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, { | 680 | ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, { |
681 | ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, { | 681 | ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, { |
682 | ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, { | 682 | ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, { |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 41a9659c16bc..f8871196098c 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -515,6 +515,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
515 | *pbytes_returned = in_buf->smb_buf_length; | 515 | *pbytes_returned = in_buf->smb_buf_length; |
516 | 516 | ||
517 | /* BB special case reconnect tid and uid here? */ | 517 | /* BB special case reconnect tid and uid here? */ |
518 | /* BB special case Errbadpassword and pwdexpired here */ | ||
518 | rc = map_smb_to_linux_error(in_buf); | 519 | rc = map_smb_to_linux_error(in_buf); |
519 | 520 | ||
520 | /* convert ByteCount if necessary */ | 521 | /* convert ByteCount if necessary */ |
@@ -306,9 +306,6 @@ void install_arg_page(struct vm_area_struct *vma, | |||
306 | struct page *page, unsigned long address) | 306 | struct page *page, unsigned long address) |
307 | { | 307 | { |
308 | struct mm_struct *mm = vma->vm_mm; | 308 | struct mm_struct *mm = vma->vm_mm; |
309 | pgd_t * pgd; | ||
310 | pud_t * pud; | ||
311 | pmd_t * pmd; | ||
312 | pte_t * pte; | 309 | pte_t * pte; |
313 | spinlock_t *ptl; | 310 | spinlock_t *ptl; |
314 | 311 | ||
@@ -316,14 +313,7 @@ void install_arg_page(struct vm_area_struct *vma, | |||
316 | goto out; | 313 | goto out; |
317 | 314 | ||
318 | flush_dcache_page(page); | 315 | flush_dcache_page(page); |
319 | pgd = pgd_offset(mm, address); | 316 | pte = get_locked_pte(mm, address, &ptl); |
320 | pud = pud_alloc(mm, pgd, address); | ||
321 | if (!pud) | ||
322 | goto out; | ||
323 | pmd = pmd_alloc(mm, pud, address); | ||
324 | if (!pmd) | ||
325 | goto out; | ||
326 | pte = pte_alloc_map_lock(mm, pmd, address, &ptl); | ||
327 | if (!pte) | 317 | if (!pte) |
328 | goto out; | 318 | goto out; |
329 | if (!pte_none(*pte)) { | 319 | if (!pte_none(*pte)) { |
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index c60e5635498d..df16fcbff3fb 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
@@ -151,6 +151,7 @@ struct hfsplus_sb_info { | |||
151 | 151 | ||
152 | #define HFSPLUS_SB_WRITEBACKUP 0x0001 | 152 | #define HFSPLUS_SB_WRITEBACKUP 0x0001 |
153 | #define HFSPLUS_SB_NODECOMPOSE 0x0002 | 153 | #define HFSPLUS_SB_NODECOMPOSE 0x0002 |
154 | #define HFSPLUS_SB_FORCE 0x0004 | ||
154 | 155 | ||
155 | 156 | ||
156 | struct hfsplus_inode_info { | 157 | struct hfsplus_inode_info { |
diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h index 5bad37cfdb29..b4fbed633219 100644 --- a/fs/hfsplus/hfsplus_raw.h +++ b/fs/hfsplus/hfsplus_raw.h | |||
@@ -123,11 +123,13 @@ struct hfsplus_vh { | |||
123 | } __packed; | 123 | } __packed; |
124 | 124 | ||
125 | /* HFS+ volume attributes */ | 125 | /* HFS+ volume attributes */ |
126 | #define HFSPLUS_VOL_UNMNT (1 << 8) | 126 | #define HFSPLUS_VOL_UNMNT (1 << 8) |
127 | #define HFSPLUS_VOL_SPARE_BLK (1 << 9) | 127 | #define HFSPLUS_VOL_SPARE_BLK (1 << 9) |
128 | #define HFSPLUS_VOL_NOCACHE (1 << 10) | 128 | #define HFSPLUS_VOL_NOCACHE (1 << 10) |
129 | #define HFSPLUS_VOL_INCNSTNT (1 << 11) | 129 | #define HFSPLUS_VOL_INCNSTNT (1 << 11) |
130 | #define HFSPLUS_VOL_SOFTLOCK (1 << 15) | 130 | #define HFSPLUS_VOL_NODEID_REUSED (1 << 12) |
131 | #define HFSPLUS_VOL_JOURNALED (1 << 13) | ||
132 | #define HFSPLUS_VOL_SOFTLOCK (1 << 15) | ||
131 | 133 | ||
132 | /* HFS+ BTree node descriptor */ | 134 | /* HFS+ BTree node descriptor */ |
133 | struct hfs_bnode_desc { | 135 | struct hfs_bnode_desc { |
diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c index cca0818aa4ca..935dafba0078 100644 --- a/fs/hfsplus/options.c +++ b/fs/hfsplus/options.c | |||
@@ -22,7 +22,7 @@ enum { | |||
22 | opt_umask, opt_uid, opt_gid, | 22 | opt_umask, opt_uid, opt_gid, |
23 | opt_part, opt_session, opt_nls, | 23 | opt_part, opt_session, opt_nls, |
24 | opt_nodecompose, opt_decompose, | 24 | opt_nodecompose, opt_decompose, |
25 | opt_err | 25 | opt_force, opt_err |
26 | }; | 26 | }; |
27 | 27 | ||
28 | static match_table_t tokens = { | 28 | static match_table_t tokens = { |
@@ -36,6 +36,7 @@ static match_table_t tokens = { | |||
36 | { opt_nls, "nls=%s" }, | 36 | { opt_nls, "nls=%s" }, |
37 | { opt_decompose, "decompose" }, | 37 | { opt_decompose, "decompose" }, |
38 | { opt_nodecompose, "nodecompose" }, | 38 | { opt_nodecompose, "nodecompose" }, |
39 | { opt_force, "force" }, | ||
39 | { opt_err, NULL } | 40 | { opt_err, NULL } |
40 | }; | 41 | }; |
41 | 42 | ||
@@ -145,6 +146,9 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi) | |||
145 | case opt_nodecompose: | 146 | case opt_nodecompose: |
146 | sbi->flags |= HFSPLUS_SB_NODECOMPOSE; | 147 | sbi->flags |= HFSPLUS_SB_NODECOMPOSE; |
147 | break; | 148 | break; |
149 | case opt_force: | ||
150 | sbi->flags |= HFSPLUS_SB_FORCE; | ||
151 | break; | ||
148 | default: | 152 | default: |
149 | return 0; | 153 | return 0; |
150 | } | 154 | } |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 0ce1c455ae55..8093351bd7c3 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -251,16 +251,28 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data) | |||
251 | return 0; | 251 | return 0; |
252 | if (!(*flags & MS_RDONLY)) { | 252 | if (!(*flags & MS_RDONLY)) { |
253 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; | 253 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; |
254 | struct hfsplus_sb_info sbi; | ||
255 | |||
256 | memset(&sbi, 0, sizeof(struct hfsplus_sb_info)); | ||
257 | sbi.nls = HFSPLUS_SB(sb).nls; | ||
258 | if (!hfsplus_parse_options(data, &sbi)) | ||
259 | return -EINVAL; | ||
254 | 260 | ||
255 | if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) { | 261 | if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) { |
256 | printk("HFS+-fs warning: Filesystem was not cleanly unmounted, " | 262 | printk("HFS+-fs warning: Filesystem was not cleanly unmounted, " |
257 | "running fsck.hfsplus is recommended. leaving read-only.\n"); | 263 | "running fsck.hfsplus is recommended. leaving read-only.\n"); |
258 | sb->s_flags |= MS_RDONLY; | 264 | sb->s_flags |= MS_RDONLY; |
259 | *flags |= MS_RDONLY; | 265 | *flags |= MS_RDONLY; |
266 | } else if (sbi.flags & HFSPLUS_SB_FORCE) { | ||
267 | /* nothing */ | ||
260 | } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) { | 268 | } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) { |
261 | printk("HFS+-fs: Filesystem is marked locked, leaving read-only.\n"); | 269 | printk("HFS+-fs: Filesystem is marked locked, leaving read-only.\n"); |
262 | sb->s_flags |= MS_RDONLY; | 270 | sb->s_flags |= MS_RDONLY; |
263 | *flags |= MS_RDONLY; | 271 | *flags |= MS_RDONLY; |
272 | } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) { | ||
273 | printk("HFS+-fs: Filesystem is marked journaled, leaving read-only.\n"); | ||
274 | sb->s_flags |= MS_RDONLY; | ||
275 | *flags |= MS_RDONLY; | ||
264 | } | 276 | } |
265 | } | 277 | } |
266 | return 0; | 278 | return 0; |
@@ -352,11 +364,19 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
352 | printk("HFS+-fs warning: Filesystem was not cleanly unmounted, " | 364 | printk("HFS+-fs warning: Filesystem was not cleanly unmounted, " |
353 | "running fsck.hfsplus is recommended. mounting read-only.\n"); | 365 | "running fsck.hfsplus is recommended. mounting read-only.\n"); |
354 | sb->s_flags |= MS_RDONLY; | 366 | sb->s_flags |= MS_RDONLY; |
367 | } else if (sbi->flags & HFSPLUS_SB_FORCE) { | ||
368 | /* nothing */ | ||
355 | } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) { | 369 | } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) { |
356 | if (!silent) | 370 | if (!silent) |
357 | printk("HFS+-fs: Filesystem is marked locked, mounting read-only.\n"); | 371 | printk("HFS+-fs: Filesystem is marked locked, mounting read-only.\n"); |
358 | sb->s_flags |= MS_RDONLY; | 372 | sb->s_flags |= MS_RDONLY; |
373 | } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) { | ||
374 | if (!silent) | ||
375 | printk("HFS+-fs: write access to a jounaled filesystem is not supported, " | ||
376 | "use the force option at your own risk, mounting read-only.\n"); | ||
377 | sb->s_flags |= MS_RDONLY; | ||
359 | } | 378 | } |
379 | sbi->flags &= ~HFSPLUS_SB_FORCE; | ||
360 | 380 | ||
361 | /* Load metadata objects (B*Trees) */ | 381 | /* Load metadata objects (B*Trees) */ |
362 | HFSPLUS_SB(sb).ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID); | 382 | HFSPLUS_SB(sb).ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID); |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 543420665c5b..d0fcc5f3497e 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -234,6 +234,7 @@ void jffs2_read_inode (struct inode *inode) | |||
234 | c = JFFS2_SB_INFO(inode->i_sb); | 234 | c = JFFS2_SB_INFO(inode->i_sb); |
235 | 235 | ||
236 | jffs2_init_inode_info(f); | 236 | jffs2_init_inode_info(f); |
237 | down(&f->sem); | ||
237 | 238 | ||
238 | ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node); | 239 | ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node); |
239 | 240 | ||
@@ -400,6 +401,7 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i | |||
400 | 401 | ||
401 | f = JFFS2_INODE_INFO(inode); | 402 | f = JFFS2_INODE_INFO(inode); |
402 | jffs2_init_inode_info(f); | 403 | jffs2_init_inode_info(f); |
404 | down(&f->sem); | ||
403 | 405 | ||
404 | memset(ri, 0, sizeof(*ri)); | 406 | memset(ri, 0, sizeof(*ri)); |
405 | /* Set OS-specific defaults for new inodes */ | 407 | /* Set OS-specific defaults for new inodes */ |
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 9e0b5458d9c0..93883817cbd0 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -51,7 +51,7 @@ static void jffs2_i_init_once(void * foo, kmem_cache_t * cachep, unsigned long f | |||
51 | 51 | ||
52 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == | 52 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == |
53 | SLAB_CTOR_CONSTRUCTOR) { | 53 | SLAB_CTOR_CONSTRUCTOR) { |
54 | init_MUTEX_LOCKED(&ei->sem); | 54 | init_MUTEX(&ei->sem); |
55 | inode_init_once(&ei->vfs_inode); | 55 | inode_init_once(&ei->vfs_inode); |
56 | } | 56 | } |
57 | } | 57 | } |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 4b15761434bc..68b7b78638ff 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -2757,6 +2757,15 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name, | |||
2757 | journal->j_cnode_used = 0; | 2757 | journal->j_cnode_used = 0; |
2758 | journal->j_must_wait = 0; | 2758 | journal->j_must_wait = 0; |
2759 | 2759 | ||
2760 | if (journal->j_cnode_free == 0) { | ||
2761 | reiserfs_warning(p_s_sb, "journal-2004: Journal cnode memory " | ||
2762 | "allocation failed (%ld bytes). Journal is " | ||
2763 | "too large for available memory. Usually " | ||
2764 | "this is due to a journal that is too large.", | ||
2765 | sizeof (struct reiserfs_journal_cnode) * num_cnodes); | ||
2766 | goto free_and_return; | ||
2767 | } | ||
2768 | |||
2760 | init_journal_hash(p_s_sb); | 2769 | init_journal_hash(p_s_sb); |
2761 | jl = journal->j_current_jl; | 2770 | jl = journal->j_current_jl; |
2762 | jl->j_list_bitmap = get_list_bitmap(p_s_sb, jl); | 2771 | jl->j_list_bitmap = get_list_bitmap(p_s_sb, jl); |
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h index 9dd9da105278..5e6362a786b7 100644 --- a/include/asm-ia64/page.h +++ b/include/asm-ia64/page.h | |||
@@ -110,8 +110,9 @@ extern int ia64_pfn_valid (unsigned long pfn); | |||
110 | # define pfn_to_page(pfn) (mem_map + (pfn)) | 110 | # define pfn_to_page(pfn) (mem_map + (pfn)) |
111 | #elif defined(CONFIG_DISCONTIGMEM) | 111 | #elif defined(CONFIG_DISCONTIGMEM) |
112 | extern struct page *vmem_map; | 112 | extern struct page *vmem_map; |
113 | extern unsigned long min_low_pfn; | ||
113 | extern unsigned long max_low_pfn; | 114 | extern unsigned long max_low_pfn; |
114 | # define pfn_valid(pfn) (((pfn) < max_low_pfn) && ia64_pfn_valid(pfn)) | 115 | # define pfn_valid(pfn) (((pfn) >= min_low_pfn) && ((pfn) < max_low_pfn) && ia64_pfn_valid(pfn)) |
115 | # define page_to_pfn(page) ((unsigned long) (page - vmem_map)) | 116 | # define page_to_pfn(page) ((unsigned long) (page - vmem_map)) |
116 | # define pfn_to_page(pfn) (vmem_map + (pfn)) | 117 | # define pfn_to_page(pfn) (vmem_map + (pfn)) |
117 | #endif | 118 | #endif |
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index e7d0593bb576..b203ea82a0a8 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h | |||
@@ -7,7 +7,6 @@ | |||
7 | #define LINUX_ATMDEV_H | 7 | #define LINUX_ATMDEV_H |
8 | 8 | ||
9 | 9 | ||
10 | #include <linux/config.h> | ||
11 | #include <linux/atmapi.h> | 10 | #include <linux/atmapi.h> |
12 | #include <linux/atm.h> | 11 | #include <linux/atm.h> |
13 | #include <linux/atmioc.h> | 12 | #include <linux/atmioc.h> |
@@ -210,6 +209,7 @@ struct atm_cirange { | |||
210 | 209 | ||
211 | #ifdef __KERNEL__ | 210 | #ifdef __KERNEL__ |
212 | 211 | ||
212 | #include <linux/config.h> | ||
213 | #include <linux/wait.h> /* wait_queue_head_t */ | 213 | #include <linux/wait.h> /* wait_queue_head_t */ |
214 | #include <linux/time.h> /* struct timeval */ | 214 | #include <linux/time.h> /* struct timeval */ |
215 | #include <linux/net.h> | 215 | #include <linux/net.h> |
@@ -274,7 +274,7 @@ enum { | |||
274 | 274 | ||
275 | 275 | ||
276 | enum { | 276 | enum { |
277 | ATM_DF_CLOSE, /* close device when last VCC is closed */ | 277 | ATM_DF_REMOVED, /* device was removed from atm_devs list */ |
278 | }; | 278 | }; |
279 | 279 | ||
280 | 280 | ||
@@ -415,7 +415,6 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops, | |||
415 | int number,unsigned long *flags); /* number == -1: pick first available */ | 415 | int number,unsigned long *flags); /* number == -1: pick first available */ |
416 | struct atm_dev *atm_dev_lookup(int number); | 416 | struct atm_dev *atm_dev_lookup(int number); |
417 | void atm_dev_deregister(struct atm_dev *dev); | 417 | void atm_dev_deregister(struct atm_dev *dev); |
418 | void shutdown_atm_dev(struct atm_dev *dev); | ||
419 | void vcc_insert_socket(struct sock *sk); | 418 | void vcc_insert_socket(struct sock *sk); |
420 | 419 | ||
421 | 420 | ||
@@ -457,18 +456,19 @@ static inline void atm_dev_hold(struct atm_dev *dev) | |||
457 | 456 | ||
458 | static inline void atm_dev_put(struct atm_dev *dev) | 457 | static inline void atm_dev_put(struct atm_dev *dev) |
459 | { | 458 | { |
460 | atomic_dec(&dev->refcnt); | 459 | if (atomic_dec_and_test(&dev->refcnt)) { |
461 | 460 | BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); | |
462 | if ((atomic_read(&dev->refcnt) == 1) && | 461 | if (dev->ops->dev_close) |
463 | test_bit(ATM_DF_CLOSE,&dev->flags)) | 462 | dev->ops->dev_close(dev); |
464 | shutdown_atm_dev(dev); | 463 | kfree(dev); |
464 | } | ||
465 | } | 465 | } |
466 | 466 | ||
467 | 467 | ||
468 | int atm_charge(struct atm_vcc *vcc,int truesize); | 468 | int atm_charge(struct atm_vcc *vcc,int truesize); |
469 | struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, | 469 | struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, |
470 | gfp_t gfp_flags); | 470 | gfp_t gfp_flags); |
471 | int atm_pcr_goal(struct atm_trafprm *tp); | 471 | int atm_pcr_goal(const struct atm_trafprm *tp); |
472 | 472 | ||
473 | void vcc_release_async(struct atm_vcc *vcc, int reply); | 473 | void vcc_release_async(struct atm_vcc *vcc, int reply); |
474 | 474 | ||
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h index 70ab56317380..c948f678e04e 100644 --- a/include/linux/cn_proc.h +++ b/include/linux/cn_proc.h | |||
@@ -86,12 +86,12 @@ struct proc_event { | |||
86 | pid_t process_pid; | 86 | pid_t process_pid; |
87 | pid_t process_tgid; | 87 | pid_t process_tgid; |
88 | union { | 88 | union { |
89 | uid_t ruid; /* current->uid */ | 89 | __u32 ruid; /* task uid */ |
90 | gid_t rgid; /* current->gid */ | 90 | __u32 rgid; /* task gid */ |
91 | } r; | 91 | } r; |
92 | union { | 92 | union { |
93 | uid_t euid; | 93 | __u32 euid; |
94 | gid_t egid; | 94 | __u32 egid; |
95 | } e; | 95 | } e; |
96 | } id; | 96 | } id; |
97 | 97 | ||
diff --git a/include/linux/mm.h b/include/linux/mm.h index 6a75a7a78bf1..29f02d8513f6 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -163,6 +163,7 @@ extern unsigned int kobjsize(const void *objp); | |||
163 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ | 163 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ |
164 | #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ | 164 | #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ |
165 | #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ | 165 | #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ |
166 | #define VM_INCOMPLETE 0x02000000 /* Strange partial PFN mapping marker */ | ||
166 | 167 | ||
167 | #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ | 168 | #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ |
168 | #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS | 169 | #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS |
@@ -741,6 +742,8 @@ struct shrinker; | |||
741 | extern struct shrinker *set_shrinker(int, shrinker_t); | 742 | extern struct shrinker *set_shrinker(int, shrinker_t); |
742 | extern void remove_shrinker(struct shrinker *shrinker); | 743 | extern void remove_shrinker(struct shrinker *shrinker); |
743 | 744 | ||
745 | extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl)); | ||
746 | |||
744 | int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); | 747 | int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); |
745 | int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address); | 748 | int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address); |
746 | int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address); | 749 | int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address); |
@@ -953,6 +956,7 @@ struct page *vmalloc_to_page(void *addr); | |||
953 | unsigned long vmalloc_to_pfn(void *addr); | 956 | unsigned long vmalloc_to_pfn(void *addr); |
954 | int remap_pfn_range(struct vm_area_struct *, unsigned long addr, | 957 | int remap_pfn_range(struct vm_area_struct *, unsigned long addr, |
955 | unsigned long pfn, unsigned long size, pgprot_t); | 958 | unsigned long pfn, unsigned long size, pgprot_t); |
959 | int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); | ||
956 | 960 | ||
957 | struct page *follow_page(struct vm_area_struct *, unsigned long address, | 961 | struct page *follow_page(struct vm_area_struct *, unsigned long address, |
958 | unsigned int foll_flags); | 962 | unsigned int foll_flags); |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index 3c9ea4b7adda..23a568910341 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | /* Common Flash Interface structures | 2 | /* Common Flash Interface structures |
3 | * See http://support.intel.com/design/flash/technote/index.htm | 3 | * See http://support.intel.com/design/flash/technote/index.htm |
4 | * $Id: cfi.h,v 1.56 2005/11/07 11:14:54 gleixner Exp $ | 4 | * $Id: cfi.h,v 1.57 2005/11/15 23:28:17 tpoynor Exp $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __MTD_CFI_H__ | 7 | #ifndef __MTD_CFI_H__ |
@@ -426,6 +426,22 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr) | |||
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr) | ||
430 | { | ||
431 | map_word val = map_read(map, addr); | ||
432 | |||
433 | if (map_bankwidth_is_1(map)) { | ||
434 | return val.x[0] & 0xff; | ||
435 | } else if (map_bankwidth_is_2(map)) { | ||
436 | return cfi16_to_cpu(val.x[0]); | ||
437 | } else { | ||
438 | /* No point in a 64-bit byteswap since that would just be | ||
439 | swapping the responses from different chips, and we are | ||
440 | only interested in one chip (a representative sample) */ | ||
441 | return cfi32_to_cpu(val.x[0]); | ||
442 | } | ||
443 | } | ||
444 | |||
429 | static inline void cfi_udelay(int us) | 445 | static inline void cfi_udelay(int us) |
430 | { | 446 | { |
431 | if (us >= 1000) { | 447 | if (us >= 1000) { |
diff --git a/kernel/power/main.c b/kernel/power/main.c index 6ee2cad530e8..d253f3ae2fa5 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | DECLARE_MUTEX(pm_sem); | 25 | DECLARE_MUTEX(pm_sem); |
26 | 26 | ||
27 | struct pm_ops * pm_ops = NULL; | 27 | struct pm_ops *pm_ops; |
28 | suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN; | 28 | suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN; |
29 | 29 | ||
30 | /** | 30 | /** |
@@ -151,6 +151,18 @@ static char *pm_states[PM_SUSPEND_MAX] = { | |||
151 | #endif | 151 | #endif |
152 | }; | 152 | }; |
153 | 153 | ||
154 | static inline int valid_state(suspend_state_t state) | ||
155 | { | ||
156 | /* Suspend-to-disk does not really need low-level support. | ||
157 | * It can work with reboot if needed. */ | ||
158 | if (state == PM_SUSPEND_DISK) | ||
159 | return 1; | ||
160 | |||
161 | if (pm_ops && pm_ops->valid && !pm_ops->valid(state)) | ||
162 | return 0; | ||
163 | return 1; | ||
164 | } | ||
165 | |||
154 | 166 | ||
155 | /** | 167 | /** |
156 | * enter_state - Do common work of entering low-power state. | 168 | * enter_state - Do common work of entering low-power state. |
@@ -167,7 +179,7 @@ static int enter_state(suspend_state_t state) | |||
167 | { | 179 | { |
168 | int error; | 180 | int error; |
169 | 181 | ||
170 | if (pm_ops && pm_ops->valid && !pm_ops->valid(state)) | 182 | if (!valid_state(state)) |
171 | return -ENODEV; | 183 | return -ENODEV; |
172 | if (down_trylock(&pm_sem)) | 184 | if (down_trylock(&pm_sem)) |
173 | return -EBUSY; | 185 | return -EBUSY; |
@@ -238,9 +250,8 @@ static ssize_t state_show(struct subsystem * subsys, char * buf) | |||
238 | char * s = buf; | 250 | char * s = buf; |
239 | 251 | ||
240 | for (i = 0; i < PM_SUSPEND_MAX; i++) { | 252 | for (i = 0; i < PM_SUSPEND_MAX; i++) { |
241 | if (pm_states[i] && pm_ops && (!pm_ops->valid | 253 | if (pm_states[i] && valid_state(i)) |
242 | ||(pm_ops->valid && pm_ops->valid(i)))) | 254 | s += sprintf(s,"%s ", pm_states[i]); |
243 | s += sprintf(s,"%s ",pm_states[i]); | ||
244 | } | 255 | } |
245 | s += sprintf(s,"\n"); | 256 | s += sprintf(s,"\n"); |
246 | return (s - buf); | 257 | return (s - buf); |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 17ee7e5a3451..656476eedb1b 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -241,7 +241,8 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in | |||
241 | if (write) { | 241 | if (write) { |
242 | copy_to_user_page(vma, page, addr, | 242 | copy_to_user_page(vma, page, addr, |
243 | maddr + offset, buf, bytes); | 243 | maddr + offset, buf, bytes); |
244 | set_page_dirty_lock(page); | 244 | if (!PageCompound(page)) |
245 | set_page_dirty_lock(page); | ||
245 | } else { | 246 | } else { |
246 | copy_from_user_page(vma, page, addr, | 247 | copy_from_user_page(vma, page, addr, |
247 | buf, maddr + offset, bytes); | 248 | buf, maddr + offset, bytes); |
diff --git a/mm/fremap.c b/mm/fremap.c index f851775e09c2..9f381e58bf44 100644 --- a/mm/fremap.c +++ b/mm/fremap.c | |||
@@ -55,20 +55,10 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
55 | pgoff_t size; | 55 | pgoff_t size; |
56 | int err = -ENOMEM; | 56 | int err = -ENOMEM; |
57 | pte_t *pte; | 57 | pte_t *pte; |
58 | pmd_t *pmd; | ||
59 | pud_t *pud; | ||
60 | pgd_t *pgd; | ||
61 | pte_t pte_val; | 58 | pte_t pte_val; |
62 | spinlock_t *ptl; | 59 | spinlock_t *ptl; |
63 | 60 | ||
64 | pgd = pgd_offset(mm, addr); | 61 | pte = get_locked_pte(mm, addr, &ptl); |
65 | pud = pud_alloc(mm, pgd, addr); | ||
66 | if (!pud) | ||
67 | goto out; | ||
68 | pmd = pmd_alloc(mm, pud, addr); | ||
69 | if (!pmd) | ||
70 | goto out; | ||
71 | pte = pte_alloc_map_lock(mm, pmd, addr, &ptl); | ||
72 | if (!pte) | 62 | if (!pte) |
73 | goto out; | 63 | goto out; |
74 | 64 | ||
@@ -110,20 +100,10 @@ int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, | |||
110 | { | 100 | { |
111 | int err = -ENOMEM; | 101 | int err = -ENOMEM; |
112 | pte_t *pte; | 102 | pte_t *pte; |
113 | pmd_t *pmd; | ||
114 | pud_t *pud; | ||
115 | pgd_t *pgd; | ||
116 | pte_t pte_val; | 103 | pte_t pte_val; |
117 | spinlock_t *ptl; | 104 | spinlock_t *ptl; |
118 | 105 | ||
119 | pgd = pgd_offset(mm, addr); | 106 | pte = get_locked_pte(mm, addr, &ptl); |
120 | pud = pud_alloc(mm, pgd, addr); | ||
121 | if (!pud) | ||
122 | goto out; | ||
123 | pmd = pmd_alloc(mm, pud, addr); | ||
124 | if (!pmd) | ||
125 | goto out; | ||
126 | pte = pte_alloc_map_lock(mm, pmd, addr, &ptl); | ||
127 | if (!pte) | 107 | if (!pte) |
128 | goto out; | 108 | goto out; |
129 | 109 | ||
diff --git a/mm/memory.c b/mm/memory.c index 9ab206b829a2..4b4fc3a7ea48 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -988,7 +988,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
988 | return i ? : -EFAULT; | 988 | return i ? : -EFAULT; |
989 | } | 989 | } |
990 | if (pages) { | 990 | if (pages) { |
991 | struct page *page = vm_normal_page(vma, start, *pte); | 991 | struct page *page = vm_normal_page(gate_vma, start, *pte); |
992 | pages[i] = page; | 992 | pages[i] = page; |
993 | if (page) | 993 | if (page) |
994 | get_page(page); | 994 | get_page(page); |
@@ -1146,6 +1146,129 @@ int zeromap_page_range(struct vm_area_struct *vma, | |||
1146 | return err; | 1146 | return err; |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | pte_t * fastcall get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl) | ||
1150 | { | ||
1151 | pgd_t * pgd = pgd_offset(mm, addr); | ||
1152 | pud_t * pud = pud_alloc(mm, pgd, addr); | ||
1153 | if (pud) { | ||
1154 | pmd_t * pmd = pmd_alloc(mm, pud, addr); | ||
1155 | if (pmd) | ||
1156 | return pte_alloc_map_lock(mm, pmd, addr, ptl); | ||
1157 | } | ||
1158 | return NULL; | ||
1159 | } | ||
1160 | |||
1161 | /* | ||
1162 | * This is the old fallback for page remapping. | ||
1163 | * | ||
1164 | * For historical reasons, it only allows reserved pages. Only | ||
1165 | * old drivers should use this, and they needed to mark their | ||
1166 | * pages reserved for the old functions anyway. | ||
1167 | */ | ||
1168 | static int insert_page(struct mm_struct *mm, unsigned long addr, struct page *page, pgprot_t prot) | ||
1169 | { | ||
1170 | int retval; | ||
1171 | pte_t *pte; | ||
1172 | spinlock_t *ptl; | ||
1173 | |||
1174 | retval = -EINVAL; | ||
1175 | if (PageAnon(page)) | ||
1176 | goto out; | ||
1177 | retval = -ENOMEM; | ||
1178 | flush_dcache_page(page); | ||
1179 | pte = get_locked_pte(mm, addr, &ptl); | ||
1180 | if (!pte) | ||
1181 | goto out; | ||
1182 | retval = -EBUSY; | ||
1183 | if (!pte_none(*pte)) | ||
1184 | goto out_unlock; | ||
1185 | |||
1186 | /* Ok, finally just insert the thing.. */ | ||
1187 | get_page(page); | ||
1188 | inc_mm_counter(mm, file_rss); | ||
1189 | page_add_file_rmap(page); | ||
1190 | set_pte_at(mm, addr, pte, mk_pte(page, prot)); | ||
1191 | |||
1192 | retval = 0; | ||
1193 | out_unlock: | ||
1194 | pte_unmap_unlock(pte, ptl); | ||
1195 | out: | ||
1196 | return retval; | ||
1197 | } | ||
1198 | |||
1199 | /* | ||
1200 | * This allows drivers to insert individual pages they've allocated | ||
1201 | * into a user vma. | ||
1202 | * | ||
1203 | * The page has to be a nice clean _individual_ kernel allocation. | ||
1204 | * If you allocate a compound page, you need to have marked it as | ||
1205 | * such (__GFP_COMP), or manually just split the page up yourself | ||
1206 | * (which is mainly an issue of doing "set_page_count(page, 1)" for | ||
1207 | * each sub-page, and then freeing them one by one when you free | ||
1208 | * them rather than freeing it as a compound page). | ||
1209 | * | ||
1210 | * NOTE! Traditionally this was done with "remap_pfn_range()" which | ||
1211 | * took an arbitrary page protection parameter. This doesn't allow | ||
1212 | * that. Your vma protection will have to be set up correctly, which | ||
1213 | * means that if you want a shared writable mapping, you'd better | ||
1214 | * ask for a shared writable mapping! | ||
1215 | * | ||
1216 | * The page does not need to be reserved. | ||
1217 | */ | ||
1218 | int vm_insert_page(struct vm_area_struct *vma, unsigned long addr, struct page *page) | ||
1219 | { | ||
1220 | if (addr < vma->vm_start || addr >= vma->vm_end) | ||
1221 | return -EFAULT; | ||
1222 | if (!page_count(page)) | ||
1223 | return -EINVAL; | ||
1224 | return insert_page(vma->vm_mm, addr, page, vma->vm_page_prot); | ||
1225 | } | ||
1226 | EXPORT_SYMBOL_GPL(vm_insert_page); | ||
1227 | |||
1228 | /* | ||
1229 | * Somebody does a pfn remapping that doesn't actually work as a vma. | ||
1230 | * | ||
1231 | * Do it as individual pages instead, and warn about it. It's bad form, | ||
1232 | * and very inefficient. | ||
1233 | */ | ||
1234 | static int incomplete_pfn_remap(struct vm_area_struct *vma, | ||
1235 | unsigned long start, unsigned long end, | ||
1236 | unsigned long pfn, pgprot_t prot) | ||
1237 | { | ||
1238 | static int warn = 10; | ||
1239 | struct page *page; | ||
1240 | int retval; | ||
1241 | |||
1242 | if (!(vma->vm_flags & VM_INCOMPLETE)) { | ||
1243 | if (warn) { | ||
1244 | warn--; | ||
1245 | printk("%s does an incomplete pfn remapping", current->comm); | ||
1246 | dump_stack(); | ||
1247 | } | ||
1248 | } | ||
1249 | vma->vm_flags |= VM_INCOMPLETE | VM_IO | VM_RESERVED; | ||
1250 | |||
1251 | if (start < vma->vm_start || end > vma->vm_end) | ||
1252 | return -EINVAL; | ||
1253 | |||
1254 | if (!pfn_valid(pfn)) | ||
1255 | return -EINVAL; | ||
1256 | |||
1257 | page = pfn_to_page(pfn); | ||
1258 | if (!PageReserved(page)) | ||
1259 | return -EINVAL; | ||
1260 | |||
1261 | retval = 0; | ||
1262 | while (start < end) { | ||
1263 | retval = insert_page(vma->vm_mm, start, page, prot); | ||
1264 | if (retval < 0) | ||
1265 | break; | ||
1266 | start += PAGE_SIZE; | ||
1267 | page++; | ||
1268 | } | ||
1269 | return retval; | ||
1270 | } | ||
1271 | |||
1149 | /* | 1272 | /* |
1150 | * maps a range of physical memory into the requested pages. the old | 1273 | * maps a range of physical memory into the requested pages. the old |
1151 | * mappings are removed. any references to nonexistent pages results | 1274 | * mappings are removed. any references to nonexistent pages results |
@@ -1220,6 +1343,9 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, | |||
1220 | struct mm_struct *mm = vma->vm_mm; | 1343 | struct mm_struct *mm = vma->vm_mm; |
1221 | int err; | 1344 | int err; |
1222 | 1345 | ||
1346 | if (addr != vma->vm_start || end != vma->vm_end) | ||
1347 | return incomplete_pfn_remap(vma, addr, end, pfn, prot); | ||
1348 | |||
1223 | /* | 1349 | /* |
1224 | * Physically remapped pages are special. Tell the | 1350 | * Physically remapped pages are special. Tell the |
1225 | * rest of the world about it: | 1351 | * rest of the world about it: |
@@ -1300,8 +1426,15 @@ static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo | |||
1300 | */ | 1426 | */ |
1301 | if (unlikely(!src)) { | 1427 | if (unlikely(!src)) { |
1302 | void *kaddr = kmap_atomic(dst, KM_USER0); | 1428 | void *kaddr = kmap_atomic(dst, KM_USER0); |
1303 | unsigned long left = __copy_from_user_inatomic(kaddr, (void __user *)va, PAGE_SIZE); | 1429 | void __user *uaddr = (void __user *)(va & PAGE_MASK); |
1304 | if (left) | 1430 | |
1431 | /* | ||
1432 | * This really shouldn't fail, because the page is there | ||
1433 | * in the page tables. But it might just be unreadable, | ||
1434 | * in which case we just give up and fill the result with | ||
1435 | * zeroes. | ||
1436 | */ | ||
1437 | if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) | ||
1305 | memset(kaddr, 0, PAGE_SIZE); | 1438 | memset(kaddr, 0, PAGE_SIZE); |
1306 | kunmap_atomic(kaddr, KM_USER0); | 1439 | kunmap_atomic(kaddr, KM_USER0); |
1307 | return; | 1440 | return; |
@@ -1332,12 +1465,11 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
1332 | unsigned long address, pte_t *page_table, pmd_t *pmd, | 1465 | unsigned long address, pte_t *page_table, pmd_t *pmd, |
1333 | spinlock_t *ptl, pte_t orig_pte) | 1466 | spinlock_t *ptl, pte_t orig_pte) |
1334 | { | 1467 | { |
1335 | struct page *old_page, *src_page, *new_page; | 1468 | struct page *old_page, *new_page; |
1336 | pte_t entry; | 1469 | pte_t entry; |
1337 | int ret = VM_FAULT_MINOR; | 1470 | int ret = VM_FAULT_MINOR; |
1338 | 1471 | ||
1339 | old_page = vm_normal_page(vma, address, orig_pte); | 1472 | old_page = vm_normal_page(vma, address, orig_pte); |
1340 | src_page = old_page; | ||
1341 | if (!old_page) | 1473 | if (!old_page) |
1342 | goto gotten; | 1474 | goto gotten; |
1343 | 1475 | ||
@@ -1345,7 +1477,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
1345 | int reuse = can_share_swap_page(old_page); | 1477 | int reuse = can_share_swap_page(old_page); |
1346 | unlock_page(old_page); | 1478 | unlock_page(old_page); |
1347 | if (reuse) { | 1479 | if (reuse) { |
1348 | flush_cache_page(vma, address, pfn); | 1480 | flush_cache_page(vma, address, pte_pfn(orig_pte)); |
1349 | entry = pte_mkyoung(orig_pte); | 1481 | entry = pte_mkyoung(orig_pte); |
1350 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); | 1482 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); |
1351 | ptep_set_access_flags(vma, address, page_table, entry, 1); | 1483 | ptep_set_access_flags(vma, address, page_table, entry, 1); |
@@ -1365,7 +1497,7 @@ gotten: | |||
1365 | 1497 | ||
1366 | if (unlikely(anon_vma_prepare(vma))) | 1498 | if (unlikely(anon_vma_prepare(vma))) |
1367 | goto oom; | 1499 | goto oom; |
1368 | if (src_page == ZERO_PAGE(address)) { | 1500 | if (old_page == ZERO_PAGE(address)) { |
1369 | new_page = alloc_zeroed_user_highpage(vma, address); | 1501 | new_page = alloc_zeroed_user_highpage(vma, address); |
1370 | if (!new_page) | 1502 | if (!new_page) |
1371 | goto oom; | 1503 | goto oom; |
@@ -1373,7 +1505,7 @@ gotten: | |||
1373 | new_page = alloc_page_vma(GFP_HIGHUSER, vma, address); | 1505 | new_page = alloc_page_vma(GFP_HIGHUSER, vma, address); |
1374 | if (!new_page) | 1506 | if (!new_page) |
1375 | goto oom; | 1507 | goto oom; |
1376 | cow_user_page(new_page, src_page, address); | 1508 | cow_user_page(new_page, old_page, address); |
1377 | } | 1509 | } |
1378 | 1510 | ||
1379 | /* | 1511 | /* |
@@ -1389,7 +1521,7 @@ gotten: | |||
1389 | } | 1521 | } |
1390 | } else | 1522 | } else |
1391 | inc_mm_counter(mm, anon_rss); | 1523 | inc_mm_counter(mm, anon_rss); |
1392 | flush_cache_page(vma, address, pfn); | 1524 | flush_cache_page(vma, address, pte_pfn(orig_pte)); |
1393 | entry = mk_pte(new_page, vma->vm_page_prot); | 1525 | entry = mk_pte(new_page, vma->vm_page_prot); |
1394 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); | 1526 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); |
1395 | ptep_establish(vma, address, page_table, entry); | 1527 | ptep_establish(vma, address, page_table, entry); |
@@ -1909,6 +2041,8 @@ static int do_no_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
1909 | int anon = 0; | 2041 | int anon = 0; |
1910 | 2042 | ||
1911 | pte_unmap(page_table); | 2043 | pte_unmap(page_table); |
2044 | BUG_ON(vma->vm_flags & VM_PFNMAP); | ||
2045 | |||
1912 | if (vma->vm_file) { | 2046 | if (vma->vm_file) { |
1913 | mapping = vma->vm_file->f_mapping; | 2047 | mapping = vma->vm_file->f_mapping; |
1914 | sequence = mapping->truncate_count; | 2048 | sequence = mapping->truncate_count; |
@@ -1941,7 +2075,7 @@ retry: | |||
1941 | page = alloc_page_vma(GFP_HIGHUSER, vma, address); | 2075 | page = alloc_page_vma(GFP_HIGHUSER, vma, address); |
1942 | if (!page) | 2076 | if (!page) |
1943 | goto oom; | 2077 | goto oom; |
1944 | cow_user_page(page, new_page, address); | 2078 | copy_user_highpage(page, new_page, address); |
1945 | page_cache_release(new_page); | 2079 | page_cache_release(new_page); |
1946 | new_page = page; | 2080 | new_page = page; |
1947 | anon = 1; | 2081 | anon = 1; |
@@ -641,7 +641,7 @@ static void try_to_unmap_cluster(unsigned long cursor, | |||
641 | continue; | 641 | continue; |
642 | 642 | ||
643 | /* Nuke the page table entry. */ | 643 | /* Nuke the page table entry. */ |
644 | flush_cache_page(vma, address, pfn); | 644 | flush_cache_page(vma, address, pte_pfn(*pte)); |
645 | pteval = ptep_clear_flush(vma, address, pte); | 645 | pteval = ptep_clear_flush(vma, address, pte); |
646 | 646 | ||
647 | /* If nonlinear, store the file page offset in the pte. */ | 647 | /* If nonlinear, store the file page offset in the pte. */ |
diff --git a/net/atm/atm_misc.c b/net/atm/atm_misc.c index 223c7ad5bd0f..02cc7e71efea 100644 --- a/net/atm/atm_misc.c +++ b/net/atm/atm_misc.c | |||
@@ -74,11 +74,14 @@ struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, | |||
74 | */ | 74 | */ |
75 | 75 | ||
76 | 76 | ||
77 | int atm_pcr_goal(struct atm_trafprm *tp) | 77 | int atm_pcr_goal(const struct atm_trafprm *tp) |
78 | { | 78 | { |
79 | if (tp->pcr && tp->pcr != ATM_MAX_PCR) return -tp->pcr; | 79 | if (tp->pcr && tp->pcr != ATM_MAX_PCR) |
80 | if (tp->min_pcr && !tp->pcr) return tp->min_pcr; | 80 | return -tp->pcr; |
81 | if (tp->max_pcr != ATM_MAX_PCR) return -tp->max_pcr; | 81 | if (tp->min_pcr && !tp->pcr) |
82 | return tp->min_pcr; | ||
83 | if (tp->max_pcr != ATM_MAX_PCR) | ||
84 | return -tp->max_pcr; | ||
82 | return 0; | 85 | return 0; |
83 | } | 86 | } |
84 | 87 | ||
diff --git a/net/atm/common.c b/net/atm/common.c index 63feea49fb13..6656b111cc05 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -221,6 +221,29 @@ void vcc_release_async(struct atm_vcc *vcc, int reply) | |||
221 | EXPORT_SYMBOL(vcc_release_async); | 221 | EXPORT_SYMBOL(vcc_release_async); |
222 | 222 | ||
223 | 223 | ||
224 | void atm_dev_release_vccs(struct atm_dev *dev) | ||
225 | { | ||
226 | int i; | ||
227 | |||
228 | write_lock_irq(&vcc_sklist_lock); | ||
229 | for (i = 0; i < VCC_HTABLE_SIZE; i++) { | ||
230 | struct hlist_head *head = &vcc_hash[i]; | ||
231 | struct hlist_node *node, *tmp; | ||
232 | struct sock *s; | ||
233 | struct atm_vcc *vcc; | ||
234 | |||
235 | sk_for_each_safe(s, node, tmp, head) { | ||
236 | vcc = atm_sk(s); | ||
237 | if (vcc->dev == dev) { | ||
238 | vcc_release_async(vcc, -EPIPE); | ||
239 | sk_del_node_init(s); | ||
240 | } | ||
241 | } | ||
242 | } | ||
243 | write_unlock_irq(&vcc_sklist_lock); | ||
244 | } | ||
245 | |||
246 | |||
224 | static int adjust_tp(struct atm_trafprm *tp,unsigned char aal) | 247 | static int adjust_tp(struct atm_trafprm *tp,unsigned char aal) |
225 | { | 248 | { |
226 | int max_sdu; | 249 | int max_sdu; |
@@ -332,12 +355,13 @@ static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi, | |||
332 | return -EINVAL; | 355 | return -EINVAL; |
333 | if (vci > 0 && vci < ATM_NOT_RSV_VCI && !capable(CAP_NET_BIND_SERVICE)) | 356 | if (vci > 0 && vci < ATM_NOT_RSV_VCI && !capable(CAP_NET_BIND_SERVICE)) |
334 | return -EPERM; | 357 | return -EPERM; |
335 | error = 0; | 358 | error = -ENODEV; |
336 | if (!try_module_get(dev->ops->owner)) | 359 | if (!try_module_get(dev->ops->owner)) |
337 | return -ENODEV; | 360 | return error; |
338 | vcc->dev = dev; | 361 | vcc->dev = dev; |
339 | write_lock_irq(&vcc_sklist_lock); | 362 | write_lock_irq(&vcc_sklist_lock); |
340 | if ((error = find_ci(vcc, &vpi, &vci))) { | 363 | if (test_bit(ATM_DF_REMOVED, &dev->flags) || |
364 | (error = find_ci(vcc, &vpi, &vci))) { | ||
341 | write_unlock_irq(&vcc_sklist_lock); | 365 | write_unlock_irq(&vcc_sklist_lock); |
342 | goto fail_module_put; | 366 | goto fail_module_put; |
343 | } | 367 | } |
@@ -423,33 +447,23 @@ int vcc_connect(struct socket *sock, int itf, short vpi, int vci) | |||
423 | if (vcc->qos.txtp.traffic_class == ATM_ANYCLASS || | 447 | if (vcc->qos.txtp.traffic_class == ATM_ANYCLASS || |
424 | vcc->qos.rxtp.traffic_class == ATM_ANYCLASS) | 448 | vcc->qos.rxtp.traffic_class == ATM_ANYCLASS) |
425 | return -EINVAL; | 449 | return -EINVAL; |
426 | if (itf != ATM_ITF_ANY) { | 450 | if (likely(itf != ATM_ITF_ANY)) { |
427 | dev = atm_dev_lookup(itf); | 451 | dev = try_then_request_module(atm_dev_lookup(itf), "atm-device-%d", itf); |
428 | if (!dev) | ||
429 | return -ENODEV; | ||
430 | error = __vcc_connect(vcc, dev, vpi, vci); | ||
431 | if (error) { | ||
432 | atm_dev_put(dev); | ||
433 | return error; | ||
434 | } | ||
435 | } else { | 452 | } else { |
436 | struct list_head *p, *next; | ||
437 | |||
438 | dev = NULL; | 453 | dev = NULL; |
439 | spin_lock(&atm_dev_lock); | 454 | down(&atm_dev_mutex); |
440 | list_for_each_safe(p, next, &atm_devs) { | 455 | if (!list_empty(&atm_devs)) { |
441 | dev = list_entry(p, struct atm_dev, dev_list); | 456 | dev = list_entry(atm_devs.next, struct atm_dev, dev_list); |
442 | atm_dev_hold(dev); | 457 | atm_dev_hold(dev); |
443 | spin_unlock(&atm_dev_lock); | ||
444 | if (!__vcc_connect(vcc, dev, vpi, vci)) | ||
445 | break; | ||
446 | atm_dev_put(dev); | ||
447 | dev = NULL; | ||
448 | spin_lock(&atm_dev_lock); | ||
449 | } | 458 | } |
450 | spin_unlock(&atm_dev_lock); | 459 | up(&atm_dev_mutex); |
451 | if (!dev) | 460 | } |
452 | return -ENODEV; | 461 | if (!dev) |
462 | return -ENODEV; | ||
463 | error = __vcc_connect(vcc, dev, vpi, vci); | ||
464 | if (error) { | ||
465 | atm_dev_put(dev); | ||
466 | return error; | ||
453 | } | 467 | } |
454 | if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC) | 468 | if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC) |
455 | set_bit(ATM_VF_PARTIAL,&vcc->flags); | 469 | set_bit(ATM_VF_PARTIAL,&vcc->flags); |
diff --git a/net/atm/common.h b/net/atm/common.h index e49ed41c0e33..4887c317cefe 100644 --- a/net/atm/common.h +++ b/net/atm/common.h | |||
@@ -47,4 +47,6 @@ static inline void atm_proc_exit(void) | |||
47 | /* SVC */ | 47 | /* SVC */ |
48 | int svc_change_qos(struct atm_vcc *vcc,struct atm_qos *qos); | 48 | int svc_change_qos(struct atm_vcc *vcc,struct atm_qos *qos); |
49 | 49 | ||
50 | void atm_dev_release_vccs(struct atm_dev *dev); | ||
51 | |||
50 | #endif | 52 | #endif |
diff --git a/net/atm/resources.c b/net/atm/resources.c index 415d2615d475..c8c459fcb038 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | 26 | ||
27 | LIST_HEAD(atm_devs); | 27 | LIST_HEAD(atm_devs); |
28 | DEFINE_SPINLOCK(atm_dev_lock); | 28 | DECLARE_MUTEX(atm_dev_mutex); |
29 | 29 | ||
30 | static struct atm_dev *__alloc_atm_dev(const char *type) | 30 | static struct atm_dev *__alloc_atm_dev(const char *type) |
31 | { | 31 | { |
@@ -52,7 +52,7 @@ static struct atm_dev *__atm_dev_lookup(int number) | |||
52 | 52 | ||
53 | list_for_each(p, &atm_devs) { | 53 | list_for_each(p, &atm_devs) { |
54 | dev = list_entry(p, struct atm_dev, dev_list); | 54 | dev = list_entry(p, struct atm_dev, dev_list); |
55 | if ((dev->ops) && (dev->number == number)) { | 55 | if (dev->number == number) { |
56 | atm_dev_hold(dev); | 56 | atm_dev_hold(dev); |
57 | return dev; | 57 | return dev; |
58 | } | 58 | } |
@@ -64,12 +64,13 @@ struct atm_dev *atm_dev_lookup(int number) | |||
64 | { | 64 | { |
65 | struct atm_dev *dev; | 65 | struct atm_dev *dev; |
66 | 66 | ||
67 | spin_lock(&atm_dev_lock); | 67 | down(&atm_dev_mutex); |
68 | dev = __atm_dev_lookup(number); | 68 | dev = __atm_dev_lookup(number); |
69 | spin_unlock(&atm_dev_lock); | 69 | up(&atm_dev_mutex); |
70 | return dev; | 70 | return dev; |
71 | } | 71 | } |
72 | 72 | ||
73 | |||
73 | struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | 74 | struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, |
74 | int number, unsigned long *flags) | 75 | int number, unsigned long *flags) |
75 | { | 76 | { |
@@ -81,11 +82,11 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | |||
81 | type); | 82 | type); |
82 | return NULL; | 83 | return NULL; |
83 | } | 84 | } |
84 | spin_lock(&atm_dev_lock); | 85 | down(&atm_dev_mutex); |
85 | if (number != -1) { | 86 | if (number != -1) { |
86 | if ((inuse = __atm_dev_lookup(number))) { | 87 | if ((inuse = __atm_dev_lookup(number))) { |
87 | atm_dev_put(inuse); | 88 | atm_dev_put(inuse); |
88 | spin_unlock(&atm_dev_lock); | 89 | up(&atm_dev_mutex); |
89 | kfree(dev); | 90 | kfree(dev); |
90 | return NULL; | 91 | return NULL; |
91 | } | 92 | } |
@@ -105,19 +106,17 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | |||
105 | memset(&dev->flags, 0, sizeof(dev->flags)); | 106 | memset(&dev->flags, 0, sizeof(dev->flags)); |
106 | memset(&dev->stats, 0, sizeof(dev->stats)); | 107 | memset(&dev->stats, 0, sizeof(dev->stats)); |
107 | atomic_set(&dev->refcnt, 1); | 108 | atomic_set(&dev->refcnt, 1); |
108 | list_add_tail(&dev->dev_list, &atm_devs); | ||
109 | spin_unlock(&atm_dev_lock); | ||
110 | 109 | ||
111 | if (atm_proc_dev_register(dev) < 0) { | 110 | if (atm_proc_dev_register(dev) < 0) { |
112 | printk(KERN_ERR "atm_dev_register: " | 111 | printk(KERN_ERR "atm_dev_register: " |
113 | "atm_proc_dev_register failed for dev %s\n", | 112 | "atm_proc_dev_register failed for dev %s\n", |
114 | type); | 113 | type); |
115 | spin_lock(&atm_dev_lock); | 114 | up(&atm_dev_mutex); |
116 | list_del(&dev->dev_list); | ||
117 | spin_unlock(&atm_dev_lock); | ||
118 | kfree(dev); | 115 | kfree(dev); |
119 | return NULL; | 116 | return NULL; |
120 | } | 117 | } |
118 | list_add_tail(&dev->dev_list, &atm_devs); | ||
119 | up(&atm_dev_mutex); | ||
121 | 120 | ||
122 | return dev; | 121 | return dev; |
123 | } | 122 | } |
@@ -125,37 +124,22 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | |||
125 | 124 | ||
126 | void atm_dev_deregister(struct atm_dev *dev) | 125 | void atm_dev_deregister(struct atm_dev *dev) |
127 | { | 126 | { |
128 | unsigned long warning_time; | 127 | BUG_ON(test_bit(ATM_DF_REMOVED, &dev->flags)); |
128 | set_bit(ATM_DF_REMOVED, &dev->flags); | ||
129 | |||
130 | /* | ||
131 | * if we remove current device from atm_devs list, new device | ||
132 | * with same number can appear, such we need deregister proc, | ||
133 | * release async all vccs and remove them from vccs list too | ||
134 | */ | ||
135 | down(&atm_dev_mutex); | ||
136 | list_del(&dev->dev_list); | ||
137 | up(&atm_dev_mutex); | ||
129 | 138 | ||
139 | atm_dev_release_vccs(dev); | ||
130 | atm_proc_dev_deregister(dev); | 140 | atm_proc_dev_deregister(dev); |
131 | 141 | ||
132 | spin_lock(&atm_dev_lock); | 142 | atm_dev_put(dev); |
133 | list_del(&dev->dev_list); | ||
134 | spin_unlock(&atm_dev_lock); | ||
135 | |||
136 | warning_time = jiffies; | ||
137 | while (atomic_read(&dev->refcnt) != 1) { | ||
138 | msleep(250); | ||
139 | if ((jiffies - warning_time) > 10 * HZ) { | ||
140 | printk(KERN_EMERG "atm_dev_deregister: waiting for " | ||
141 | "dev %d to become free. Usage count = %d\n", | ||
142 | dev->number, atomic_read(&dev->refcnt)); | ||
143 | warning_time = jiffies; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | kfree(dev); | ||
148 | } | ||
149 | |||
150 | void shutdown_atm_dev(struct atm_dev *dev) | ||
151 | { | ||
152 | if (atomic_read(&dev->refcnt) > 1) { | ||
153 | set_bit(ATM_DF_CLOSE, &dev->flags); | ||
154 | return; | ||
155 | } | ||
156 | if (dev->ops->dev_close) | ||
157 | dev->ops->dev_close(dev); | ||
158 | atm_dev_deregister(dev); | ||
159 | } | 143 | } |
160 | 144 | ||
161 | 145 | ||
@@ -211,16 +195,16 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) | |||
211 | return -EFAULT; | 195 | return -EFAULT; |
212 | if (get_user(len, &iobuf->length)) | 196 | if (get_user(len, &iobuf->length)) |
213 | return -EFAULT; | 197 | return -EFAULT; |
214 | spin_lock(&atm_dev_lock); | 198 | down(&atm_dev_mutex); |
215 | list_for_each(p, &atm_devs) | 199 | list_for_each(p, &atm_devs) |
216 | size += sizeof(int); | 200 | size += sizeof(int); |
217 | if (size > len) { | 201 | if (size > len) { |
218 | spin_unlock(&atm_dev_lock); | 202 | up(&atm_dev_mutex); |
219 | return -E2BIG; | 203 | return -E2BIG; |
220 | } | 204 | } |
221 | tmp_buf = kmalloc(size, GFP_ATOMIC); | 205 | tmp_buf = kmalloc(size, GFP_ATOMIC); |
222 | if (!tmp_buf) { | 206 | if (!tmp_buf) { |
223 | spin_unlock(&atm_dev_lock); | 207 | up(&atm_dev_mutex); |
224 | return -ENOMEM; | 208 | return -ENOMEM; |
225 | } | 209 | } |
226 | tmp_p = tmp_buf; | 210 | tmp_p = tmp_buf; |
@@ -228,7 +212,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) | |||
228 | dev = list_entry(p, struct atm_dev, dev_list); | 212 | dev = list_entry(p, struct atm_dev, dev_list); |
229 | *tmp_p++ = dev->number; | 213 | *tmp_p++ = dev->number; |
230 | } | 214 | } |
231 | spin_unlock(&atm_dev_lock); | 215 | up(&atm_dev_mutex); |
232 | error = ((copy_to_user(buf, tmp_buf, size)) || | 216 | error = ((copy_to_user(buf, tmp_buf, size)) || |
233 | put_user(size, &iobuf->length)) | 217 | put_user(size, &iobuf->length)) |
234 | ? -EFAULT : 0; | 218 | ? -EFAULT : 0; |
@@ -245,7 +229,8 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) | |||
245 | if (get_user(number, &sioc->number)) | 229 | if (get_user(number, &sioc->number)) |
246 | return -EFAULT; | 230 | return -EFAULT; |
247 | 231 | ||
248 | if (!(dev = atm_dev_lookup(number))) | 232 | if (!(dev = try_then_request_module(atm_dev_lookup(number), |
233 | "atm-device-%d", number))) | ||
249 | return -ENODEV; | 234 | return -ENODEV; |
250 | 235 | ||
251 | switch (cmd) { | 236 | switch (cmd) { |
@@ -414,13 +399,13 @@ static __inline__ void *dev_get_idx(loff_t left) | |||
414 | 399 | ||
415 | void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) | 400 | void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) |
416 | { | 401 | { |
417 | spin_lock(&atm_dev_lock); | 402 | down(&atm_dev_mutex); |
418 | return *pos ? dev_get_idx(*pos) : (void *) 1; | 403 | return *pos ? dev_get_idx(*pos) : (void *) 1; |
419 | } | 404 | } |
420 | 405 | ||
421 | void atm_dev_seq_stop(struct seq_file *seq, void *v) | 406 | void atm_dev_seq_stop(struct seq_file *seq, void *v) |
422 | { | 407 | { |
423 | spin_unlock(&atm_dev_lock); | 408 | up(&atm_dev_mutex); |
424 | } | 409 | } |
425 | 410 | ||
426 | void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 411 | void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
@@ -434,4 +419,3 @@ void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
434 | EXPORT_SYMBOL(atm_dev_register); | 419 | EXPORT_SYMBOL(atm_dev_register); |
435 | EXPORT_SYMBOL(atm_dev_deregister); | 420 | EXPORT_SYMBOL(atm_dev_deregister); |
436 | EXPORT_SYMBOL(atm_dev_lookup); | 421 | EXPORT_SYMBOL(atm_dev_lookup); |
437 | EXPORT_SYMBOL(shutdown_atm_dev); | ||
diff --git a/net/atm/resources.h b/net/atm/resources.h index 12910619dbb6..b7fb82a93b42 100644 --- a/net/atm/resources.h +++ b/net/atm/resources.h | |||
@@ -11,8 +11,7 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | extern struct list_head atm_devs; | 13 | extern struct list_head atm_devs; |
14 | extern spinlock_t atm_dev_lock; | 14 | extern struct semaphore atm_dev_mutex; |
15 | |||
16 | 15 | ||
17 | int atm_dev_ioctl(unsigned int cmd, void __user *arg); | 16 | int atm_dev_ioctl(unsigned int cmd, void __user *arg); |
18 | 17 | ||
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 2a8c9afc3695..7ea0209cb169 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -975,7 +975,7 @@ static void fib_seq_stop(struct seq_file *seq, void *v) | |||
975 | 975 | ||
976 | static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi) | 976 | static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi) |
977 | { | 977 | { |
978 | static unsigned type2flags[RTN_MAX + 1] = { | 978 | static const unsigned type2flags[RTN_MAX + 1] = { |
979 | [7] = RTF_REJECT, [8] = RTF_REJECT, | 979 | [7] = RTF_REJECT, [8] = RTF_REJECT, |
980 | }; | 980 | }; |
981 | unsigned flags = type2flags[type]; | 981 | unsigned flags = type2flags[type]; |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 186f20c4a45e..6d2a6ac070e3 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -83,7 +83,7 @@ for (nhsel=0; nhsel < 1; nhsel++) | |||
83 | #define endfor_nexthops(fi) } | 83 | #define endfor_nexthops(fi) } |
84 | 84 | ||
85 | 85 | ||
86 | static struct | 86 | static const struct |
87 | { | 87 | { |
88 | int error; | 88 | int error; |
89 | u8 scope; | 89 | u8 scope; |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index e3eceecd0496..92e23b2ad4d2 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -220,7 +220,7 @@ struct icmp_control { | |||
220 | short error; /* This ICMP is classed as an error message */ | 220 | short error; /* This ICMP is classed as an error message */ |
221 | }; | 221 | }; |
222 | 222 | ||
223 | static struct icmp_control icmp_pointers[NR_ICMP_TYPES+1]; | 223 | static const struct icmp_control icmp_pointers[NR_ICMP_TYPES+1]; |
224 | 224 | ||
225 | /* | 225 | /* |
226 | * The ICMP socket(s). This is the most convenient way to flow control | 226 | * The ICMP socket(s). This is the most convenient way to flow control |
@@ -994,7 +994,7 @@ error: | |||
994 | /* | 994 | /* |
995 | * This table is the definition of how we handle ICMP. | 995 | * This table is the definition of how we handle ICMP. |
996 | */ | 996 | */ |
997 | static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = { | 997 | static const struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = { |
998 | [ICMP_ECHOREPLY] = { | 998 | [ICMP_ECHOREPLY] = { |
999 | .output_entry = ICMP_MIB_OUTECHOREPS, | 999 | .output_entry = ICMP_MIB_OUTECHOREPS, |
1000 | .input_entry = ICMP_MIB_INECHOREPS, | 1000 | .input_entry = ICMP_MIB_INECHOREPS, |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 4e9c74b54b15..a4c347c3b8e3 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -1217,7 +1217,7 @@ static int ipgre_tunnel_init(struct net_device *dev) | |||
1217 | return 0; | 1217 | return 0; |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | int __init ipgre_fb_tunnel_init(struct net_device *dev) | 1220 | static int __init ipgre_fb_tunnel_init(struct net_device *dev) |
1221 | { | 1221 | { |
1222 | struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; | 1222 | struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; |
1223 | struct iphdr *iph = &tunnel->parms.iph; | 1223 | struct iphdr *iph = &tunnel->parms.iph; |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 11c2f68254f0..eba64e2bd397 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -690,7 +690,7 @@ csum_page(struct page *page, int offset, int copy) | |||
690 | return csum; | 690 | return csum; |
691 | } | 691 | } |
692 | 692 | ||
693 | inline int ip_ufo_append_data(struct sock *sk, | 693 | static inline int ip_ufo_append_data(struct sock *sk, |
694 | int getfrag(void *from, char *to, int offset, int len, | 694 | int getfrag(void *from, char *to, int offset, int len, |
695 | int odd, struct sk_buff *skb), | 695 | int odd, struct sk_buff *skb), |
696 | void *from, int length, int hh_len, int fragheaderlen, | 696 | void *from, int length, int hh_len, int fragheaderlen, |
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c index f828fa2eb7de..2a3a8c59c655 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/ipv4/ipvs/ip_vs_conn.c | |||
@@ -771,7 +771,7 @@ static inline int todrop_entry(struct ip_vs_conn *cp) | |||
771 | * The drop rate array needs tuning for real environments. | 771 | * The drop rate array needs tuning for real environments. |
772 | * Called from timer bh only => no locking | 772 | * Called from timer bh only => no locking |
773 | */ | 773 | */ |
774 | static char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; | 774 | static const char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; |
775 | static char todrop_counter[9] = {0}; | 775 | static char todrop_counter[9] = {0}; |
776 | int i; | 776 | int i; |
777 | 777 | ||
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 2d66848e7aa0..9bdcf31b760e 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -1909,7 +1909,7 @@ static int ip_vs_set_timeout(struct ip_vs_timeout_user *u) | |||
1909 | #define DAEMON_ARG_LEN (sizeof(struct ip_vs_daemon_user)) | 1909 | #define DAEMON_ARG_LEN (sizeof(struct ip_vs_daemon_user)) |
1910 | #define MAX_ARG_LEN SVCDEST_ARG_LEN | 1910 | #define MAX_ARG_LEN SVCDEST_ARG_LEN |
1911 | 1911 | ||
1912 | static unsigned char set_arglen[SET_CMDID(IP_VS_SO_SET_MAX)+1] = { | 1912 | static const unsigned char set_arglen[SET_CMDID(IP_VS_SO_SET_MAX)+1] = { |
1913 | [SET_CMDID(IP_VS_SO_SET_ADD)] = SERVICE_ARG_LEN, | 1913 | [SET_CMDID(IP_VS_SO_SET_ADD)] = SERVICE_ARG_LEN, |
1914 | [SET_CMDID(IP_VS_SO_SET_EDIT)] = SERVICE_ARG_LEN, | 1914 | [SET_CMDID(IP_VS_SO_SET_EDIT)] = SERVICE_ARG_LEN, |
1915 | [SET_CMDID(IP_VS_SO_SET_DEL)] = SERVICE_ARG_LEN, | 1915 | [SET_CMDID(IP_VS_SO_SET_DEL)] = SERVICE_ARG_LEN, |
@@ -2180,7 +2180,7 @@ __ip_vs_get_timeouts(struct ip_vs_timeout_user *u) | |||
2180 | #define GET_TIMEOUT_ARG_LEN (sizeof(struct ip_vs_timeout_user)) | 2180 | #define GET_TIMEOUT_ARG_LEN (sizeof(struct ip_vs_timeout_user)) |
2181 | #define GET_DAEMON_ARG_LEN (sizeof(struct ip_vs_daemon_user) * 2) | 2181 | #define GET_DAEMON_ARG_LEN (sizeof(struct ip_vs_daemon_user) * 2) |
2182 | 2182 | ||
2183 | static unsigned char get_arglen[GET_CMDID(IP_VS_SO_GET_MAX)+1] = { | 2183 | static const unsigned char get_arglen[GET_CMDID(IP_VS_SO_GET_MAX)+1] = { |
2184 | [GET_CMDID(IP_VS_SO_GET_VERSION)] = 64, | 2184 | [GET_CMDID(IP_VS_SO_GET_VERSION)] = 64, |
2185 | [GET_CMDID(IP_VS_SO_GET_INFO)] = GET_INFO_ARG_LEN, | 2185 | [GET_CMDID(IP_VS_SO_GET_INFO)] = GET_INFO_ARG_LEN, |
2186 | [GET_CMDID(IP_VS_SO_GET_SERVICES)] = GET_SERVICES_ARG_LEN, | 2186 | [GET_CMDID(IP_VS_SO_GET_SERVICES)] = GET_SERVICES_ARG_LEN, |
diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/ipv4/ipvs/ip_vs_proto_tcp.c index c19408973c09..0e878fd6215c 100644 --- a/net/ipv4/ipvs/ip_vs_proto_tcp.c +++ b/net/ipv4/ipvs/ip_vs_proto_tcp.c | |||
@@ -251,7 +251,7 @@ tcp_csum_check(struct sk_buff *skb, struct ip_vs_protocol *pp) | |||
251 | #define TCP_DIR_OUTPUT 4 | 251 | #define TCP_DIR_OUTPUT 4 |
252 | #define TCP_DIR_INPUT_ONLY 8 | 252 | #define TCP_DIR_INPUT_ONLY 8 |
253 | 253 | ||
254 | static int tcp_state_off[IP_VS_DIR_LAST] = { | 254 | static const int tcp_state_off[IP_VS_DIR_LAST] = { |
255 | [IP_VS_DIR_INPUT] = TCP_DIR_INPUT, | 255 | [IP_VS_DIR_INPUT] = TCP_DIR_INPUT, |
256 | [IP_VS_DIR_OUTPUT] = TCP_DIR_OUTPUT, | 256 | [IP_VS_DIR_OUTPUT] = TCP_DIR_OUTPUT, |
257 | [IP_VS_DIR_INPUT_ONLY] = TCP_DIR_INPUT_ONLY, | 257 | [IP_VS_DIR_INPUT_ONLY] = TCP_DIR_INPUT_ONLY, |
diff --git a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c index fa3f914117ec..e52847fa10f5 100644 --- a/net/ipv4/netfilter/ip_conntrack_amanda.c +++ b/net/ipv4/netfilter/ip_conntrack_amanda.c | |||
@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL"); | |||
37 | module_param(master_timeout, int, 0600); | 37 | module_param(master_timeout, int, 0600); |
38 | MODULE_PARM_DESC(master_timeout, "timeout for the master connection"); | 38 | MODULE_PARM_DESC(master_timeout, "timeout for the master connection"); |
39 | 39 | ||
40 | static char *conns[] = { "DATA ", "MESG ", "INDEX " }; | 40 | static const char *conns[] = { "DATA ", "MESG ", "INDEX " }; |
41 | 41 | ||
42 | /* This is slow, but it's simple. --RR */ | 42 | /* This is slow, but it's simple. --RR */ |
43 | static char *amanda_buffer; | 43 | static char *amanda_buffer; |
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c index 422ab68ee7fb..7a4ecddd597b 100644 --- a/net/ipv4/netfilter/ip_conntrack_core.c +++ b/net/ipv4/netfilter/ip_conntrack_core.c | |||
@@ -1354,7 +1354,7 @@ static void free_conntrack_hash(struct list_head *hash, int vmalloced,int size) | |||
1354 | get_order(sizeof(struct list_head) * size)); | 1354 | get_order(sizeof(struct list_head) * size)); |
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | void ip_conntrack_flush() | 1357 | void ip_conntrack_flush(void) |
1358 | { | 1358 | { |
1359 | /* This makes sure all current packets have passed through | 1359 | /* This makes sure all current packets have passed through |
1360 | netfilter framework. Roll on, two-stage module | 1360 | netfilter framework. Roll on, two-stage module |
@@ -1408,7 +1408,7 @@ static struct list_head *alloc_hashtable(int size, int *vmalloced) | |||
1408 | return hash; | 1408 | return hash; |
1409 | } | 1409 | } |
1410 | 1410 | ||
1411 | int set_hashsize(const char *val, struct kernel_param *kp) | 1411 | static int set_hashsize(const char *val, struct kernel_param *kp) |
1412 | { | 1412 | { |
1413 | int i, bucket, hashsize, vmalloced; | 1413 | int i, bucket, hashsize, vmalloced; |
1414 | int old_vmalloced, old_size; | 1414 | int old_vmalloced, old_size; |
diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c index 59e12b02b22c..68b173bcda60 100644 --- a/net/ipv4/netfilter/ip_conntrack_ftp.c +++ b/net/ipv4/netfilter/ip_conntrack_ftp.c | |||
@@ -55,7 +55,7 @@ static int try_rfc959(const char *, size_t, u_int32_t [], char); | |||
55 | static int try_eprt(const char *, size_t, u_int32_t [], char); | 55 | static int try_eprt(const char *, size_t, u_int32_t [], char); |
56 | static int try_epsv_response(const char *, size_t, u_int32_t [], char); | 56 | static int try_epsv_response(const char *, size_t, u_int32_t [], char); |
57 | 57 | ||
58 | static struct ftp_search { | 58 | static const struct ftp_search { |
59 | enum ip_conntrack_dir dir; | 59 | enum ip_conntrack_dir dir; |
60 | const char *pattern; | 60 | const char *pattern; |
61 | size_t plen; | 61 | size_t plen; |
diff --git a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c index 2dea1db14406..d7c40421d0d1 100644 --- a/net/ipv4/netfilter/ip_conntrack_irc.c +++ b/net/ipv4/netfilter/ip_conntrack_irc.c | |||
@@ -59,7 +59,7 @@ MODULE_PARM_DESC(max_dcc_channels, "max number of expected DCC channels per IRC | |||
59 | module_param(dcc_timeout, int, 0400); | 59 | module_param(dcc_timeout, int, 0400); |
60 | MODULE_PARM_DESC(dcc_timeout, "timeout on for unestablished DCC channels"); | 60 | MODULE_PARM_DESC(dcc_timeout, "timeout on for unestablished DCC channels"); |
61 | 61 | ||
62 | static char *dccprotos[] = { "SEND ", "CHAT ", "MOVE ", "TSEND ", "SCHAT " }; | 62 | static const char *dccprotos[] = { "SEND ", "CHAT ", "MOVE ", "TSEND ", "SCHAT " }; |
63 | #define MINMATCHLEN 5 | 63 | #define MINMATCHLEN 5 |
64 | 64 | ||
65 | #if 0 | 65 | #if 0 |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c index e4d6b268e8c4..5f9925db608e 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c | |||
@@ -51,7 +51,7 @@ static int icmp_invert_tuple(struct ip_conntrack_tuple *tuple, | |||
51 | const struct ip_conntrack_tuple *orig) | 51 | const struct ip_conntrack_tuple *orig) |
52 | { | 52 | { |
53 | /* Add 1; spaces filled with 0. */ | 53 | /* Add 1; spaces filled with 0. */ |
54 | static u_int8_t invmap[] | 54 | static const u_int8_t invmap[] |
55 | = { [ICMP_ECHO] = ICMP_ECHOREPLY + 1, | 55 | = { [ICMP_ECHO] = ICMP_ECHOREPLY + 1, |
56 | [ICMP_ECHOREPLY] = ICMP_ECHO + 1, | 56 | [ICMP_ECHOREPLY] = ICMP_ECHO + 1, |
57 | [ICMP_TIMESTAMP] = ICMP_TIMESTAMPREPLY + 1, | 57 | [ICMP_TIMESTAMP] = ICMP_TIMESTAMPREPLY + 1, |
@@ -110,7 +110,7 @@ static int icmp_packet(struct ip_conntrack *ct, | |||
110 | return NF_ACCEPT; | 110 | return NF_ACCEPT; |
111 | } | 111 | } |
112 | 112 | ||
113 | static u_int8_t valid_new[] = { | 113 | static const u_int8_t valid_new[] = { |
114 | [ICMP_ECHO] = 1, | 114 | [ICMP_ECHO] = 1, |
115 | [ICMP_TIMESTAMP] = 1, | 115 | [ICMP_TIMESTAMP] = 1, |
116 | [ICMP_INFO_REQUEST] = 1, | 116 | [ICMP_INFO_REQUEST] = 1, |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c index 59a4a0111dd3..977fb59d4563 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c | |||
@@ -65,7 +65,7 @@ static unsigned long ip_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000; | |||
65 | static unsigned long ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000; | 65 | static unsigned long ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000; |
66 | static unsigned long ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS; | 66 | static unsigned long ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS; |
67 | 67 | ||
68 | static unsigned long * sctp_timeouts[] | 68 | static const unsigned long * sctp_timeouts[] |
69 | = { NULL, /* SCTP_CONNTRACK_NONE */ | 69 | = { NULL, /* SCTP_CONNTRACK_NONE */ |
70 | &ip_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */ | 70 | &ip_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */ |
71 | &ip_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */ | 71 | &ip_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */ |
@@ -118,7 +118,7 @@ cookie echoed to closed. | |||
118 | */ | 118 | */ |
119 | 119 | ||
120 | /* SCTP conntrack state transitions */ | 120 | /* SCTP conntrack state transitions */ |
121 | static enum sctp_conntrack sctp_conntracks[2][9][SCTP_CONNTRACK_MAX] = { | 121 | static const enum sctp_conntrack sctp_conntracks[2][9][SCTP_CONNTRACK_MAX] = { |
122 | { | 122 | { |
123 | /* ORIGINAL */ | 123 | /* ORIGINAL */ |
124 | /* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA */ | 124 | /* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA */ |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c index ee3b7d6c4d2e..625981676776 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c | |||
@@ -99,7 +99,7 @@ unsigned long ip_ct_tcp_timeout_close = 10 SECS; | |||
99 | to ~13-30min depending on RTO. */ | 99 | to ~13-30min depending on RTO. */ |
100 | unsigned long ip_ct_tcp_timeout_max_retrans = 5 MINS; | 100 | unsigned long ip_ct_tcp_timeout_max_retrans = 5 MINS; |
101 | 101 | ||
102 | static unsigned long * tcp_timeouts[] | 102 | static const unsigned long * tcp_timeouts[] |
103 | = { NULL, /* TCP_CONNTRACK_NONE */ | 103 | = { NULL, /* TCP_CONNTRACK_NONE */ |
104 | &ip_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */ | 104 | &ip_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */ |
105 | &ip_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */ | 105 | &ip_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */ |
@@ -170,7 +170,7 @@ enum tcp_bit_set { | |||
170 | * if they are invalid | 170 | * if they are invalid |
171 | * or we do not support the request (simultaneous open) | 171 | * or we do not support the request (simultaneous open) |
172 | */ | 172 | */ |
173 | static enum tcp_conntrack tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { | 173 | static const enum tcp_conntrack tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { |
174 | { | 174 | { |
175 | /* ORIGINAL */ | 175 | /* ORIGINAL */ |
176 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sLI */ | 176 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sLI */ |
@@ -817,7 +817,7 @@ void ip_conntrack_tcp_update(struct sk_buff *skb, | |||
817 | #define TH_CWR 0x80 | 817 | #define TH_CWR 0x80 |
818 | 818 | ||
819 | /* table of valid flag combinations - ECE and CWR are always valid */ | 819 | /* table of valid flag combinations - ECE and CWR are always valid */ |
820 | static u8 tcp_valid_flags[(TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG) + 1] = | 820 | static const u8 tcp_valid_flags[(TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG) + 1] = |
821 | { | 821 | { |
822 | [TH_SYN] = 1, | 822 | [TH_SYN] = 1, |
823 | [TH_SYN|TH_ACK] = 1, | 823 | [TH_SYN|TH_ACK] = 1, |
diff --git a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c index 762f4d93936b..c1a61462507f 100644 --- a/net/ipv4/netfilter/ip_nat_core.c +++ b/net/ipv4/netfilter/ip_nat_core.c | |||
@@ -49,7 +49,7 @@ static unsigned int ip_nat_htable_size; | |||
49 | static struct list_head *bysource; | 49 | static struct list_head *bysource; |
50 | 50 | ||
51 | #define MAX_IP_NAT_PROTO 256 | 51 | #define MAX_IP_NAT_PROTO 256 |
52 | struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO]; | 52 | static struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO]; |
53 | 53 | ||
54 | static inline struct ip_nat_protocol * | 54 | static inline struct ip_nat_protocol * |
55 | __ip_nat_proto_find(u_int8_t protonum) | 55 | __ip_nat_proto_find(u_int8_t protonum) |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 75c27e92f6ab..45886c8475e8 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -1892,7 +1892,7 @@ static int ipt_get_matches(char *buffer, char **start, off_t offset, int length) | |||
1892 | return pos; | 1892 | return pos; |
1893 | } | 1893 | } |
1894 | 1894 | ||
1895 | static struct { char *name; get_info_t *get_info; } ipt_proc_entry[] = | 1895 | static const struct { char *name; get_info_t *get_info; } ipt_proc_entry[] = |
1896 | { { "ip_tables_names", ipt_get_tables }, | 1896 | { { "ip_tables_names", ipt_get_tables }, |
1897 | { "ip_tables_targets", ipt_get_targets }, | 1897 | { "ip_tables_targets", ipt_get_targets }, |
1898 | { "ip_tables_matches", ipt_get_matches }, | 1898 | { "ip_tables_matches", ipt_get_matches }, |
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index 92ed050fac69..30be0f1dae37 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c | |||
@@ -197,7 +197,7 @@ static void dump_packet(const struct nf_loginfo *info, | |||
197 | } | 197 | } |
198 | case IPPROTO_ICMP: { | 198 | case IPPROTO_ICMP: { |
199 | struct icmphdr _icmph, *ich; | 199 | struct icmphdr _icmph, *ich; |
200 | static size_t required_len[NR_ICMP_TYPES+1] | 200 | static const size_t required_len[NR_ICMP_TYPES+1] |
201 | = { [ICMP_ECHOREPLY] = 4, | 201 | = { [ICMP_ECHOREPLY] = 4, |
202 | [ICMP_DEST_UNREACH] | 202 | [ICMP_DEST_UNREACH] |
203 | = 8 + sizeof(struct iphdr), | 203 | = 8 + sizeof(struct iphdr), |
@@ -351,7 +351,7 @@ static void dump_packet(const struct nf_loginfo *info, | |||
351 | /* maxlen = 230+ 91 + 230 + 252 = 803 */ | 351 | /* maxlen = 230+ 91 + 230 + 252 = 803 */ |
352 | } | 352 | } |
353 | 353 | ||
354 | struct nf_loginfo default_loginfo = { | 354 | static struct nf_loginfo default_loginfo = { |
355 | .type = NF_LOG_TYPE_LOG, | 355 | .type = NF_LOG_TYPE_LOG, |
356 | .u = { | 356 | .u = { |
357 | .log = { | 357 | .log = { |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index a65e508fbd40..0d7dc668db46 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -98,7 +98,7 @@ fold_field(void *mib[], int offt) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | /* snmp items */ | 100 | /* snmp items */ |
101 | static struct snmp_mib snmp4_ipstats_list[] = { | 101 | static const struct snmp_mib snmp4_ipstats_list[] = { |
102 | SNMP_MIB_ITEM("InReceives", IPSTATS_MIB_INRECEIVES), | 102 | SNMP_MIB_ITEM("InReceives", IPSTATS_MIB_INRECEIVES), |
103 | SNMP_MIB_ITEM("InHdrErrors", IPSTATS_MIB_INHDRERRORS), | 103 | SNMP_MIB_ITEM("InHdrErrors", IPSTATS_MIB_INHDRERRORS), |
104 | SNMP_MIB_ITEM("InAddrErrors", IPSTATS_MIB_INADDRERRORS), | 104 | SNMP_MIB_ITEM("InAddrErrors", IPSTATS_MIB_INADDRERRORS), |
@@ -119,7 +119,7 @@ static struct snmp_mib snmp4_ipstats_list[] = { | |||
119 | SNMP_MIB_SENTINEL | 119 | SNMP_MIB_SENTINEL |
120 | }; | 120 | }; |
121 | 121 | ||
122 | static struct snmp_mib snmp4_icmp_list[] = { | 122 | static const struct snmp_mib snmp4_icmp_list[] = { |
123 | SNMP_MIB_ITEM("InMsgs", ICMP_MIB_INMSGS), | 123 | SNMP_MIB_ITEM("InMsgs", ICMP_MIB_INMSGS), |
124 | SNMP_MIB_ITEM("InErrors", ICMP_MIB_INERRORS), | 124 | SNMP_MIB_ITEM("InErrors", ICMP_MIB_INERRORS), |
125 | SNMP_MIB_ITEM("InDestUnreachs", ICMP_MIB_INDESTUNREACHS), | 125 | SNMP_MIB_ITEM("InDestUnreachs", ICMP_MIB_INDESTUNREACHS), |
@@ -149,7 +149,7 @@ static struct snmp_mib snmp4_icmp_list[] = { | |||
149 | SNMP_MIB_SENTINEL | 149 | SNMP_MIB_SENTINEL |
150 | }; | 150 | }; |
151 | 151 | ||
152 | static struct snmp_mib snmp4_tcp_list[] = { | 152 | static const struct snmp_mib snmp4_tcp_list[] = { |
153 | SNMP_MIB_ITEM("RtoAlgorithm", TCP_MIB_RTOALGORITHM), | 153 | SNMP_MIB_ITEM("RtoAlgorithm", TCP_MIB_RTOALGORITHM), |
154 | SNMP_MIB_ITEM("RtoMin", TCP_MIB_RTOMIN), | 154 | SNMP_MIB_ITEM("RtoMin", TCP_MIB_RTOMIN), |
155 | SNMP_MIB_ITEM("RtoMax", TCP_MIB_RTOMAX), | 155 | SNMP_MIB_ITEM("RtoMax", TCP_MIB_RTOMAX), |
@@ -167,7 +167,7 @@ static struct snmp_mib snmp4_tcp_list[] = { | |||
167 | SNMP_MIB_SENTINEL | 167 | SNMP_MIB_SENTINEL |
168 | }; | 168 | }; |
169 | 169 | ||
170 | static struct snmp_mib snmp4_udp_list[] = { | 170 | static const struct snmp_mib snmp4_udp_list[] = { |
171 | SNMP_MIB_ITEM("InDatagrams", UDP_MIB_INDATAGRAMS), | 171 | SNMP_MIB_ITEM("InDatagrams", UDP_MIB_INDATAGRAMS), |
172 | SNMP_MIB_ITEM("NoPorts", UDP_MIB_NOPORTS), | 172 | SNMP_MIB_ITEM("NoPorts", UDP_MIB_NOPORTS), |
173 | SNMP_MIB_ITEM("InErrors", UDP_MIB_INERRORS), | 173 | SNMP_MIB_ITEM("InErrors", UDP_MIB_INERRORS), |
@@ -175,7 +175,7 @@ static struct snmp_mib snmp4_udp_list[] = { | |||
175 | SNMP_MIB_SENTINEL | 175 | SNMP_MIB_SENTINEL |
176 | }; | 176 | }; |
177 | 177 | ||
178 | static struct snmp_mib snmp4_net_list[] = { | 178 | static const struct snmp_mib snmp4_net_list[] = { |
179 | SNMP_MIB_ITEM("SyncookiesSent", LINUX_MIB_SYNCOOKIESSENT), | 179 | SNMP_MIB_ITEM("SyncookiesSent", LINUX_MIB_SYNCOOKIESSENT), |
180 | SNMP_MIB_ITEM("SyncookiesRecv", LINUX_MIB_SYNCOOKIESRECV), | 180 | SNMP_MIB_ITEM("SyncookiesRecv", LINUX_MIB_SYNCOOKIESRECV), |
181 | SNMP_MIB_ITEM("SyncookiesFailed", LINUX_MIB_SYNCOOKIESFAILED), | 181 | SNMP_MIB_ITEM("SyncookiesFailed", LINUX_MIB_SYNCOOKIESFAILED), |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 381dd6a6aebb..f701a136a6ae 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1371,7 +1371,7 @@ out: kfree_skb(skb); | |||
1371 | * are needed for AMPRnet AX.25 paths. | 1371 | * are needed for AMPRnet AX.25 paths. |
1372 | */ | 1372 | */ |
1373 | 1373 | ||
1374 | static unsigned short mtu_plateau[] = | 1374 | static const unsigned short mtu_plateau[] = |
1375 | {32000, 17914, 8166, 4352, 2002, 1492, 576, 296, 216, 128 }; | 1375 | {32000, 17914, 8166, 4352, 2002, 1492, 576, 296, 216, 128 }; |
1376 | 1376 | ||
1377 | static __inline__ unsigned short guess_mtu(unsigned short old_mtu) | 1377 | static __inline__ unsigned short guess_mtu(unsigned short old_mtu) |
@@ -3149,8 +3149,7 @@ int __init ip_rt_init(void) | |||
3149 | sizeof(struct rt_hash_bucket), | 3149 | sizeof(struct rt_hash_bucket), |
3150 | rhash_entries, | 3150 | rhash_entries, |
3151 | (num_physpages >= 128 * 1024) ? | 3151 | (num_physpages >= 128 * 1024) ? |
3152 | (27 - PAGE_SHIFT) : | 3152 | 15 : 17, |
3153 | (29 - PAGE_SHIFT), | ||
3154 | HASH_HIGHMEM, | 3153 | HASH_HIGHMEM, |
3155 | &rt_hash_log, | 3154 | &rt_hash_log, |
3156 | &rt_hash_mask, | 3155 | &rt_hash_mask, |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 9ac7a4f46bd8..ef98b14ac56d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1413,7 +1413,7 @@ recv_urg: | |||
1413 | * closed. | 1413 | * closed. |
1414 | */ | 1414 | */ |
1415 | 1415 | ||
1416 | static unsigned char new_state[16] = { | 1416 | static const unsigned char new_state[16] = { |
1417 | /* current state: new state: action: */ | 1417 | /* current state: new state: action: */ |
1418 | /* (Invalid) */ TCP_CLOSE, | 1418 | /* (Invalid) */ TCP_CLOSE, |
1419 | /* TCP_ESTABLISHED */ TCP_FIN_WAIT1 | TCP_ACTION_FIN, | 1419 | /* TCP_ESTABLISHED */ TCP_FIN_WAIT1 | TCP_ACTION_FIN, |
@@ -2065,8 +2065,7 @@ void __init tcp_init(void) | |||
2065 | sizeof(struct inet_ehash_bucket), | 2065 | sizeof(struct inet_ehash_bucket), |
2066 | thash_entries, | 2066 | thash_entries, |
2067 | (num_physpages >= 128 * 1024) ? | 2067 | (num_physpages >= 128 * 1024) ? |
2068 | (25 - PAGE_SHIFT) : | 2068 | 13 : 15, |
2069 | (27 - PAGE_SHIFT), | ||
2070 | HASH_HIGHMEM, | 2069 | HASH_HIGHMEM, |
2071 | &tcp_hashinfo.ehash_size, | 2070 | &tcp_hashinfo.ehash_size, |
2072 | NULL, | 2071 | NULL, |
@@ -2082,8 +2081,7 @@ void __init tcp_init(void) | |||
2082 | sizeof(struct inet_bind_hashbucket), | 2081 | sizeof(struct inet_bind_hashbucket), |
2083 | tcp_hashinfo.ehash_size, | 2082 | tcp_hashinfo.ehash_size, |
2084 | (num_physpages >= 128 * 1024) ? | 2083 | (num_physpages >= 128 * 1024) ? |
2085 | (25 - PAGE_SHIFT) : | 2084 | 13 : 15, |
2086 | (27 - PAGE_SHIFT), | ||
2087 | HASH_HIGHMEM, | 2085 | HASH_HIGHMEM, |
2088 | &tcp_hashinfo.bhash_size, | 2086 | &tcp_hashinfo.bhash_size, |
2089 | NULL, | 2087 | NULL, |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index a16064ba0caf..76ff9f4fe89d 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -985,6 +985,8 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev, | |||
985 | } | 985 | } |
986 | 986 | ||
987 | /* Rule 4: Prefer home address -- not implemented yet */ | 987 | /* Rule 4: Prefer home address -- not implemented yet */ |
988 | if (hiscore.rule < 4) | ||
989 | hiscore.rule++; | ||
988 | 990 | ||
989 | /* Rule 5: Prefer outgoing interface */ | 991 | /* Rule 5: Prefer outgoing interface */ |
990 | if (hiscore.rule < 5) { | 992 | if (hiscore.rule < 5) { |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 1bdf0fb8bf8a..34a332225c17 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -751,7 +751,7 @@ void icmpv6_cleanup(void) | |||
751 | inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6); | 751 | inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6); |
752 | } | 752 | } |
753 | 753 | ||
754 | static struct icmp6_err { | 754 | static const struct icmp6_err { |
755 | int err; | 755 | int err; |
756 | int fatal; | 756 | int fatal; |
757 | } tab_unreach[] = { | 757 | } tab_unreach[] = { |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index c1fa693511a1..8523c76ebf76 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -774,7 +774,8 @@ out_err_release: | |||
774 | *dst = NULL; | 774 | *dst = NULL; |
775 | return err; | 775 | return err; |
776 | } | 776 | } |
777 | inline int ip6_ufo_append_data(struct sock *sk, | 777 | |
778 | static inline int ip6_ufo_append_data(struct sock *sk, | ||
778 | int getfrag(void *from, char *to, int offset, int len, | 779 | int getfrag(void *from, char *to, int offset, int len, |
779 | int odd, struct sk_buff *skb), | 780 | int odd, struct sk_buff *skb), |
780 | void *from, int length, int hh_len, int fragheaderlen, | 781 | void *from, int length, int hh_len, int fragheaderlen, |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 25757ade989f..3620718defe6 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -628,8 +628,8 @@ e_inval: | |||
628 | return -EINVAL; | 628 | return -EINVAL; |
629 | } | 629 | } |
630 | 630 | ||
631 | int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr, | 631 | static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr, |
632 | char __user *optval, int len) | 632 | char __user *optval, int len) |
633 | { | 633 | { |
634 | if (!hdr) | 634 | if (!hdr) |
635 | return 0; | 635 | return 0; |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 7d492226c16e..95d469271c4d 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -1972,7 +1972,7 @@ static int ip6t_get_matches(char *buffer, char **start, off_t offset, int length | |||
1972 | return pos; | 1972 | return pos; |
1973 | } | 1973 | } |
1974 | 1974 | ||
1975 | static struct { char *name; get_info_t *get_info; } ip6t_proc_entry[] = | 1975 | static const struct { char *name; get_info_t *get_info; } ip6t_proc_entry[] = |
1976 | { { "ip6_tables_names", ip6t_get_tables }, | 1976 | { { "ip6_tables_names", ip6t_get_tables }, |
1977 | { "ip6_tables_targets", ip6t_get_targets }, | 1977 | { "ip6_tables_targets", ip6t_get_targets }, |
1978 | { "ip6_tables_matches", ip6t_get_matches }, | 1978 | { "ip6_tables_matches", ip6t_get_matches }, |