From 54229e371711587f204a94157e737947f9c0017b Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Fri, 17 Aug 2007 13:57:39 +1000 Subject: [PATCH] --- yaml --- r: 64458 b: refs/heads/master c: dfa70f81a05fa857fb1428ac2a88da84ecd50dd9 h: refs/heads/master v: v3 --- [refs] | 2 +- .../feature-removal-schedule.txt | 8 - trunk/Documentation/kernel-parameters.txt | 19 ++- trunk/arch/i386/boot/boot.h | 24 +-- trunk/arch/i386/boot/cpucheck.c | 3 +- trunk/arch/i386/boot/edd.c | 6 +- trunk/arch/i386/boot/tty.c | 14 +- trunk/arch/i386/boot/video-vga.c | 17 +-- trunk/arch/i386/kernel/io_apic.c | 8 + trunk/arch/parisc/kernel/sys_parisc32.c | 141 ++++++++++++++++++ trunk/arch/parisc/kernel/syscall_table.S | 4 +- trunk/arch/parisc/kernel/vmlinux.lds.S | 2 - trunk/arch/powerpc/platforms/pasemi/iommu.c | 6 +- trunk/arch/x86_64/kernel/io_apic.c | 8 +- trunk/drivers/acpi/Kconfig | 14 -- trunk/drivers/acpi/ac.c | 5 +- trunk/drivers/acpi/asus_acpi.c | 2 +- trunk/drivers/acpi/battery.c | 52 +++---- trunk/drivers/acpi/bus.c | 10 +- trunk/drivers/acpi/button.c | 2 +- trunk/drivers/acpi/ec.c | 47 ++---- trunk/drivers/acpi/event.c | 22 +-- trunk/drivers/acpi/hardware/hwsleep.c | 19 +-- trunk/drivers/acpi/namespace/nsxfeval.c | 2 +- trunk/drivers/acpi/processor_core.c | 13 +- trunk/drivers/acpi/sbs.c | 3 +- trunk/drivers/acpi/scan.c | 5 +- trunk/drivers/acpi/sleep/main.c | 2 +- trunk/drivers/acpi/tables/tbutils.c | 71 --------- trunk/drivers/acpi/thermal.c | 67 ++------- trunk/drivers/acpi/utilities/utglobal.c | 1 - trunk/drivers/acpi/video.c | 109 ++------------ trunk/drivers/char/agp/amd-k7-agp.c | 2 - trunk/drivers/char/agp/ati-agp.c | 3 - trunk/drivers/char/agp/efficeon-agp.c | 2 - trunk/drivers/char/agp/hp-agp.c | 1 - trunk/drivers/char/agp/i460-agp.c | 4 - trunk/drivers/char/agp/intel-agp.c | 14 +- trunk/drivers/char/agp/nvidia-agp.c | 3 - trunk/drivers/char/agp/via-agp.c | 5 - trunk/drivers/char/drm/drm_bufs.c | 13 +- trunk/drivers/char/drm/via_dmablit.c | 2 +- trunk/drivers/char/sonypi.c | 2 +- trunk/drivers/firewire/fw-card.c | 6 +- trunk/drivers/firewire/fw-sbp2.c | 49 ++---- trunk/drivers/ieee1394/sbp2.c | 14 +- trunk/drivers/md/Kconfig | 2 +- trunk/drivers/misc/asus-laptop.c | 5 +- trunk/drivers/misc/sony-laptop.c | 28 +--- trunk/drivers/misc/thinkpad_acpi.c | 26 ++-- trunk/drivers/net/dm9000.c | 25 +++- trunk/drivers/net/ehea/ehea_main.c | 8 +- trunk/drivers/net/ehea/ehea_qmr.c | 6 - trunk/drivers/net/forcedeth.c | 2 +- trunk/drivers/net/meth.c | 2 +- trunk/drivers/net/myri10ge/myri10ge.c | 34 ++++- trunk/drivers/net/phy/phy_device.c | 2 +- trunk/drivers/net/sgiseeq.c | 4 +- trunk/drivers/net/sky2.c | 64 ++++---- trunk/drivers/net/sky2.h | 3 +- trunk/drivers/pci/hotplug/acpiphp_ibm.c | 7 +- trunk/drivers/pnp/card.c | 16 +- trunk/drivers/pnp/core.c | 7 +- trunk/drivers/pnp/driver.c | 6 +- trunk/drivers/pnp/interface.c | 9 +- trunk/drivers/pnp/isapnp/core.c | 24 ++- trunk/drivers/pnp/isapnp/proc.c | 45 ++++++ trunk/drivers/pnp/manager.c | 27 +++- trunk/drivers/pnp/pnpacpi/core.c | 4 +- trunk/drivers/pnp/pnpacpi/rsparser.c | 23 +-- trunk/drivers/pnp/pnpbios/core.c | 44 +++++- trunk/drivers/pnp/pnpbios/proc.c | 2 +- trunk/drivers/pnp/pnpbios/rsparser.c | 9 +- trunk/drivers/pnp/resource.c | 26 ++++ trunk/drivers/video/console/Kconfig | 2 +- trunk/drivers/video/console/sticore.c | 14 +- trunk/include/acpi/acpi_bus.h | 10 +- trunk/include/acpi/acpixf.h | 2 +- trunk/include/acpi/acstruct.h | 2 +- trunk/include/asm-i386/io_apic.h | 1 + trunk/include/asm-parisc/io.h | 10 -- trunk/include/asm-parisc/vga.h | 6 - trunk/include/asm-x86_64/io_apic.h | 6 - trunk/include/linux/input.h | 6 - trunk/include/linux/pci_ids.h | 1 - trunk/include/linux/sched.h | 3 +- trunk/init/main.c | 12 +- trunk/kernel/sched.c | 22 +-- trunk/kernel/sched_fair.c | 106 ++++--------- trunk/kernel/sched_rt.c | 11 +- trunk/kernel/sysctl.c | 33 ++-- 91 files changed, 694 insertions(+), 841 deletions(-) delete mode 100644 trunk/include/asm-parisc/vga.h diff --git a/[refs] b/[refs] index 251b0a4884f8..fcf97d8eef5f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d96a2a5c6479342229416565944b56bc7a2b1a60 +refs/heads/master: dfa70f81a05fa857fb1428ac2a88da84ecd50dd9 diff --git a/trunk/Documentation/feature-removal-schedule.txt b/trunk/Documentation/feature-removal-schedule.txt index b9a3fdc1cc5a..a43d2878a4ef 100644 --- a/trunk/Documentation/feature-removal-schedule.txt +++ b/trunk/Documentation/feature-removal-schedule.txt @@ -197,14 +197,6 @@ Who: Len Brown --------------------------- -What: /proc/acpi/event -When: February 2008 -Why: /proc/acpi/event has been replaced by events via the input layer - and netlink since 2.6.23. -Who: Len Brown - ---------------------------- - What: Compaq touchscreen device emulation When: Oct 2007 Files: drivers/input/tsdev.c diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index b41cde31d112..975f029be25c 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -952,10 +952,14 @@ and is between 256 and 4096 characters. It is defined in the file Format: <1-256> maxcpus= [SMP] Maximum number of processors that an SMP kernel - should make use of. maxcpus=n : n >= 0 limits the - kernel to using 'n' processors. n=0 is a special case, - it is equivalent to "nosmp", which also disables - the IO APIC. + should make use of. + Using "nosmp" or "maxcpus=0" will disable SMP + entirely (the MPS table probe still happens, though). + A command-line option of "maxcpus=", where + is an integer greater than 0, limits the maximum number + of CPUs activated in SMP mode to . + Using "maxcpus=1" on an SMP kernel is the trivial + case of an SMP kernel with only one CPU. max_addr=[KMG] [KNL,BOOT,ia64] All physical memory greater than or equal to this physical address is ignored. @@ -1180,8 +1184,7 @@ and is between 256 and 4096 characters. It is defined in the file nosep [BUGS=X86-32] Disables x86 SYSENTER/SYSEXIT support. - nosmp [SMP] Tells an SMP kernel to act as a UP kernel, - and disable the IO APIC. legacy for "maxcpus=0". + nosmp [SMP] Tells an SMP kernel to act as a UP kernel. nosoftlockup [KNL] Disable the soft-lockup detector. @@ -1823,10 +1826,6 @@ and is between 256 and 4096 characters. It is defined in the file -1: disable all active trip points in all thermal zones : override all lowest active trip points - thermal.crt= [HW,ACPI] - -1: disable all critical trip points in all thermal zones - : lower all critical trip points - thermal.nocrt= [HW,ACPI] Set to disable actions on ACPI thermal zone critical and hot trip points. diff --git a/trunk/arch/i386/boot/boot.h b/trunk/arch/i386/boot/boot.h index 20bab9431acb..dec70c9b6050 100644 --- a/trunk/arch/i386/boot/boot.h +++ b/trunk/arch/i386/boot/boot.h @@ -87,7 +87,7 @@ static inline void set_fs(u16 seg) static inline u16 fs(void) { u16 seg; - asm volatile("movw %%fs,%0" : "=rm" (seg)); + asm("movw %%fs,%0" : "=rm" (seg)); return seg; } @@ -98,7 +98,7 @@ static inline void set_gs(u16 seg) static inline u16 gs(void) { u16 seg; - asm volatile("movw %%gs,%0" : "=rm" (seg)); + asm("movw %%gs,%0" : "=rm" (seg)); return seg; } @@ -107,19 +107,19 @@ typedef unsigned int addr_t; static inline u8 rdfs8(addr_t addr) { u8 v; - asm volatile("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr)); + asm("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr)); return v; } static inline u16 rdfs16(addr_t addr) { u16 v; - asm volatile("movw %%fs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr)); + asm("movw %%fs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr)); return v; } static inline u32 rdfs32(addr_t addr) { u32 v; - asm volatile("movl %%fs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr)); + asm("movl %%fs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr)); return v; } @@ -139,19 +139,19 @@ static inline void wrfs32(u32 v, addr_t addr) static inline u8 rdgs8(addr_t addr) { u8 v; - asm volatile("movb %%gs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr)); + asm("movb %%gs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr)); return v; } static inline u16 rdgs16(addr_t addr) { u16 v; - asm volatile("movw %%gs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr)); + asm("movw %%gs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr)); return v; } static inline u32 rdgs32(addr_t addr) { u32 v; - asm volatile("movl %%gs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr)); + asm("movl %%gs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr)); return v; } @@ -180,15 +180,15 @@ static inline int memcmp(const void *s1, const void *s2, size_t len) static inline int memcmp_fs(const void *s1, addr_t s2, size_t len) { u8 diff; - asm volatile("fs; repe; cmpsb; setnz %0" - : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len)); + asm("fs; repe; cmpsb; setnz %0" + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len)); return diff; } static inline int memcmp_gs(const void *s1, addr_t s2, size_t len) { u8 diff; - asm volatile("gs; repe; cmpsb; setnz %0" - : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len)); + asm("gs; repe; cmpsb; setnz %0" + : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len)); return diff; } diff --git a/trunk/arch/i386/boot/cpucheck.c b/trunk/arch/i386/boot/cpucheck.c index e655a89c5510..991e8ceae1de 100644 --- a/trunk/arch/i386/boot/cpucheck.c +++ b/trunk/arch/i386/boot/cpucheck.c @@ -96,8 +96,7 @@ static int has_fpu(void) asm volatile("movl %0,%%cr0" : : "r" (cr0)); } - asm volatile("fninit ; fnstsw %0 ; fnstcw %1" - : "+m" (fsw), "+m" (fcw)); + asm("fninit ; fnstsw %0 ; fnstcw %1" : "+m" (fsw), "+m" (fcw)); return fsw == 0 && (fcw & 0x103f) == 0x003f; } diff --git a/trunk/arch/i386/boot/edd.c b/trunk/arch/i386/boot/edd.c index bd138e442ec2..82b5c846a194 100644 --- a/trunk/arch/i386/boot/edd.c +++ b/trunk/arch/i386/boot/edd.c @@ -30,9 +30,9 @@ static int read_mbr(u8 devno, void *buf) cx = 0x0001; /* Sector 0-0-1 */ dx = devno; bx = (size_t)buf; - asm volatile("pushfl; stc; int $0x13; setc %%al; popfl" - : "+a" (ax), "+c" (cx), "+d" (dx), "+b" (bx) - : : "esi", "edi", "memory"); + asm("pushfl; stc; int $0x13; setc %%al; popfl" + : "+a" (ax), "+c" (cx), "+d" (dx), "+b" (bx) + : : "esi", "edi", "memory"); return -(u8)ax; /* 0 or -1 */ } diff --git a/trunk/arch/i386/boot/tty.c b/trunk/arch/i386/boot/tty.c index f3f14bd26371..9c668aad3515 100644 --- a/trunk/arch/i386/boot/tty.c +++ b/trunk/arch/i386/boot/tty.c @@ -54,9 +54,9 @@ static u8 gettime(void) u16 ax = 0x0200; u16 cx, dx; - asm volatile("int $0x1a" - : "+a" (ax), "=c" (cx), "=d" (dx) - : : "ebx", "esi", "edi"); + asm("int $0x1a" + : "+a" (ax), "=c" (cx), "=d" (dx) + : : "ebx", "esi", "edi"); return dx >> 8; } @@ -67,7 +67,7 @@ static u8 gettime(void) int getchar(void) { u16 ax = 0; - asm volatile("int $0x16" : "+a" (ax)); + asm("int $0x16" : "+a" (ax)); return ax & 0xff; } @@ -75,9 +75,9 @@ int getchar(void) static int kbd_pending(void) { u8 pending; - asm volatile("int $0x16; setnz %0" - : "=rm" (pending) - : "a" (0x0100)); + asm("int $0x16; setnz %0" + : "=rm" (pending) + : "a" (0x0100)); return pending; } diff --git a/trunk/arch/i386/boot/video-vga.c b/trunk/arch/i386/boot/video-vga.c index aef02f9ec0c1..700d09a9c9b3 100644 --- a/trunk/arch/i386/boot/video-vga.c +++ b/trunk/arch/i386/boot/video-vga.c @@ -47,16 +47,16 @@ static u8 vga_set_basic_mode(void) #ifdef CONFIG_VIDEO_400_HACK if (adapter >= ADAPTER_VGA) { - asm volatile(INT10 - : : "a" (0x1202), "b" (0x0030) - : "ecx", "edx", "esi", "edi"); + asm(INT10 + : : "a" (0x1202), "b" (0x0030) + : "ecx", "edx", "esi", "edi"); } #endif ax = 0x0f00; - asm volatile(INT10 - : "+a" (ax) - : : "ebx", "ecx", "edx", "esi", "edi"); + asm(INT10 + : "+a" (ax) + : : "ebx", "ecx", "edx", "esi", "edi"); mode = (u8)ax; @@ -73,10 +73,9 @@ static u8 vga_set_basic_mode(void) mode = 3; /* Set the mode */ - ax = mode; asm volatile(INT10 - : "+a" (ax) - : : "ebx", "ecx", "edx", "esi", "edi"); + : : "a" (mode) + : "ebx", "ecx", "edx", "esi", "edi"); do_restore = 1; return mode; } diff --git a/trunk/arch/i386/kernel/io_apic.c b/trunk/arch/i386/kernel/io_apic.c index e2f4a1c68547..4b8a8da4b2e0 100644 --- a/trunk/arch/i386/kernel/io_apic.c +++ b/trunk/arch/i386/kernel/io_apic.c @@ -754,6 +754,14 @@ static int pirq_entries [MAX_PIRQS]; static int pirqs_enabled; int skip_ioapic_setup; +static int __init ioapic_setup(char *str) +{ + skip_ioapic_setup = 1; + return 1; +} + +__setup("noapic", ioapic_setup); + static int __init ioapic_pirq_setup(char *str) { int i, max; diff --git a/trunk/arch/parisc/kernel/sys_parisc32.c b/trunk/arch/parisc/kernel/sys_parisc32.c index 2989c6682bf6..bb23ff71c28e 100644 --- a/trunk/arch/parisc/kernel/sys_parisc32.c +++ b/trunk/arch/parisc/kernel/sys_parisc32.c @@ -285,6 +285,147 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) return err; } +struct linux32_dirent { + u32 d_ino; + compat_off_t d_off; + u16 d_reclen; + char d_name[1]; +}; + +struct old_linux32_dirent { + u32 d_ino; + u32 d_offset; + u16 d_namlen; + char d_name[1]; +}; + +struct getdents32_callback { + struct linux32_dirent __user * current_dir; + struct linux32_dirent __user * previous; + int count; + int error; +}; + +struct readdir32_callback { + struct old_linux32_dirent __user * dirent; + int count; +}; + +#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) +static int filldir32 (void *__buf, const char *name, int namlen, + loff_t offset, u64 ino, unsigned int d_type) +{ + struct linux32_dirent __user * dirent; + struct getdents32_callback * buf = (struct getdents32_callback *) __buf; + int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, 4); + u32 d_ino; + + buf->error = -EINVAL; /* only used if we fail.. */ + if (reclen > buf->count) + return -EINVAL; + d_ino = ino; + if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) + return -EOVERFLOW; + dirent = buf->previous; + if (dirent) + put_user(offset, &dirent->d_off); + dirent = buf->current_dir; + buf->previous = dirent; + put_user(d_ino, &dirent->d_ino); + put_user(reclen, &dirent->d_reclen); + copy_to_user(dirent->d_name, name, namlen); + put_user(0, dirent->d_name + namlen); + dirent = ((void __user *)dirent) + reclen; + buf->current_dir = dirent; + buf->count -= reclen; + return 0; +} + +asmlinkage long +sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count) +{ + struct file * file; + struct linux32_dirent __user * lastdirent; + struct getdents32_callback buf; + int error; + + error = -EFAULT; + if (!access_ok(VERIFY_WRITE, dirent, count)) + goto out; + + error = -EBADF; + file = fget(fd); + if (!file) + goto out; + + buf.current_dir = (struct linux32_dirent __user *) dirent; + buf.previous = NULL; + buf.count = count; + buf.error = 0; + + error = vfs_readdir(file, filldir32, &buf); + if (error < 0) + goto out_putf; + error = buf.error; + lastdirent = buf.previous; + if (lastdirent) { + if (put_user(file->f_pos, &lastdirent->d_off)) + error = -EFAULT; + else + error = count - buf.count; + } + +out_putf: + fput(file); +out: + return error; +} + +static int fillonedir32(void * __buf, const char * name, int namlen, + loff_t offset, u64 ino, unsigned int d_type) +{ + struct readdir32_callback * buf = (struct readdir32_callback *) __buf; + struct old_linux32_dirent __user * dirent; + u32 d_ino; + + if (buf->count) + return -EINVAL; + d_ino = ino; + if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) + return -EOVERFLOW; + buf->count++; + dirent = buf->dirent; + put_user(d_ino, &dirent->d_ino); + put_user(offset, &dirent->d_offset); + put_user(namlen, &dirent->d_namlen); + copy_to_user(dirent->d_name, name, namlen); + put_user(0, dirent->d_name + namlen); + return 0; +} + +asmlinkage long +sys32_readdir (unsigned int fd, void __user * dirent, unsigned int count) +{ + int error; + struct file * file; + struct readdir32_callback buf; + + error = -EBADF; + file = fget(fd); + if (!file) + goto out; + + buf.count = 0; + buf.dirent = dirent; + + error = vfs_readdir(file, fillonedir32, &buf); + if (error >= 0) + error = buf.count; + fput(file); +out: + return error; +} + /*** copied from mips64 ***/ /* * Ooo, nasty. We need here to frob 32-bit unsigned longs to diff --git a/trunk/arch/parisc/kernel/syscall_table.S b/trunk/arch/parisc/kernel/syscall_table.S index 2540786a970f..627f3c28ad8c 100644 --- a/trunk/arch/parisc/kernel/syscall_table.S +++ b/trunk/arch/parisc/kernel/syscall_table.S @@ -222,7 +222,9 @@ ENTRY_SAME(setfsgid) /* I think this might work */ ENTRY_SAME(llseek) /* 140 */ - ENTRY_COMP(getdents) + /* struct linux_dirent has longs, like 'unsigned long d_ino' which + * almost definitely should be 'ino_t d_ino' but it's too late now */ + ENTRY_DIFF(getdents) /* it is POSSIBLE that select will be OK because even though fd_set * contains longs, the macros and sizes are clever. */ ENTRY_COMP(select) diff --git a/trunk/arch/parisc/kernel/vmlinux.lds.S b/trunk/arch/parisc/kernel/vmlinux.lds.S index ee7a16eb6fdd..d4e6a93c8d9a 100644 --- a/trunk/arch/parisc/kernel/vmlinux.lds.S +++ b/trunk/arch/parisc/kernel/vmlinux.lds.S @@ -81,8 +81,6 @@ SECTIONS __ex_table : { *(__ex_table) } __stop___ex_table = .; - NOTES - __start___unwind = .; /* unwind info */ .PARISC.unwind : { *(.PARISC.unwind) } __stop___unwind = .; diff --git a/trunk/arch/powerpc/platforms/pasemi/iommu.c b/trunk/arch/powerpc/platforms/pasemi/iommu.c index f33b21b9f5d4..9014d55c717b 100644 --- a/trunk/arch/powerpc/platforms/pasemi/iommu.c +++ b/trunk/arch/powerpc/platforms/pasemi/iommu.c @@ -93,7 +93,7 @@ static void iobmap_build(struct iommu_table *tbl, long index, pr_debug("iobmap: build at: %lx, %lx, addr: %lx\n", index, npages, uaddr); - bus_addr = (tbl->it_offset + index) << PAGE_SHIFT; + bus_addr = (tbl->it_offset + index) << IOBMAP_PAGE_SHIFT; ip = ((u32 *)tbl->it_base) + index; @@ -118,7 +118,7 @@ static void iobmap_free(struct iommu_table *tbl, long index, pr_debug("iobmap: free at: %lx, %lx\n", index, npages); - bus_addr = (tbl->it_offset + index) << PAGE_SHIFT; + bus_addr = (tbl->it_offset + index) << IOBMAP_PAGE_SHIFT; ip = ((u32 *)tbl->it_base) + index; @@ -137,7 +137,7 @@ static void iommu_table_iobmap_setup(void) iommu_table_iobmap.it_busno = 0; iommu_table_iobmap.it_offset = 0; /* it_size is in number of entries */ - iommu_table_iobmap.it_size = 0x80000000 >> PAGE_SHIFT; + iommu_table_iobmap.it_size = 0x80000000 >> IOBMAP_PAGE_SHIFT; /* Initialize the common IOMMU code */ iommu_table_iobmap.it_base = (unsigned long)iob_l2_base; diff --git a/trunk/arch/x86_64/kernel/io_apic.c b/trunk/arch/x86_64/kernel/io_apic.c index 966fa1062491..f57f8b901912 100644 --- a/trunk/arch/x86_64/kernel/io_apic.c +++ b/trunk/arch/x86_64/kernel/io_apic.c @@ -397,12 +397,14 @@ static void clear_IO_APIC (void) int skip_ioapic_setup; int ioapic_force; -static int __init parse_noapic(char *str) +/* dummy parsing: see setup.c */ + +static int __init disable_ioapic_setup(char *str) { - disable_ioapic_setup(); + skip_ioapic_setup = 1; return 0; } -early_param("noapic", parse_noapic); +early_param("noapic", disable_ioapic_setup); /* Actually the next is obsolete, but keep it for paranoid reasons -AK */ static int __init disable_timer_pin_setup(char *arg) diff --git a/trunk/drivers/acpi/Kconfig b/trunk/drivers/acpi/Kconfig index 574259476fbf..f1372de4ce79 100644 --- a/trunk/drivers/acpi/Kconfig +++ b/trunk/drivers/acpi/Kconfig @@ -68,20 +68,6 @@ config ACPI_PROCFS Say N to delete /proc/acpi/ files that have moved to /sys/ -config ACPI_PROC_EVENT - bool "Deprecated /proc/acpi/event support" - depends on PROC_FS - ---help--- - A user-space daemon, acpi, typically read /proc/acpi/event - and handled all ACPI sub-system generated events. - - These events are now delivered to user-space via - either the input layer, or as netlink events. - - This build option enables the old code for for legacy - user-space implementation. After some time, this will - be moved under CONFIG_ACPI_PROCFS, and then deleted. - config ACPI_AC tristate "AC Adapter" depends on X86 diff --git a/trunk/drivers/acpi/ac.c b/trunk/drivers/acpi/ac.c index 26d70702b313..d8b35093527a 100644 --- a/trunk/drivers/acpi/ac.c +++ b/trunk/drivers/acpi/ac.c @@ -204,10 +204,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_DEVICE_CHECK: acpi_ac_get_state(ac); - acpi_bus_generate_proc_event(device, event, (u32) ac->state); - acpi_bus_generate_netlink_event(device->pnp.device_class, - device->dev.bus_id, event, - (u32) ac->state); + acpi_bus_generate_event(device, event, (u32) ac->state); break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, diff --git a/trunk/drivers/acpi/asus_acpi.c b/trunk/drivers/acpi/asus_acpi.c index d915fec9bf63..86fd142f4bf3 100644 --- a/trunk/drivers/acpi/asus_acpi.c +++ b/trunk/drivers/acpi/asus_acpi.c @@ -1069,7 +1069,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) hotk->brightness = (event & ~((u32) BR_DOWN)); } - acpi_bus_generate_proc_event(hotk->device, event, + acpi_bus_generate_event(hotk->device, event, hotk->event_count[event % 128]++); return; diff --git a/trunk/drivers/acpi/battery.c b/trunk/drivers/acpi/battery.c index 9b2c0f74f869..d7b499fe0cd9 100644 --- a/trunk/drivers/acpi/battery.c +++ b/trunk/drivers/acpi/battery.c @@ -113,7 +113,7 @@ struct acpi_battery_info { acpi_string oem_info; }; -enum acpi_battery_files{ +enum acpi_battery_files { ACPI_BATTERY_INFO = 0, ACPI_BATTERY_STATE, ACPI_BATTERY_ALARM, @@ -129,13 +129,14 @@ struct acpi_battery_flags { }; struct acpi_battery { - struct mutex mutex; struct acpi_device *device; struct acpi_battery_flags flags; struct acpi_buffer bif_data; struct acpi_buffer bst_data; + struct mutex lock; unsigned long alarm; unsigned long update_time[ACPI_BATTERY_NUMFILES]; + }; inline int acpi_battery_present(struct acpi_battery *battery) @@ -235,10 +236,10 @@ static int acpi_battery_get_info(struct acpi_battery *battery) return 0; /* Evaluate _BIF */ - - status = - acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL, - &buffer); + mutex_lock(&battery->lock); + status = acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", + NULL, &buffer); + mutex_unlock(&battery->lock); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); return -ENODEV; @@ -285,10 +286,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery) return 0; /* Evaluate _BST */ - - status = - acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL, - &buffer); + mutex_lock(&battery->lock); + status = acpi_evaluate_object(acpi_battery_handle(battery), "_BST", + NULL, &buffer); + mutex_unlock(&battery->lock); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); return -ENODEV; @@ -336,9 +337,10 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery, arg0.integer.value = alarm; - status = - acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", + mutex_lock(&battery->lock); + status = acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", &arg_list, NULL); + mutex_unlock(&battery->lock); if (ACPI_FAILURE(status)) return -ENODEV; @@ -658,8 +660,6 @@ acpi_battery_write_alarm(struct file *file, if (!battery || (count > sizeof(alarm_string) - 1)) return -EINVAL; - mutex_lock(&battery->mutex); - result = acpi_battery_update(battery, 1, &update_result); if (result) { result = -ENODEV; @@ -688,9 +688,7 @@ acpi_battery_write_alarm(struct file *file, acpi_battery_check_result(battery, result); if (!result) - result = count; - - mutex_unlock(&battery->mutex); + return count; return result; } @@ -714,8 +712,6 @@ static int acpi_battery_read(int fid, struct seq_file *seq) int update_result = ACPI_BATTERY_NONE_UPDATE; int update = 0; - mutex_lock(&battery->mutex); - update = (get_seconds() - battery->update_time[fid] >= update_time); update = (update | battery->flags.update[fid]); @@ -733,7 +729,6 @@ static int acpi_battery_read(int fid, struct seq_file *seq) result = acpi_read_funcs[fid].print(seq, result); acpi_battery_check_result(battery, result); battery->flags.update[fid] = result; - mutex_unlock(&battery->mutex); return result; } @@ -872,11 +867,8 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) case ACPI_NOTIFY_DEVICE_CHECK: device = battery->device; acpi_battery_notify_update(battery); - acpi_bus_generate_proc_event(device, event, + acpi_bus_generate_event(device, event, acpi_battery_present(battery)); - acpi_bus_generate_netlink_event(device->pnp.device_class, - device->dev.bus_id, event, - acpi_battery_present(battery)); break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -900,10 +892,7 @@ static int acpi_battery_add(struct acpi_device *device) if (!battery) return -ENOMEM; - mutex_init(&battery->mutex); - - mutex_lock(&battery->mutex); - + mutex_init(&battery->lock); battery->device = device; strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); @@ -939,7 +928,6 @@ static int acpi_battery_add(struct acpi_device *device) kfree(battery); } - mutex_unlock(&battery->mutex); return result; } @@ -954,8 +942,6 @@ static int acpi_battery_remove(struct acpi_device *device, int type) battery = acpi_driver_data(device); - mutex_lock(&battery->mutex); - status = acpi_remove_notify_handler(device->handle, ACPI_ALL_NOTIFY, acpi_battery_notify); @@ -966,9 +952,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) kfree(battery->bst_data.pointer); - mutex_unlock(&battery->mutex); - - mutex_destroy(&battery->mutex); + mutex_destroy(&battery->lock); kfree(battery); diff --git a/trunk/drivers/acpi/bus.c b/trunk/drivers/acpi/bus.c index 9ba778a2b484..6b2658c96242 100644 --- a/trunk/drivers/acpi/bus.c +++ b/trunk/drivers/acpi/bus.c @@ -276,7 +276,6 @@ EXPORT_SYMBOL(acpi_bus_set_power); Event Management -------------------------------------------------------------------------- */ -#ifdef CONFIG_ACPI_PROC_EVENT static DEFINE_SPINLOCK(acpi_bus_event_lock); LIST_HEAD(acpi_bus_event_list); @@ -284,7 +283,7 @@ DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue); extern int event_is_open; -int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data) +int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) { struct acpi_bus_event *event = NULL; unsigned long flags = 0; @@ -293,6 +292,10 @@ int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data) if (!device) return -EINVAL; + if (acpi_bus_generate_genetlink_event(device, type, data)) + printk(KERN_WARNING PREFIX + "Failed to generate an ACPI event via genetlink!\n"); + /* drop event on the floor if no one's listening */ if (!event_is_open) return 0; @@ -315,7 +318,7 @@ int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data) return 0; } -EXPORT_SYMBOL(acpi_bus_generate_proc_event); +EXPORT_SYMBOL(acpi_bus_generate_event); int acpi_bus_receive_event(struct acpi_bus_event *event) { @@ -361,7 +364,6 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) } EXPORT_SYMBOL(acpi_bus_receive_event); -#endif /* CONFIG_ACPI_PROC_EVENT */ /* -------------------------------------------------------------------------- Notification Handling diff --git a/trunk/drivers/acpi/button.c b/trunk/drivers/acpi/button.c index 2e79a3395ecf..540581338ef5 100644 --- a/trunk/drivers/acpi/button.c +++ b/trunk/drivers/acpi/button.c @@ -284,7 +284,7 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) } input_sync(input); - acpi_bus_generate_proc_event(button->device, event, + acpi_bus_generate_event(button->device, event, ++button->pushed); break; default: diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index 43749c86861f..56bee9e065cf 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -696,6 +696,14 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) return AE_CTRL_TERMINATE; } +static void ec_remove_handlers(struct acpi_ec *ec) +{ + acpi_remove_address_space_handler(ec->handle, + ACPI_ADR_SPACE_EC, + &acpi_ec_space_handler); + acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); +} + static int acpi_ec_add(struct acpi_device *device) { struct acpi_ec *ec = NULL; @@ -719,16 +727,13 @@ static int acpi_ec_add(struct acpi_device *device) /* Check if we found the boot EC */ if (boot_ec) { if (boot_ec->gpe == ec->gpe) { - /* We might have incorrect info for GL at boot time */ - mutex_lock(&boot_ec->lock); - boot_ec->global_lock = ec->global_lock; - /* Copy handlers from new ec into boot ec */ - list_splice(&ec->list, &boot_ec->list); - mutex_unlock(&boot_ec->lock); - kfree(ec); - ec = boot_ec; + ec_remove_handlers(boot_ec); + mutex_destroy(&boot_ec->lock); + kfree(boot_ec); + first_ec = boot_ec = NULL; } - } else + } + if (!first_ec) first_ec = ec; ec->handle = device->handle; acpi_driver_data(device) = ec; @@ -757,9 +762,6 @@ static int acpi_ec_remove(struct acpi_device *device, int type) if (ec == first_ec) first_ec = NULL; - /* Don't touch boot EC */ - if (boot_ec != ec) - kfree(ec); return 0; } @@ -823,9 +825,7 @@ static int acpi_ec_start(struct acpi_device *device) if (!ec) return -EINVAL; - /* Boot EC is already working */ - if (ec != boot_ec) - ret = ec_install_handlers(ec); + ret = ec_install_handlers(ec); /* EC is fully operational, allow queries */ atomic_set(&ec->query_pending, 0); @@ -835,7 +835,6 @@ static int acpi_ec_start(struct acpi_device *device) static int acpi_ec_stop(struct acpi_device *device, int type) { - acpi_status status; struct acpi_ec *ec; if (!device) @@ -844,21 +843,7 @@ static int acpi_ec_stop(struct acpi_device *device, int type) ec = acpi_driver_data(device); if (!ec) return -EINVAL; - - /* Don't touch boot EC */ - if (ec == boot_ec) - return 0; - - status = acpi_remove_address_space_handler(ec->handle, - ACPI_ADR_SPACE_EC, - &acpi_ec_space_handler); - if (ACPI_FAILURE(status)) - return -ENODEV; - - status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); - if (ACPI_FAILURE(status)) - return -ENODEV; - + ec_remove_handlers(ec); return 0; } diff --git a/trunk/drivers/acpi/event.c b/trunk/drivers/acpi/event.c index a2b9304596ce..95637a4ff782 100644 --- a/trunk/drivers/acpi/event.c +++ b/trunk/drivers/acpi/event.c @@ -17,7 +17,6 @@ #define _COMPONENT ACPI_SYSTEM_COMPONENT ACPI_MODULE_NAME("event"); -#ifdef CONFIG_ACPI_PROC_EVENT /* Global vars for handling event proc entry */ static DEFINE_SPINLOCK(acpi_system_event_lock); int event_is_open = 0; @@ -107,7 +106,6 @@ static const struct file_operations acpi_system_event_ops = { .release = acpi_system_close_event, .poll = acpi_system_poll_event, }; -#endif /* CONFIG_ACPI_PROC_EVENT */ #ifdef CONFIG_NET static unsigned int acpi_event_seqnum; @@ -149,8 +147,7 @@ static struct genl_multicast_group acpi_event_mcgrp = { .name = ACPI_GENL_MCAST_GROUP_NAME, }; -int acpi_bus_generate_netlink_event(const char *device_class, - const char *bus_id, +int acpi_bus_generate_genetlink_event(struct acpi_device *device, u8 type, int data) { struct sk_buff *skb; @@ -194,8 +191,8 @@ int acpi_bus_generate_netlink_event(const char *device_class, memset(event, 0, sizeof(struct acpi_genl_event)); - strcpy(event->device_class, device_class); - strcpy(event->bus_id, bus_id); + strcpy(event->device_class, device->pnp.device_class); + strcpy(event->bus_id, device->dev.bus_id); event->type = type; event->data = data; @@ -214,8 +211,6 @@ int acpi_bus_generate_netlink_event(const char *device_class, return 0; } -EXPORT_SYMBOL(acpi_bus_generate_netlink_event); - static int acpi_event_genetlink_init(void) { int result; @@ -233,15 +228,12 @@ static int acpi_event_genetlink_init(void) } #else -int acpi_bus_generate_netlink_event(const char *device_class, - const char *bus_id, - u8 type, int data) +int acpi_bus_generate_genetlink_event(struct acpi_device *device, u8 type, + int data) { return 0; } -EXPORT_SYMBOL(acpi_generate_netlink_event); - static int acpi_event_genetlink_init(void) { return -ENODEV; @@ -250,9 +242,7 @@ static int acpi_event_genetlink_init(void) static int __init acpi_event_init(void) { -#ifdef CONFIG_ACPI_PROC_EVENT struct proc_dir_entry *entry; -#endif int error = 0; if (acpi_disabled) @@ -264,14 +254,12 @@ static int __init acpi_event_init(void) printk(KERN_WARNING PREFIX "Failed to create genetlink family for ACPI event\n"); -#ifdef CONFIG_ACPI_PROC_EVENT /* 'event' [R] */ entry = create_proc_entry("event", S_IRUSR, acpi_root_dir); if (entry) entry->proc_fops = &acpi_system_event_ops; else return -ENODEV; -#endif return 0; } diff --git a/trunk/drivers/acpi/hardware/hwsleep.c b/trunk/drivers/acpi/hardware/hwsleep.c index cf69c0040a39..76c525dc590b 100644 --- a/trunk/drivers/acpi/hardware/hwsleep.c +++ b/trunk/drivers/acpi/hardware/hwsleep.c @@ -576,10 +576,13 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); } + status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK")); + } + /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ + /* - * GPEs must be enabled before _WAK is called as GPEs - * might get fired there - * * Restore the GPEs: * 1) Disable/Clear all GPEs * 2) Enable all runtime GPEs @@ -588,19 +591,13 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } + acpi_gbl_system_awake_and_running = TRUE; + status = acpi_hw_enable_all_runtime_gpes(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL); - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { - ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK")); - } - /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ - - acpi_gbl_system_awake_and_running = TRUE; - /* Enable power button */ (void) diff --git a/trunk/drivers/acpi/namespace/nsxfeval.c b/trunk/drivers/acpi/namespace/nsxfeval.c index f39fbc6b9237..ab65b2c2560e 100644 --- a/trunk/drivers/acpi/namespace/nsxfeval.c +++ b/trunk/drivers/acpi/namespace/nsxfeval.c @@ -540,7 +540,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, ******************************************************************************/ acpi_status -acpi_get_devices(const char *HID, +acpi_get_devices(char *HID, acpi_walk_callback user_function, void *context, void **return_value) { diff --git a/trunk/drivers/acpi/processor_core.c b/trunk/drivers/acpi/processor_core.c index e944aaee4e06..498422343f38 100644 --- a/trunk/drivers/acpi/processor_core.c +++ b/trunk/drivers/acpi/processor_core.c @@ -698,23 +698,16 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) switch (event) { case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: acpi_processor_ppc_has_changed(pr); - acpi_bus_generate_proc_event(device, event, + acpi_bus_generate_event(device, event, pr->performance_platform_limit); - acpi_bus_generate_netlink_event(device->pnp.device_class, - device->dev.bus_id, event, - pr->performance_platform_limit); break; case ACPI_PROCESSOR_NOTIFY_POWER: acpi_processor_cst_has_changed(pr); - acpi_bus_generate_proc_event(device, event, 0); - acpi_bus_generate_netlink_event(device->pnp.device_class, - device->dev.bus_id, event, 0); + acpi_bus_generate_event(device, event, 0); break; case ACPI_PROCESSOR_NOTIFY_THROTTLING: acpi_processor_tstate_has_changed(pr); - acpi_bus_generate_proc_event(device, event, 0); - acpi_bus_generate_netlink_event(device->pnp.device_class, - device->dev.bus_id, event, 0); + acpi_bus_generate_event(device, event, 0); default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported event [0x%x]\n", event)); diff --git a/trunk/drivers/acpi/sbs.c b/trunk/drivers/acpi/sbs.c index a578986e3214..82c3a550016d 100644 --- a/trunk/drivers/acpi/sbs.c +++ b/trunk/drivers/acpi/sbs.c @@ -440,12 +440,11 @@ static int acpi_sbs_generate_event(struct acpi_device *device, strcpy(acpi_device_bid(device), bid); strcpy(acpi_device_class(device), class); - result = acpi_bus_generate_proc_event(device, event, state); + result = acpi_bus_generate_event(device, event, state); strcpy(acpi_device_bid(device), bid_saved); strcpy(acpi_device_class(device), class_saved); - acpi_bus_generate_netlink_event(class, bid, event, state); return result; } diff --git a/trunk/drivers/acpi/scan.c b/trunk/drivers/acpi/scan.c index 64620d668742..be74347d1354 100644 --- a/trunk/drivers/acpi/scan.c +++ b/trunk/drivers/acpi/scan.c @@ -35,9 +35,8 @@ struct acpi_device_bus_id{ * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: * char *modalias: "acpi:IBM0001:ACPI0001" */ -static int create_modalias(struct acpi_device *acpi_dev, char *modalias, - int size) -{ +int create_modalias(struct acpi_device *acpi_dev, char *modalias, int size){ + int len; if (!acpi_dev->flags.hardware_id) diff --git a/trunk/drivers/acpi/sleep/main.c b/trunk/drivers/acpi/sleep/main.c index c52ade816fb4..e8cff5dd4cbc 100644 --- a/trunk/drivers/acpi/sleep/main.c +++ b/trunk/drivers/acpi/sleep/main.c @@ -305,7 +305,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p) unsigned long d_min, d_max; if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { - printk(KERN_DEBUG "ACPI handle has no context!\n"); + printk(KERN_ERR "ACPI handle has no context!\n"); return -ENODEV; } diff --git a/trunk/drivers/acpi/tables/tbutils.c b/trunk/drivers/acpi/tables/tbutils.c index 8cc9492ffbf2..1da64b4518c0 100644 --- a/trunk/drivers/acpi/tables/tbutils.c +++ b/trunk/drivers/acpi/tables/tbutils.c @@ -51,65 +51,6 @@ ACPI_MODULE_NAME("tbutils") static acpi_physical_address acpi_tb_get_root_table_entry(u8 * table_entry, acpi_native_uint table_entry_size); -/******************************************************************************* - * - * FUNCTION: acpi_tb_check_xsdt - * - * PARAMETERS: address - Pointer to the XSDT - * - * RETURN: status - * AE_OK - XSDT is okay - * AE_NO_MEMORY - can't map XSDT - * AE_INVALID_TABLE_LENGTH - invalid table length - * AE_NULL_ENTRY - XSDT has NULL entry - * - * DESCRIPTION: validate XSDT -******************************************************************************/ - -static acpi_status -acpi_tb_check_xsdt(acpi_physical_address address) -{ - struct acpi_table_header *table; - u32 length; - u64 xsdt_entry_address; - u8 *table_entry; - u32 table_count; - int i; - - table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); - if (!table) - return AE_NO_MEMORY; - - length = table->length; - acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); - if (length < sizeof(struct acpi_table_header)) - return AE_INVALID_TABLE_LENGTH; - - table = acpi_os_map_memory(address, length); - if (!table) - return AE_NO_MEMORY; - - /* Calculate the number of tables described in XSDT */ - table_count = - (u32) ((table->length - - sizeof(struct acpi_table_header)) / sizeof(u64)); - table_entry = - ACPI_CAST_PTR(u8, table) + sizeof(struct acpi_table_header); - for (i = 0; i < table_count; i++) { - ACPI_MOVE_64_TO_64(&xsdt_entry_address, table_entry); - if (!xsdt_entry_address) { - /* XSDT has NULL entry */ - break; - } - table_entry += sizeof(u64); - } - acpi_os_unmap_memory(table, length); - - if (i < table_count) - return AE_NULL_ENTRY; - else - return AE_OK; -} /******************************************************************************* * @@ -400,7 +341,6 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) u32 table_count; struct acpi_table_header *table; acpi_physical_address address; - acpi_physical_address rsdt_address; u32 length; u8 *table_entry; acpi_status status; @@ -429,8 +369,6 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) */ address = (acpi_physical_address) rsdp->xsdt_physical_address; table_entry_size = sizeof(u64); - rsdt_address = (acpi_physical_address) - rsdp->rsdt_physical_address; } else { /* Root table is an RSDT (32-bit physical addresses) */ @@ -444,15 +382,6 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) */ acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp)); - if (table_entry_size == sizeof(u64)) { - if (acpi_tb_check_xsdt(address) == AE_NULL_ENTRY) { - /* XSDT has NULL entry, RSDT is used */ - address = rsdt_address; - table_entry_size = sizeof(u32); - ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry," - "using RSDT")); - } - } /* Map the RSDT/XSDT table header to get the full table length */ table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); diff --git a/trunk/drivers/acpi/thermal.c b/trunk/drivers/acpi/thermal.c index bc6d5866ef98..1e06159fd9c4 100644 --- a/trunk/drivers/acpi/thermal.c +++ b/trunk/drivers/acpi/thermal.c @@ -77,27 +77,23 @@ MODULE_LICENSE("GPL"); static int act; module_param(act, int, 0644); -MODULE_PARM_DESC(act, "Disable or override all lowest active trip points."); - -static int crt; -module_param(crt, int, 0644); -MODULE_PARM_DESC(crt, "Disable or lower all critical trip points."); +MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.\n"); static int tzp; module_param(tzp, int, 0444); -MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds."); +MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); static int nocrt; module_param(nocrt, int, 0); -MODULE_PARM_DESC(nocrt, "Set to take no action upon ACPI thermal zone critical trips points."); +MODULE_PARM_DESC(nocrt, "Set to disable action on ACPI thermal zone critical and hot trips.\n"); static int off; module_param(off, int, 0); -MODULE_PARM_DESC(off, "Set to disable ACPI thermal support."); +MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.\n"); static int psv; module_param(psv, int, 0644); -MODULE_PARM_DESC(psv, "Disable or override all passive trip points."); +MODULE_PARM_DESC(psv, "Disable or override all passive trip points.\n"); static int acpi_thermal_add(struct acpi_device *device); static int acpi_thermal_remove(struct acpi_device *device, int type); @@ -344,20 +340,6 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) tz->trips.critical.temperature)); } - if (tz->trips.critical.flags.valid == 1) { - if (crt == -1) { - tz->trips.critical.flags.valid = 0; - } else if (crt > 0) { - unsigned long crt_k = CELSIUS_TO_KELVIN(crt); - - /* - * Allow override to lower critical threshold - */ - if (crt_k < tz->trips.critical.temperature) - tz->trips.critical.temperature = crt_k; - } - } - /* Critical Sleep (optional) */ status = @@ -503,12 +485,8 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) printk(KERN_EMERG "Critical temperature reached (%ld C), shutting down.\n", KELVIN_TO_CELSIUS(tz->temperature)); - acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, + acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, tz->trips.critical.flags.enabled); - acpi_bus_generate_netlink_event(tz->device->pnp.device_class, - tz->device->dev.bus_id, - ACPI_THERMAL_NOTIFY_CRITICAL, - tz->trips.critical.flags.enabled); orderly_poweroff(true); @@ -526,12 +504,8 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) } else if (tz->trips.hot.flags.enabled) tz->trips.hot.flags.enabled = 0; - acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, + acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, tz->trips.hot.flags.enabled); - acpi_bus_generate_netlink_event(tz->device->pnp.device_class, - tz->device->dev.bus_id, - ACPI_THERMAL_NOTIFY_HOT, - tz->trips.hot.flags.enabled); /* TBD: Call user-mode "sleep(S4)" function */ @@ -1093,9 +1067,9 @@ static int acpi_thermal_add_fs(struct acpi_device *device) entry->owner = THIS_MODULE; } - /* 'trip_points' [R] */ + /* 'trip_points' [R/W] */ entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, - S_IRUGO, + S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) return -ENODEV; @@ -1175,16 +1149,12 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) case ACPI_THERMAL_NOTIFY_THRESHOLDS: acpi_thermal_get_trip_points(tz); acpi_thermal_check(tz); - acpi_bus_generate_proc_event(device, event, 0); - acpi_bus_generate_netlink_event(device->pnp.device_class, - device->dev.bus_id, event, 0); + acpi_bus_generate_event(device, event, 0); break; case ACPI_THERMAL_NOTIFY_DEVICES: if (tz->flags.devices) acpi_thermal_get_devices(tz); - acpi_bus_generate_proc_event(device, event, 0); - acpi_bus_generate_netlink_event(device->pnp.device_class, - device->dev.bus_id, event, 0); + acpi_bus_generate_event(device, event, 0); break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -1369,13 +1339,6 @@ static int thermal_act(struct dmi_system_id *d) { } return 0; } -static int thermal_nocrt(struct dmi_system_id *d) { - - printk(KERN_NOTICE "ACPI: %s detected: " - "disabling all critical thermal trip point actions.\n", d->ident); - nocrt = 1; - return 0; -} static int thermal_tzp(struct dmi_system_id *d) { if (tzp == 0) { @@ -1424,14 +1387,6 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = { DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), }, }, - { - .callback = thermal_nocrt, - .ident = "Gigabyte GA-7ZX", - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."), - DMI_MATCH(DMI_BOARD_NAME, "7ZX"), - }, - }, {} }; #endif /* CONFIG_DMI */ diff --git a/trunk/drivers/acpi/utilities/utglobal.c b/trunk/drivers/acpi/utilities/utglobal.c index 93ea8290b4f7..1621655d6e2b 100644 --- a/trunk/drivers/acpi/utilities/utglobal.c +++ b/trunk/drivers/acpi/utilities/utglobal.c @@ -126,7 +126,6 @@ const char *acpi_format_exception(acpi_status status) "Unknown exception code: 0x%8.8X", status)); exception = "UNKNOWN_STATUS_CODE"; - dump_stack(); } return (ACPI_CAST_PTR(const char, exception)); diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index 3c9bb85a6a93..d98701941981 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -31,7 +31,7 @@ #include #include #include -#include + #include #include #include @@ -138,8 +138,6 @@ struct acpi_video_bus { struct semaphore sem; struct list_head video_device_list; struct proc_dir_entry *dir; - struct input_dev *input; - char phys[32]; /* for input device */ }; struct acpi_video_device_flags { @@ -1766,9 +1764,6 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) { struct acpi_video_bus *video = data; struct acpi_device *device = NULL; - struct input_dev *input; - int keycode; - printk("video bus notify\n"); @@ -1776,13 +1771,11 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) return; device = video->device; - input = video->input; switch (event) { case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch, * most likely via hotkey. */ - acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_SWITCHVIDEOMODE; + acpi_bus_generate_event(device, event, 0); break; case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video @@ -1790,38 +1783,22 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) acpi_video_device_enumerate(video); acpi_video_device_rebind(video); acpi_video_switch_output(video, event); - acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_SWITCHVIDEOMODE; + acpi_bus_generate_event(device, event, 0); break; case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */ - acpi_video_switch_output(video, event); - acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_SWITCHVIDEOMODE; - break; case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */ - acpi_video_switch_output(video, event); - acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_VIDEO_NEXT; - break; case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */ acpi_video_switch_output(video, event); - acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_VIDEO_PREV; + acpi_bus_generate_event(device, event, 0); break; default: - keycode = KEY_UNKNOWN; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported event [0x%x]\n", event)); break; } - input_report_key(input, keycode, 1); - input_sync(input); - input_report_key(input, keycode, 0); - input_sync(input); - return; } @@ -1829,65 +1806,38 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) { struct acpi_video_device *video_device = data; struct acpi_device *device = NULL; - struct acpi_video_bus *bus; - struct input_dev *input; - int keycode; if (!video_device) return; device = video_device->dev; - bus = video_device->video; - input = bus->input; switch (event) { - case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ - acpi_video_switch_brightness(video_device, event); - acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_BRIGHTNESS_CYCLE; + case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ + case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */ + acpi_bus_generate_event(device, event, 0); break; + case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */ - acpi_video_switch_brightness(video_device, event); - acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_BRIGHTNESSUP; - break; case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */ - acpi_video_switch_brightness(video_device, event); - acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_BRIGHTNESSDOWN; - break; case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */ - acpi_video_switch_brightness(video_device, event); - acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_BRIGHTNESS_ZERO; - break; case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */ acpi_video_switch_brightness(video_device, event); - acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_DISPLAY_OFF; + acpi_bus_generate_event(device, event, 0); break; default: - keycode = KEY_UNKNOWN; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported event [0x%x]\n", event)); break; } - - input_report_key(input, keycode, 1); - input_sync(input); - input_report_key(input, keycode, 0); - input_sync(input); - return; } -static int instance; static int acpi_video_bus_add(struct acpi_device *device) { int result = 0; acpi_status status = 0; struct acpi_video_bus *video = NULL; - struct input_dev *input; if (!device) @@ -1897,13 +1847,6 @@ static int acpi_video_bus_add(struct acpi_device *device) if (!video) return -ENOMEM; - /* a hack to fix the duplicate name "VID" problem on T61 */ - if (!strcmp(device->pnp.bus_id, "VID")) { - if (instance) - device->pnp.bus_id[3] = '0' + instance; - instance ++; - } - video->device = device; strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); @@ -1938,39 +1881,6 @@ static int acpi_video_bus_add(struct acpi_device *device) goto end; } - - video->input = input = input_allocate_device(); - - snprintf(video->phys, sizeof(video->phys), - "%s/video/input0", acpi_device_hid(video->device)); - - input->name = acpi_device_name(video->device); - input->phys = video->phys; - input->id.bustype = BUS_HOST; - input->id.product = 0x06; - input->evbit[0] = BIT(EV_KEY); - set_bit(KEY_SWITCHVIDEOMODE, input->keybit); - set_bit(KEY_VIDEO_NEXT, input->keybit); - set_bit(KEY_VIDEO_PREV, input->keybit); - set_bit(KEY_BRIGHTNESS_CYCLE, input->keybit); - set_bit(KEY_BRIGHTNESSUP, input->keybit); - set_bit(KEY_BRIGHTNESSDOWN, input->keybit); - set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); - set_bit(KEY_DISPLAY_OFF, input->keybit); - set_bit(KEY_UNKNOWN, input->keybit); - result = input_register_device(input); - if (result) { - acpi_remove_notify_handler(video->device->handle, - ACPI_DEVICE_NOTIFY, - acpi_video_bus_notify); - acpi_video_bus_stop_devices(video); - acpi_video_bus_put_devices(video); - kfree(video->attached_array); - acpi_video_bus_remove_fs(device); - goto end; - } - - printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), video->flags.multihead ? "yes" : "no", @@ -2004,7 +1914,6 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) acpi_video_bus_put_devices(video); acpi_video_bus_remove_fs(device); - input_unregister_device(video->input); kfree(video->attached_array); kfree(video); diff --git a/trunk/drivers/char/agp/amd-k7-agp.c b/trunk/drivers/char/agp/amd-k7-agp.c index f60bca70d1fb..df0ddf14b85c 100644 --- a/trunk/drivers/char/agp/amd-k7-agp.c +++ b/trunk/drivers/char/agp/amd-k7-agp.c @@ -223,8 +223,6 @@ static int amd_irongate_configure(void) pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp); temp = (temp & PCI_BASE_ADDRESS_MEM_MASK); amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); - if (!amd_irongate_private.registers) - return -ENOMEM; /* Write out the address of the gatt table */ writel(agp_bridge->gatt_bus_addr, amd_irongate_private.registers+AMD_ATTBASE); diff --git a/trunk/drivers/char/agp/ati-agp.c b/trunk/drivers/char/agp/ati-agp.c index 2d46b713c8f2..da7513d7b4e7 100644 --- a/trunk/drivers/char/agp/ati-agp.c +++ b/trunk/drivers/char/agp/ati-agp.c @@ -213,9 +213,6 @@ static int ati_configure(void) temp = (temp & 0xfffff000); ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); - if (!ati_generic_private.registers) - return -ENOMEM; - if (is_r200()) pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000); else diff --git a/trunk/drivers/char/agp/efficeon-agp.c b/trunk/drivers/char/agp/efficeon-agp.c index d78cd09186aa..df8da7262853 100644 --- a/trunk/drivers/char/agp/efficeon-agp.c +++ b/trunk/drivers/char/agp/efficeon-agp.c @@ -375,7 +375,6 @@ static int __devinit agp_efficeon_probe(struct pci_dev *pdev, if (!r->start && r->end) { if (pci_assign_resource(pdev, 0)) { printk(KERN_ERR PFX "could not assign resource 0\n"); - agp_put_bridge(bridge); return -ENODEV; } } @@ -387,7 +386,6 @@ static int __devinit agp_efficeon_probe(struct pci_dev *pdev, */ if (pci_enable_device(pdev)) { printk(KERN_ERR PFX "Unable to Enable PCI device\n"); - agp_put_bridge(bridge); return -ENODEV; } diff --git a/trunk/drivers/char/agp/hp-agp.c b/trunk/drivers/char/agp/hp-agp.c index 313a133a1172..bcdb149c8179 100644 --- a/trunk/drivers/char/agp/hp-agp.c +++ b/trunk/drivers/char/agp/hp-agp.c @@ -221,7 +221,6 @@ hp_zx1_lba_init (u64 hpa) if (cap != PCI_CAP_ID_AGP) { printk(KERN_ERR PFX "Invalid capability ID 0x%02x at 0x%x\n", cap, hp->lba_cap_offset); - iounmap(hp->lba_regs); return -ENODEV; } diff --git a/trunk/drivers/char/agp/i460-agp.c b/trunk/drivers/char/agp/i460-agp.c index 75d2aca6353d..53354bf83af7 100644 --- a/trunk/drivers/char/agp/i460-agp.c +++ b/trunk/drivers/char/agp/i460-agp.c @@ -249,10 +249,6 @@ static int i460_create_gatt_table (struct agp_bridge_data *bridge) num_entries = A_SIZE_8(temp)->num_entries; i460.gatt = ioremap(INTEL_I460_ATTBASE, PAGE_SIZE << page_order); - if (!i460.gatt) { - printk(KERN_ERR PFX "ioremap failed\n"); - return -ENOMEM; - } /* These are no good, the should be removed from the agp_bridge strucure... */ agp_bridge->gatt_table_real = NULL; diff --git a/trunk/drivers/char/agp/intel-agp.c b/trunk/drivers/char/agp/intel-agp.c index 2c9ca2c64628..294cdbf4d44d 100644 --- a/trunk/drivers/char/agp/intel-agp.c +++ b/trunk/drivers/char/agp/intel-agp.c @@ -930,10 +930,8 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) temp &= 0xfff80000; intel_private.registers = ioremap(temp,128 * 4096); - if (!intel_private.registers) { - iounmap(intel_private.gtt); + if (!intel_private.registers) return -ENOMEM; - } temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000; global_cache_flush(); /* FIXME: ? */ @@ -987,15 +985,13 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge) temp &= 0xfff00000; intel_private.gtt = ioremap((temp + (512 * 1024)) , 512 * 1024); - if (!intel_private.gtt) - return -ENOMEM; + if (!intel_private.gtt) + return -ENOMEM; intel_private.registers = ioremap(temp,128 * 4096); - if (!intel_private.registers) { - iounmap(intel_private.gtt); - return -ENOMEM; - } + if (!intel_private.registers) + return -ENOMEM; temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000; global_cache_flush(); /* FIXME: ? */ diff --git a/trunk/drivers/char/agp/nvidia-agp.c b/trunk/drivers/char/agp/nvidia-agp.c index 225ed2a53d45..6cd7373dcdf4 100644 --- a/trunk/drivers/char/agp/nvidia-agp.c +++ b/trunk/drivers/char/agp/nvidia-agp.c @@ -157,9 +157,6 @@ static int nvidia_configure(void) nvidia_private.aperture = (volatile u32 __iomem *) ioremap(apbase, 33 * PAGE_SIZE); - if (!nvidia_private.aperture) - return -ENOMEM; - return 0; } diff --git a/trunk/drivers/char/agp/via-agp.c b/trunk/drivers/char/agp/via-agp.c index 0ecc54d327bc..9aaf401a8975 100644 --- a/trunk/drivers/char/agp/via-agp.c +++ b/trunk/drivers/char/agp/via-agp.c @@ -399,11 +399,6 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata = .device_id = PCI_DEVICE_ID_VIA_P4M890, .chipset_name = "P4M890", }, - /* P4M900 */ - { - .device_id = PCI_DEVICE_ID_VIA_VT3364, - .chipset_name = "P4M900", - }, { }, /* dummy final entry, always present */ }; diff --git a/trunk/drivers/char/drm/drm_bufs.c b/trunk/drivers/char/drm/drm_bufs.c index c115b39b8517..923174c54a1c 100644 --- a/trunk/drivers/char/drm/drm_bufs.c +++ b/trunk/drivers/char/drm/drm_bufs.c @@ -177,14 +177,8 @@ static int drm_addmap_core(struct drm_device * dev, unsigned int offset, MTRR_TYPE_WRCOMB, 1); } } - if (map->type == _DRM_REGISTERS) { + if (map->type == _DRM_REGISTERS) map->handle = ioremap(map->offset, map->size); - if (!map->handle) { - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - return -ENOMEM; - } - } - break; case _DRM_SHM: list = drm_find_matching_map(dev, map); @@ -485,6 +479,11 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp, return -EINVAL; } + if (!map) { + mutex_unlock(&dev->struct_mutex); + return -EINVAL; + } + /* Register and framebuffer maps are permanent */ if ((map->type == _DRM_REGISTERS) || (map->type == _DRM_FRAME_BUFFER)) { mutex_unlock(&dev->struct_mutex); diff --git a/trunk/drivers/char/drm/via_dmablit.c b/trunk/drivers/char/drm/via_dmablit.c index 3dd1ed3d1bf5..832de1d9ba7e 100644 --- a/trunk/drivers/char/drm/via_dmablit.c +++ b/trunk/drivers/char/drm/via_dmablit.c @@ -560,7 +560,7 @@ via_init_dmablit(struct drm_device *dev) blitq->head = 0; blitq->cur = 0; blitq->serviced = 0; - blitq->num_free = VIA_NUM_BLIT_SLOTS - 1; + blitq->num_free = VIA_NUM_BLIT_SLOTS; blitq->num_outstanding = 0; blitq->is_active = 0; blitq->aborting = 0; diff --git a/trunk/drivers/char/sonypi.c b/trunk/drivers/char/sonypi.c index 859858561ab6..aeec67e27264 100644 --- a/trunk/drivers/char/sonypi.c +++ b/trunk/drivers/char/sonypi.c @@ -875,7 +875,7 @@ static irqreturn_t sonypi_irq(int irq, void *dev_id) #ifdef CONFIG_ACPI if (sonypi_acpi_device) - acpi_bus_generate_proc_event(sonypi_acpi_device, 1, event); + acpi_bus_generate_event(sonypi_acpi_device, 1, event); #endif kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); diff --git a/trunk/drivers/firewire/fw-card.c b/trunk/drivers/firewire/fw-card.c index 3e9719948a8e..0aeab3218bb6 100644 --- a/trunk/drivers/firewire/fw-card.c +++ b/trunk/drivers/firewire/fw-card.c @@ -510,11 +510,9 @@ fw_core_remove_card(struct fw_card *card) /* Set up the dummy driver. */ card->driver = &dummy_driver; - fw_destroy_nodes(card); - flush_scheduled_work(); - fw_flush_transactions(card); - del_timer_sync(&card->flush_timer); + + fw_destroy_nodes(card); fw_card_put(card); } diff --git a/trunk/drivers/firewire/fw-sbp2.c b/trunk/drivers/firewire/fw-sbp2.c index 238730f75db1..ba816ef6def1 100644 --- a/trunk/drivers/firewire/fw-sbp2.c +++ b/trunk/drivers/firewire/fw-sbp2.c @@ -159,7 +159,6 @@ struct sbp2_pointer { struct sbp2_orb { struct fw_transaction t; - struct kref kref; dma_addr_t request_bus; int rcode; struct sbp2_pointer pointer; @@ -280,14 +279,6 @@ static const struct { } }; -static void -free_orb(struct kref *kref) -{ - struct sbp2_orb *orb = container_of(kref, struct sbp2_orb, kref); - - kfree(orb); -} - static void sbp2_status_write(struct fw_card *card, struct fw_request *request, int tcode, int destination, int source, @@ -321,8 +312,8 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request, spin_lock_irqsave(&card->lock, flags); list_for_each_entry(orb, &sd->orb_list, link) { if (STATUS_GET_ORB_HIGH(status) == 0 && - STATUS_GET_ORB_LOW(status) == orb->request_bus) { - orb->rcode = RCODE_COMPLETE; + STATUS_GET_ORB_LOW(status) == orb->request_bus && + orb->rcode == RCODE_COMPLETE) { list_del(&orb->link); break; } @@ -334,8 +325,6 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request, else fw_error("status write for unknown orb\n"); - kref_put(&orb->kref, free_orb); - fw_send_response(card, request, RCODE_COMPLETE); } @@ -346,27 +335,13 @@ complete_transaction(struct fw_card *card, int rcode, struct sbp2_orb *orb = data; unsigned long flags; - /* - * This is a little tricky. We can get the status write for - * the orb before we get this callback. The status write - * handler above will assume the orb pointer transaction was - * successful and set the rcode to RCODE_COMPLETE for the orb. - * So this callback only sets the rcode if it hasn't already - * been set and only does the cleanup if the transaction - * failed and we didn't already get a status write. - */ - spin_lock_irqsave(&card->lock, flags); - - if (orb->rcode == -1) - orb->rcode = rcode; - if (orb->rcode != RCODE_COMPLETE) { + orb->rcode = rcode; + if (rcode != RCODE_COMPLETE) { + spin_lock_irqsave(&card->lock, flags); list_del(&orb->link); + spin_unlock_irqrestore(&card->lock, flags); orb->callback(orb, NULL); } - - spin_unlock_irqrestore(&card->lock, flags); - - kref_put(&orb->kref, free_orb); } static void @@ -385,10 +360,6 @@ sbp2_send_orb(struct sbp2_orb *orb, struct fw_unit *unit, list_add_tail(&orb->link, &sd->orb_list); spin_unlock_irqrestore(&device->card->lock, flags); - /* Take a ref for the orb list and for the transaction callback. */ - kref_get(&orb->kref); - kref_get(&orb->kref); - fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST, node_id, generation, device->max_speed, offset, &orb->pointer, sizeof(orb->pointer), @@ -445,7 +416,6 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation, if (orb == NULL) return -ENOMEM; - kref_init(&orb->base.kref); orb->response_bus = dma_map_single(device->card->device, &orb->response, sizeof(orb->response), DMA_FROM_DEVICE); @@ -520,7 +490,7 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation, if (response) fw_memcpy_from_be32(response, orb->response, sizeof(orb->response)); - kref_put(&orb->base.kref, free_orb); + kfree(orb); return retval; } @@ -916,6 +886,7 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) orb->cmd->result = result; orb->done(orb->cmd); + kfree(orb); } static int sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb) @@ -1034,7 +1005,6 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) /* Initialize rcode to something not RCODE_COMPLETE. */ orb->base.rcode = -1; - kref_init(&orb->base.kref); orb->unit = unit; orb->done = done; @@ -1081,11 +1051,10 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) sbp2_send_orb(&orb->base, unit, sd->node_id, sd->generation, sd->command_block_agent_address + SBP2_ORB_POINTER); - kref_put(&orb->base.kref, free_orb); return 0; fail_mapping: - kref_put(&orb->base.kref, free_orb); + kfree(orb); fail_alloc: return SCSI_MLQUEUE_HOST_BUSY; } diff --git a/trunk/drivers/ieee1394/sbp2.c b/trunk/drivers/ieee1394/sbp2.c index a81ba8fca0db..47dbe8f17e82 100644 --- a/trunk/drivers/ieee1394/sbp2.c +++ b/trunk/drivers/ieee1394/sbp2.c @@ -513,9 +513,9 @@ static int sbp2util_create_command_orb_pool(struct sbp2_lu *lu) return 0; } -static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu, - struct hpsb_host *host) +static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu) { + struct hpsb_host *host = lu->hi->host; struct list_head *lh, *next; struct sbp2_command_info *cmd; unsigned long flags; @@ -922,16 +922,15 @@ static void sbp2_remove_device(struct sbp2_lu *lu) if (!lu) return; + hi = lu->hi; - if (!hi) - goto no_hi; if (lu->shost) { scsi_remove_host(lu->shost); scsi_host_put(lu->shost); } flush_scheduled_work(); - sbp2util_remove_command_orb_pool(lu, hi->host); + sbp2util_remove_command_orb_pool(lu); list_del(&lu->lu_list); @@ -972,8 +971,9 @@ static void sbp2_remove_device(struct sbp2_lu *lu) lu->ud->device.driver_data = NULL; - module_put(hi->host->driver->owner); -no_hi: + if (hi) + module_put(hi->host->driver->owner); + kfree(lu); } diff --git a/trunk/drivers/md/Kconfig b/trunk/drivers/md/Kconfig index 34a8c60a254a..531d4d17d011 100644 --- a/trunk/drivers/md/Kconfig +++ b/trunk/drivers/md/Kconfig @@ -263,7 +263,7 @@ config DM_MULTIPATH_EMC config DM_MULTIPATH_RDAC tristate "LSI/Engenio RDAC multipath support (EXPERIMENTAL)" - depends on DM_MULTIPATH && BLK_DEV_DM && SCSI && EXPERIMENTAL + depends on DM_MULTIPATH && BLK_DEV_DM && EXPERIMENTAL ---help--- Multipath support for LSI/Engenio RDAC. diff --git a/trunk/drivers/misc/asus-laptop.c b/trunk/drivers/misc/asus-laptop.c index 7dce318df1bd..d0fc4fd212e6 100644 --- a/trunk/drivers/misc/asus-laptop.c +++ b/trunk/drivers/misc/asus-laptop.c @@ -732,7 +732,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) lcd_blank(FB_BLANK_POWERDOWN); } - acpi_bus_generate_proc_event(hotk->device, event, + acpi_bus_generate_event(hotk->device, event, hotk->event_count[event % 128]++); return; @@ -1072,8 +1072,7 @@ static void asus_backlight_exit(void) } #define ASUS_LED_UNREGISTER(object) \ - if (object##_led.dev) \ - led_classdev_unregister(&object##_led) + led_classdev_unregister(&object##_led) static void asus_led_exit(void) { diff --git a/trunk/drivers/misc/sony-laptop.c b/trunk/drivers/misc/sony-laptop.c index d38ddce592c0..91da6880ae93 100644 --- a/trunk/drivers/misc/sony-laptop.c +++ b/trunk/drivers/misc/sony-laptop.c @@ -855,15 +855,6 @@ static struct dmi_system_id sony_nc_ids[] = { DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FE"), }, }, - { - .ident = "Sony Vaio FZ Series", - .callback = sony_nc_C_enable, - .driver_data = sony_C_events, - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), - DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ"), - }, - }, { .ident = "Sony Vaio C Series", .callback = sony_nc_C_enable, @@ -913,7 +904,7 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) dprintk("sony_acpi_notify, event: 0x%.2x\n", ev); sony_laptop_report_input_event(ev); - acpi_bus_generate_proc_event(sony_nc_acpi_device, 1, ev); + acpi_bus_generate_event(sony_nc_acpi_device, 1, ev); } static acpi_status sony_walk_callback(acpi_handle handle, u32 level, @@ -2301,7 +2292,7 @@ static irqreturn_t sony_pic_irq(int irq, void *dev_id) found: sony_laptop_report_input_event(device_event); - acpi_bus_generate_proc_event(spic_dev.acpi_dev, 1, device_event); + acpi_bus_generate_event(spic_dev.acpi_dev, 1, device_event); sonypi_compat_report_event(device_event); return IRQ_HANDLED; @@ -2317,6 +2308,8 @@ static int sony_pic_remove(struct acpi_device *device, int type) struct sony_pic_ioport *io, *tmp_io; struct sony_pic_irq *irq, *tmp_irq; + sonypi_compat_exit(); + if (sony_pic_disable(device)) { printk(KERN_ERR DRV_PFX "Couldn't disable device.\n"); return -ENXIO; @@ -2326,8 +2319,6 @@ static int sony_pic_remove(struct acpi_device *device, int type) release_region(spic_dev.cur_ioport->io.minimum, spic_dev.cur_ioport->io.address_length); - sonypi_compat_exit(); - sony_laptop_remove_input(); /* pf attrs */ @@ -2393,9 +2384,6 @@ static int sony_pic_add(struct acpi_device *device) goto err_free_resources; } - if (sonypi_compat_init()) - goto err_remove_input; - /* request io port */ list_for_each_entry(io, &spic_dev.ioports, list) { if (request_region(io->io.minimum, io->io.address_length, @@ -2410,7 +2398,7 @@ static int sony_pic_add(struct acpi_device *device) if (!spic_dev.cur_ioport) { printk(KERN_ERR DRV_PFX "Failed to request_region.\n"); result = -ENODEV; - goto err_remove_compat; + goto err_remove_input; } /* request IRQ */ @@ -2450,6 +2438,9 @@ static int sony_pic_add(struct acpi_device *device) if (result) goto err_remove_pf; + if (sonypi_compat_init()) + goto err_remove_pf; + return 0; err_remove_pf: @@ -2465,9 +2456,6 @@ static int sony_pic_add(struct acpi_device *device) release_region(spic_dev.cur_ioport->io.minimum, spic_dev.cur_ioport->io.address_length); -err_remove_compat: - sonypi_compat_exit(); - err_remove_input: sony_laptop_remove_input(); diff --git a/trunk/drivers/misc/thinkpad_acpi.c b/trunk/drivers/misc/thinkpad_acpi.c index bb8956d0c104..f6cd34a3dbac 100644 --- a/trunk/drivers/misc/thinkpad_acpi.c +++ b/trunk/drivers/misc/thinkpad_acpi.c @@ -1190,10 +1190,10 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) } if (sendacpi) - acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey); + acpi_bus_generate_event(ibm->acpi->device, event, hkey); } else { printk(IBM_ERR "unknown hotkey notification event %d\n", event); - acpi_bus_generate_proc_event(ibm->acpi->device, event, 0); + acpi_bus_generate_event(ibm->acpi->device, event, 0); } } @@ -2162,27 +2162,22 @@ static void dock_notify(struct ibm_struct *ibm, u32 event) int docked = dock_docked(); int pci = ibm->acpi->hid && ibm->acpi->device && acpi_match_device_ids(ibm->acpi->device, ibm_pci_device_ids); - int data; if (event == 1 && !pci) /* 570 */ - data = 1; /* button */ + acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */ else if (event == 1 && pci) /* 570 */ - data = 3; /* dock */ + acpi_bus_generate_event(ibm->acpi->device, event, 3); /* dock */ else if (event == 3 && docked) - data = 1; /* button */ + acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */ else if (event == 3 && !docked) - data = 2; /* undock */ + acpi_bus_generate_event(ibm->acpi->device, event, 2); /* undock */ else if (event == 0 && docked) - data = 3; /* dock */ + acpi_bus_generate_event(ibm->acpi->device, event, 3); /* dock */ else { printk(IBM_ERR "unknown dock event %d, status %d\n", event, _sta(dock_handle)); - data = 0; /* unknown */ + acpi_bus_generate_event(ibm->acpi->device, event, 0); /* unknown */ } - acpi_bus_generate_proc_event(ibm->acpi->device, event, data); - acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, - ibm->acpi->device->dev.bus_id, - event, data); } static int dock_read(char *p) @@ -2280,10 +2275,7 @@ static int __init bay_init(struct ibm_init_struct *iibm) static void bay_notify(struct ibm_struct *ibm, u32 event) { - acpi_bus_generate_proc_event(ibm->acpi->device, event, 0); - acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, - ibm->acpi->device->dev.bus_id, - event, 0); + acpi_bus_generate_event(ibm->acpi->device, event, 0); } #define bay_occupied(b) (_sta(b##_handle) & 1) diff --git a/trunk/drivers/net/dm9000.c b/trunk/drivers/net/dm9000.c index 738aa5906514..c3de81bf090a 100644 --- a/trunk/drivers/net/dm9000.c +++ b/trunk/drivers/net/dm9000.c @@ -700,7 +700,6 @@ dm9000_init_dm9000(struct net_device *dev) static int dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev) { - unsigned long flags; board_info_t *db = (board_info_t *) dev->priv; PRINTK3("dm9000_start_xmit\n"); @@ -708,7 +707,10 @@ dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev) if (db->tx_pkt_cnt > 1) return 1; - spin_lock_irqsave(&db->lock, flags); + netif_stop_queue(dev); + + /* Disable all interrupts */ + iow(db, DM9000_IMR, IMR_PAR); /* Move data to DM9000 TX RAM */ writeb(DM9000_MWCMD, db->io_addr); @@ -716,9 +718,12 @@ dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev) (db->outblk)(db->io_data, skb->data, skb->len); db->stats.tx_bytes += skb->len; - db->tx_pkt_cnt++; /* TX control: First packet immediately send, second packet queue */ - if (db->tx_pkt_cnt == 1) { + if (db->tx_pkt_cnt == 0) { + + /* First Packet */ + db->tx_pkt_cnt++; + /* Set TX length to DM9000 */ iow(db, DM9000_TXPLL, skb->len & 0xff); iow(db, DM9000_TXPLH, (skb->len >> 8) & 0xff); @@ -727,17 +732,23 @@ dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev) iow(db, DM9000_TCR, TCR_TXREQ); /* Cleared after TX complete */ dev->trans_start = jiffies; /* save the time stamp */ + } else { /* Second packet */ + db->tx_pkt_cnt++; db->queue_pkt_len = skb->len; - netif_stop_queue(dev); } - spin_unlock_irqrestore(&db->lock, flags); - /* free this SKB */ dev_kfree_skb(skb); + /* Re-enable resource check */ + if (db->tx_pkt_cnt == 1) + netif_wake_queue(dev); + + /* Re-enable interrupt */ + iow(db, DM9000_IMR, IMR_PAR | IMR_PTM | IMR_PRM); + return 0; } diff --git a/trunk/drivers/net/ehea/ehea_main.c b/trunk/drivers/net/ehea/ehea_main.c index db5747490a07..9756211e83ce 100644 --- a/trunk/drivers/net/ehea/ehea_main.c +++ b/trunk/drivers/net/ehea/ehea_main.c @@ -76,7 +76,7 @@ MODULE_PARM_DESC(rq1_entries, "Number of entries for Receive Queue 1 " MODULE_PARM_DESC(sq_entries, " Number of entries for the Send Queue " "[2^x - 1], x = [6..14]. Default = " __MODULE_STRING(EHEA_DEF_ENTRIES_SQ) ")"); -MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 0 "); +MODULE_PARM_DESC(use_mcs, " 0:NAPI, 1:Multiple receive queues, Default = 1 "); static int port_name_cnt = 0; static LIST_HEAD(adapter_list); @@ -2490,7 +2490,7 @@ static ssize_t ehea_show_port_id(struct device *dev, struct device_attribute *attr, char *buf) { struct ehea_port *port = container_of(dev, struct ehea_port, ofdev.dev); - return sprintf(buf, "%d", port->logical_port_id); + return sprintf(buf, "0x%X", port->logical_port_id); } static DEVICE_ATTR(log_port_id, S_IRUSR | S_IRGRP | S_IROTH, ehea_show_port_id, @@ -2781,7 +2781,7 @@ static ssize_t ehea_probe_port(struct device *dev, u32 logical_port_id; - sscanf(buf, "%d", &logical_port_id); + sscanf(buf, "%X", &logical_port_id); port = ehea_get_port(adapter, logical_port_id); @@ -2834,7 +2834,7 @@ static ssize_t ehea_remove_port(struct device *dev, int i; u32 logical_port_id; - sscanf(buf, "%d", &logical_port_id); + sscanf(buf, "%X", &logical_port_id); port = ehea_get_port(adapter, logical_port_id); diff --git a/trunk/drivers/net/ehea/ehea_qmr.c b/trunk/drivers/net/ehea/ehea_qmr.c index c82e24596074..a36fa6c23fdf 100644 --- a/trunk/drivers/net/ehea/ehea_qmr.c +++ b/trunk/drivers/net/ehea/ehea_qmr.c @@ -235,8 +235,6 @@ int ehea_destroy_cq(struct ehea_cq *cq) if (!cq) return 0; - hcp_epas_dtor(&cq->epas); - if ((hret = ehea_destroy_cq_res(cq, NORMAL_FREE)) == H_R_STATE) { ehea_error_data(cq->adapter, cq->fw_handle); hret = ehea_destroy_cq_res(cq, FORCE_FREE); @@ -363,8 +361,6 @@ int ehea_destroy_eq(struct ehea_eq *eq) if (!eq) return 0; - hcp_epas_dtor(&eq->epas); - if ((hret = ehea_destroy_eq_res(eq, NORMAL_FREE)) == H_R_STATE) { ehea_error_data(eq->adapter, eq->fw_handle); hret = ehea_destroy_eq_res(eq, FORCE_FREE); @@ -545,8 +541,6 @@ int ehea_destroy_qp(struct ehea_qp *qp) if (!qp) return 0; - hcp_epas_dtor(&qp->epas); - if ((hret = ehea_destroy_qp_res(qp, NORMAL_FREE)) == H_R_STATE) { ehea_error_data(qp->adapter, qp->fw_handle); hret = ehea_destroy_qp_res(qp, FORCE_FREE); diff --git a/trunk/drivers/net/forcedeth.c b/trunk/drivers/net/forcedeth.c index 1938d6dfc863..10f4e3b55168 100644 --- a/trunk/drivers/net/forcedeth.c +++ b/trunk/drivers/net/forcedeth.c @@ -552,7 +552,7 @@ union ring_type { #define PHY_OUI_MARVELL 0x5043 #define PHY_OUI_CICADA 0x03f1 #define PHY_OUI_VITESSE 0x01c1 -#define PHY_OUI_REALTEK 0x0732 +#define PHY_OUI_REALTEK 0x01c1 #define PHYID1_OUI_MASK 0x03ff #define PHYID1_OUI_SHFT 6 #define PHYID2_OUI_MASK 0xfc00 diff --git a/trunk/drivers/net/meth.c b/trunk/drivers/net/meth.c index 32bed6bc6c06..92b403bf38b0 100644 --- a/trunk/drivers/net/meth.c +++ b/trunk/drivers/net/meth.c @@ -405,7 +405,7 @@ static void meth_rx(struct net_device* dev, unsigned long int_status) priv->stats.rx_length_errors++; skb = priv->rx_skbs[priv->rx_write]; } else { - skb = alloc_skb(METH_RX_BUFF_SIZE, GFP_ATOMIC); + skb = alloc_skb(METH_RX_BUFF_SIZE, GFP_ATOMIC | GFP_DMA); if (!skb) { /* Ouch! No memory! Drop packet on the floor */ DPRINTK("No mem: dropping packet\n"); diff --git a/trunk/drivers/net/myri10ge/myri10ge.c b/trunk/drivers/net/myri10ge/myri10ge.c index 1c42266bf889..ae9bb7b7fd67 100644 --- a/trunk/drivers/net/myri10ge/myri10ge.c +++ b/trunk/drivers/net/myri10ge/myri10ge.c @@ -72,7 +72,7 @@ #include "myri10ge_mcp.h" #include "myri10ge_mcp_gen_header.h" -#define MYRI10GE_VERSION_STR "1.3.2-1.269" +#define MYRI10GE_VERSION_STR "1.3.1-1.248" MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); MODULE_AUTHOR("Maintainer: help@myri.com"); @@ -2514,20 +2514,26 @@ static void myri10ge_firmware_probe(struct myri10ge_priv *mgp) { struct pci_dev *pdev = mgp->pdev; struct device *dev = &pdev->dev; - int status; + int cap, status; + u16 val; mgp->tx.boundary = 4096; /* * Verify the max read request size was set to 4KB * before trying the test with 4KB. */ - status = pcie_get_readrq(pdev); - if (status < 0) { + cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); + if (cap < 64) { + dev_err(dev, "Bad PCI_CAP_ID_EXP location %d\n", cap); + goto abort; + } + status = pci_read_config_word(pdev, cap + PCI_EXP_DEVCTL, &val); + if (status != 0) { dev_err(dev, "Couldn't read max read req size: %d\n", status); goto abort; } - if (status != 4096) { - dev_warn(dev, "Max Read Request size != 4096 (%d)\n", status); + if ((val & (5 << 12)) != (5 << 12)) { + dev_warn(dev, "Max Read Request size != 4096 (0x%x)\n", val); mgp->tx.boundary = 2048; } /* @@ -2844,7 +2850,9 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) size_t bytes; int i; int status = -ENXIO; + int cap; int dac_enabled; + u16 val; netdev = alloc_etherdev(sizeof(*mgp)); if (netdev == NULL) { @@ -2876,7 +2884,19 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) = pci_find_capability(pdev, PCI_CAP_ID_VNDR); /* Set our max read request to 4KB */ - status = pcie_set_readrq(pdev, 4096); + cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); + if (cap < 64) { + dev_err(&pdev->dev, "Bad PCI_CAP_ID_EXP location %d\n", cap); + goto abort_with_netdev; + } + status = pci_read_config_word(pdev, cap + PCI_EXP_DEVCTL, &val); + if (status != 0) { + dev_err(&pdev->dev, "Error %d reading PCI_EXP_DEVCTL\n", + status); + goto abort_with_netdev; + } + val = (val & ~PCI_EXP_DEVCTL_READRQ) | (5 << 12); + status = pci_write_config_word(pdev, cap + PCI_EXP_DEVCTL, val); if (status != 0) { dev_err(&pdev->dev, "Error %d writing PCI_EXP_DEVCTL\n", status); diff --git a/trunk/drivers/net/phy/phy_device.c b/trunk/drivers/net/phy/phy_device.c index e275df8c55bc..a8b74cdab1ea 100644 --- a/trunk/drivers/net/phy/phy_device.c +++ b/trunk/drivers/net/phy/phy_device.c @@ -364,7 +364,7 @@ EXPORT_SYMBOL(genphy_config_advert); */ int genphy_setup_forced(struct phy_device *phydev) { - int ctl = 0; + int ctl = BMCR_RESET; phydev->pause = phydev->asym_pause = 0; diff --git a/trunk/drivers/net/sgiseeq.c b/trunk/drivers/net/sgiseeq.c index 0fb74cb51c4b..384b4685e977 100644 --- a/trunk/drivers/net/sgiseeq.c +++ b/trunk/drivers/net/sgiseeq.c @@ -726,7 +726,7 @@ static int __init sgiseeq_probe(struct platform_device *pdev) return err; } -static int __exit sgiseeq_remove(struct platform_device *pdev) +static void __exit sgiseeq_remove(struct platform_device *pdev) { struct net_device *dev = platform_get_drvdata(pdev); struct sgiseeq_private *sp = netdev_priv(dev); @@ -735,8 +735,6 @@ static int __exit sgiseeq_remove(struct platform_device *pdev) free_page((unsigned long) sp->srings); free_netdev(dev); platform_set_drvdata(pdev, NULL); - - return 0; } static struct platform_driver sgiseeq_driver = { diff --git a/trunk/drivers/net/sky2.c b/trunk/drivers/net/sky2.c index e6d937ec6886..757592436390 100644 --- a/trunk/drivers/net/sky2.c +++ b/trunk/drivers/net/sky2.c @@ -51,7 +51,7 @@ #include "sky2.h" #define DRV_NAME "sky2" -#define DRV_VERSION "1.17" +#define DRV_VERSION "1.16" #define PFX DRV_NAME " " /* @@ -99,6 +99,10 @@ static int disable_msi = 0; module_param(disable_msi, int, 0); MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); +static int idle_timeout = 100; +module_param(idle_timeout, int, 0); +MODULE_PARM_DESC(idle_timeout, "Watchdog timer for lost interrupts (ms)"); + static const struct pci_device_id sky2_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, /* SK-9Sxx */ { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */ @@ -215,12 +219,9 @@ static void sky2_power_on(struct sky2_hw *hw) else sky2_write8(hw, B2_Y2_CLK_GATE, 0); - if (hw->chip_id == CHIP_ID_YUKON_EC_U || - hw->chip_id == CHIP_ID_YUKON_EX) { + if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) { u32 reg; - sky2_pci_write32(hw, PCI_DEV_REG3, 0); - reg = sky2_pci_read32(hw, PCI_DEV_REG4); /* set all bits to 0 except bits 15..12 and 8 */ reg &= P_ASPM_CONTROL_MSK; @@ -237,8 +238,6 @@ static void sky2_power_on(struct sky2_hw *hw) reg = sky2_read32(hw, B2_GP_IO); reg |= GLB_GPIO_STAT_RACE_DIS; sky2_write32(hw, B2_GP_IO, reg); - - sky2_read32(hw, B2_GP_IO); } } @@ -1620,9 +1619,6 @@ static int sky2_down(struct net_device *dev) if (netif_msg_ifdown(sky2)) printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); - if (netif_carrier_ok(dev) && --hw->active == 0) - del_timer(&hw->watchdog_timer); - /* Stop more packets from being queued */ netif_stop_queue(dev); @@ -1743,10 +1739,6 @@ static void sky2_link_up(struct sky2_port *sky2) netif_carrier_on(sky2->netdev); - if (hw->active++ == 0) - mod_timer(&hw->watchdog_timer, jiffies + 1); - - /* Turn on link LED */ sky2_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF); @@ -1798,11 +1790,6 @@ static void sky2_link_down(struct sky2_port *sky2) netif_carrier_off(sky2->netdev); - /* Stop watchdog if both ports are not active */ - if (--hw->active == 0) - del_timer(&hw->watchdog_timer); - - /* Turn on link LED */ sky2_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF); @@ -2434,20 +2421,25 @@ static void sky2_le_error(struct sky2_hw *hw, unsigned port, sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK); } -/* Check for lost IRQ once a second */ -static void sky2_watchdog(unsigned long arg) +/* If idle then force a fake soft NAPI poll once a second + * to work around cases where sharing an edge triggered interrupt. + */ +static inline void sky2_idle_start(struct sky2_hw *hw) { - struct sky2_hw *hw = (struct sky2_hw *) arg; + if (idle_timeout > 0) + mod_timer(&hw->idle_timer, + jiffies + msecs_to_jiffies(idle_timeout)); +} - if (sky2_read32(hw, B0_ISRC)) { - struct net_device *dev = hw->dev[0]; +static void sky2_idle(unsigned long arg) +{ + struct sky2_hw *hw = (struct sky2_hw *) arg; + struct net_device *dev = hw->dev[0]; - if (__netif_rx_schedule_prep(dev)) - __netif_rx_schedule(dev); - } + if (__netif_rx_schedule_prep(dev)) + __netif_rx_schedule(dev); - if (hw->active > 0) - mod_timer(&hw->watchdog_timer, round_jiffies(jiffies + HZ)); + mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout)); } /* Hardware/software error handling */ @@ -2735,6 +2727,8 @@ static void sky2_restart(struct work_struct *work) struct net_device *dev; int i, err; + del_timer_sync(&hw->idle_timer); + rtnl_lock(); sky2_write32(hw, B0_IMSK, 0); sky2_read32(hw, B0_IMSK); @@ -2763,6 +2757,8 @@ static void sky2_restart(struct work_struct *work) } } + sky2_idle_start(hw); + rtnl_unlock(); } @@ -4029,9 +4025,11 @@ static int __devinit sky2_probe(struct pci_dev *pdev, sky2_show_addr(dev1); } - setup_timer(&hw->watchdog_timer, sky2_watchdog, (unsigned long) hw); + setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw); INIT_WORK(&hw->restart_work, sky2_restart); + sky2_idle_start(hw); + pci_set_drvdata(pdev, hw); return 0; @@ -4066,7 +4064,7 @@ static void __devexit sky2_remove(struct pci_dev *pdev) if (!hw) return; - del_timer_sync(&hw->watchdog_timer); + del_timer_sync(&hw->idle_timer); flush_scheduled_work(); @@ -4110,6 +4108,7 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) if (!hw) return 0; + del_timer_sync(&hw->idle_timer); netif_poll_disable(hw->dev[0]); for (i = 0; i < hw->ports; i++) { @@ -4175,7 +4174,7 @@ static int sky2_resume(struct pci_dev *pdev) } netif_poll_enable(hw->dev[0]); - + sky2_idle_start(hw); return 0; out: dev_err(&pdev->dev, "resume failed (%d)\n", err); @@ -4192,6 +4191,7 @@ static void sky2_shutdown(struct pci_dev *pdev) if (!hw) return; + del_timer_sync(&hw->idle_timer); netif_poll_disable(hw->dev[0]); for (i = 0; i < hw->ports; i++) { diff --git a/trunk/drivers/net/sky2.h b/trunk/drivers/net/sky2.h index 72e12b7cfa40..dce4d276d443 100644 --- a/trunk/drivers/net/sky2.h +++ b/trunk/drivers/net/sky2.h @@ -2045,13 +2045,12 @@ struct sky2_hw { u8 chip_rev; u8 pmd_type; u8 ports; - u8 active; struct sky2_status_le *st_le; u32 st_idx; dma_addr_t st_dma; - struct timer_list watchdog_timer; + struct timer_list idle_timer; struct work_struct restart_work; int msi; wait_queue_head_t msi_wait; diff --git a/trunk/drivers/pci/hotplug/acpiphp_ibm.c b/trunk/drivers/pci/hotplug/acpiphp_ibm.c index 56829f82be4a..70db38c0ced9 100644 --- a/trunk/drivers/pci/hotplug/acpiphp_ibm.c +++ b/trunk/drivers/pci/hotplug/acpiphp_ibm.c @@ -267,10 +267,7 @@ static void ibm_handle_events(acpi_handle handle, u32 event, void *context) if (subevent == 0x80) { dbg("%s: generationg bus event\n", __FUNCTION__); - acpi_bus_generate_proc_event(note->device, note->event, detail); - acpi_bus_generate_netlink_event(note->device->pnp.device_class, - note->device->dev.bus_id, - note->event, detail); + acpi_bus_generate_event(note->device, note->event, detail); } else note->event = event; } @@ -402,7 +399,7 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle, status = acpi_get_object_info(handle, &info_buffer); if (ACPI_FAILURE(status)) { - err("%s: Failed to get device information\n", __FUNCTION__); + err("%s: Failed to get device information", __FUNCTION__); return 0; } info.hardware_id.value[sizeof(info.hardware_id.value) - 1] = '\0'; diff --git a/trunk/drivers/pnp/card.c b/trunk/drivers/pnp/card.c index 6c0440c20e31..b6a4f02b01d1 100644 --- a/trunk/drivers/pnp/card.c +++ b/trunk/drivers/pnp/card.c @@ -25,13 +25,13 @@ static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv, int found; struct pnp_dev *dev; - if (i == PNP_MAX_DEVICES || - !*drv_id->devs[i].id) + if (i == PNP_MAX_DEVICES + || !*drv_id->devs[i].id) return drv_id; found = 0; card_for_each_dev(card, dev) { - if (compare_pnp_id(dev->id, - drv_id->devs[i].id)) { + if (compare_pnp_id + (dev->id, drv_id->devs[i].id)) { found = 1; break; } @@ -183,7 +183,7 @@ static int pnp_interface_attach_card(struct pnp_card *card) return 0; -err_name: + err_name: device_remove_file(&card->dev, &dev_attr_name); return rc; } @@ -321,10 +321,10 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, pos = pos->next; } -done: + done: return NULL; -found: + found: dev->card_link = clink; dev->dev.driver = &drv->link.driver; if (pnp_bus_type.probe(&dev->dev)) @@ -334,7 +334,7 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, return dev; -err_out: + err_out: dev->dev.driver = NULL; dev->card_link = NULL; return NULL; diff --git a/trunk/drivers/pnp/core.c b/trunk/drivers/pnp/core.c index d5964feb14de..61066fdb9e6d 100644 --- a/trunk/drivers/pnp/core.c +++ b/trunk/drivers/pnp/core.c @@ -52,6 +52,9 @@ int pnp_register_protocol(struct pnp_protocol *protocol) int nodenum; struct list_head *pos; + if (!protocol) + return -EINVAL; + INIT_LIST_HEAD(&protocol->devices); INIT_LIST_HEAD(&protocol->cards); nodenum = 0; @@ -91,6 +94,8 @@ static void pnp_free_ids(struct pnp_dev *dev) struct pnp_id *id; struct pnp_id *next; + if (!dev) + return; id = dev->id; while (id) { next = id->next; @@ -138,7 +143,7 @@ int __pnp_add_device(struct pnp_dev *dev) */ int pnp_add_device(struct pnp_dev *dev) { - if (dev->card) + if (!dev || !dev->protocol || dev->card) return -EINVAL; dev->dev.parent = &dev->protocol->dev; sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, diff --git a/trunk/drivers/pnp/driver.c b/trunk/drivers/pnp/driver.c index 2fa64a6b25c8..30b8f6f3258a 100644 --- a/trunk/drivers/pnp/driver.c +++ b/trunk/drivers/pnp/driver.c @@ -118,7 +118,7 @@ static int pnp_device_probe(struct device *dev) goto fail; return error; -fail: + fail: pnp_device_detach(pnp_dev); return error; } @@ -232,6 +232,10 @@ int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { struct pnp_id *ptr; + if (!id) + return -EINVAL; + if (!dev) + return -EINVAL; id->next = NULL; ptr = dev->id; while (ptr && ptr->next) diff --git a/trunk/drivers/pnp/interface.c b/trunk/drivers/pnp/interface.c index a0cfb75bbb8d..fe6684e13e82 100644 --- a/trunk/drivers/pnp/interface.c +++ b/trunk/drivers/pnp/interface.c @@ -459,8 +459,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, up(&pnp_res_mutex); goto done; } - -done: + done: if (retval < 0) return retval; return count; @@ -500,10 +499,10 @@ int pnp_interface_attach_device(struct pnp_dev *dev) return 0; -err_res: + err_res: device_remove_file(&dev->dev, &dev_attr_resources); -err_opt: + err_opt: device_remove_file(&dev->dev, &dev_attr_options); -err: + err: return rc; } diff --git a/trunk/drivers/pnp/isapnp/core.c b/trunk/drivers/pnp/isapnp/core.c index b035d60a1dcc..b4e2aa995b53 100644 --- a/trunk/drivers/pnp/isapnp/core.c +++ b/trunk/drivers/pnp/isapnp/core.c @@ -47,6 +47,9 @@ #if 0 #define ISAPNP_REGION_OK #endif +#if 0 +#define ISAPNP_DEBUG +#endif int isapnp_disable; /* Disable ISA PnP */ static int isapnp_rdp; /* Read Data Port */ @@ -90,6 +93,7 @@ MODULE_LICENSE("GPL"); static unsigned char isapnp_checksum_value; static DEFINE_MUTEX(isapnp_cfg_mutex); +static int isapnp_detected; static int isapnp_csn_count; /* some prototypes */ @@ -331,7 +335,7 @@ static int __init isapnp_isolate(void) } else if (iteration > 1) { break; } -__next: + __next: if (csn == 255) break; checksum = 0x6a; @@ -729,7 +733,7 @@ static int __init isapnp_create_device(struct pnp_card *card, "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n", type, dev->number, card->number); } -__skip: + __skip: if (size > 0) isapnp_skip_bytes(size); } @@ -784,7 +788,7 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card) "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n", type, card->number); } -__skip: + __skip: if (size > 0) isapnp_skip_bytes(size); } @@ -936,6 +940,9 @@ EXPORT_SYMBOL(isapnp_protocol); EXPORT_SYMBOL(isapnp_present); EXPORT_SYMBOL(isapnp_cfg_begin); EXPORT_SYMBOL(isapnp_cfg_end); +#if 0 +EXPORT_SYMBOL(isapnp_read_byte); +#endif EXPORT_SYMBOL(isapnp_write_byte); static int isapnp_read_resources(struct pnp_dev *dev, @@ -986,7 +993,6 @@ static int isapnp_get_resources(struct pnp_dev *dev, struct pnp_resource_table *res) { int ret; - pnp_init_resource_table(res); isapnp_cfg_begin(dev->card->number, dev->number); ret = isapnp_read_resources(dev, res); @@ -1040,7 +1046,7 @@ static int isapnp_set_resources(struct pnp_dev *dev, static int isapnp_disable_resources(struct pnp_dev *dev) { - if (!dev->active) + if (!dev || !dev->active) return -EINVAL; isapnp_cfg_begin(dev->card->number, dev->number); isapnp_deactivate(dev->number); @@ -1063,6 +1069,7 @@ static int __init isapnp_init(void) struct pnp_dev *dev; if (isapnp_disable) { + isapnp_detected = 0; printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n"); return 0; } @@ -1110,6 +1117,7 @@ static int __init isapnp_init(void) } isapnp_set_rdp(); } + isapnp_detected = 1; if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) { cards = isapnp_isolate(); if (cards < 0 || (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) { @@ -1117,6 +1125,7 @@ static int __init isapnp_init(void) release_region(_PIDXR, 1); #endif release_region(_PNPWRP, 1); + isapnp_detected = 0; printk(KERN_INFO "isapnp: No Plug & Play device found\n"); return 0; @@ -1139,12 +1148,13 @@ static int __init isapnp_init(void) } } } - if (cards) + if (cards) { printk(KERN_INFO "isapnp: %i Plug & Play card%s detected total\n", cards, cards > 1 ? "s" : ""); - else + } else { printk(KERN_INFO "isapnp: No Plug & Play card found\n"); + } isapnp_proc_init(); return 0; diff --git a/trunk/drivers/pnp/isapnp/proc.c b/trunk/drivers/pnp/isapnp/proc.c index 560ccb640816..3fbc0f9ffc26 100644 --- a/trunk/drivers/pnp/isapnp/proc.c +++ b/trunk/drivers/pnp/isapnp/proc.c @@ -112,6 +112,33 @@ static int isapnp_proc_attach_device(struct pnp_dev *dev) return 0; } +#ifdef MODULE +static int __exit isapnp_proc_detach_device(struct pnp_dev *dev) +{ + struct pnp_card *bus = dev->card; + struct proc_dir_entry *de; + char name[16]; + + if (!(de = bus->procdir)) + return -EINVAL; + sprintf(name, "%02x", dev->number); + remove_proc_entry(name, de); + return 0; +} + +static int __exit isapnp_proc_detach_bus(struct pnp_card *bus) +{ + struct proc_dir_entry *de; + char name[16]; + + if (!(de = bus->procdir)) + return -EINVAL; + sprintf(name, "%02x", bus->number); + remove_proc_entry(name, isapnp_proc_bus_dir); + return 0; +} +#endif /* MODULE */ + int __init isapnp_proc_init(void) { struct pnp_dev *dev; @@ -122,3 +149,21 @@ int __init isapnp_proc_init(void) } return 0; } + +#ifdef MODULE +int __exit isapnp_proc_done(void) +{ + struct pnp_dev *dev; + struct pnp_bus *card; + + isapnp_for_each_dev(dev) { + isapnp_proc_detach_device(dev); + } + isapnp_for_each_card(card) { + isapnp_proc_detach_bus(card); + } + if (isapnp_proc_bus_dir) + remove_proc_entry("isapnp", proc_bus); + return 0; +} +#endif /* MODULE */ diff --git a/trunk/drivers/pnp/manager.c b/trunk/drivers/pnp/manager.c index 0826287eef53..3bda513a6bd3 100644 --- a/trunk/drivers/pnp/manager.c +++ b/trunk/drivers/pnp/manager.c @@ -21,6 +21,9 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) resource_size_t *start, *end; unsigned long *flags; + if (!dev || !rule) + return -EINVAL; + if (idx >= PNP_MAX_PORT) { pnp_err ("More than 4 ports is incompatible with pnp specifications."); @@ -63,6 +66,9 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) resource_size_t *start, *end; unsigned long *flags; + if (!dev || !rule) + return -EINVAL; + if (idx >= PNP_MAX_MEM) { pnp_err ("More than 8 mems is incompatible with pnp specifications."); @@ -121,6 +127,9 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx) 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2 }; + if (!dev || !rule) + return -EINVAL; + if (idx >= PNP_MAX_IRQ) { pnp_err ("More than 2 irqs is incompatible with pnp specifications."); @@ -172,6 +181,9 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) 1, 3, 5, 6, 7, 0, 2, 4 }; + if (!dev || !rule) + return -EINVAL; + if (idx >= PNP_MAX_DMA) { pnp_err ("More than 2 dmas is incompatible with pnp specifications."); @@ -378,7 +390,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum) up(&pnp_res_mutex); return 1; -fail: + fail: pnp_clean_resource_table(&dev->res); up(&pnp_res_mutex); return 0; @@ -398,6 +410,8 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int i; struct pnp_resource_table *bak; + if (!dev || !res) + return -EINVAL; if (!pnp_can_configure(dev)) return -ENODEV; bak = pnp_alloc(sizeof(struct pnp_resource_table)); @@ -430,7 +444,7 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, kfree(bak); return 0; -fail: + fail: dev->res = *bak; up(&pnp_res_mutex); kfree(bak); @@ -446,6 +460,9 @@ int pnp_auto_config_dev(struct pnp_dev *dev) struct pnp_option *dep; int i = 1; + if (!dev) + return -EINVAL; + if (!pnp_can_configure(dev)) { pnp_dbg("Device %s does not support resource configuration.", dev->dev.bus_id); @@ -524,6 +541,8 @@ int pnp_activate_dev(struct pnp_dev *dev) { int error; + if (!dev) + return -EINVAL; if (dev->active) return 0; /* the device is already active */ @@ -549,6 +568,8 @@ int pnp_disable_dev(struct pnp_dev *dev) { int error; + if (!dev) + return -EINVAL; if (!dev->active) return 0; /* the device is already disabled */ @@ -575,6 +596,8 @@ int pnp_disable_dev(struct pnp_dev *dev) void pnp_resource_change(struct resource *resource, resource_size_t start, resource_size_t size) { + if (resource == NULL) + return; resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET); resource->start = start; resource->end = start + size - 1; diff --git a/trunk/drivers/pnp/pnpacpi/core.c b/trunk/drivers/pnp/pnpacpi/core.c index a5a372222d69..616fc72190bf 100644 --- a/trunk/drivers/pnp/pnpacpi/core.c +++ b/trunk/drivers/pnp/pnpacpi/core.c @@ -248,9 +248,9 @@ static int __init pnpacpi_add_device(struct acpi_device *device) num++; return AE_OK; -err1: + err1: kfree(dev_id); -err: + err: kfree(dev); return -EINVAL; } diff --git a/trunk/drivers/pnp/pnpacpi/rsparser.c b/trunk/drivers/pnp/pnpacpi/rsparser.c index 0e3b8d0ff06b..ce5027feb3da 100644 --- a/trunk/drivers/pnp/pnpacpi/rsparser.c +++ b/trunk/drivers/pnp/pnpacpi/rsparser.c @@ -34,17 +34,19 @@ */ static int irq_flags(int triggering, int polarity) { + int flag; if (triggering == ACPI_LEVEL_SENSITIVE) { if (polarity == ACPI_ACTIVE_LOW) - return IORESOURCE_IRQ_LOWLEVEL; + flag = IORESOURCE_IRQ_LOWLEVEL; else - return IORESOURCE_IRQ_HIGHLEVEL; + flag = IORESOURCE_IRQ_HIGHLEVEL; } else { if (polarity == ACPI_ACTIVE_LOW) - return IORESOURCE_IRQ_LOWEDGE; + flag = IORESOURCE_IRQ_LOWEDGE; else - return IORESOURCE_IRQ_HIGHEDGE; + flag = IORESOURCE_IRQ_HIGHEDGE; } + return flag; } static void decode_irq_flags(int flag, int *triggering, int *polarity) @@ -240,7 +242,8 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, void *data) { - struct pnp_resource_table *res_table = data; + struct pnp_resource_table *res_table = + (struct pnp_resource_table *)data; int i; switch (res->type) { @@ -563,7 +566,8 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, void *data) { int priority = 0; - struct acpipnp_parse_option_s *parse_data = data; + struct acpipnp_parse_option_s *parse_data = + (struct acpipnp_parse_option_s *)data; struct pnp_dev *dev = parse_data->dev; struct pnp_option *option = parse_data->option; @@ -701,7 +705,7 @@ static int pnpacpi_supported_resource(struct acpi_resource *res) static acpi_status pnpacpi_count_resources(struct acpi_resource *res, void *data) { - int *res_cnt = data; + int *res_cnt = (int *)data; if (pnpacpi_supported_resource(res)) (*res_cnt)++; @@ -710,7 +714,7 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) { - struct acpi_resource **resource = data; + struct acpi_resource **resource = (struct acpi_resource **)data; if (pnpacpi_supported_resource(res)) { (*resource)->type = res->type; @@ -882,7 +886,8 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, int i = 0; /* pnpacpi_build_resource_template allocates extra mem */ int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1; - struct acpi_resource *resource = buffer->pointer; + struct acpi_resource *resource = + (struct acpi_resource *)buffer->pointer; int port = 0, irq = 0, dma = 0, mem = 0; pnp_dbg("res cnt %d", res_cnt); diff --git a/trunk/drivers/pnp/pnpbios/core.c b/trunk/drivers/pnp/pnpbios/core.c index 0691f473e9d4..3692a099b45f 100644 --- a/trunk/drivers/pnp/pnpbios/core.c +++ b/trunk/drivers/pnp/pnpbios/core.c @@ -419,6 +419,7 @@ static void __init build_devlist(void) static int pnpbios_disabled; int pnpbios_dont_use_current_config; +#ifndef MODULE static int __init pnpbios_setup(char *str) { int invert; @@ -442,6 +443,7 @@ static int __init pnpbios_setup(char *str) } __setup("pnpbios=", pnpbios_setup); +#endif /* PnP BIOS signature: "$PnP" */ #define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24)) @@ -589,7 +591,6 @@ subsys_initcall(pnpbios_init); static int __init pnpbios_thread_init(void) { struct task_struct *task; - #if defined(CONFIG_PPC_MERGE) if (check_legacy_ioport(PNPBIOS_BASE)) return 0; @@ -605,7 +606,48 @@ static int __init pnpbios_thread_init(void) return 0; } +#ifndef MODULE + +/* init/main.c calls pnpbios_init early */ + /* Start the kernel thread later: */ module_init(pnpbios_thread_init); +#else + +/* + * N.B.: Building pnpbios as a module hasn't been fully implemented + */ + +MODULE_LICENSE("GPL"); + +static int __init pnpbios_init_all(void) +{ + int r; + + r = pnpbios_init(); + if (r) + return r; + r = pnpbios_thread_init(); + if (r) + return r; + return 0; +} + +static void __exit pnpbios_exit(void) +{ +#ifdef CONFIG_HOTPLUG + unloading = 1; + wait_for_completion(&unload_sem); +#endif + pnpbios_proc_exit(); + /* We ought to free resources here */ + return; +} + +module_init(pnpbios_init_all); +module_exit(pnpbios_exit); + +#endif + EXPORT_SYMBOL(pnpbios_protocol); diff --git a/trunk/drivers/pnp/pnpbios/proc.c b/trunk/drivers/pnp/pnpbios/proc.c index 9d9841f24a85..9c8c07701b65 100644 --- a/trunk/drivers/pnp/pnpbios/proc.c +++ b/trunk/drivers/pnp/pnpbios/proc.c @@ -212,7 +212,7 @@ static int proc_write_node(struct file *file, const char __user * buf, goto out; } ret = count; -out: + out: kfree(node); return ret; } diff --git a/trunk/drivers/pnp/pnpbios/rsparser.c b/trunk/drivers/pnp/pnpbios/rsparser.c index 3fabf11b0027..04ecd7b67230 100644 --- a/trunk/drivers/pnp/pnpbios/rsparser.c +++ b/trunk/drivers/pnp/pnpbios/rsparser.c @@ -238,7 +238,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, break; default: /* an unkown tag */ -len_err: + len_err: printk(KERN_ERR "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", tag, len); @@ -298,7 +298,6 @@ static void pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, struct pnp_option *option) { struct pnp_mem *mem; - mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; @@ -469,7 +468,7 @@ static unsigned char *pnpbios_parse_resource_option_data(unsigned char *p, return p + 2; default: /* an unkown tag */ -len_err: + len_err: printk(KERN_ERR "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", tag, len); @@ -563,7 +562,7 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p, break; default: /* an unkown tag */ -len_err: + len_err: printk(KERN_ERR "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", tag, len); @@ -757,7 +756,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p, break; default: /* an unkown tag */ -len_err: + len_err: printk(KERN_ERR "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", tag, len); diff --git a/trunk/drivers/pnp/resource.c b/trunk/drivers/pnp/resource.c index ef1286900db3..ea6ec14a0559 100644 --- a/trunk/drivers/pnp/resource.c +++ b/trunk/drivers/pnp/resource.c @@ -47,6 +47,9 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) { struct pnp_option *option; + if (!dev) + return NULL; + option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED); /* this should never happen but if it does we'll try to continue */ @@ -61,6 +64,9 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, { struct pnp_option *option; + if (!dev) + return NULL; + option = pnp_build_option(priority); if (dev->dependent) { @@ -77,6 +83,11 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { struct pnp_irq *ptr; + if (!option) + return -EINVAL; + if (!data) + return -EINVAL; + ptr = option->irq; while (ptr && ptr->next) ptr = ptr->next; @@ -101,6 +112,11 @@ int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { struct pnp_dma *ptr; + if (!option) + return -EINVAL; + if (!data) + return -EINVAL; + ptr = option->dma; while (ptr && ptr->next) ptr = ptr->next; @@ -116,6 +132,11 @@ int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { struct pnp_port *ptr; + if (!option) + return -EINVAL; + if (!data) + return -EINVAL; + ptr = option->port; while (ptr && ptr->next) ptr = ptr->next; @@ -131,6 +152,11 @@ int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data) { struct pnp_mem *ptr; + if (!option) + return -EINVAL; + if (!data) + return -EINVAL; + ptr = option->mem; while (ptr && ptr->next) ptr = ptr->next; diff --git a/trunk/drivers/video/console/Kconfig b/trunk/drivers/video/console/Kconfig index 5db6b1e489b0..49643969f9f8 100644 --- a/trunk/drivers/video/console/Kconfig +++ b/trunk/drivers/video/console/Kconfig @@ -145,7 +145,7 @@ config FRAMEBUFFER_CONSOLE_ROTATION oriented. config STI_CONSOLE - bool "STI text console" + tristate "STI text console" depends on PARISC default y help diff --git a/trunk/drivers/video/console/sticore.c b/trunk/drivers/video/console/sticore.c index e9ab657f0bb7..870017d44970 100644 --- a/trunk/drivers/video/console/sticore.c +++ b/trunk/drivers/video/console/sticore.c @@ -232,14 +232,18 @@ sti_bmove(struct sti_struct *sti, int src_y, int src_x, } -static void sti_flush(unsigned long start, unsigned long end) +/* FIXME: Do we have another solution for this ? */ +static void sti_flush(unsigned long from, unsigned long len) { - flush_icache_range(start, end); + flush_data_cache(); + flush_kernel_dcache_range(from, len); + flush_icache_range(from, from+len); } void __devinit sti_rom_copy(unsigned long base, unsigned long count, void *dest) { + unsigned long dest_len = count; unsigned long dest_start = (unsigned long) dest; /* this still needs to be revisited (see arch/parisc/mm/init.c:246) ! */ @@ -256,7 +260,7 @@ sti_rom_copy(unsigned long base, unsigned long count, void *dest) dest++; } - sti_flush(dest_start, (unsigned long)dest); + sti_flush(dest_start, dest_len); } @@ -659,6 +663,7 @@ sti_bmode_font_raw(struct sti_cooked_font *f) static void __devinit sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest) { + unsigned long dest_len = count; unsigned long dest_start = (unsigned long) dest; while (count) { @@ -667,8 +672,7 @@ sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest) base += 4; dest++; } - - sti_flush(dest_start, (unsigned long)dest); + sti_flush(dest_start, dest_len); } static struct sti_rom * __devinit diff --git a/trunk/include/acpi/acpi_bus.h b/trunk/include/acpi/acpi_bus.h index 86aea44ce6d4..3d0fea235bf3 100644 --- a/trunk/include/acpi/acpi_bus.h +++ b/trunk/include/acpi/acpi_bus.h @@ -321,7 +321,8 @@ struct acpi_bus_event { }; extern struct kset acpi_subsys; -extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); +extern int acpi_bus_generate_genetlink_event(struct acpi_device *device, + u8 type, int data); /* * External Functions */ @@ -331,13 +332,8 @@ void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context); int acpi_bus_get_status(struct acpi_device *device); int acpi_bus_get_power(acpi_handle handle, int *state); int acpi_bus_set_power(acpi_handle handle, int state); -#ifdef CONFIG_ACPI_PROC_EVENT -int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); +int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); int acpi_bus_receive_event(struct acpi_bus_event *event); -#else -static inline int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data) - { return 0; } -#endif int acpi_bus_register_driver(struct acpi_driver *driver); void acpi_bus_unregister_driver(struct acpi_driver *driver); int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, diff --git a/trunk/include/acpi/acpixf.h b/trunk/include/acpi/acpixf.h index 3d7ab9e0c9fe..b5cca5daa348 100644 --- a/trunk/include/acpi/acpixf.h +++ b/trunk/include/acpi/acpixf.h @@ -130,7 +130,7 @@ acpi_walk_namespace(acpi_object_type type, void *context, void **return_value); acpi_status -acpi_get_devices(const char *HID, +acpi_get_devices(char *HID, acpi_walk_callback user_function, void *context, void **return_value); diff --git a/trunk/include/acpi/acstruct.h b/trunk/include/acpi/acstruct.h index 88482655407f..aeb4498e5e06 100644 --- a/trunk/include/acpi/acstruct.h +++ b/trunk/include/acpi/acstruct.h @@ -146,7 +146,7 @@ struct acpi_init_walk_info { struct acpi_get_devices_info { acpi_walk_callback user_function; void *context; - const char *hid; + char *hid; }; union acpi_aml_operands { diff --git a/trunk/include/asm-i386/io_apic.h b/trunk/include/asm-i386/io_apic.h index dbe734ddf2af..340764076d5f 100644 --- a/trunk/include/asm-i386/io_apic.h +++ b/trunk/include/asm-i386/io_apic.h @@ -150,6 +150,7 @@ extern int (*ioapic_renumber_irq)(int ioapic, int irq); #else /* !CONFIG_X86_IO_APIC */ #define io_apic_assign_pci_irqs 0 +static inline void disable_ioapic_setup(void) { } #endif #endif diff --git a/trunk/include/asm-parisc/io.h b/trunk/include/asm-parisc/io.h index 4cc9bcec0564..c0fed91da3a2 100644 --- a/trunk/include/asm-parisc/io.h +++ b/trunk/include/asm-parisc/io.h @@ -15,16 +15,6 @@ extern unsigned long parisc_vmerge_max_size; #define virt_to_bus virt_to_phys #define bus_to_virt phys_to_virt -static inline unsigned long isa_bus_to_virt(unsigned long addr) { - BUG(); - return 0; -} - -static inline unsigned long isa_virt_to_bus(void *addr) { - BUG(); - return 0; -} - /* * Memory mapped I/O * diff --git a/trunk/include/asm-parisc/vga.h b/trunk/include/asm-parisc/vga.h deleted file mode 100644 index 154a84c843a7..000000000000 --- a/trunk/include/asm-parisc/vga.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_PARISC_VGA_H__ -#define __ASM_PARISC_VGA_H__ - -/* nothing */ - -#endif __ASM_PARISC_VGA_H__ diff --git a/trunk/include/asm-x86_64/io_apic.h b/trunk/include/asm-x86_64/io_apic.h index d9f2e54324d5..969d225a9350 100644 --- a/trunk/include/asm-x86_64/io_apic.h +++ b/trunk/include/asm-x86_64/io_apic.h @@ -109,12 +109,6 @@ extern int mpc_default_type; /* 1 if "noapic" boot option passed */ extern int skip_ioapic_setup; -static inline void disable_ioapic_setup(void) -{ - skip_ioapic_setup = 1; -} - - /* * If we use the IO-APIC for IRQ routing, disable automatic * assignment of PCI IRQ's. diff --git a/trunk/include/linux/input.h b/trunk/include/linux/input.h index cf2b5619aa13..e02c6a66b2ba 100644 --- a/trunk/include/linux/input.h +++ b/trunk/include/linux/input.h @@ -363,12 +363,6 @@ struct input_absinfo { #define KEY_UNKNOWN 240 -#define KEY_VIDEO_NEXT 241 /* drive next video source */ -#define KEY_VIDEO_PREV 242 /* drive previous video source */ -#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */ -#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */ -#define KEY_DISPLAY_OFF 245 /* display device to off state */ - #define BTN_MISC 0x100 #define BTN_0 0x100 #define BTN_1 0x101 diff --git a/trunk/include/linux/pci_ids.h b/trunk/include/linux/pci_ids.h index 06d23e10a16d..f77944e432f2 100644 --- a/trunk/include/linux/pci_ids.h +++ b/trunk/include/linux/pci_ids.h @@ -1290,7 +1290,6 @@ #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_VT3364 0x0364 #define PCI_DEVICE_ID_VIA_8371_0 0x0391 #define PCI_DEVICE_ID_VIA_8501_0 0x0501 #define PCI_DEVICE_ID_VIA_82C561 0x0561 diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index bd6a0320a770..ba78807eab91 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -1399,8 +1399,7 @@ static inline void idle_task_exit(void) {} extern void sched_idle_next(void); -extern unsigned int sysctl_sched_latency; -extern unsigned int sysctl_sched_min_granularity; +extern unsigned int sysctl_sched_granularity; extern unsigned int sysctl_sched_wakeup_granularity; extern unsigned int sysctl_sched_batch_wakeup_granularity; extern unsigned int sysctl_sched_stat_granularity; diff --git a/trunk/init/main.c b/trunk/init/main.c index cc0653ec081d..d3bcb3b11620 100644 --- a/trunk/init/main.c +++ b/trunk/init/main.c @@ -146,14 +146,9 @@ static unsigned int __initdata max_cpus = NR_CPUS; * greater than 0, limits the maximum number of CPUs activated in * SMP mode to . */ -#ifndef CONFIG_X86_IO_APIC -static inline void disable_ioapic_setup(void) {}; -#endif - static int __init nosmp(char *str) { max_cpus = 0; - disable_ioapic_setup(); return 0; } @@ -162,13 +157,10 @@ early_param("nosmp", nosmp); static int __init maxcpus(char *str) { get_option(&str, &max_cpus); - if (max_cpus == 0) - disable_ioapic_setup(); - - return 0; + return 1; } -early_param("maxcpus=", maxcpus); +__setup("maxcpus=", maxcpus); #else #define max_cpus NR_CPUS #endif diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index 9fe473a190de..96e9b82246d2 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -2180,6 +2180,12 @@ int can_migrate_task(struct task_struct *p, struct rq *rq, int this_cpu, if (task_running(rq, p)) return 0; + /* + * Aggressive migration if too many balance attempts have failed: + */ + if (sd->nr_balance_failed > sd->cache_nice_tries) + return 1; + return 1; } @@ -4911,18 +4917,14 @@ cpumask_t nohz_cpu_mask = CPU_MASK_NONE; static inline void sched_init_granularity(void) { unsigned int factor = 1 + ilog2(num_online_cpus()); - const unsigned long limit = 100000000; - - sysctl_sched_min_granularity *= factor; - if (sysctl_sched_min_granularity > limit) - sysctl_sched_min_granularity = limit; + const unsigned long gran_limit = 100000000; - sysctl_sched_latency *= factor; - if (sysctl_sched_latency > limit) - sysctl_sched_latency = limit; + sysctl_sched_granularity *= factor; + if (sysctl_sched_granularity > gran_limit) + sysctl_sched_granularity = gran_limit; - sysctl_sched_runtime_limit = sysctl_sched_latency; - sysctl_sched_wakeup_granularity = sysctl_sched_min_granularity / 2; + sysctl_sched_runtime_limit = sysctl_sched_granularity * 8; + sysctl_sched_wakeup_granularity = sysctl_sched_granularity / 2; } #ifdef CONFIG_SMP diff --git a/trunk/kernel/sched_fair.c b/trunk/kernel/sched_fair.c index ee3771850aaf..fedbb51bba96 100644 --- a/trunk/kernel/sched_fair.c +++ b/trunk/kernel/sched_fair.c @@ -15,42 +15,34 @@ * * Scaled math optimizations by Thomas Gleixner * Copyright (C) 2007, Thomas Gleixner - * - * Adaptive scheduling granularity, math enhancements by Peter Zijlstra - * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra */ /* - * Targeted preemption latency for CPU-bound tasks: - * (default: 20ms, units: nanoseconds) + * Preemption granularity: + * (default: 2 msec, units: nanoseconds) * - * NOTE: this latency value is not the same as the concept of - * 'timeslice length' - timeslices in CFS are of variable length. - * (to see the precise effective timeslice length of your workload, - * run vmstat and monitor the context-switches field) + * NOTE: this granularity value is not the same as the concept of + * 'timeslice length' - timeslices in CFS will typically be somewhat + * larger than this value. (to see the precise effective timeslice + * length of your workload, run vmstat and monitor the context-switches + * field) * * On SMP systems the value of this is multiplied by the log2 of the * number of CPUs. (i.e. factor 2x on 2-way systems, 3x on 4-way * systems, 4x on 8-way systems, 5x on 16-way systems, etc.) - * Targeted preemption latency for CPU-bound tasks: - */ -unsigned int sysctl_sched_latency __read_mostly = 20000000ULL; - -/* - * Minimal preemption granularity for CPU-bound tasks: - * (default: 2 msec, units: nanoseconds) */ -unsigned int sysctl_sched_min_granularity __read_mostly = 2000000ULL; +unsigned int sysctl_sched_granularity __read_mostly = 2000000000ULL/HZ; /* * SCHED_BATCH wake-up granularity. - * (default: 25 msec, units: nanoseconds) + * (default: 10 msec, units: nanoseconds) * * This option delays the preemption effects of decoupled workloads * and reduces their over-scheduling. Synchronous workloads will still * have immediate wakeup/sleep latencies. */ -unsigned int sysctl_sched_batch_wakeup_granularity __read_mostly = 25000000UL; +unsigned int sysctl_sched_batch_wakeup_granularity __read_mostly = + 10000000000ULL/HZ; /* * SCHED_OTHER wake-up granularity. @@ -60,12 +52,12 @@ unsigned int sysctl_sched_batch_wakeup_granularity __read_mostly = 25000000UL; * and reduces their over-scheduling. Synchronous workloads will still * have immediate wakeup/sleep latencies. */ -unsigned int sysctl_sched_wakeup_granularity __read_mostly = 1000000UL; +unsigned int sysctl_sched_wakeup_granularity __read_mostly = 1000000000ULL/HZ; unsigned int sysctl_sched_stat_granularity __read_mostly; /* - * Initialized in sched_init_granularity() [to 5 times the base granularity]: + * Initialized in sched_init_granularity(): */ unsigned int sysctl_sched_runtime_limit __read_mostly; @@ -221,49 +213,6 @@ static struct sched_entity *__pick_next_entity(struct cfs_rq *cfs_rq) * Scheduling class statistics methods: */ -/* - * Calculate the preemption granularity needed to schedule every - * runnable task once per sysctl_sched_latency amount of time. - * (down to a sensible low limit on granularity) - * - * For example, if there are 2 tasks running and latency is 10 msecs, - * we switch tasks every 5 msecs. If we have 3 tasks running, we have - * to switch tasks every 3.33 msecs to get a 10 msecs observed latency - * for each task. We do finer and finer scheduling up to until we - * reach the minimum granularity value. - * - * To achieve this we use the following dynamic-granularity rule: - * - * gran = lat/nr - lat/nr/nr - * - * This comes out of the following equations: - * - * kA1 + gran = kB1 - * kB2 + gran = kA2 - * kA2 = kA1 - * kB2 = kB1 - d + d/nr - * lat = d * nr - * - * Where 'k' is key, 'A' is task A (waiting), 'B' is task B (running), - * '1' is start of time, '2' is end of time, 'd' is delay between - * 1 and 2 (during which task B was running), 'nr' is number of tasks - * running, 'lat' is the the period of each task. ('lat' is the - * sched_latency that we aim for.) - */ -static long -sched_granularity(struct cfs_rq *cfs_rq) -{ - unsigned int gran = sysctl_sched_latency; - unsigned int nr = cfs_rq->nr_running; - - if (nr > 1) { - gran = gran/nr - gran/nr/nr; - gran = max(gran, sysctl_sched_min_granularity); - } - - return gran; -} - /* * We rescale the rescheduling granularity of tasks according to their * nice level, but only linearly, not exponentially: @@ -354,10 +303,10 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr) delta_fair = calc_delta_fair(delta_exec, lw); delta_mine = calc_delta_mine(delta_exec, curr->load.weight, lw); - if (cfs_rq->sleeper_bonus > sysctl_sched_latency) { - delta = min((u64)delta_mine, cfs_rq->sleeper_bonus); - delta = min(delta, (unsigned long)( - (long)sysctl_sched_runtime_limit - curr->wait_runtime)); + if (cfs_rq->sleeper_bonus > sysctl_sched_granularity) { + delta = min(cfs_rq->sleeper_bonus, (u64)delta_exec); + delta = calc_delta_mine(delta, curr->load.weight, lw); + delta = min((u64)delta, cfs_rq->sleeper_bonus); cfs_rq->sleeper_bonus -= delta; delta_mine -= delta; } @@ -545,13 +494,6 @@ static void __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se) unsigned long load = cfs_rq->load.weight, delta_fair; long prev_runtime; - /* - * Do not boost sleepers if there's too much bonus 'in flight' - * already: - */ - if (unlikely(cfs_rq->sleeper_bonus > sysctl_sched_runtime_limit)) - return; - if (sysctl_sched_features & SCHED_FEAT_SLEEPER_LOAD_AVG) load = rq_of(cfs_rq)->cpu_load[2]; @@ -571,13 +513,16 @@ static void __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se) prev_runtime = se->wait_runtime; __add_wait_runtime(cfs_rq, se, delta_fair); - schedstat_add(cfs_rq, wait_runtime, se->wait_runtime); delta_fair = se->wait_runtime - prev_runtime; /* * Track the amount of bonus we've given to sleepers: */ cfs_rq->sleeper_bonus += delta_fair; + if (unlikely(cfs_rq->sleeper_bonus > sysctl_sched_runtime_limit)) + cfs_rq->sleeper_bonus = sysctl_sched_runtime_limit; + + schedstat_add(cfs_rq, wait_runtime, se->wait_runtime); } static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se) @@ -741,8 +686,7 @@ static void entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) if (next == curr) return; - __check_preempt_curr_fair(cfs_rq, next, curr, - sched_granularity(cfs_rq)); + __check_preempt_curr_fair(cfs_rq, next, curr, sysctl_sched_granularity); } /************************************************** @@ -1087,7 +1031,7 @@ static void task_new_fair(struct rq *rq, struct task_struct *p) * it will preempt the parent: */ p->se.fair_key = current->se.fair_key - - niced_granularity(&rq->curr->se, sched_granularity(cfs_rq)) - 1; + niced_granularity(&rq->curr->se, sysctl_sched_granularity) - 1; /* * The first wait is dominated by the child-runs-first logic, * so do not credit it with that waiting time yet: @@ -1100,7 +1044,7 @@ static void task_new_fair(struct rq *rq, struct task_struct *p) * -granularity/2, so initialize the task with that: */ if (sysctl_sched_features & SCHED_FEAT_START_DEBIT) - p->se.wait_runtime = -(sched_granularity(cfs_rq) / 2); + p->se.wait_runtime = -(sysctl_sched_granularity / 2); __enqueue_entity(cfs_rq, se); } @@ -1113,7 +1057,7 @@ static void task_new_fair(struct rq *rq, struct task_struct *p) */ static void set_curr_task_fair(struct rq *rq) { - struct sched_entity *se = &rq->curr->se; + struct sched_entity *se = &rq->curr.se; for_each_sched_entity(se) set_next_entity(cfs_rq_of(se), se); diff --git a/trunk/kernel/sched_rt.c b/trunk/kernel/sched_rt.c index 4b87476a02d0..dcdcad632fd9 100644 --- a/trunk/kernel/sched_rt.c +++ b/trunk/kernel/sched_rt.c @@ -207,15 +207,10 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p) return; p->time_slice = static_prio_timeslice(p->static_prio); + set_tsk_need_resched(p); - /* - * Requeue to the end of queue if we are not the only element - * on the queue: - */ - if (p->run_list.prev != p->run_list.next) { - requeue_task_rt(rq, p); - set_tsk_need_resched(p); - } + /* put it at the end of the queue: */ + requeue_task_rt(rq, p); } static struct sched_class rt_sched_class __read_mostly = { diff --git a/trunk/kernel/sysctl.c b/trunk/kernel/sysctl.c index 6ace893c17c9..9029690f4fae 100644 --- a/trunk/kernel/sysctl.c +++ b/trunk/kernel/sysctl.c @@ -222,19 +222,8 @@ static ctl_table kern_table[] = { #ifdef CONFIG_SCHED_DEBUG { .ctl_name = CTL_UNNUMBERED, - .procname = "sched_min_granularity_ns", - .data = &sysctl_sched_min_granularity, - .maxlen = sizeof(unsigned int), - .mode = 0644, - .proc_handler = &proc_dointvec_minmax, - .strategy = &sysctl_intvec, - .extra1 = &min_sched_granularity_ns, - .extra2 = &max_sched_granularity_ns, - }, - { - .ctl_name = CTL_UNNUMBERED, - .procname = "sched_latency_ns", - .data = &sysctl_sched_latency, + .procname = "sched_granularity_ns", + .data = &sysctl_sched_granularity, .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = &proc_dointvec_minmax, @@ -294,15 +283,6 @@ static ctl_table kern_table[] = { .mode = 0644, .proc_handler = &proc_dointvec, }, - { - .ctl_name = CTL_UNNUMBERED, - .procname = "sched_features", - .data = &sysctl_sched_features, - .maxlen = sizeof(unsigned int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, -#endif #ifdef CONFIG_PROVE_LOCKING { .ctl_name = CTL_UNNUMBERED, @@ -322,6 +302,15 @@ static ctl_table kern_table[] = { .mode = 0644, .proc_handler = &proc_dointvec, }, +#endif + { + .ctl_name = CTL_UNNUMBERED, + .procname = "sched_features", + .data = &sysctl_sched_features, + .maxlen = sizeof(unsigned int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, #endif { .ctl_name = KERN_PANIC,