diff options
93 files changed, 1251 insertions, 343 deletions
diff --git a/Documentation/BUG-HUNTING b/Documentation/BUG-HUNTING index 65b97e1dbf70..35f5bd243336 100644 --- a/Documentation/BUG-HUNTING +++ b/Documentation/BUG-HUNTING @@ -191,6 +191,30 @@ e.g. crash dump output as shown by Dave Miller. > mov 0x8(%ebp), %ebx ! %ebx = skb->sk > mov 0x13c(%ebx), %eax ! %eax = inet_sk(sk)->opt +In addition, you can use GDB to figure out the exact file and line +number of the OOPS from the vmlinux file. If you have +CONFIG_DEBUG_INFO enabled, you can simply copy the EIP value from the +OOPS: + + EIP: 0060:[<c021e50e>] Not tainted VLI + +And use GDB to translate that to human-readable form: + + gdb vmlinux + (gdb) l *0xc021e50e + +If you don't have CONFIG_DEBUG_INFO enabled, you use the function +offset from the OOPS: + + EIP is at vt_ioctl+0xda8/0x1482 + +And recompile the kernel with CONFIG_DEBUG_INFO enabled: + + make vmlinux + gdb vmlinux + (gdb) p vt_ioctl + (gdb) l *(0x<address of vt_ioctl> + 0xda8) + Another very useful option of the Kernel Hacking section in menuconfig is Debug memory allocations. This will help you see whether data has been initialised and not set before use etc. To see the values that get assigned diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist index 3af3e65cf43b..6ebffb57e3db 100644 --- a/Documentation/SubmitChecklist +++ b/Documentation/SubmitChecklist @@ -84,3 +84,9 @@ kernel patches. 24: Avoid whitespace damage such as indenting with spaces or whitespace at the end of lines. You can test this by feeding the patch to "git apply --check --whitespace=error-all" + +25: Check your patch for general style as detailed in + Documentation/CodingStyle. Check for trivial violations with the + patch style checker prior to submission (scripts/checkpatch.pl). + You should be able to justify all violations that remain in + your patch. diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index a417b25fb1aa..d91125ab6f49 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches @@ -118,7 +118,20 @@ then only post say 15 or so at a time and wait for review and integration. -4) Select e-mail destination. +4) Style check your changes. + +Check your patch for basic style violations, details of which can be +found in Documentation/CodingStyle. Failure to do so simply wastes +the reviewers time and will get your patch rejected, probabally +without even being read. + +At a minimum you should check your patches with the patch style +checker prior to submission (scripts/patchcheck.pl). You should +be able to justify all violations that remain in your patch. + + + +5) Select e-mail destination. Look through the MAINTAINERS file and the source code, and determine if your change applies to a specific subsystem of the kernel, with @@ -146,7 +159,7 @@ discussed should the patch then be submitted to Linus. -5) Select your CC (e-mail carbon copy) list. +6) Select your CC (e-mail carbon copy) list. Unless you have a reason NOT to do so, CC linux-kernel@vger.kernel.org. @@ -187,8 +200,7 @@ URL: <http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/> - -6) No MIME, no links, no compression, no attachments. Just plain text. +7) No MIME, no links, no compression, no attachments. Just plain text. Linus and other kernel developers need to be able to read and comment on the changes you are submitting. It is important for a kernel @@ -223,9 +235,9 @@ pref("mailnews.display.disable_format_flowed_support", true); -7) E-mail size. +8) E-mail size. -When sending patches to Linus, always follow step #6. +When sending patches to Linus, always follow step #7. Large changes are not appropriate for mailing lists, and some maintainers. If your patch, uncompressed, exceeds 40 kB in size, @@ -234,7 +246,7 @@ server, and provide instead a URL (link) pointing to your patch. -8) Name your kernel version. +9) Name your kernel version. It is important to note, either in the subject line or in the patch description, the kernel version to which this patch applies. @@ -244,7 +256,7 @@ Linus will not apply it. -9) Don't get discouraged. Re-submit. +10) Don't get discouraged. Re-submit. After you have submitted your change, be patient and wait. If Linus likes your change and applies it, it will appear in the next version @@ -270,7 +282,7 @@ When in doubt, solicit comments on linux-kernel mailing list. -10) Include PATCH in the subject +11) Include PATCH in the subject Due to high e-mail traffic to Linus, and to linux-kernel, it is common convention to prefix your subject line with [PATCH]. This lets Linus @@ -279,7 +291,7 @@ e-mail discussions. -11) Sign your work +12) Sign your work To improve tracking of who did what, especially with patches that can percolate to their final resting place in the kernel through several @@ -328,7 +340,8 @@ now, but you can do this to mark internal company procedures or just point out some special detail about the sign-off. -12) The canonical patch format + +13) The canonical patch format The canonical patch subject line is: @@ -427,6 +440,10 @@ section Linus Computer Science 101. Nuff said. If your code deviates too much from this, it is likely to be rejected without further review, and without comment. +Check your patches with the patch style checker prior to submission +(scripts/checkpatch.pl). You should be able to justify all +violations that remain in your patch. + 2) #ifdefs are ugly diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 2d7ea85075ba..49ae1ea9e868 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -70,6 +70,7 @@ Who: David Miller <davem@davemloft.net> What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. When: December 2006 +Files: include/linux/video_decoder.h Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 series. The old API have lots of drawbacks and don't provide enough means to work with all video and audio standards. The newer API is diff --git a/Documentation/hrtimer/timer_stats.txt b/Documentation/hrtimer/timer_stats.txt index 27f782e3593f..22b0814d0ad0 100644 --- a/Documentation/hrtimer/timer_stats.txt +++ b/Documentation/hrtimer/timer_stats.txt @@ -2,9 +2,10 @@ timer_stats - timer usage statistics ------------------------------------ timer_stats is a debugging facility to make the timer (ab)usage in a Linux -system visible to kernel and userspace developers. It is not intended for -production usage as it adds significant overhead to the (hr)timer code and the -(hr)timer data structures. +system visible to kernel and userspace developers. If enabled in the config +but not used it has almost zero runtime overhead, and a relatively small +data structure overhead. Even if collection is enabled runtime all the +locking is per-CPU and lookup is hashed. timer_stats should be used by kernel and userspace developers to verify that their code does not make unduly use of timers. This helps to avoid unnecessary diff --git a/Documentation/ia64/aliasing-test.c b/Documentation/ia64/aliasing-test.c index 3153167b41c3..d485256ee1ce 100644 --- a/Documentation/ia64/aliasing-test.c +++ b/Documentation/ia64/aliasing-test.c @@ -197,7 +197,7 @@ skip: return rc; } -main() +int main() { int rc; diff --git a/MAINTAINERS b/MAINTAINERS index f63d03a6c865..124b9508ae2e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -30,8 +30,11 @@ trivial patch so apply some common sense. job the maintainers (and especially Linus) do is to keep things looking the same. Sometimes this means that the clever hack in your driver to get around a problem actually needs to become a - generalized kernel feature ready for next time. See - Documentation/CodingStyle for guidance here. + generalized kernel feature ready for next time. + + PLEASE check your patch with the automated style checker + (scripts/checkpatch.pl) to catch trival style violations. + See Documentation/CodingStyle for guidance here. PLEASE try to include any credit lines you want added with the patch. It avoids people being missed off by mistake and makes @@ -972,6 +975,15 @@ M: johannes@sipsolutions.net L: linux-wireless@vger.kernel.org S: Maintained +CHECKPATCH +P: Andy Whitcroft +M: apw@shadowen.org +P: Randy Dunlap +M: rdunlap@xenotime.net +P: Joel Schopp +M: jschopp@austin.ibm.com +S: Supported + COMMON INTERNET FILE SYSTEM (CIFS) P: Steve French M: sfrench@samba.org @@ -2888,8 +2900,8 @@ W: ftp://ftp.kernel.org/pub/linux/kernel/people/rml/preempt-kernel S: Supported PRISM54 WIRELESS DRIVER -P: Prism54 Development Team -M: developers@islsm.org +P: Luis R. Rodriguez +M: mcgrof@gmail.com L: linux-wireless@vger.kernel.org W: http://prism54.org S: Maintained diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 770f717bd250..79c6e5a24456 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -83,22 +83,20 @@ choice check out the Linux/Alpha FAQ, accessible on the WWW from <http://www.alphalinux.org/>. In summary: - Alcor/Alpha-XLT AS 600 + Alcor/Alpha-XLT AS 600, AS 500, XL-300, XL-366 Alpha-XL XL-233, XL-266 AlphaBook1 Alpha laptop Avanti AS 200, AS 205, AS 250, AS 255, AS 300, AS 400 Cabriolet AlphaPC64, AlphaPCI64 - DP264 DP264 + DP264 DP264 / DS20 / ES40 / DS10 / DS10L EB164 EB164 21164 evaluation board EB64+ EB64+ 21064 evaluation board EB66 EB66 21066 evaluation board EB66+ EB66+ 21066 evaluation board - Jensen DECpc 150, DEC 2000 model 300, - DEC 2000 model 500 + Jensen DECpc 150, DEC 2000 models 300, 500 LX164 AlphaPC164-LX Lynx AS 2100A - Miata Personal Workstation 433a, 433au, 500a, - 500au, 600a, or 600au + Miata Personal Workstation 433/500/600 a/au Marvel AlphaServer ES47 / ES80 / GS1280 Mikasa AS 1000 Noname AXPpci33, UDB (Multia) @@ -108,9 +106,9 @@ choice Ruffian RPX164-2, AlphaPC164-UX, AlphaPC164-BX SX164 AlphaPC164-SX Sable AS 2000, AS 2100 - Shark DS 20L - Takara Takara - Titan AlphaServer ES45 / DS25 + Shark DS 20L + Takara Takara (OEM) + Titan AlphaServer ES45 / DS25 / DS15 Wildfire AlphaServer GS 40/80/160/320 If you don't know what to do, choose "generic". @@ -481,6 +479,15 @@ config ALPHA_BROKEN_IRQ_MASK depends on ALPHA_GENERIC || ALPHA_PC164 default y +config VGA_HOSE + bool + depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI + default y + help + Support VGA on an arbitrary hose; needed for several platforms + which always have multiple hoses, and whose consoles support it. + + config ALPHA_SRM bool "Use SRM as bootloader" if ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_NAUTILUS || ALPHA_NONAME default y if ALPHA_JENSEN || ALPHA_MIKASA || ALPHA_SABLE || ALPHA_LYNX || ALPHA_NORITAKE || ALPHA_DP264 || ALPHA_RAWHIDE || ALPHA_EIGER || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_SHARK || ALPHA_MARVEL @@ -537,10 +544,14 @@ config HAVE_DEC_LOCK default y config NR_CPUS - int "Maximum number of CPUs (2-64)" - range 2 64 + int "Maximum number of CPUs (2-32)" + range 2 32 depends on SMP - default "64" + default "32" if ALPHA_GENERIC || ALPHA_MARVEL + default "4" if !ALPHA_GENERIC && !ALPHA_MARVEL + help + MARVEL support can handle a maximum of 32 CPUs, all the others + with working support have a maximum of 4 CPUs. config ARCH_DISCONTIGMEM_ENABLE bool "Discontiguous Memory Support (EXPERIMENTAL)" @@ -644,6 +655,13 @@ source "arch/alpha/oprofile/Kconfig" source "arch/alpha/Kconfig.debug" +# DUMMY_CONSOLE may be defined in drivers/video/console/Kconfig +# but we also need it if VGA_HOSE is set +config DUMMY_CONSOLE + bool + depends on VGA_HOSE + default y + source "security/Kconfig" source "crypto/Kconfig" diff --git a/arch/alpha/boot/tools/mkbb.c b/arch/alpha/boot/tools/mkbb.c index 23c7190b047c..632a7fd6d7dc 100644 --- a/arch/alpha/boot/tools/mkbb.c +++ b/arch/alpha/boot/tools/mkbb.c @@ -81,7 +81,7 @@ typedef union __bootblock { #define bootblock_label __u1.__label #define bootblock_checksum __u2.__checksum -main(int argc, char ** argv) +int main(int argc, char ** argv) { bootblock bootblock_from_disk; bootblock bootloader_image; diff --git a/arch/alpha/kernel/console.c b/arch/alpha/kernel/console.c index f313b34939bb..da711e37fc97 100644 --- a/arch/alpha/kernel/console.c +++ b/arch/alpha/kernel/console.c @@ -9,16 +9,20 @@ #include <linux/init.h> #include <linux/tty.h> #include <linux/console.h> +#include <linux/vt.h> #include <asm/vga.h> #include <asm/machvec.h> +#include "pci_impl.h" + #ifdef CONFIG_VGA_HOSE -/* - * Externally-visible vga hose bases - */ -unsigned long __vga_hose_io_base = 0; /* base for default hose */ -unsigned long __vga_hose_mem_base = 0; /* base for default hose */ +struct pci_controller *pci_vga_hose; +static struct resource alpha_vga = { + .name = "alpha-vga+", + .start = 0x3C0, + .end = 0x3DF +}; static struct pci_controller * __init default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2) @@ -30,36 +34,58 @@ default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2) } void __init -set_vga_hose(struct pci_controller *hose) -{ - if (hose) { - __vga_hose_io_base = hose->io_space->start; - __vga_hose_mem_base = hose->mem_space->start; - } -} - -void __init locate_and_init_vga(void *(*sel_func)(void *, void *)) { struct pci_controller *hose = NULL; struct pci_dev *dev = NULL; + /* Default the select function */ if (!sel_func) sel_func = (void *)default_vga_hose_select; + /* Find the console VGA device */ for(dev=NULL; (dev=pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev));) { - if (!hose) hose = dev->sysdata; - else hose = sel_func(hose, dev->sysdata); + if (!hose) + hose = dev->sysdata; + else + hose = sel_func(hose, dev->sysdata); } - /* Did we already inititialize the correct one? */ - if (conswitchp == &vga_con && - __vga_hose_io_base == hose->io_space->start && - __vga_hose_mem_base == hose->mem_space->start) + /* Did we already initialize the correct one? Is there one? */ + if (!hose || (conswitchp == &vga_con && pci_vga_hose == hose)) return; - /* Set the VGA hose and init the new console */ - set_vga_hose(hose); + /* Create a new VGA ioport resource WRT the hose it is on. */ + alpha_vga.start += hose->io_space->start; + alpha_vga.end += hose->io_space->start; + request_resource(hose->io_space, &alpha_vga); + + /* Set the VGA hose and init the new console. */ + pci_vga_hose = hose; take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1); } +void __init +find_console_vga_hose(void) +{ + u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset); + + if (pu64[7] == 3) { /* TERM_TYPE == graphics */ + struct pci_controller *hose; + int h = (pu64[30] >> 24) & 0xff; /* console hose # */ + + /* + * Our hose numbering DOES match the console's, so find + * the right one... + */ + for (hose = hose_head; hose; hose = hose->next) { + if (hose->index == h) break; + } + + if (hose) { + printk("Console graphics on hose %d\n", h); + pci_vga_hose = hose; + } + } +} + #endif diff --git a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c index 7f6a98455e74..f10d2eddd2c3 100644 --- a/arch/alpha/kernel/core_marvel.c +++ b/arch/alpha/kernel/core_marvel.c @@ -25,6 +25,7 @@ #include <asm/pgalloc.h> #include <asm/tlbflush.h> #include <asm/rtc.h> +#include <asm/vga.h> #include "proto.h" #include "pci_impl.h" @@ -367,9 +368,8 @@ marvel_io7_present(gct6_node *node) } static void __init -marvel_init_vga_hose(void) +marvel_find_console_vga_hose(void) { -#ifdef CONFIG_VGA_HOSE u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset); if (pu64[7] == 3) { /* TERM_TYPE == graphics */ @@ -403,7 +403,6 @@ marvel_init_vga_hose(void) pci_vga_hose = hose; } } -#endif /* CONFIG_VGA_HOSE */ } gct6_search_struct gct_wanted_node_list[] = { @@ -459,7 +458,7 @@ marvel_init_arch(void) marvel_init_io7(io7); /* Check for graphic console location (if any). */ - marvel_init_vga_hose(); + marvel_find_console_vga_hose(); } void @@ -684,9 +683,6 @@ __marvel_rtc_io(u8 b, unsigned long addr, int write) /* * IO map support. */ - -#define __marvel_is_mem_vga(a) (((a) >= 0xa0000) && ((a) <= 0xc0000)) - void __iomem * marvel_ioremap(unsigned long addr, unsigned long size) { @@ -698,13 +694,9 @@ marvel_ioremap(unsigned long addr, unsigned long size) unsigned long pfn; /* - * Adjust the addr. + * Adjust the address. */ -#ifdef CONFIG_VGA_HOSE - if (pci_vga_hose && __marvel_is_mem_vga(addr)) { - addr += pci_vga_hose->mem_space->start; - } -#endif + FIXUP_MEMADDR_VGA(addr); /* * Find the hose. @@ -781,7 +773,9 @@ marvel_ioremap(unsigned long addr, unsigned long size) return (void __iomem *) vaddr; } - return NULL; + /* Assume it was already a reasonable address */ + vaddr = baddr + hose->mem_space->start; + return (void __iomem *) vaddr; } void @@ -803,21 +797,12 @@ marvel_is_mmio(const volatile void __iomem *xaddr) return (addr & 0xFF000000UL) == 0; } -#define __marvel_is_port_vga(a) \ - (((a) >= 0x3b0) && ((a) < 0x3e0) && ((a) != 0x3b3) && ((a) != 0x3d3)) #define __marvel_is_port_kbd(a) (((a) == 0x60) || ((a) == 0x64)) #define __marvel_is_port_rtc(a) (((a) == 0x70) || ((a) == 0x71)) void __iomem *marvel_ioportmap (unsigned long addr) { - if (__marvel_is_port_rtc (addr) || __marvel_is_port_kbd(addr)) - ; -#ifdef CONFIG_VGA_HOSE - else if (__marvel_is_port_vga (addr) && pci_vga_hose) - addr += pci_vga_hose->io_space->start; -#endif - else - return NULL; + FIXUP_IOADDR_VGA(addr); return (void __iomem *)addr; } @@ -829,8 +814,14 @@ marvel_ioread8(void __iomem *xaddr) return 0; else if (__marvel_is_port_rtc(addr)) return __marvel_rtc_io(0, addr, 0); - else + else if (marvel_is_ioaddr(addr)) return __kernel_ldbu(*(vucp)addr); + else + /* this should catch other legacy addresses + that would normally fail on MARVEL, + because there really is nothing there... + */ + return ~0; } void @@ -841,7 +832,7 @@ marvel_iowrite8(u8 b, void __iomem *xaddr) return; else if (__marvel_is_port_rtc(addr)) __marvel_rtc_io(b, addr, 1); - else + else if (marvel_is_ioaddr(addr)) __kernel_stb(b, *(vucp)addr); } diff --git a/arch/alpha/kernel/core_titan.c b/arch/alpha/kernel/core_titan.c index 3662fef7db9a..819326627b96 100644 --- a/arch/alpha/kernel/core_titan.c +++ b/arch/alpha/kernel/core_titan.c @@ -21,6 +21,7 @@ #include <asm/smp.h> #include <asm/pgalloc.h> #include <asm/tlbflush.h> +#include <asm/vga.h> #include "proto.h" #include "pci_impl.h" @@ -35,6 +36,11 @@ struct } saved_config[4] __attribute__((common)); /* + * Is PChip 1 present? No need to query it more than once. + */ +static int titan_pchip1_present; + +/* * BIOS32-style PCI interface: */ @@ -344,43 +350,17 @@ titan_init_one_pachip_port(titan_pachip_port *port, int index) static void __init titan_init_pachips(titan_pachip *pachip0, titan_pachip *pachip1) { - int pchip1_present = TITAN_cchip->csc.csr & 1L<<14; + titan_pchip1_present = TITAN_cchip->csc.csr & 1L<<14; /* Init the ports in hose order... */ titan_init_one_pachip_port(&pachip0->g_port, 0); /* hose 0 */ - if (pchip1_present) + if (titan_pchip1_present) titan_init_one_pachip_port(&pachip1->g_port, 1);/* hose 1 */ titan_init_one_pachip_port(&pachip0->a_port, 2); /* hose 2 */ - if (pchip1_present) + if (titan_pchip1_present) titan_init_one_pachip_port(&pachip1->a_port, 3);/* hose 3 */ } -static void __init -titan_init_vga_hose(void) -{ -#ifdef CONFIG_VGA_HOSE - u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset); - - if (pu64[7] == 3) { /* TERM_TYPE == graphics */ - struct pci_controller *hose; - int h = (pu64[30] >> 24) & 0xff; /* console hose # */ - - /* - * Our hose numbering matches the console's, so just find - * the right one... - */ - for (hose = hose_head; hose; hose = hose->next) { - if (hose->index == h) break; - } - - if (hose) { - printk("Console graphics on hose %d\n", hose->index); - pci_vga_hose = hose; - } - } -#endif /* CONFIG_VGA_HOSE */ -} - void __init titan_init_arch(void) { @@ -406,6 +386,7 @@ titan_init_arch(void) /* With multiple PCI busses, we play with I/O as physical addrs. */ ioport_resource.end = ~0UL; + iomem_resource.end = ~0UL; /* PCI DMA Direct Mapping is 1GB at 2GB. */ __direct_map_base = 0x80000000; @@ -415,7 +396,7 @@ titan_init_arch(void) titan_init_pachips(TITAN_pachip0, TITAN_pachip1); /* Check for graphic console location (if any). */ - titan_init_vga_hose(); + find_console_vga_hose(); } static void @@ -441,9 +422,7 @@ titan_kill_one_pachip_port(titan_pachip_port *port, int index) static void titan_kill_pachips(titan_pachip *pachip0, titan_pachip *pachip1) { - int pchip1_present = TITAN_cchip->csc.csr & 1L<<14; - - if (pchip1_present) { + if (titan_pchip1_present) { titan_kill_one_pachip_port(&pachip1->g_port, 1); titan_kill_one_pachip_port(&pachip1->a_port, 3); } @@ -463,6 +442,14 @@ titan_kill_arch(int mode) */ void __iomem * +titan_ioportmap(unsigned long addr) +{ + FIXUP_IOADDR_VGA(addr); + return (void __iomem *)(addr + TITAN_IO_BIAS); +} + + +void __iomem * titan_ioremap(unsigned long addr, unsigned long size) { int h = (addr & TITAN_HOSE_MASK) >> TITAN_HOSE_SHIFT; @@ -475,14 +462,12 @@ titan_ioremap(unsigned long addr, unsigned long size) unsigned long pfn; /* - * Adjust the addr. + * Adjust the address and hose, if necessary. */ -#ifdef CONFIG_VGA_HOSE - if (pci_vga_hose && __titan_is_mem_vga(addr)) { + if (pci_vga_hose && __is_mem_vga(addr)) { h = pci_vga_hose->index; addr += pci_vga_hose->mem_space->start; } -#endif /* * Find the hose. @@ -521,8 +506,10 @@ titan_ioremap(unsigned long addr, unsigned long size) * Map it */ area = get_vm_area(size, VM_IOREMAP); - if (!area) + if (!area) { + printk("ioremap failed... no vm_area...\n"); return NULL; + } ptes = hose->sg_pci->ptes; for (vaddr = (unsigned long)area->addr; @@ -539,7 +526,7 @@ titan_ioremap(unsigned long addr, unsigned long size) if (__alpha_remap_area_pages(vaddr, pfn << PAGE_SHIFT, PAGE_SIZE, 0)) { - printk("FAILED to map...\n"); + printk("FAILED to remap_area_pages...\n"); vfree(area->addr); return NULL; } @@ -551,7 +538,8 @@ titan_ioremap(unsigned long addr, unsigned long size) return (void __iomem *) vaddr; } - return NULL; + /* Assume a legacy (read: VGA) address, and return appropriately. */ + return (void __iomem *)(addr + TITAN_MEM_BIAS); } void @@ -574,6 +562,7 @@ titan_is_mmio(const volatile void __iomem *xaddr) } #ifndef CONFIG_ALPHA_GENERIC +EXPORT_SYMBOL(titan_ioportmap); EXPORT_SYMBOL(titan_ioremap); EXPORT_SYMBOL(titan_iounmap); EXPORT_SYMBOL(titan_is_mmio); @@ -750,6 +739,7 @@ titan_agp_info(void) if (titan_query_agp(port)) hosenum = 2; if (hosenum < 0 && + titan_pchip1_present && titan_query_agp(port = &TITAN_pachip1->a_port)) hosenum = 3; diff --git a/arch/alpha/kernel/core_tsunami.c b/arch/alpha/kernel/core_tsunami.c index ce623c6e55e1..ef91e09590d4 100644 --- a/arch/alpha/kernel/core_tsunami.c +++ b/arch/alpha/kernel/core_tsunami.c @@ -19,6 +19,7 @@ #include <asm/ptrace.h> #include <asm/smp.h> +#include <asm/vga.h> #include "proto.h" #include "pci_impl.h" @@ -349,6 +350,26 @@ tsunami_init_one_pchip(tsunami_pchip *pchip, int index) tsunami_pci_tbi(hose, 0, -1); } + +void __iomem * +tsunami_ioportmap(unsigned long addr) +{ + FIXUP_IOADDR_VGA(addr); + return (void __iomem *)(addr + TSUNAMI_IO_BIAS); +} + +void __iomem * +tsunami_ioremap(unsigned long addr, unsigned long size) +{ + FIXUP_MEMADDR_VGA(addr); + return (void __iomem *)(addr + TSUNAMI_MEM_BIAS); +} + +#ifndef CONFIG_ALPHA_GENERIC +EXPORT_SYMBOL(tsunami_ioportmap); +EXPORT_SYMBOL(tsunami_ioremap); +#endif + void __init tsunami_init_arch(void) { @@ -393,6 +414,9 @@ tsunami_init_arch(void) tsunami_init_one_pchip(TSUNAMI_pchip0, 0); if (TSUNAMI_cchip->csc.csr & 1L<<14) tsunami_init_one_pchip(TSUNAMI_pchip1, 1); + + /* Check for graphic console location (if any). */ + find_console_vga_hose(); } static void diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h index 95912ecc65e1..708d5ca87782 100644 --- a/arch/alpha/kernel/proto.h +++ b/arch/alpha/kernel/proto.h @@ -108,6 +108,15 @@ extern int wildfire_cpuid_to_nid(int); extern unsigned long wildfire_node_mem_start(int); extern unsigned long wildfire_node_mem_size(int); +/* console.c */ +#ifdef CONFIG_VGA_HOSE +extern void find_console_vga_hose(void); +extern void locate_and_init_vga(void *(*)(void *, void *)); +#else +static inline void find_console_vga_hose(void) { } +static inline void locate_and_init_vga(void *(*sel_func)(void *, void *)) { } +#endif + /* setup.c */ extern unsigned long srm_hae; extern int boot_cpuid; diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c index 85d2f933dd07..c71b0fd7a61f 100644 --- a/arch/alpha/kernel/sys_dp264.c +++ b/arch/alpha/kernel/sys_dp264.c @@ -543,6 +543,7 @@ dp264_init_pci(void) { common_init_pci(); SMC669_Init(0); + locate_and_init_vga(NULL); } static void __init @@ -551,6 +552,14 @@ monet_init_pci(void) common_init_pci(); SMC669_Init(1); es1888_init(); + locate_and_init_vga(NULL); +} + +static void __init +clipper_init_pci(void) +{ + common_init_pci(); + locate_and_init_vga(NULL); } static void __init @@ -655,7 +664,7 @@ struct alpha_machine_vector clipper_mv __initmv = { .init_arch = tsunami_init_arch, .init_irq = clipper_init_irq, .init_rtc = common_init_rtc, - .init_pci = common_init_pci, + .init_pci = clipper_init_pci, .kill_arch = tsunami_kill_arch, .pci_map_irq = clipper_map_irq, .pci_swizzle = common_swizzle, diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c index e349f03b830e..0bcb968cb60a 100644 --- a/arch/alpha/kernel/sys_marvel.c +++ b/arch/alpha/kernel/sys_marvel.c @@ -22,6 +22,7 @@ #include <asm/core_marvel.h> #include <asm/hwrpb.h> #include <asm/tlbflush.h> +#include <asm/vga.h> #include "proto.h" #include "err_impl.h" @@ -412,10 +413,7 @@ marvel_init_pci(void) pci_probe_only = 1; common_init_pci(); - -#ifdef CONFIG_VGA_HOSE locate_and_init_vga(NULL); -#endif /* Clear any io7 errors. */ for (io7 = NULL; (io7 = marvel_next_io7(io7)) != NULL; ) diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c index f009b7bc0943..1d3c1398c428 100644 --- a/arch/alpha/kernel/sys_titan.c +++ b/arch/alpha/kernel/sys_titan.c @@ -331,9 +331,7 @@ titan_init_pci(void) pci_probe_only = 1; common_init_pci(); SMC669_Init(0); -#ifdef CONFIG_VGA_HOSE locate_and_init_vga(NULL); -#endif } diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c index 36440c899583..074b7cb07743 100644 --- a/arch/arm/mm/alignment.c +++ b/arch/arm/mm/alignment.c @@ -630,7 +630,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) fs = get_fs(); set_fs(KERNEL_DS); - if thumb_mode(regs) { + if (thumb_mode(regs)) { fault = __get_user(tinstr, (u16 *)(instrptr & ~1)); if (!(fault)) instr = thumb2arm(tinstr); diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c index 11ba75a05220..de7688cfd573 100644 --- a/arch/h8300/kernel/sys_h8300.c +++ b/arch/h8300/kernel/sys_h8300.c @@ -288,9 +288,9 @@ asmlinkage void syscall_print(void *dummy,...) int kernel_execve(const char *filename, char *const argv[], char *const envp[]) { register long res __asm__("er0"); + register char *const *_c __asm__("er3") = envp; + register char *const *_b __asm__("er2") = argv; register const char * _a __asm__("er1") = filename; - register void *_b __asm__("er2") = argv; - register void *_c __asm__("er3") = envp; __asm__ __volatile__ ("mov.l %1,er0\n\t" "trapa #0\n\t" : "=r" (res) diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c index 300e3279ca5a..f97183011c2c 100644 --- a/arch/h8300/kernel/traps.c +++ b/arch/h8300/kernel/traps.c @@ -136,7 +136,7 @@ void show_stack(struct task_struct *task, unsigned long *esp) printk("\nCall Trace:"); i = 0; stack = esp; - while (((unsigned long)stack & (THREAD_SIZE - 1)) == 0) { + while (((unsigned long)stack & (THREAD_SIZE - 1)) != 0) { addr = *stack++; /* * If the address is either in the text segment of the diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c index 83f825f2e2d7..d865d041bea1 100644 --- a/arch/i386/kernel/microcode.c +++ b/arch/i386/kernel/microcode.c @@ -478,7 +478,7 @@ static int __init microcode_dev_init (void) return 0; } -static void __exit microcode_dev_exit (void) +static void microcode_dev_exit (void) { misc_deregister(µcode_dev); } diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c index 50dfc65319cd..5513f8d5b5be 100644 --- a/arch/i386/kernel/reboot.c +++ b/arch/i386/kernel/reboot.c @@ -89,6 +89,14 @@ static int __init set_bios_reboot(struct dmi_system_id *d) } static struct dmi_system_id __initdata reboot_dmi_table[] = { + { /* Handle problems with rebooting on Dell E520's */ + .callback = set_bios_reboot, + .ident = "Dell E520", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Dell DM061"), + }, + }, { /* Handle problems with rebooting on Dell 1300's */ .callback = set_bios_reboot, .ident = "Dell PowerEdge 1300", diff --git a/arch/i386/kernel/vmi.c b/arch/i386/kernel/vmi.c index c8726c424b35..c12720d7cbc5 100644 --- a/arch/i386/kernel/vmi.c +++ b/arch/i386/kernel/vmi.c @@ -27,6 +27,7 @@ #include <linux/bootmem.h> #include <linux/mm.h> #include <linux/highmem.h> +#include <linux/sched.h> #include <asm/vmi.h> #include <asm/io.h> #include <asm/fixmap.h> diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c index a7c0783b269a..11b7a51566a8 100644 --- a/arch/i386/oprofile/nmi_int.c +++ b/arch/i386/oprofile/nmi_int.c @@ -154,7 +154,7 @@ static int allocate_msrs(void) size_t counters_size = sizeof(struct op_msr) * model->num_counters; int i; - for_each_online_cpu(i) { + for_each_possible_cpu(i) { cpu_msrs[i].counters = kmalloc(counters_size, GFP_KERNEL); if (!cpu_msrs[i].counters) { success = 0; @@ -211,8 +211,14 @@ static int nmi_setup(void) /* Assume saved/restored counters are the same on all CPUs */ model->fill_in_addresses(&cpu_msrs[0]); for_each_possible_cpu (cpu) { - if (cpu != 0) - cpu_msrs[cpu] = cpu_msrs[0]; + if (cpu != 0) { + memcpy(cpu_msrs[cpu].counters, cpu_msrs[0].counters, + sizeof(struct op_msr) * model->num_counters); + + memcpy(cpu_msrs[cpu].controls, cpu_msrs[0].controls, + sizeof(struct op_msr) * model->num_controls); + } + } on_each_cpu(nmi_save_registers, NULL, 0, 1); on_each_cpu(nmi_cpu_setup, NULL, 0, 1); diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c index b62eafb997bc..b95b42950ed4 100644 --- a/arch/i386/pci/fixup.c +++ b/arch/i386/pci/fixup.c @@ -436,3 +436,14 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, pci_early_fixup_cyrix_5530); DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, pci_early_fixup_cyrix_5530); + +/* + * Siemens Nixdorf AG FSC Multiprocessor Interrupt Controller: + * prevent update of the BAR0, which doesn't look like a normal BAR. + */ +static void __devinit pci_siemens_interrupt_controller(struct pci_dev *dev) +{ + dev->resource[0].flags |= IORESOURCE_PCI_FIXED; +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015, + pci_siemens_interrupt_controller); diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c index 7a5bed5bdc57..e8a57138b4a6 100644 --- a/arch/m68k/mac/debug.c +++ b/arch/m68k/mac/debug.c @@ -71,7 +71,7 @@ void mac_debugging_short(int pos, short num) /* calculate current offset */ pengoffset = (unsigned char *)mac_videobase + - (150+line*2) * mac_rowbytes) + 80 * peng; + (150+line*2) * mac_rowbytes + 80 * peng; pptr = pengoffset; diff --git a/arch/mips/jmr3927/rbhma3100/kgdb_io.c b/arch/mips/jmr3927/rbhma3100/kgdb_io.c index 2604f2c9a96e..342579cfdc01 100644 --- a/arch/mips/jmr3927/rbhma3100/kgdb_io.c +++ b/arch/mips/jmr3927/rbhma3100/kgdb_io.c @@ -36,7 +36,7 @@ #define TIMEOUT 0xffffff static int remoteDebugInitialized = 0; -static void debugInit(int baud) +static void debugInit(int baud); int putDebugChar(unsigned char c) { diff --git a/arch/mips/pci/pci-ocelot.c b/arch/mips/pci/pci-ocelot.c index 7f94f26d35ae..1421d34535ef 100644 --- a/arch/mips/pci/pci-ocelot.c +++ b/arch/mips/pci/pci-ocelot.c @@ -71,19 +71,19 @@ static inline void pci0WriteConfigReg(unsigned int offset, unsigned int data) } static struct resource ocelot_mem_resource = { - start = GT_PCI_MEM_BASE; - end = GT_PCI_MEM_BASE + GT_PCI_MEM_BASE - 1; + .start = GT_PCI_MEM_BASE, + .end = GT_PCI_MEM_BASE + GT_PCI_MEM_BASE - 1, }; static struct resource ocelot_io_resource = { - start = GT_PCI_IO_BASE; - end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1; + .start = GT_PCI_IO_BASE, + .end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1, }; static struct pci_controller ocelot_pci_controller = { - .pci_ops = gt64xxx_pci0_ops; - .mem_resource = &ocelot_mem_resource; - .io_resource = &ocelot_io_resource; + .pci_ops = gt64xxx_pci0_ops, + .mem_resource = &ocelot_mem_resource, + .io_resource = &ocelot_io_resource, }; static int __init ocelot_pcibios_init(void) diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c index 1336da8bdee1..1ad5111aec38 100644 --- a/arch/x86_64/mm/init.c +++ b/arch/x86_64/mm/init.c @@ -761,3 +761,9 @@ int in_gate_area_no_task(unsigned long addr) { return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END); } + +void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size) +{ + return __alloc_bootmem_core(pgdat->bdata, size, + SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0); +} diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index b770deab968c..6d7d4157e049 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c @@ -1357,7 +1357,7 @@ static struct backlight_ops asus_backlight_data = { .update_status = set_brightness_status, }; -static void __exit asus_acpi_exit(void) +static void asus_acpi_exit(void) { if (asus_backlight_device) backlight_device_unregister(asus_backlight_device); diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index 3906d47b9783..1cfbecb0ac10 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c @@ -538,7 +538,7 @@ static struct backlight_ops toshiba_backlight_data = { .update_status = set_lcd_status, }; -static void __exit toshiba_acpi_exit(void) +static void toshiba_acpi_exit(void) { if (toshiba_backlight_device) backlight_device_unregister(toshiba_backlight_device); diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig index 2e18a63ead36..ea4fe3e48f33 100644 --- a/drivers/auxdisplay/Kconfig +++ b/drivers/auxdisplay/Kconfig @@ -68,6 +68,10 @@ config CFAG12864B depends on X86 depends on FB depends on KS0108 + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select FB_SYS_FOPS default n ---help--- If you have a Crystalfontz 128x64 2-color LCD, cfag12864b Series, diff --git a/drivers/auxdisplay/cfag12864bfb.c b/drivers/auxdisplay/cfag12864bfb.c index 66fafbb1d087..307c190699e0 100644 --- a/drivers/auxdisplay/cfag12864bfb.c +++ b/drivers/auxdisplay/cfag12864bfb.c @@ -73,9 +73,11 @@ static int cfag12864bfb_mmap(struct fb_info *info, struct vm_area_struct *vma) static struct fb_ops cfag12864bfb_ops = { .owner = THIS_MODULE, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_read = fb_sys_read, + .fb_write = fb_sys_write, + .fb_fillrect = sys_fillrect, + .fb_copyarea = sys_copyarea, + .fb_imageblit = sys_imageblit, .fb_mmap = cfag12864bfb_mmap, }; diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index b3d4ccc33a47..154f42203b05 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c @@ -1191,6 +1191,7 @@ static int job_control(struct tty_struct *tty, struct file *file) is_current_pgrp_orphaned()) return -EIO; kill_pgrp(task_pgrp(current), SIGTTIN, 1); + set_thread_flag(TIF_SIGPENDING); return -ERESTARTSYS; } } diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 75d2a46e106f..3752edc30c36 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -1148,7 +1148,8 @@ int tty_check_change(struct tty_struct * tty) return 0; if (is_current_pgrp_orphaned()) return -EIO; - (void) kill_pgrp(task_pgrp(current), SIGTTOU, 1); + kill_pgrp(task_pgrp(current), SIGTTOU, 1); + set_thread_flag(TIF_SIGPENDING); return -ERESTARTSYS; } diff --git a/drivers/char/watchdog/ixp2000_wdt.c b/drivers/char/watchdog/ixp2000_wdt.c index fd955dbd588c..dc7548dcaf35 100644 --- a/drivers/char/watchdog/ixp2000_wdt.c +++ b/drivers/char/watchdog/ixp2000_wdt.c @@ -205,7 +205,7 @@ static void __exit ixp2000_wdt_exit(void) module_init(ixp2000_wdt_init); module_exit(ixp2000_wdt_exit); -MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net">); +MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>"); MODULE_DESCRIPTION("IXP2000 Network Processor Watchdog"); module_param(heartbeat, int, 0); diff --git a/drivers/isdn/Kconfig b/drivers/isdn/Kconfig index d42fe89cddf6..3e088c42b222 100644 --- a/drivers/isdn/Kconfig +++ b/drivers/isdn/Kconfig @@ -26,9 +26,9 @@ menu "Old ISDN4Linux" depends on NET && ISDN config ISDN_I4L - tristate "Old ISDN4Linux (obsolete)" + tristate "Old ISDN4Linux (deprecated)" ---help--- - This driver allows you to use an ISDN-card for networking + This driver allows you to use an ISDN adapter for networking connections and as dialin/out device. The isdn-tty's have a built in AT-compatible modem emulator. Network devices support autodial, channel-bundling, callback and caller-authentication without having @@ -39,8 +39,9 @@ config ISDN_I4L ISDN support in the linux kernel is moving towards a new API, called CAPI (Common ISDN Application Programming Interface). - Therefore the old ISDN4Linux layer is becoming obsolete. It is - still usable, though, if you select this option. + Therefore the old ISDN4Linux layer will eventually become obsolete. + It is still available, though, for use with adapters that are not + supported by the new CAPI subsystem yet. if ISDN_I4L source "drivers/isdn/i4l/Kconfig" diff --git a/drivers/isdn/hardware/eicon/diva_didd.c b/drivers/isdn/hardware/eicon/diva_didd.c index 14298b8c835f..d755d904e62c 100644 --- a/drivers/isdn/hardware/eicon/diva_didd.c +++ b/drivers/isdn/hardware/eicon/diva_didd.c @@ -99,7 +99,7 @@ static int DIVA_INIT_FUNCTION create_proc(void) return (0); } -static void DIVA_EXIT_FUNCTION remove_proc(void) +static void remove_proc(void) { remove_proc_entry(DRIVERLNAME, proc_net_eicon); remove_proc_entry("net/eicon", NULL); diff --git a/drivers/isdn/hardware/eicon/divasfunc.c b/drivers/isdn/hardware/eicon/divasfunc.c index df61e510a28b..46fc21a3f8ff 100644 --- a/drivers/isdn/hardware/eicon/divasfunc.c +++ b/drivers/isdn/hardware/eicon/divasfunc.c @@ -231,7 +231,7 @@ int DIVA_INIT_FUNCTION divasfunc_init(int dbgmask) /* * exit */ -void DIVA_EXIT_FUNCTION divasfunc_exit(void) +void divasfunc_exit(void) { divasa_xdi_driver_unload(); disconnect_didd(); diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index ea5f30d4a5a2..4e5f87c1e714 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c @@ -2693,8 +2693,9 @@ isdn_tty_getdial(char *p, char *q,int cnt) int limit = ISDN_MSNLEN - 1; /* MUST match the size of interface var to avoid buffer overflow */ - while (strchr(" 0123456789,#.*WPTS-", *p) && *p && --cnt>0) { + while (strchr(" 0123456789,#.*WPTSR-", *p) && *p && --cnt>0) { if ((*p >= '0' && *p <= '9') || ((*p == 'S') && first) || + ((*p == 'R') && first) || (*p == '*') || (*p == '#')) { *q++ = *p; limit--; diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index e6e4d240b2a6..184238e2ece4 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c @@ -639,7 +639,7 @@ static void free_vmcs(struct vmcs *vmcs) free_pages((unsigned long)vmcs, vmcs_descriptor.order); } -static __exit void free_kvm_area(void) +static void free_kvm_area(void) { int cpu; diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c index c08ad8f823d2..2d1b3df95c5b 100644 --- a/drivers/misc/tifm_7xx1.c +++ b/drivers/misc/tifm_7xx1.c @@ -343,7 +343,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev, if (!fm->addr) goto err_out_free; - rc = request_irq(dev->irq, tifm_7xx1_isr, SA_SHIRQ, DRIVER_NAME, fm); + rc = request_irq(dev->irq, tifm_7xx1_isr, IRQF_SHARED, DRIVER_NAME, fm); if (rc) goto err_out_unmap; diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c index a4873ab84e6b..e8f686f7a357 100644 --- a/drivers/mtd/devices/pmc551.c +++ b/drivers/mtd/devices/pmc551.c @@ -650,7 +650,7 @@ MODULE_DESCRIPTION(PMC551_VERSION); */ static int msize = 0; #if defined(CONFIG_MTD_PMC551_APERTURE_SIZE) -static int asize = CONFIG_MTD_PMC551_APERTURE_SIZE +static int asize = CONFIG_MTD_PMC551_APERTURE_SIZE; #else static int asize = 0; #endif diff --git a/drivers/mtd/nand/autcpu12.c b/drivers/mtd/nand/autcpu12.c index fe94ae9ae1f2..e3744eb8eccb 100644 --- a/drivers/mtd/nand/autcpu12.c +++ b/drivers/mtd/nand/autcpu12.c @@ -101,7 +101,7 @@ static void autcpu12_hwcontrol(struct mtd_info *mtd, int cmd, struct nand_chip *chip = mtd->priv; if (ctrl & NAND_CTRL_CHANGE) { - void __iomem *addr + void __iomem *addr; unsigned char bits; addr = CS89712_VIRT_BASE + AUTCPU12_SMC_PORT_OFFSET; diff --git a/drivers/mtd/nand/ppchameleonevb.c b/drivers/mtd/nand/ppchameleonevb.c index eb7d4d443deb..082073acf20f 100644 --- a/drivers/mtd/nand/ppchameleonevb.c +++ b/drivers/mtd/nand/ppchameleonevb.c @@ -81,7 +81,7 @@ __setup("ppchameleonevb_fio_pbase=", ppchameleonevb_fio_pbase); */ static struct mtd_partition partition_info_hi[] = { { .name = "PPChameleon HI Nand Flash", - offset = 0, + .offset = 0, .size = 128 * 1024 * 1024 } }; @@ -424,9 +424,9 @@ static void __exit ppchameleonevb_cleanup(void) /* Release iomaps */ this = (struct nand_chip *) &ppchameleon_mtd[1]; - iounmap((void *) this->IO_ADDR_R; + iounmap((void *) this->IO_ADDR_R); this = (struct nand_chip *) &ppchameleonevb_mtd[1]; - iounmap((void *) this->IO_ADDR_R; + iounmap((void *) this->IO_ADDR_R); /* Free the MTD device structure */ kfree (ppchameleon_mtd); diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 1798a9f9fb25..7d57f4a25dc1 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -2280,6 +2280,7 @@ config GFAR_NAPI config UCC_GETH tristate "Freescale QE Gigabit Ethernet" depends on QUICC_ENGINE + select PHYLIB help This driver supports the Gigabit Ethernet mode of the QUICC Engine, which is available on some Freescale SOCs. diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index 675fe918421b..84b81642011c 100644 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c @@ -155,7 +155,7 @@ This function will write into PHY registers. */ static int amd8111e_write_phy(struct amd8111e_priv* lp,int phy_id, int reg, u32 val) { - unsigned int repeat = REPEAT_CNT + unsigned int repeat = REPEAT_CNT; void __iomem *mmio = lp->mmio; unsigned int reg_val; diff --git a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h index 2007510c4eb6..e65080a5994a 100644 --- a/drivers/net/amd8111e.h +++ b/drivers/net/amd8111e.h @@ -615,7 +615,7 @@ typedef enum { #define SSTATE 2 /* Assume contoller gets data 10 times the maximum processing time */ -#define REPEAT_CNT 10; +#define REPEAT_CNT 10 /* amd8111e decriptor flag definitions */ typedef enum { diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c index 88efe9731bab..e5502af5b8e2 100644 --- a/drivers/net/fec_8xx/fec_main.c +++ b/drivers/net/fec_8xx/fec_main.c @@ -550,7 +550,7 @@ static int fec_enet_rx_common(struct net_device *dev, int *budget) skbn = dev_alloc_skb(pkt_len + 2); if (skbn != NULL) { skb_reserve(skbn, 2); /* align IP header */ - skb_copy_from_linear_data(skb + skb_copy_from_linear_data(skb, skbn->data, pkt_len); /* swap */ diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index 8118a6750b61..8caa591c5649 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c @@ -3005,7 +3005,7 @@ static int __init hp100_isa_init(void) return cards > 0 ? 0 : -ENODEV; } -static void __exit hp100_isa_cleanup(void) +static void hp100_isa_cleanup(void) { int i; diff --git a/drivers/net/skfp/smt.c b/drivers/net/skfp/smt.c index fe847800acdc..75afc1f07ba0 100644 --- a/drivers/net/skfp/smt.c +++ b/drivers/net/skfp/smt.c @@ -1748,7 +1748,7 @@ char *addr_to_string(struct fddi_addr *addr) #endif #ifdef AM29K -smt_ifconfig(int argc, char *argv[]) +int smt_ifconfig(int argc, char *argv[]) { if (argc >= 2 && !strcmp(argv[0],"opt_bypass") && !strcmp(argv[1],"yes")) { diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index d9cbd586ae4b..be1df85e5e2d 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -15,10 +15,10 @@ #include <linux/pci.h> #include <linux/proc_fs.h> #include <linux/msi.h> +#include <linux/smp.h> #include <asm/errno.h> #include <asm/io.h> -#include <asm/smp.h> #include "pci.h" #include "msi.h" @@ -333,7 +333,7 @@ static int msi_capability_init(struct pci_dev *dev) msi_mask_bits_reg(pos, is_64bit_address(control)), maskbits); } - list_add(&entry->list, &dev->msi_list); + list_add_tail(&entry->list, &dev->msi_list); /* Configure MSI capability structure */ ret = arch_setup_msi_irqs(dev, 1, PCI_CAP_ID_MSI); @@ -404,7 +404,7 @@ static int msix_capability_init(struct pci_dev *dev, entry->dev = dev; entry->mask_base = base; - list_add(&entry->list, &dev->msi_list); + list_add_tail(&entry->list, &dev->msi_list); } ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX); @@ -558,12 +558,12 @@ static int msi_free_irqs(struct pci_dev* dev) list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) { if (entry->msi_attrib.type == PCI_CAP_ID_MSIX) { - if (list_is_last(&entry->list, &dev->msi_list)) - iounmap(entry->mask_base); - writel(1, entry->mask_base + entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); + + if (list_is_last(&entry->list, &dev->msi_list)) + iounmap(entry->mask_base); } list_del(&entry->list); kfree(entry); diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 1cff65fb9c43..01d8f8a8843c 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1637,8 +1637,10 @@ static void __init quirk_disable_all_msi(struct pci_dev *dev) printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n"); } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX, quirk_disable_all_msi); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi); /* Disable MSI on chipsets that are known to not support it */ static void __devinit quirk_disable_msi(struct pci_dev *dev) diff --git a/drivers/pci/search.c b/drivers/pci/search.c index b137a27472c7..c13232435dc0 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c @@ -403,10 +403,11 @@ const struct pci_device_id *pci_find_present(const struct pci_device_id *ids) while (ids->vendor || ids->subvendor || ids->class_mask) { list_for_each_entry(dev, &pci_devices, global_list) { if ((found = pci_match_one_device(ids, dev)) != NULL) - break; + goto exit; } ids++; } +exit: up_read(&pci_bus_sem); return found; } diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 6085261aa2c1..e24ea82dc35b 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -641,9 +641,16 @@ cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) * drivers can't provide shutdown() methods to disable IRQs. * Or better yet, fix PNP to allow those methods... */ - return cmos_do_probe(&pnp->dev, - &pnp->res.port_resource[0], - pnp->res.irq_resource[0].start); + if (pnp_port_start(pnp,0) == 0x70 && !pnp_irq_valid(pnp,0)) + /* Some machines contain a PNP entry for the RTC, but + * don't define the IRQ. It should always be safe to + * hardcode it in these cases + */ + return cmos_do_probe(&pnp->dev, &pnp->res.port_resource[0], 8); + else + return cmos_do_probe(&pnp->dev, + &pnp->res.port_resource[0], + pnp->res.irq_resource[0].start); } static void __exit cmos_pnp_remove(struct pnp_dev *pnp) diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index bb3cb3360541..88ea5a1fb606 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -2625,7 +2625,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) { #ifdef REAL_DMA static void NCR5380_dma_complete(NCR5380_instance * instance) { NCR5380_local_declare(); - struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata * instance->hostdata); + struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; int transferred; NCR5380_setup(instance); diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 9ddc6e4a74b0..05f692bd0adc 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -5180,7 +5180,7 @@ ahd_handle_devreset(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, cur_lun = lun; max_lun = lun; } - for (cur_lun <= max_lun; cur_lun++) { + for (;cur_lun <= max_lun; cur_lun++) { struct ahd_tmode_lstate* lstate; lstate = tstate->enabled_luns[cur_lun]; diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 1d8a2f6bb8eb..8b2601de3630 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c @@ -113,16 +113,16 @@ static void atmel_spi_next_xfer(struct spi_master *master, len = as->remaining_bytes; - tx_dma = xfer->tx_dma; - rx_dma = xfer->rx_dma; + tx_dma = xfer->tx_dma + xfer->len - len; + rx_dma = xfer->rx_dma + xfer->len - len; /* use scratch buffer only when rx or tx data is unspecified */ - if (rx_dma == INVALID_DMA_ADDRESS) { + if (!xfer->rx_buf) { rx_dma = as->buffer_dma; if (len > BUFFER_SIZE) len = BUFFER_SIZE; } - if (tx_dma == INVALID_DMA_ADDRESS) { + if (!xfer->tx_buf) { tx_dma = as->buffer_dma; if (len > BUFFER_SIZE) len = BUFFER_SIZE; diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 51daa212c6b7..656be4a5094a 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c @@ -121,7 +121,7 @@ 32.768 KHz Clock */ /* SPI DMA Register Bit Fields & Masks */ -#define SPI_DMA_RHDMA (0xF << 4) /* RXFIFO Half Status */ +#define SPI_DMA_RHDMA (0x1 << 4) /* RXFIFO Half Status */ #define SPI_DMA_RFDMA (0x1 << 5) /* RXFIFO Full Status */ #define SPI_DMA_TEDMA (0x1 << 6) /* TXFIFO Empty Status */ #define SPI_DMA_THDMA (0x1 << 7) /* TXFIFO Half Status */ @@ -1355,6 +1355,7 @@ static int setup(struct spi_device *spi) spi->bits_per_word, spi_speed_hz(SPI_CONTROL_DATARATE_MIN), spi->max_speed_hz); + return status; err_first_setup: kfree(chip); diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c index ba6fede5c466..8a1b07c74394 100644 --- a/drivers/video/arkfb.c +++ b/drivers/video/arkfb.c @@ -1055,9 +1055,10 @@ err_enable_device: static void __devexit ark_pci_remove(struct pci_dev *dev) { struct fb_info *info = pci_get_drvdata(dev); - struct arkfb_info *par = info->par; if (info) { + struct arkfb_info *par = info->par; + #ifdef CONFIG_MTRR if (par->mtrr_reg >= 0) { mtrr_del(par->mtrr_reg, 0, 0); diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index 71f24e00fcd0..8e6ef4bc7a5c 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h @@ -176,7 +176,6 @@ extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info); #endif extern void fbcon_set_bitops(struct fbcon_ops *ops); extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); -extern struct class *fb_class; #define FBCON_ATTRIBUTE_UNDERLINE 1 #define FBCON_ATTRIBUTE_REVERSE 2 diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index 616a0c08e30c..b52e883f0a52 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c @@ -498,7 +498,7 @@ static int pm3fb_set_par(struct fb_info *info) else par->video |= PM3VideoControl_LINE_DOUBLE_OFF; - if (info->var.activate == FB_ACTIVATE_NOW) + if ((info->var.activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) par->video |= PM3VideoControl_ENABLE; else { par->video |= PM3VideoControl_DISABLE; diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c index 836a612af977..64779e70408f 100644 --- a/drivers/video/skeletonfb.c +++ b/drivers/video/skeletonfb.c @@ -132,7 +132,6 @@ static struct fb_info info; static struct xxx_par __initdata current_par; int xxxfb_init(void); -int xxxfb_setup(char*); /** * xxxfb_open - Optional function. Called when the framebuffer is @@ -975,6 +974,21 @@ static struct platform_device xxxfb_device = { .name = "xxxfb", }; +#ifndef MODULE + /* + * Setup + */ + +/* + * Only necessary if your driver takes special options, + * otherwise we fall back on the generic fb_setup(). + */ +int __init xxxfb_setup(char *options) +{ + /* Parse user speficied options (`video=xxxfb:') */ +} +#endif /* MODULE */ + static int __init xxxfb_init(void) { int ret; @@ -1006,21 +1020,6 @@ static void __exit xxxfb_exit(void) } #endif /* CONFIG_PCI */ -#ifdef MODULE - /* - * Setup - */ - -/* - * Only necessary if your driver takes special options, - * otherwise we fall back on the generic fb_setup(). - */ -int __init xxxfb_setup(char *options) -{ - /* Parse user speficied options (`video=xxxfb:') */ -} -#endif /* MODULE */ - /* ------------------------------------------------------------------------- */ diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c index 5e9755e464a1..30c0b948852b 100644 --- a/drivers/video/vt8623fb.c +++ b/drivers/video/vt8623fb.c @@ -778,9 +778,10 @@ err_enable_device: static void __devexit vt8623_pci_remove(struct pci_dev *dev) { struct fb_info *info = pci_get_drvdata(dev); - struct vt8623fb_info *par = info->par; if (info) { + struct vt8623fb_info *par = info->par; + #ifdef CONFIG_MTRR if (par->mtrr_reg >= 0) { mtrr_del(par->mtrr_reg, 0, 0); diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 8a23483ca8d0..3b64bb16c727 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c @@ -30,15 +30,15 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, unsigned long *blockgrpp, ext4_grpblk_t *offsetp) { - struct ext4_super_block *es = EXT4_SB(sb)->s_es; + struct ext4_super_block *es = EXT4_SB(sb)->s_es; ext4_grpblk_t offset; - blocknr = blocknr - le32_to_cpu(es->s_first_data_block); + blocknr = blocknr - le32_to_cpu(es->s_first_data_block); offset = do_div(blocknr, EXT4_BLOCKS_PER_GROUP(sb)); if (offsetp) *offsetp = offset; if (blockgrpp) - *blockgrpp = blocknr; + *blockgrpp = blocknr; } diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index a0f0c04e79b2..b9ce24129070 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -374,7 +374,7 @@ ext4_ext_binsearch_idx(struct inode *inode, struct ext4_ext_path *path, int bloc le32_to_cpu(ix[-1].ei_block)); } BUG_ON(k && le32_to_cpu(ix->ei_block) - <= le32_to_cpu(ix[-1].ei_block)); + <= le32_to_cpu(ix[-1].ei_block)); if (block < le32_to_cpu(ix->ei_block)) break; chix = ix; @@ -423,8 +423,8 @@ ext4_ext_binsearch(struct inode *inode, struct ext4_ext_path *path, int block) path->p_ext = l - 1; ext_debug(" -> %d:%llu:%d ", - le32_to_cpu(path->p_ext->ee_block), - ext_pblock(path->p_ext), + le32_to_cpu(path->p_ext->ee_block), + ext_pblock(path->p_ext), le16_to_cpu(path->p_ext->ee_len)); #ifdef CHECK_BINSEARCH @@ -435,7 +435,7 @@ ext4_ext_binsearch(struct inode *inode, struct ext4_ext_path *path, int block) chex = ex = EXT_FIRST_EXTENT(eh); for (k = 0; k < le16_to_cpu(eh->eh_entries); k++, ex++) { BUG_ON(k && le32_to_cpu(ex->ee_block) - <= le32_to_cpu(ex[-1].ee_block)); + <= le32_to_cpu(ex[-1].ee_block)); if (block < le32_to_cpu(ex->ee_block)) break; chex = ex; @@ -577,7 +577,7 @@ static int ext4_ext_insert_index(handle_t *handle, struct inode *inode, curp->p_hdr->eh_entries = cpu_to_le16(le16_to_cpu(curp->p_hdr->eh_entries)+1); BUG_ON(le16_to_cpu(curp->p_hdr->eh_entries) - > le16_to_cpu(curp->p_hdr->eh_max)); + > le16_to_cpu(curp->p_hdr->eh_max)); BUG_ON(ix > EXT_LAST_INDEX(curp->p_hdr)); err = ext4_ext_dirty(handle, inode, curp); @@ -621,12 +621,12 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, border = path[depth].p_ext[1].ee_block; ext_debug("leaf will be split." " next leaf starts at %d\n", - le32_to_cpu(border)); + le32_to_cpu(border)); } else { border = newext->ee_block; ext_debug("leaf will be added." " next leaf starts at %d\n", - le32_to_cpu(border)); + le32_to_cpu(border)); } /* @@ -684,9 +684,9 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, while (path[depth].p_ext <= EXT_MAX_EXTENT(path[depth].p_hdr)) { ext_debug("move %d:%llu:%d in new leaf %llu\n", - le32_to_cpu(path[depth].p_ext->ee_block), - ext_pblock(path[depth].p_ext), - le16_to_cpu(path[depth].p_ext->ee_len), + le32_to_cpu(path[depth].p_ext->ee_block), + ext_pblock(path[depth].p_ext), + le16_to_cpu(path[depth].p_ext->ee_len), newblock); /*memmove(ex++, path[depth].p_ext++, sizeof(struct ext4_extent)); @@ -765,9 +765,9 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, EXT_LAST_INDEX(path[i].p_hdr)); while (path[i].p_idx <= EXT_MAX_INDEX(path[i].p_hdr)) { ext_debug("%d: move %d:%d in new index %llu\n", i, - le32_to_cpu(path[i].p_idx->ei_block), - idx_pblock(path[i].p_idx), - newblock); + le32_to_cpu(path[i].p_idx->ei_block), + idx_pblock(path[i].p_idx), + newblock); /*memmove(++fidx, path[i].p_idx++, sizeof(struct ext4_extent_idx)); neh->eh_entries++; @@ -1128,6 +1128,55 @@ ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1, } /* + * check if a portion of the "newext" extent overlaps with an + * existing extent. + * + * If there is an overlap discovered, it updates the length of the newext + * such that there will be no overlap, and then returns 1. + * If there is no overlap found, it returns 0. + */ +unsigned int ext4_ext_check_overlap(struct inode *inode, + struct ext4_extent *newext, + struct ext4_ext_path *path) +{ + unsigned long b1, b2; + unsigned int depth, len1; + unsigned int ret = 0; + + b1 = le32_to_cpu(newext->ee_block); + len1 = le16_to_cpu(newext->ee_len); + depth = ext_depth(inode); + if (!path[depth].p_ext) + goto out; + b2 = le32_to_cpu(path[depth].p_ext->ee_block); + + /* + * get the next allocated block if the extent in the path + * is before the requested block(s) + */ + if (b2 < b1) { + b2 = ext4_ext_next_allocated_block(path); + if (b2 == EXT_MAX_BLOCK) + goto out; + } + + /* check for wrap through zero */ + if (b1 + len1 < b1) { + len1 = EXT_MAX_BLOCK - b1; + newext->ee_len = cpu_to_le16(len1); + ret = 1; + } + + /* check for overlap */ + if (b1 + len1 > b2) { + newext->ee_len = cpu_to_le16(b2 - b1); + ret = 1; + } +out: + return ret; +} + +/* * ext4_ext_insert_extent: * tries to merge requsted extent into the existing extent or * inserts requested extent as new one into the tree, @@ -1212,12 +1261,12 @@ has_space: if (!nearex) { /* there is no extent in this leaf, create first one */ ext_debug("first extent in the leaf: %d:%llu:%d\n", - le32_to_cpu(newext->ee_block), - ext_pblock(newext), - le16_to_cpu(newext->ee_len)); + le32_to_cpu(newext->ee_block), + ext_pblock(newext), + le16_to_cpu(newext->ee_len)); path[depth].p_ext = EXT_FIRST_EXTENT(eh); } else if (le32_to_cpu(newext->ee_block) - > le32_to_cpu(nearex->ee_block)) { + > le32_to_cpu(nearex->ee_block)) { /* BUG_ON(newext->ee_block == nearex->ee_block); */ if (nearex != EXT_LAST_EXTENT(eh)) { len = EXT_MAX_EXTENT(eh) - nearex; @@ -1225,9 +1274,9 @@ has_space: len = len < 0 ? 0 : len; ext_debug("insert %d:%llu:%d after: nearest 0x%p, " "move %d from 0x%p to 0x%p\n", - le32_to_cpu(newext->ee_block), - ext_pblock(newext), - le16_to_cpu(newext->ee_len), + le32_to_cpu(newext->ee_block), + ext_pblock(newext), + le16_to_cpu(newext->ee_len), nearex, len, nearex + 1, nearex + 2); memmove(nearex + 2, nearex + 1, len); } @@ -1358,9 +1407,9 @@ int ext4_ext_walk_space(struct inode *inode, unsigned long block, cbex.ec_start = 0; cbex.ec_type = EXT4_EXT_CACHE_GAP; } else { - cbex.ec_block = le32_to_cpu(ex->ee_block); - cbex.ec_len = le16_to_cpu(ex->ee_len); - cbex.ec_start = ext_pblock(ex); + cbex.ec_block = le32_to_cpu(ex->ee_block); + cbex.ec_len = le16_to_cpu(ex->ee_len); + cbex.ec_start = ext_pblock(ex); cbex.ec_type = EXT4_EXT_CACHE_EXTENT; } @@ -1431,16 +1480,16 @@ ext4_ext_put_gap_in_cache(struct inode *inode, struct ext4_ext_path *path, len = le32_to_cpu(ex->ee_block) - block; ext_debug("cache gap(before): %lu [%lu:%lu]", (unsigned long) block, - (unsigned long) le32_to_cpu(ex->ee_block), - (unsigned long) le16_to_cpu(ex->ee_len)); + (unsigned long) le32_to_cpu(ex->ee_block), + (unsigned long) le16_to_cpu(ex->ee_len)); } else if (block >= le32_to_cpu(ex->ee_block) - + le16_to_cpu(ex->ee_len)) { - lblock = le32_to_cpu(ex->ee_block) - + le16_to_cpu(ex->ee_len); + + le16_to_cpu(ex->ee_len)) { + lblock = le32_to_cpu(ex->ee_block) + + le16_to_cpu(ex->ee_len); len = ext4_ext_next_allocated_block(path); ext_debug("cache gap(after): [%lu:%lu] %lu", - (unsigned long) le32_to_cpu(ex->ee_block), - (unsigned long) le16_to_cpu(ex->ee_len), + (unsigned long) le32_to_cpu(ex->ee_block), + (unsigned long) le16_to_cpu(ex->ee_len), (unsigned long) block); BUG_ON(len == lblock); len = len - lblock; @@ -1468,9 +1517,9 @@ ext4_ext_in_cache(struct inode *inode, unsigned long block, BUG_ON(cex->ec_type != EXT4_EXT_CACHE_GAP && cex->ec_type != EXT4_EXT_CACHE_EXTENT); if (block >= cex->ec_block && block < cex->ec_block + cex->ec_len) { - ex->ee_block = cpu_to_le32(cex->ec_block); + ex->ee_block = cpu_to_le32(cex->ec_block); ext4_ext_store_pblock(ex, cex->ec_start); - ex->ee_len = cpu_to_le16(cex->ec_len); + ex->ee_len = cpu_to_le16(cex->ec_len); ext_debug("%lu cached by %lu:%lu:%llu\n", (unsigned long) block, (unsigned long) cex->ec_block, @@ -1956,9 +2005,9 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, /* we should allocate requested block */ } else if (goal == EXT4_EXT_CACHE_EXTENT) { /* block is already allocated */ - newblock = iblock - - le32_to_cpu(newex.ee_block) - + ext_pblock(&newex); + newblock = iblock + - le32_to_cpu(newex.ee_block) + + ext_pblock(&newex); /* number of remaining blocks in the extent */ allocated = le16_to_cpu(newex.ee_len) - (iblock - le32_to_cpu(newex.ee_block)); @@ -1987,7 +2036,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, ex = path[depth].p_ext; if (ex) { - unsigned long ee_block = le32_to_cpu(ex->ee_block); + unsigned long ee_block = le32_to_cpu(ex->ee_block); ext4_fsblk_t ee_start = ext_pblock(ex); unsigned short ee_len = le16_to_cpu(ex->ee_len); @@ -2000,7 +2049,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, if (ee_len > EXT_MAX_LEN) goto out2; /* if found extent covers block, simply return it */ - if (iblock >= ee_block && iblock < ee_block + ee_len) { + if (iblock >= ee_block && iblock < ee_block + ee_len) { newblock = iblock - ee_block + ee_start; /* number of remaining blocks in the extent */ allocated = ee_len - (iblock - ee_block); @@ -2031,7 +2080,15 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, /* allocate new block */ goal = ext4_ext_find_goal(inode, path, iblock); - allocated = max_blocks; + + /* Check if we can really insert (iblock)::(iblock+max_blocks) extent */ + newex.ee_block = cpu_to_le32(iblock); + newex.ee_len = cpu_to_le16(max_blocks); + err = ext4_ext_check_overlap(inode, &newex, path); + if (err) + allocated = le16_to_cpu(newex.ee_len); + else + allocated = max_blocks; newblock = ext4_new_blocks(handle, inode, goal, &allocated, &err); if (!newblock) goto out2; @@ -2039,12 +2096,15 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, goal, newblock, allocated); /* try to insert new extent into found leaf and return */ - newex.ee_block = cpu_to_le32(iblock); ext4_ext_store_pblock(&newex, newblock); newex.ee_len = cpu_to_le16(allocated); err = ext4_ext_insert_extent(handle, inode, path, &newex); - if (err) + if (err) { + /* free data blocks we just allocated */ + ext4_free_blocks(handle, inode, ext_pblock(&newex), + le16_to_cpu(newex.ee_len)); goto out2; + } if (extend_disksize && inode->i_size > EXT4_I(inode)->i_disksize) EXT4_I(inode)->i_disksize = inode->i_size; @@ -2157,11 +2217,3 @@ int ext4_ext_writepage_trans_blocks(struct inode *inode, int num) return needed; } - -EXPORT_SYMBOL(ext4_mark_inode_dirty); -EXPORT_SYMBOL(ext4_ext_invalidate_cache); -EXPORT_SYMBOL(ext4_ext_insert_extent); -EXPORT_SYMBOL(ext4_ext_walk_space); -EXPORT_SYMBOL(ext4_ext_find_goal); -EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert); - diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index b34182b6ee4d..0bcf62a750ff 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -255,8 +255,8 @@ static int verify_chain(Indirect *from, Indirect *to) * @inode: inode in question (we are only interested in its superblock) * @i_block: block number to be parsed * @offsets: array to store the offsets in - * @boundary: set this non-zero if the referred-to block is likely to be - * followed (on disk) by an indirect block. + * @boundary: set this non-zero if the referred-to block is likely to be + * followed (on disk) by an indirect block. * * To store the locations of file's data ext4 uses a data structure common * for UNIX filesystems - tree of pointers anchored in the inode, with diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 4ec57be5baf5..2811e5720ad0 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -46,7 +46,7 @@ */ #define NAMEI_RA_CHUNKS 2 #define NAMEI_RA_BLOCKS 4 -#define NAMEI_RA_SIZE (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS) +#define NAMEI_RA_SIZE (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS) #define NAMEI_RA_INDEX(c,b) (((c) * NAMEI_RA_BLOCKS) + (b)) static struct buffer_head *ext4_append(handle_t *handle, @@ -241,7 +241,7 @@ static inline unsigned dx_node_limit (struct inode *dir) static void dx_show_index (char * label, struct dx_entry *entries) { int i, n = dx_get_count (entries); - printk("%s index ", label); + printk("%s index ", label); for (i = 0; i < n; i++) { printk("%x->%u ", i? dx_get_hash(entries + i) : 0, dx_get_block(entries + i)); diff --git a/fs/ext4/super.c b/fs/ext4/super.c index cb9afdd0e26e..175b68c60968 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1985,7 +1985,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb, if (bd_claim(bdev, sb)) { printk(KERN_ERR - "EXT4: failed to claim external journal device.\n"); + "EXT4: failed to claim external journal device.\n"); blkdev_put(bdev); return NULL; } diff --git a/fs/udf/inode.c b/fs/udf/inode.c index c8461551e108..1f0129405cf4 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -460,8 +460,8 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block, kernel_long_ad laarr[EXTENT_MERGE_SIZE]; struct extent_position prev_epos, cur_epos, next_epos; int count = 0, startnum = 0, endnum = 0; - uint32_t elen = 0; - kernel_lb_addr eloc; + uint32_t elen = 0, tmpelen; + kernel_lb_addr eloc, tmpeloc; int c = 1; loff_t lbcount = 0, b_off = 0; uint32_t newblocknum, newblock; @@ -520,8 +520,12 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block, b_off -= lbcount; offset = b_off >> inode->i_sb->s_blocksize_bits; - /* Move into indirect extent if we are at a pointer to it */ - udf_next_aext(inode, &prev_epos, &eloc, &elen, 0); + /* + * Move prev_epos and cur_epos into indirect extent if we are at + * the pointer to it + */ + udf_next_aext(inode, &prev_epos, &tmpeloc, &tmpelen, 0); + udf_next_aext(inode, &cur_epos, &tmpeloc, &tmpelen, 0); /* if the extent is allocated and recorded, return the block if the extent is not a multiple of the blocksize, round up */ diff --git a/fs/udf/super.c b/fs/udf/super.c index 3a743d854c17..6658afb41cc7 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1351,7 +1351,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) for (i=0; i<UDF_SB_NUMPARTS(sb); i++) { - switch UDF_SB_PARTTYPE(sb, i) + switch (UDF_SB_PARTTYPE(sb, i)) { case UDF_VIRTUAL_MAP15: case UDF_VIRTUAL_MAP20: diff --git a/include/asm-alpha/core_t2.h b/include/asm-alpha/core_t2.h index 457c34b6eb09..90e6b5d6c214 100644 --- a/include/asm-alpha/core_t2.h +++ b/include/asm-alpha/core_t2.h @@ -437,9 +437,15 @@ static inline void t2_outl(u32 b, unsigned long addr) static DEFINE_SPINLOCK(t2_hae_lock); +/* + * NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since + * they may be called directly, rather than through the + * ioreadNN/iowriteNN routines. + */ + __EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) { - unsigned long addr = (unsigned long) xaddr; + unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long result, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -453,7 +459,7 @@ __EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) { - unsigned long addr = (unsigned long) xaddr; + unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long result, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -471,7 +477,7 @@ __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) */ __EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr) { - unsigned long addr = (unsigned long) xaddr; + unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long result, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -485,7 +491,7 @@ __EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr) __EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr) { - unsigned long addr = (unsigned long) xaddr; + unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long r0, r1, work, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -501,7 +507,7 @@ __EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr) { - unsigned long addr = (unsigned long) xaddr; + unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long msb, w; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -515,7 +521,7 @@ __EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) { - unsigned long addr = (unsigned long) xaddr; + unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long msb, w; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -533,7 +539,7 @@ __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) */ __EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr) { - unsigned long addr = (unsigned long) xaddr; + unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -546,7 +552,7 @@ __EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr) { - unsigned long addr = (unsigned long) xaddr; + unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; unsigned long msb, work; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -587,14 +593,14 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr) __EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ { \ if (t2_is_mmio(xaddr)) \ - return t2_read##OS(xaddr - T2_DENSE_MEM); \ + return t2_read##OS(xaddr); \ else \ return t2_in##OS((unsigned long)xaddr - T2_IO); \ } \ __EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \ { \ if (t2_is_mmio(xaddr)) \ - t2_write##OS(b, xaddr - T2_DENSE_MEM); \ + t2_write##OS(b, xaddr); \ else \ t2_out##OS(b, (unsigned long)xaddr - T2_IO); \ } diff --git a/include/asm-alpha/core_titan.h b/include/asm-alpha/core_titan.h index a64ccbff7d98..a17f6f33b68e 100644 --- a/include/asm-alpha/core_titan.h +++ b/include/asm-alpha/core_titan.h @@ -380,12 +380,7 @@ struct el_PRIVATEER_envdata_mcheck { /* * Memory functions. all accesses are done through linear space. */ - -__EXTERN_INLINE void __iomem *titan_ioportmap(unsigned long addr) -{ - return (void __iomem *)(addr + TITAN_IO_BIAS); -} - +extern void __iomem *titan_ioportmap(unsigned long addr); extern void __iomem *titan_ioremap(unsigned long addr, unsigned long size); extern void titan_iounmap(volatile void __iomem *addr); diff --git a/include/asm-alpha/core_tsunami.h b/include/asm-alpha/core_tsunami.h index 44e635d2c571..58d4fe48742c 100644 --- a/include/asm-alpha/core_tsunami.h +++ b/include/asm-alpha/core_tsunami.h @@ -2,6 +2,7 @@ #define __ALPHA_TSUNAMI__H__ #include <linux/types.h> +#include <linux/pci.h> #include <asm/compiler.h> /* @@ -302,18 +303,8 @@ struct el_TSUNAMI_sysdata_mcheck { /* * Memory functions. all accesses are done through linear space. */ - -__EXTERN_INLINE void __iomem *tsunami_ioportmap(unsigned long addr) -{ - return (void __iomem *)(addr + TSUNAMI_IO_BIAS); -} - -__EXTERN_INLINE void __iomem *tsunami_ioremap(unsigned long addr, - unsigned long size) -{ - return (void __iomem *)(addr + TSUNAMI_MEM_BIAS); -} - +extern void __iomem *tsunami_ioportmap(unsigned long addr); +extern void __iomem *tsunami_ioremap(unsigned long addr, unsigned long size); __EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr) { return addr >= TSUNAMI_BASE; diff --git a/include/asm-alpha/core_wildfire.h b/include/asm-alpha/core_wildfire.h index 12af803d445a..cd562f544ba2 100644 --- a/include/asm-alpha/core_wildfire.h +++ b/include/asm-alpha/core_wildfire.h @@ -295,7 +295,7 @@ __EXTERN_INLINE int wildfire_is_ioaddr(unsigned long addr) __EXTERN_INLINE int wildfire_is_mmio(const volatile void __iomem *xaddr) { - unsigned long addr = (unsigned long)addr; + unsigned long addr = (unsigned long)xaddr; return (addr & 0x100000000UL) == 0; } diff --git a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h index ed06f59b544d..e8df1e7aae6b 100644 --- a/include/asm-alpha/vga.h +++ b/include/asm-alpha/vga.h @@ -46,6 +46,37 @@ extern void scr_memcpyw(u16 *d, const u16 *s, unsigned int count); #define vga_readb(a) readb((u8 __iomem *)(a)) #define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a)) +#ifdef CONFIG_VGA_HOSE +#include <linux/ioport.h> +#include <linux/pci.h> + +extern struct pci_controller *pci_vga_hose; + +# define __is_port_vga(a) \ + (((a) >= 0x3b0) && ((a) < 0x3e0) && \ + ((a) != 0x3b3) && ((a) != 0x3d3)) + +# define __is_mem_vga(a) \ + (((a) >= 0xa0000) && ((a) <= 0xc0000)) + +# define FIXUP_IOADDR_VGA(a) do { \ + if (pci_vga_hose && __is_port_vga(a)) \ + (a) += pci_vga_hose->io_space->start; \ + } while(0) + +# define FIXUP_MEMADDR_VGA(a) do { \ + if (pci_vga_hose && __is_mem_vga(a)) \ + (a) += pci_vga_hose->mem_space->start; \ + } while(0) + +#else /* CONFIG_VGA_HOSE */ +# define pci_vga_hose 0 +# define __is_port_vga(a) 0 +# define __is_mem_vga(a) 0 +# define FIXUP_IOADDR_VGA(a) +# define FIXUP_MEMADDR_VGA(a) +#endif /* CONFIG_VGA_HOSE */ + #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(x, s)) #endif diff --git a/include/asm-h8300/processor.h b/include/asm-h8300/processor.h index 99b664aa2083..49fc886a6232 100644 --- a/include/asm-h8300/processor.h +++ b/include/asm-h8300/processor.h @@ -78,7 +78,7 @@ struct thread_struct { do { \ set_fs(USER_DS); /* reads from user space */ \ (_regs)->pc = (_pc); \ - (_regs)->ccr &= 0x00; /* clear kernel flag */ \ + (_regs)->ccr = 0x00; /* clear all flags */ \ (_regs)->er5 = current->mm->start_data; /* GOT base */ \ wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \ } while(0) diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 0365ec9fc0c9..c83534ee1e79 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h @@ -59,6 +59,7 @@ extern void *__alloc_bootmem_core(struct bootmem_data *bdata, unsigned long align, unsigned long goal, unsigned long limit); +extern void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size); #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE extern void reserve_bootmem(unsigned long addr, unsigned long size); diff --git a/include/linux/errno.h b/include/linux/errno.h index d90b80f9b28c..46685832ed99 100644 --- a/include/linux/errno.h +++ b/include/linux/errno.h @@ -5,7 +5,12 @@ #ifdef __KERNEL__ -/* Should never be seen by user programs */ +/* + * These should never be seen by user programs. To return one of ERESTART* + * codes, signal_pending() MUST be set. Note that ptrace can observe these + * at syscall exit tracing, but they will never be left for the debugged user + * process to see. + */ #define ERESTARTSYS 512 #define ERESTARTNOINTR 513 #define ERESTARTNOHAND 514 /* restart if no handler.. */ diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h index 54c576d414c3..de1f9f78625a 100644 --- a/include/linux/ext4_fs.h +++ b/include/linux/ext4_fs.h @@ -32,9 +32,9 @@ /* * Define EXT4_RESERVATION to reserve data blocks for expanding files */ -#define EXT4_DEFAULT_RESERVE_BLOCKS 8 +#define EXT4_DEFAULT_RESERVE_BLOCKS 8 /*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ -#define EXT4_MAX_RESERVE_BLOCKS 1027 +#define EXT4_MAX_RESERVE_BLOCKS 1027 #define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0 /* * Always enable hashed directories @@ -204,12 +204,12 @@ struct ext4_group_desc /* Used to pass group descriptor data when online resize is done */ struct ext4_new_group_input { - __u32 group; /* Group number for this data */ - __u64 block_bitmap; /* Absolute block number of block bitmap */ - __u64 inode_bitmap; /* Absolute block number of inode bitmap */ - __u64 inode_table; /* Absolute block number of inode table start */ - __u32 blocks_count; /* Total number of blocks in this group */ - __u16 reserved_blocks; /* Number of reserved blocks in this group */ + __u32 group; /* Group number for this data */ + __u64 block_bitmap; /* Absolute block number of block bitmap */ + __u64 inode_bitmap; /* Absolute block number of inode bitmap */ + __u64 inode_table; /* Absolute block number of inode table start */ + __u32 blocks_count; /* Total number of blocks in this group */ + __u16 reserved_blocks; /* Number of reserved blocks in this group */ __u16 unused; }; @@ -310,7 +310,7 @@ struct ext4_inode { __u8 l_i_frag; /* Fragment number */ __u8 l_i_fsize; /* Fragment size */ __le16 l_i_file_acl_high; - __le16 l_i_uid_high; /* these 2 fields */ + __le16 l_i_uid_high; /* these 2 fields */ __le16 l_i_gid_high; /* were reserved2[0] */ __u32 l_i_reserved2; } linux2; @@ -513,7 +513,14 @@ struct ext4_super_block { /*150*/ __le32 s_blocks_count_hi; /* Blocks count */ __le32 s_r_blocks_count_hi; /* Reserved blocks count */ __le32 s_free_blocks_count_hi; /* Free blocks count */ - __u32 s_reserved[169]; /* Padding to the end of the block */ + __u16 s_min_extra_isize; /* All inodes have at least # bytes */ + __u16 s_want_extra_isize; /* New inodes should reserve # bytes */ + __u32 s_flags; /* Miscellaneous flags */ + __u16 s_raid_stride; /* RAID stride */ + __u16 s_mmp_interval; /* # seconds to wait in MMP checking */ + __u64 s_mmp_block; /* Block for multi-mount protection */ + __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ + __u32 s_reserved[163]; /* Padding to the end of the block */ }; #ifdef __KERNEL__ @@ -780,9 +787,9 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, * Ok, these declarations are also in <linux/kernel.h> but none of the * ext4 source programs needs to include it so they are duplicated here. */ -# define NORET_TYPE /**/ -# define ATTRIB_NORET __attribute__((noreturn)) -# define NORET_AND noreturn, +# define NORET_TYPE /**/ +# define ATTRIB_NORET __attribute__((noreturn)) +# define NORET_AND noreturn, /* balloc.c */ extern unsigned int ext4_block_group(struct super_block *sb, diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h index 7eb1d73fc5d1..acfe59740b03 100644 --- a/include/linux/ext4_fs_extents.h +++ b/include/linux/ext4_fs_extents.h @@ -151,8 +151,8 @@ typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *, ((struct ext4_extent_idx *) (((char *) (__hdr__)) + \ sizeof(struct ext4_extent_header))) #define EXT_HAS_FREE_INDEX(__path__) \ - (le16_to_cpu((__path__)->p_hdr->eh_entries) \ - < le16_to_cpu((__path__)->p_hdr->eh_max)) + (le16_to_cpu((__path__)->p_hdr->eh_entries) \ + < le16_to_cpu((__path__)->p_hdr->eh_max)) #define EXT_LAST_EXTENT(__hdr__) \ (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1) #define EXT_LAST_INDEX(__hdr__) \ @@ -190,6 +190,7 @@ ext4_ext_invalidate_cache(struct inode *inode) extern int ext4_extent_tree_init(handle_t *, struct inode *); extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); +extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *); extern struct ext4_ext_path * ext4_ext_find_extent(struct inode *, int, struct ext4_ext_path *); diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h index d5b177e5b395..9de494406995 100644 --- a/include/linux/ext4_fs_i.h +++ b/include/linux/ext4_fs_i.h @@ -41,14 +41,14 @@ struct ext4_reserve_window_node { struct ext4_block_alloc_info { /* information about reservation window */ - struct ext4_reserve_window_node rsv_window_node; + struct ext4_reserve_window_node rsv_window_node; /* * was i_next_alloc_block in ext4_inode_info * is the logical (file-relative) number of the * most-recently-allocated block in this file. * We use this for detecting linearly ascending allocation requests. */ - __u32 last_alloc_logical_block; + __u32 last_alloc_logical_block; /* * Was i_next_alloc_goal in ext4_inode_info * is the *physical* companion to i_next_alloc_block. @@ -56,7 +56,7 @@ struct ext4_block_alloc_info { * allocated to this file. This give us the goal (target) for the next * allocation when we detect linearly ascending requests. */ - ext4_fsblk_t last_alloc_physical_block; + ext4_fsblk_t last_alloc_physical_block; }; #define rsv_start rsv_window._rsv_start diff --git a/include/linux/fb.h b/include/linux/fb.h index c654d0e9ce33..66226824ab68 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -942,6 +942,7 @@ extern int fb_new_modelist(struct fb_info *info); extern struct fb_info *registered_fb[FB_MAX]; extern int num_registered_fb; +extern struct class *fb_class; static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 4712e269d8d3..6a115cffea34 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1292,6 +1292,7 @@ #define PCI_DEVICE_ID_VIA_P4M890 0x0327 #define PCI_DEVICE_ID_VIA_VT3324 0x0324 #define PCI_DEVICE_ID_VIA_VT3336 0x0336 +#define PCI_DEVICE_ID_VIA_VT3351 0x0351 #define PCI_DEVICE_ID_VIA_8371_0 0x0391 #define PCI_DEVICE_ID_VIA_8501_0 0x0501 #define PCI_DEVICE_ID_VIA_82C561 0x0561 @@ -1437,6 +1438,7 @@ #define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 #define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 #define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 +#define PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX 0x0104 #define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132 #define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 #define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 @@ -2267,11 +2269,11 @@ #define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e #define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 #define PCI_DEVICE_ID_INTEL_ICH9_0 0x2910 -#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2911 +#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2917 #define PCI_DEVICE_ID_INTEL_ICH9_2 0x2912 #define PCI_DEVICE_ID_INTEL_ICH9_3 0x2913 #define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914 -#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2915 +#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919 #define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index a3ac4c896831..7f2c99d66e9d 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -152,6 +152,7 @@ #include <linux/sched.h> #include <linux/tty.h> #include <linux/mutex.h> +#include <linux/sysrq.h> struct uart_port; struct uart_info; diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c index 338a9b489fbc..27478948b318 100644 --- a/kernel/futex_compat.c +++ b/kernel/futex_compat.c @@ -144,20 +144,21 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, struct timespec ts; ktime_t t, *tp = NULL; int val2 = 0; + int cmd = op & FUTEX_CMD_MASK; - if (utime && (op == FUTEX_WAIT || op == FUTEX_LOCK_PI)) { + if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI)) { if (get_compat_timespec(&ts, utime)) return -EFAULT; if (!timespec_valid(&ts)) return -EINVAL; t = timespec_to_ktime(ts); - if (op == FUTEX_WAIT) + if (cmd == FUTEX_WAIT) t = ktime_add(ktime_get(), t); tp = &t; } - if (op == FUTEX_REQUEUE || op == FUTEX_CMP_REQUEUE - || op == FUTEX_CMP_REQUEUE_PI) + if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE + || cmd == FUTEX_CMP_REQUEUE_PI) val2 = (int) (unsigned long) utime; return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); diff --git a/kernel/time/timer_stats.c b/kernel/time/timer_stats.c index 868f1bceb07f..321693724ad7 100644 --- a/kernel/time/timer_stats.c +++ b/kernel/time/timer_stats.c @@ -117,21 +117,6 @@ static struct entry entries[MAX_ENTRIES]; static atomic_t overflow_count; -static void reset_entries(void) -{ - nr_entries = 0; - memset(entries, 0, sizeof(entries)); - atomic_set(&overflow_count, 0); -} - -static struct entry *alloc_entry(void) -{ - if (nr_entries >= MAX_ENTRIES) - return NULL; - - return entries + nr_entries++; -} - /* * The entries are in a hash-table, for fast lookup: */ @@ -149,6 +134,22 @@ static struct entry *alloc_entry(void) static struct entry *tstat_hash_table[TSTAT_HASH_SIZE] __read_mostly; +static void reset_entries(void) +{ + nr_entries = 0; + memset(entries, 0, sizeof(entries)); + memset(tstat_hash_table, 0, sizeof(tstat_hash_table)); + atomic_set(&overflow_count, 0); +} + +static struct entry *alloc_entry(void) +{ + if (nr_entries >= MAX_ENTRIES) + return NULL; + + return entries + nr_entries++; +} + static int match_entries(struct entry *entry1, struct entry *entry2) { return entry1->timer == entry2->timer && @@ -202,12 +203,15 @@ static struct entry *tstat_lookup(struct entry *entry, char *comm) if (curr) { *curr = *entry; curr->count = 0; + curr->next = NULL; memcpy(curr->comm, comm, TASK_COMM_LEN); + + smp_mb(); /* Ensure that curr is initialized before insert */ + if (prev) prev->next = curr; else *head = curr; - curr->next = NULL; } out_unlock: spin_unlock(&table_lock); @@ -232,10 +236,15 @@ void timer_stats_update_stats(void *timer, pid_t pid, void *startf, /* * It doesnt matter which lock we take: */ - spinlock_t *lock = &per_cpu(lookup_lock, raw_smp_processor_id()); + spinlock_t *lock; struct entry *entry, input; unsigned long flags; + if (likely(!active)) + return; + + lock = &per_cpu(lookup_lock, raw_smp_processor_id()); + input.timer = timer; input.start_func = startf; input.expire_func = timerf; @@ -360,6 +369,7 @@ static ssize_t tstats_write(struct file *file, const char __user *buf, if (!active) { reset_entries(); time_start = ktime_get(); + smp_mb(); active = 1; } break; diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 1ba77ca7d165..da95e10cfd70 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -126,7 +126,10 @@ config TIMER_STATS reprogrammed. The statistics can be read from /proc/timer_stats. The statistics collection is started by writing 1 to /proc/timer_stats, writing 0 stops it. This feature is useful to collect information - about timer usage patterns in kernel and userspace. + about timer usage patterns in kernel and userspace. This feature + is lightweight if enabled in the kernel config but not activated + (it defaults to deactivated on bootup and will only be activated + if some application like powertop activates it explicitly). config DEBUG_SLAB bool "Debug slab memory allocations" diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 84279127fcd3..df9d554bea30 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -65,7 +65,7 @@ static int __add_zone(struct zone *zone, unsigned long phys_start_pfn) int zone_type; zone_type = zone - pgdat->node_zones; - if (!populated_zone(zone)) { + if (!zone->wait_table) { int ret = 0; ret = init_currently_empty_zone(zone, phys_start_pfn, nr_pages, MEMMAP_HOTPLUG); diff --git a/mm/slub.c b/mm/slub.c index 238c5a6ee896..51663a3c3c24 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2608,6 +2608,19 @@ static void for_all_slabs(void (*func)(struct kmem_cache *, int), int cpu) } /* + * Version of __flush_cpu_slab for the case that interrupts + * are enabled. + */ +static void cpu_slab_flush(struct kmem_cache *s, int cpu) +{ + unsigned long flags; + + local_irq_save(flags); + __flush_cpu_slab(s, cpu); + local_irq_restore(flags); +} + +/* * Use the cpu notifier to insure that the cpu slabs are flushed when * necessary. */ @@ -2621,7 +2634,7 @@ static int __cpuinit slab_cpuup_callback(struct notifier_block *nfb, case CPU_UP_CANCELED_FROZEN: case CPU_DEAD: case CPU_DEAD_FROZEN: - for_all_slabs(__flush_cpu_slab, cpu); + for_all_slabs(cpu_slab_flush, cpu); break; default: break; diff --git a/mm/sparse.c b/mm/sparse.c index 1302f8348d51..545e4d3afcdf 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -209,6 +209,12 @@ static int __meminit sparse_init_one_section(struct mem_section *ms, return 1; } +__attribute__((weak)) +void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size) +{ + return NULL; +} + static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum) { struct page *map; @@ -219,6 +225,11 @@ static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum) if (map) return map; + map = alloc_bootmem_high_node(NODE_DATA(nid), + sizeof(struct page) * PAGES_PER_SECTION); + if (map) + return map; + map = alloc_bootmem_node(NODE_DATA(nid), sizeof(struct page) * PAGES_PER_SECTION); if (map) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl new file mode 100644 index 000000000000..e216d49624b7 --- /dev/null +++ b/scripts/checkpatch.pl @@ -0,0 +1,595 @@ +#!/usr/bin/perl -w +# (c) 2001, Dave Jones. <davej@codemonkey.org.uk> (the file handling bit) +# (c) 2005, Joel Scohpp <jschopp@austin.ibm.com> (the ugly bit) +# (c) 2007, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite, etc) +# Licensed under the terms of the GNU GPL License version 2 + +use strict; + +my $P = $0; + +my $V = '0.01'; + +use Getopt::Long qw(:config no_auto_abbrev); + +my $quiet = 0; +my $tree = 1; +my $chk_signoff = 1; +my $chk_patch = 1; +GetOptions( + 'q|quiet' => \$quiet, + 'tree!' => \$tree, + 'signoff!' => \$chk_signoff, + 'patch!' => \$chk_patch, +) or exit; + +my $exit = 0; + +if ($#ARGV < 0) { + print "usage: patchstylecheckemail.pl [options] patchfile\n"; + print "version: $V\n"; + print "options: -q => quiet\n"; + print " --no-tree => run without a kernel tree\n"; + exit(1); +} + +if ($tree && !top_of_kernel_tree()) { + print "Must be run from the top-level dir. of a kernel tree\n"; + exit(2); +} + +my @deprecated = (); +my $removal = 'Documentation/feature-removal-schedule.txt'; +if ($tree && -f $removal) { + open(REMOVE, "<$removal") || die "$P: $removal: open failed - $!\n"; + while (<REMOVE>) { + if (/^Files:\s+(.*\S)/) { + for my $file (split(/[, ]+/, $1)) { + if ($file =~ m@include/(.*)@) { + push(@deprecated, $1); + } + } + } + } +} + +my @lines = (); +while (<>) { + chomp; + push(@lines, $_); + if (eof(ARGV)) { + if (!process($ARGV, @lines)) { + $exit = 1; + } + @lines = (); + } +} + +exit($exit); + +sub top_of_kernel_tree { + if ((-f "COPYING") && (-f "CREDITS") && (-f "Kbuild") && + (-f "MAINTAINERS") && (-f "Makefile") && (-f "README") && + (-d "Documentation") && (-d "arch") && (-d "include") && + (-d "drivers") && (-d "fs") && (-d "init") && (-d "ipc") && + (-d "kernel") && (-d "lib") && (-d "scripts")) { + return 1; + } + return 0; +} + +sub expand_tabs { + my ($str) = @_; + + my $res = ''; + my $n = 0; + for my $c (split(//, $str)) { + if ($c eq "\t") { + $res .= ' '; + $n++; + for (; ($n % 8) != 0; $n++) { + $res .= ' '; + } + next; + } + $res .= $c; + $n++; + } + + return $res; +} + +sub cat_vet { + my ($vet) = @_; + + $vet =~ s/\t/^I/; + $vet =~ s/$/\$/; + + return $vet; +} + +sub process { + my $filename = shift; + my @lines = @_; + + my $linenr=0; + my $prevline=""; + my $stashline=""; + + my $lineforcounting=''; + my $indent; + my $previndent=0; + my $stashindent=0; + + my $clean = 1; + my $signoff = 0; + my $is_patch = 0; + + # Trace the real file/line as we go. + my $realfile = ''; + my $realline = 0; + my $realcnt = 0; + my $here = ''; + my $in_comment = 0; + my $first_line = 0; + + foreach my $line (@lines) { + $linenr++; + +#extract the filename as it passes + if ($line=~/^\+\+\+\s+(\S+)/) { + $realfile=$1; + $in_comment = 0; + next; + } +#extract the line range in the file after the patch is applied + if ($line=~/^\@\@ -\d+,\d+ \+(\d+)(,(\d+))? \@\@/) { + $is_patch = 1; + $first_line = 1; + $in_comment = 0; + $realline=$1-1; + if (defined $2) { + $realcnt=$3+1; + } else { + $realcnt=1+1; + } + next; + } + +#track the line number as we move through the hunk + if ($line=~/^[ \+]/) { + $realline++; + $realcnt-- if ($realcnt != 0); + + # track any sort of multi-line comment. Obviously if + # the added text or context do not include the whole + # comment we will not see it. Such is life. + # + # Guestimate if this is a continuing comment. If this + # is the start of a diff block and this line starts + # ' *' then it is very likely a comment. + if ($first_line and $line =~ m@^.\s*\*@) { + $in_comment = 1; + } + if ($line =~ m@/\*@) { + $in_comment = 1; + } + if ($line =~ m@\*/@) { + $in_comment = 0; + } + + $lineforcounting = $line; + $lineforcounting =~ s/^\+//; + $lineforcounting = expand_tabs($lineforcounting); + + my ($white) = ($lineforcounting =~ /^(\s*)/); + $indent = length($white); + + # Track the previous line. + ($prevline, $stashline) = ($stashline, $line); + ($previndent, $stashindent) = ($stashindent, $indent); + $first_line = 0; + } + +#make up the handle for any error we report on this line + $here = "PATCH: $ARGV:$linenr:"; + $here .= "\nFILE: $realfile:$realline:" if ($realcnt != 0); + + my $herecurr = "$here\n$line\n\n"; + my $hereprev = "$here\n$prevline\n$line\n\n"; + +#check the patch for a signoff: + if ($line =~ /^\s*Signed-off-by:\s/) { + $signoff++; + + } elsif ($line =~ /^\s*signed-off-by:/i) { + if (!($line =~ /^\s*Signed-off-by:/)) { + print "use Signed-off-by:\n"; + print "$herecurr"; + $clean = 0; + } + if ($line =~ /^\s*signed-off-by:\S/i) { + print "need space after Signed-off-by:\n"; + print "$herecurr"; + $clean = 0; + } + } + +#ignore lines not being added + if ($line=~/^[^\+]/) {next;} + +# check we are in a valid source file *.[hcsS] if not then ignore this hunk + next if ($realfile !~ /\.[hcsS]$/); + +#trailing whitespace + if ($line=~/\S\s+$/) { + my $herevet = "$here\n" . cat_vet($line) . "\n\n"; + print "trailing whitespace\n"; + print "$herevet"; + $clean = 0; + } +#80 column limit + if (!($prevline=~/\/\*\*/) && length($lineforcounting) > 80) { + print "line over 80 characters\n"; + print "$herecurr"; + $clean = 0; + } + +# check we are in a valid source file *.[hc] if not then ignore this hunk + next if ($realfile !~ /\.[hc]$/); + +# at the beginning of a line any tabs must come first and anything +# more than 8 must use tabs. + if ($line=~/^\+\s* \t\s*\S/ or $line=~/^\+\s* \s*/) { + my $herevet = "$here\n" . cat_vet($line) . "\n\n"; + print "use tabs not spaces\n"; + print "$herevet"; + $clean = 0; + } + + # + # The rest of our checks refer specifically to C style + # only apply those _outside_ comments. + # + next if ($in_comment); + +# no C99 // comments + if ($line =~ m@//@ and !($line =~ m@\".*//.*\"@)) { + print "do not use C99 // comments\n"; + print "$herecurr"; + $clean = 0; + } + + # Remove comments from the line before processing. + $line =~ s@/\*.*\*/@@g; + $line =~ s@/\*.*@@; + $line =~ s@.*\*/@@; + $line =~ s@//.*@@; + +#EXPORT_SYMBOL should immediately follow its function closing }. + if (($line =~ /EXPORT_SYMBOL.*\(.*\)/) || + ($line =~ /EXPORT_UNUSED_SYMBOL.*\(.*\)/)) { + if (($prevline !~ /^}/) && + ($prevline !~ /^\+}/) && + ($prevline !~ /^ }/)) { + print "EXPORT_SYMBOL(func); should immediately follow its function\n"; + print "$herecurr"; + $clean = 0; + } + } + + # check for static initialisers. + if ($line=~/\s*static\s.*=\s+(0|NULL);/) { + print "do not initialise statics to 0 or NULL\n"; + print "$herecurr"; + $clean = 0; + } + + # check for new typedefs. + if ($line=~/\s*typedef\s/) { + print "do not add new typedefs\n"; + print "$herecurr"; + $clean = 0; + } + +# * goes on variable not on type + if ($line=~/[A-Za-z\d_]+\* [A-Za-z\d_]+/) { + print "\"foo* bar\" should be \"foo *bar\"\n"; + print "$herecurr"; + $clean = 0; + } + +# # no BUG() or BUG_ON() +# if ($line =~ /\b(BUG|BUG_ON)\b/) { +# print "Try to use WARN_ON & Recovery code rather than BUG() or BUG_ON()\n"; +# print "$herecurr"; +# $clean = 0; +# } + +# printk should use KERN_* levels + if ($line =~ /\bprintk\((?!KERN_)/) { + print "printk() should include KERN_ facility level\n"; + print "$herecurr"; + $clean = 0; + } + +#function brace can't be on same line, except for #defines of do while, or if closed on same line + if (($line=~/[A-Za-z\d_]+\**\s+\**[A-Za-z\d_]+\(.*\).* {/) and + !($line=~/\#define.*do\s{/) and !($line=~/}/)) { + print "braces following function declarations go on the next line\n"; + print "$herecurr"; + $clean = 0; + } + my $opline = $line; + $opline =~ s/^.//; + if (!($line=~/\#\s*include/)) { + # Check operator spacing. + my @elements = split(/(<<=|>>=|<=|>=|==|!=|\+=|-=|\*=|\/=|%=|\^=|\|=|&=|->|<<|>>|<|>|=|!|~|&&|\|\||,|\^|\+\+|--|;|&|\||\+|-|\*|\/\/|\/)/, $opline); + for (my $n = 0; $n < $#elements; $n += 2) { + # $wN says we have white-space before or after + # $sN says we have a separator before or after + # $oN says we have another operator before or after + my $w1 = $elements[$n] =~ /\s$/; + my $s1 = $elements[$n] =~ /(\[|\(|\s)$/; + my $o1 = $elements[$n] eq ''; + my $op = $elements[$n + 1]; + my $w2 = 1; + my $s2 = 1; + my $o2 = 0; + # If we have something after the operator handle it. + if (defined $elements[$n + 2]) { + $w2 = $elements[$n + 2] =~ /^\s/; + $s2 = $elements[$n + 2] =~ /^(\s|\)|\]|;)/; + $o2 = $elements[$n + 2] eq ''; + } + + # Generate the context. + my $at = "here: "; + for (my $m = $n; $m >= 0; $m--) { + if ($elements[$m] ne '') { + $at .= $elements[$m]; + last; + } + } + $at .= $op; + for (my $m = $n + 2; defined $elements[$m]; $m++) { + if ($elements[$m] ne '') { + $at .= $elements[$m]; + last; + } + } + + ##print "<$s1:$op:$s2> <$elements[$n]:$elements[$n + 1]:$elements[$n + 2]>\n"; + # Skip things apparently in quotes. + next if ($line=~/\".*\Q$op\E.*\"/ or $line=~/\'\Q$op\E\'/); + + # We need ; as an operator. // is a comment. + if ($op eq ';' or $op eq '//') { + + # -> should have no spaces + } elsif ($op eq '->') { + if ($s1 or $s2) { + print "no spaces around that '$op' $at\n"; + print "$herecurr"; + $clean = 0; + } + + # , must have a space on the right. + } elsif ($op eq ',') { + if (!$s2) { + print "need space after that '$op' $at\n"; + print "$herecurr"; + $clean = 0; + } + + # unary ! and unary ~ are allowed no space on the right + } elsif ($op eq '!' or $op eq '~') { + if (!$s1 && !$o1) { + print "need space before that '$op' $at\n"; + print "$herecurr"; + $clean = 0; + } + if ($s2) { + print "no space after that '$op' $at\n"; + print "$herecurr"; + $clean = 0; + } + + # unary ++ and unary -- are allowed no space on one side. + } elsif ($op eq '++' or $op eq '--') { + if (($s1 && $s2) || ((!$s1 && !$o1) && (!$s2 && !$o2))) { + print "need space one side of that '$op' $at\n"; + print "$herecurr"; + $clean = 0; + } + + # & is both unary and binary + # unary: + # a &b + # binary (consistent spacing): + # a&b OK + # a & b OK + # + # boiling down to: if there is a space on the right then there + # should be one on the left. + # + # - is the same + # + # * is the same only adding: + # type: + # (foo *) + # (foo **) + # + } elsif ($op eq '&' or $op eq '-' or $op eq '*') { + if ($w2 and !$w1) { + print "need space before that '$op' $at\n"; + print "$herecurr"; + $clean = 0; + } + + # << and >> may either have or not have spaces both sides + } elsif ($op eq '<<' or $op eq '>>' or $op eq '+' or $op eq '/' or + $op eq '^' or $op eq '|') + { + if ($s1 != $s2) { + print "need consistent spacing around '$op' $at\n"; + print "$herecurr"; + $clean = 0; + } + + # All the others need spaces both sides. + } elsif (!$s1 or !$s2) { + print "need spaces around that '$op' $at\n"; + print "$herecurr"; + $clean = 0; + } + } + } + +#need space before brace following if, while, etc + if ($line=~/\(.*\){/) { + print "need a space before the brace\n"; + print "$herecurr"; + $clean = 0; + } + +#goto labels aren't indented, allow a single space however + if ($line=~/^.\s+[A-Za-z\d_]+:/ and + !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) { + print "labels should not be indented\n"; + print "$herecurr"; + $clean = 0; + } + +# Need a space before open parenthesis after if, while etc + if ($line=~/(if|while|for|switch)\(/) { + print "need a space before the open parenthesis\n"; + print "$herecurr"; + $clean = 0; + } + +# Check for illegal assignment in if conditional. + if ($line=~/(if|while)\s*\(.*[^<>!=]=[^=].*\)/) { + print "do not use assignment in if condition\n"; + print "$herecurr"; + $clean = 0; + } + + # Check for }<nl>else {, these must be at the same + # indent level to be relevant to each other. + if ($prevline=~/}\s*$/ and $line=~/^.\s*else\s*/ and + $previndent == $indent) { + print "else should follow close brace\n"; + print "$hereprev"; + $clean = 0; + } + + # Check for switch () {<nl>case, these must be at the + # same indent. We will only catch the first one, as our + # context is very small but people tend to be consistent + # so we will catch them out more often than not. + if ($prevline=~/\s*switch\s*\(.*\)/ and $line=~/\s*case\s+/ + and $previndent != $indent) { + print "switch and case should be at the same indent\n"; + print "$hereprev"; + $clean = 0; + } + +#studly caps, commented out until figure out how to distinguish between use of existing and adding new +# if (($line=~/[\w_][a-z\d]+[A-Z]/) and !($line=~/print/)) { +# print "No studly caps, use _\n"; +# print "$herecurr"; +# $clean = 0; +# } + +#no spaces allowed after \ in define + if ($line=~/\#define.*\\\s$/) { + print("Whitepspace after \\ makes next lines useless\n"); + print "$herecurr"; + $clean = 0; + } + +#warn if <asm/foo.h> is #included and <linux/foo.h> is available. + if ($tree && $line =~ qr|\s*\#\s*include\s*\<asm\/(.*)\.h\>|) { + my $checkfile = "include/linux/$1.h"; + if (-f $checkfile) { + print "Use #include <linux/$1.h> instead of <asm/$1.h>\n"; + print $herecurr; + $clean = 0; + } + } + +#if/while/etc brace do not go on next line, unless #defining a do while loop, or if that brace on the next line is for something else + if ($prevline=~/(if|while|for|switch)\s*\(/) { + my @opened = $prevline=~/\(/g; + my @closed = $prevline=~/\)/g; + my $nr_line = $linenr; + my $remaining = $realcnt; + my $next_line = $line; + my $extra_lines = 0; + my $display_segment = $prevline; + + while ($remaining > 0 && scalar @opened > scalar @closed) { + $prevline .= $next_line; + $display_segment .= "\n" . $next_line; + $next_line = $lines[$nr_line]; + $nr_line++; + $remaining--; + + @opened = $prevline=~/\(/g; + @closed = $prevline=~/\)/g; + } + + if (($prevline=~/(if|while|for|switch)\s*\(.*\)\s*$/) and ($next_line=~/{/) and + !($next_line=~/(if|while|for)/) and !($next_line=~/\#define.*do.*while/)) { + print "That { should be on the previous line\n"; + print "$display_segment\n$next_line\n\n"; + $clean = 0; + } + } + +#multiline macros should be enclosed in a do while loop + if (($prevline=~/\#define.*\\/) and !($prevline=~/do\s+{/) and + !($prevline=~/\(\{/) and ($line=~/;\s*\\/) and + !($line=~/do.*{/) and !($line=~/\(\{/)) { + print "Macros with multiple statements should be enclosed in a do - while loop\n"; + print "$hereprev"; + $clean = 0; + } + +# don't include deprecated include files + for my $inc (@deprecated) { + if ($line =~ m@\#\s*include\s*\<$inc>@) { + print "Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n"; + print "$herecurr"; + $clean = 0; + } + } + +# don't use kernel_thread() + if ($line =~ /\bkernel_thread\b/) { + print "Don't use kernel_thread(), use kthread(): see Documentation/feature-removal-schedule.txt\n"; + print "$herecurr"; + $clean = 0; + } + } + + if ($chk_patch && !$is_patch) { + $clean = 0; + print "Does not appear to be a unified-diff format patch\n"; + } + if ($is_patch && $chk_signoff && $signoff == 0) { + $clean = 0; + print "Missing Signed-off-by: line(s)\n"; + } + + if ($clean == 1 && $quiet == 0) { + print "Your patch has no obvious style problems and is ready for submission.\n" + } + if ($clean == 0 && $quiet == 0) { + print "Your patch has style problems, please review. If any of these errors\n"; + print "are false positives report them to the maintainer, see\n"; + print "CHECKPATCH in MAINTAINERS.\n"; + } + return $clean; +} diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c index c7e1b2646193..e7ed868fa7c0 100644 --- a/sound/arm/sa11xx-uda1341.c +++ b/sound/arm/sa11xx-uda1341.c @@ -987,7 +987,7 @@ static int __init sa11xx_uda1341_init(void) if (platform_get_drvdata(device)) return 0; platform_device_unregister(device); - err = -ENODEV + err = -ENODEV; } else err = PTR_ERR(device); platform_driver_unregister(&sa11xx_uda1341_driver); |