diff --git a/[refs] b/[refs] index 6883ad27a44f..2e06327c5959 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 886c35fbcf6fb2eee15687efc2d64d99b6ad9a4a +refs/heads/master: c5b5a5993234d4db2079e57e456bda5278ef59cf diff --git a/trunk/.gitignore b/trunk/.gitignore index 090b293b8779..3016ed30526d 100644 --- a/trunk/.gitignore +++ b/trunk/.gitignore @@ -41,7 +41,6 @@ include/linux/autoconf.h include/linux/compile.h include/linux/version.h include/linux/utsrelease.h -include/linux/bounds.h # stgit generated dirs patches-* diff --git a/trunk/Documentation/hwmon/w83l785ts b/trunk/Documentation/hwmon/w83l785ts index bd1fa9d4468d..1841cedc25b2 100644 --- a/trunk/Documentation/hwmon/w83l785ts +++ b/trunk/Documentation/hwmon/w83l785ts @@ -33,8 +33,7 @@ Known Issues ------------ On some systems (Asus), the BIOS is known to interfere with the driver -and cause read errors. Or maybe the W83L785TS-S chip is simply unreliable, -we don't really know. The driver will retry a given number of times +and cause read errors. The driver will retry a given number of times (5 by default) and then give up, returning the old value (or 0 if there is no old value). It seems to work well enough so that you should not notice anything. Thanks to James Bolt for helping test this feature. diff --git a/trunk/Documentation/kdump/kdump.txt b/trunk/Documentation/kdump/kdump.txt index b8e52c0355d3..d0ac72cc19ff 100644 --- a/trunk/Documentation/kdump/kdump.txt +++ b/trunk/Documentation/kdump/kdump.txt @@ -245,8 +245,6 @@ The syntax is: crashkernel=:[,:,...][@offset] range=start-[end] - 'start' is inclusive and 'end' is exclusive. - For example: crashkernel=512M-2G:64M,2G-:128M @@ -255,11 +253,10 @@ This would mean: 1) if the RAM is smaller than 512M, then don't reserve anything (this is the "rescue" case) - 2) if the RAM size is between 512M and 2G (exclusive), then reserve 64M + 2) if the RAM size is between 512M and 2G, then reserve 64M 3) if the RAM size is larger than 2G, then reserve 128M - Boot into System Kernel ======================= diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index cae9001a670d..c3a533d5d382 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -1196,9 +1196,9 @@ S: Maintained CPUSETS P: Paul Jackson -P: Paul Menage +P: Simon Derr M: pj@sgi.com -M: menage@google.com +M: simon.derr@bull.net L: linux-kernel@vger.kernel.org W: http://www.bullopensource.org/cpuset/ S: Supported @@ -1557,14 +1557,6 @@ M: raisch@de.ibm.com L: general@lists.openfabrics.org S: Supported -EMBEDDED LINUX -P: Paul Gortmaker -M: paul.gortmaker@windriver.com -P David Woodhouse -M: dwmw2@infradead.org -L: linux-embedded@vger.kernel.org -S: Maintained - EMULEX LPFC FC SCSI DRIVER P: James Smart M: james.smart@emulex.com diff --git a/trunk/Makefile b/trunk/Makefile index 5cf825819533..d3634cd6fe35 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -794,7 +794,7 @@ endif # ifdef CONFIG_KALLSYMS quiet_cmd_vmlinux-modpost = LD $@ cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@ \ $(vmlinux-init) --start-group $(vmlinux-main) --end-group \ - $(filter-out $(vmlinux-init) $(vmlinux-main) FORCE ,$^) + $(filter-out $(vmlinux-init) $(vmlinux-main) $(vmlinux-lds) FORCE ,$^) define rule_vmlinux-modpost : +$(call cmd,vmlinux-modpost) @@ -818,9 +818,7 @@ endif ifdef CONFIG_KALLSYMS .tmp_vmlinux1: vmlinux.o endif - -modpost-init := $(filter-out init/built-in.o, $(vmlinux-init)) -vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE +vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE $(call if_changed_rule,vmlinux-modpost) # The actual objects are generated when descending, diff --git a/trunk/arch/frv/mm/Makefile b/trunk/arch/frv/mm/Makefile index 1bca5ab8a6ab..fb8b1d860f46 100644 --- a/trunk/arch/frv/mm/Makefile +++ b/trunk/arch/frv/mm/Makefile @@ -6,4 +6,4 @@ obj-y := init.o kmap.o obj-$(CONFIG_MMU) += \ pgalloc.o highmem.o fault.o extable.o cache-page.o tlb-flush.o tlb-miss.o \ - mmu-context.o dma-alloc.o elf-fdpic.o + mmu-context.o dma-alloc.o unaligned.o elf-fdpic.o diff --git a/trunk/arch/ia64/kernel/acpi.c b/trunk/arch/ia64/kernel/acpi.c index c7467f863c7a..19709a079635 100644 --- a/trunk/arch/ia64/kernel/acpi.c +++ b/trunk/arch/ia64/kernel/acpi.c @@ -966,7 +966,7 @@ acpi_map_iosapics (void) fs_initcall(acpi_map_iosapics); #endif /* CONFIG_ACPI_NUMA */ -int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) +int __ref acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) { int err; diff --git a/trunk/arch/ia64/kvm/kvm-ia64.c b/trunk/arch/ia64/kvm/kvm-ia64.c index 318b81100623..6df073240135 100644 --- a/trunk/arch/ia64/kvm/kvm-ia64.c +++ b/trunk/arch/ia64/kvm/kvm-ia64.c @@ -1,3 +1,4 @@ + /* * kvm_ia64.c: Basic KVM suppport On Itanium series processors * @@ -430,7 +431,7 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu) if (itc_diff < 0) itc_diff = -itc_diff; - expires = div64_u64(itc_diff, cyc_per_usec); + expires = div64_64(itc_diff, cyc_per_usec); kt = ktime_set(0, 1000 * expires); vcpu->arch.ht_active = 1; hrtimer_start(p_ht, kt, HRTIMER_MODE_ABS); diff --git a/trunk/arch/m68knommu/kernel/asm-offsets.c b/trunk/arch/m68knommu/kernel/asm-offsets.c index c785d07c02cc..fd0c685a7f11 100644 --- a/trunk/arch/m68knommu/kernel/asm-offsets.c +++ b/trunk/arch/m68knommu/kernel/asm-offsets.c @@ -87,7 +87,6 @@ int main(void) DEFINE(TI_TASK, offsetof(struct thread_info, task)); DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); - DEFINE(TI_PREEMPTCOUNT, offsetof(struct thread_info, preempt_count)); DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); return 0; diff --git a/trunk/arch/m68knommu/kernel/entry.S b/trunk/arch/m68knommu/kernel/entry.S index f4782d2dce8f..1e7ea6a3e1a1 100644 --- a/trunk/arch/m68knommu/kernel/entry.S +++ b/trunk/arch/m68knommu/kernel/entry.S @@ -32,7 +32,6 @@ #include #include #include -#include .text @@ -141,11 +140,3 @@ ENTRY(sys_rt_sigreturn) RESTORE_SWITCH_STACK rts -ENTRY(ret_from_user_signal) - moveq #__NR_sigreturn,%d0 - trap #0 - -ENTRY(ret_from_user_rt_signal) - move #__NR_rt_sigreturn,%d0 - trap #0 - diff --git a/trunk/arch/m68knommu/kernel/setup.c b/trunk/arch/m68knommu/kernel/setup.c index 03f4fe6a2fc0..d6f0200316fe 100644 --- a/trunk/arch/m68knommu/kernel/setup.c +++ b/trunk/arch/m68knommu/kernel/setup.c @@ -162,7 +162,7 @@ void __init setup_arch(char **cmdline_p) printk(KERN_INFO "DragonEngine II board support by Georges Menie\n"); #endif #ifdef CONFIG_M5235EVB - printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n"); + printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)"); #endif #ifdef DEBUG diff --git a/trunk/arch/m68knommu/kernel/signal.c b/trunk/arch/m68knommu/kernel/signal.c index bbfcae9e52b4..70371378db86 100644 --- a/trunk/arch/m68knommu/kernel/signal.c +++ b/trunk/arch/m68knommu/kernel/signal.c @@ -51,8 +51,6 @@ #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) -void ret_from_user_signal(void); -void ret_from_user_rt_signal(void); asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs); /* @@ -541,6 +539,10 @@ static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) return err; } +static inline void push_cache (unsigned long vaddr) +{ +} + static inline void * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) { @@ -584,11 +586,16 @@ static void setup_frame (int sig, struct k_sigaction *ka, err |= copy_to_user (&frame->sc, &context, sizeof(context)); /* Set up to return from userspace. */ - err |= __put_user((void *) ret_from_user_signal, &frame->pretcode); + err |= __put_user(frame->retcode, &frame->pretcode); + /* moveq #,d0; trap #0 */ + err |= __put_user(0x70004e40 + (__NR_sigreturn << 16), + (long *)(frame->retcode)); if (err) goto give_sigsegv; + push_cache ((unsigned long) &frame->retcode); + /* Set up registers for signal handler */ wrusp ((unsigned long) frame); regs->pc = (unsigned long) ka->sa.sa_handler; @@ -648,11 +655,17 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info, err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set)); /* Set up to return from userspace. */ - err |= __put_user((void *) ret_from_user_rt_signal, &frame->pretcode); + err |= __put_user(frame->retcode, &frame->pretcode); + /* moveq #,d0; notb d0; trap #0 */ + err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16), + (long *)(frame->retcode + 0)); + err |= __put_user(0x4e40, (short *)(frame->retcode + 4)); if (err) goto give_sigsegv; + push_cache ((unsigned long) &frame->retcode); + /* Set up registers for signal handler */ wrusp ((unsigned long) frame); regs->pc = (unsigned long) ka->sa.sa_handler; diff --git a/trunk/arch/m68knommu/kernel/traps.c b/trunk/arch/m68knommu/kernel/traps.c index ec9aea652e79..437a061d8b94 100644 --- a/trunk/arch/m68knommu/kernel/traps.c +++ b/trunk/arch/m68knommu/kernel/traps.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -103,47 +102,56 @@ asmlinkage void buserr_c(struct frame *fp) force_sig(SIGSEGV, current); } + int kstack_depth_to_print = 48; -static void __show_stack(struct task_struct *task, unsigned long *stack) +void show_stack(struct task_struct *task, unsigned long *stack) { unsigned long *endstack, addr; - unsigned long *last_stack; + extern char _start, _etext; int i; - if (!stack) - stack = (unsigned long *)task->thread.ksp; + if (!stack) { + if (task) + stack = (unsigned long *)task->thread.ksp; + else + stack = (unsigned long *)&stack; + } addr = (unsigned long) stack; endstack = (unsigned long *) PAGE_ALIGN(addr); printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack); for (i = 0; i < kstack_depth_to_print; i++) { - if (stack + 1 + i > endstack) + if (stack + 1 > endstack) break; if (i % 8 == 0) printk("\n" KERN_EMERG " "); - printk(" %08lx", *(stack + i)); + printk(" %08lx", *stack++); } printk("\n"); -#ifdef CONFIG_FRAME_POINTER - printk(KERN_EMERG "Call Trace:\n"); - - last_stack = stack - 1; - while (stack <= endstack && stack > last_stack) { - - addr = *(stack + 1); - printk(KERN_EMERG " [%08lx] ", addr); - print_symbol(KERN_CONT "%s\n", addr); - - last_stack = stack; - stack = (unsigned long *)*stack; + printk(KERN_EMERG "Call Trace:"); + i = 0; + while (stack + 1 <= endstack) { + addr = *stack++; + /* + * If the address is either in the text segment of the + * kernel, or in the region which contains vmalloc'ed + * memory, it *may* be the address of a calling + * routine; if so, print it so that someone tracing + * down the cause of the crash will be able to figure + * out the call path that was taken. + */ + if (((addr >= (unsigned long) &_start) && + (addr <= (unsigned long) &_etext))) { + if (i % 4 == 0) + printk("\n" KERN_EMERG " "); + printk(" [<%08lx>]", addr); + i++; + } } printk("\n"); -#else - printk(KERN_EMERG "CONFIG_FRAME_POINTER disabled, no symbolic call trace\n"); -#endif } void bad_super_trap(struct frame *fp) @@ -290,46 +298,18 @@ asmlinkage void set_esp0(unsigned long ssp) current->thread.esp0 = ssp; } + /* * The architecture-independent backtrace generator */ void dump_stack(void) { - /* - * We need frame pointers for this little trick, which works as follows: - * - * +------------+ 0x00 - * | Next SP | -> 0x0c - * +------------+ 0x04 - * | Caller | - * +------------+ 0x08 - * | Local vars | -> our stack var - * +------------+ 0x0c - * | Next SP | -> 0x18, that is what we pass to show_stack() - * +------------+ 0x10 - * | Caller | - * +------------+ 0x14 - * | Local vars | - * +------------+ 0x18 - * | ... | - * +------------+ - */ + unsigned long stack; - unsigned long *stack; - - stack = (unsigned long *)&stack; - stack++; - __show_stack(current, stack); + show_stack(current, &stack); } -EXPORT_SYMBOL(dump_stack); -void show_stack(struct task_struct *task, unsigned long *stack) -{ - if (!stack && !task) - dump_stack(); - else - __show_stack(task, stack); -} +EXPORT_SYMBOL(dump_stack); #ifdef CONFIG_M68KFPU_EMU asmlinkage void fpemu_signal(int signal, int code, void *addr) diff --git a/trunk/arch/m68knommu/kernel/vmlinux.lds.S b/trunk/arch/m68knommu/kernel/vmlinux.lds.S index 5592e0bf951f..b44edb08e212 100644 --- a/trunk/arch/m68knommu/kernel/vmlinux.lds.S +++ b/trunk/arch/m68knommu/kernel/vmlinux.lds.S @@ -64,7 +64,6 @@ SECTIONS { _stext = . ; TEXT_TEXT SCHED_TEXT - LOCK_TEXT *(.text.lock) . = ALIGN(16); /* Exception table */ @@ -74,7 +73,6 @@ SECTIONS { *(.rodata) *(.rodata.*) *(__vermagic) /* Kernel version magic */ - *(__markers_strings) *(.rodata1) *(.rodata.str1.1) @@ -184,7 +182,6 @@ SECTIONS { *(COMMON) . = ALIGN(4) ; _ebss = . ; - _end = . ; } > BSS } diff --git a/trunk/arch/m68knommu/platform/5206e/config.c b/trunk/arch/m68knommu/platform/5206e/config.c index d01a5d2b7557..a6692e958f6b 100644 --- a/trunk/arch/m68knommu/platform/5206e/config.c +++ b/trunk/arch/m68knommu/platform/5206e/config.c @@ -48,7 +48,7 @@ static struct platform_device *m5206e_devices[] __initdata = { /***************************************************************************/ -static void __init m5206e_uart_init_line(int line, int irq) +static void __init m5206_uart_init_line(int line, int irq) { if (line == 0) { writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); diff --git a/trunk/arch/m68knommu/platform/5272/config.c b/trunk/arch/m68knommu/platform/5272/config.c index 230bae691a7f..2aca599a1ca7 100644 --- a/trunk/arch/m68knommu/platform/5272/config.c +++ b/trunk/arch/m68knommu/platform/5272/config.c @@ -139,6 +139,10 @@ void __init config_BSP(char *commandp, int size) /* Copy command line from FLASH to local buffer... */ memcpy(commandp, (char *) 0xf0004000, size); commandp[size-1] = 0; +#elif defined(CONFIG_MTD_KeyTechnology) + /* Copy command line from FLASH to local buffer... */ + memcpy(commandp, (char *) 0xffe06000, size); + commandp[size-1] = 0; #elif defined(CONFIG_CANCam) /* Copy command line from FLASH to local buffer... */ memcpy(commandp, (char *) 0xf0010000, size); diff --git a/trunk/arch/m68knommu/platform/528x/config.c b/trunk/arch/m68knommu/platform/528x/config.c index dfdb5c2ed8e6..036e1b73d944 100644 --- a/trunk/arch/m68knommu/platform/528x/config.c +++ b/trunk/arch/m68knommu/platform/528x/config.c @@ -26,240 +26,9 @@ #include #include -#ifdef CONFIG_MTD_PARTITIONS -#include -#endif - /***************************************************************************/ void coldfire_reset(void); -static void coldfire_qspi_cs_control(u8 cs, u8 command); - -/***************************************************************************/ - -#if defined(CONFIG_SPI) - -#if defined(CONFIG_WILDFIRE) -#define SPI_NUM_CHIPSELECTS 0x02 -#define SPI_PAR_VAL 0x07 /* Enable DIN, DOUT, CLK */ -#define SPI_CS_MASK 0x18 - -#define FLASH_BLOCKSIZE (1024*64) -#define FLASH_NUMBLOCKS 16 -#define FLASH_TYPE "m25p80" - -#define M25P80_CS 0 -#define MMC_CS 1 - -#ifdef CONFIG_MTD_PARTITIONS -static struct mtd_partition stm25p_partitions[] = { - /* sflash */ - [0] = { - .name = "stm25p80", - .offset = 0x00000000, - .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS, - .mask_flags = 0 - } -}; - -#endif - -#elif defined(CONFIG_WILDFIREMOD) - -#define SPI_NUM_CHIPSELECTS 0x08 -#define SPI_PAR_VAL 0x07 /* Enable DIN, DOUT, CLK */ -#define SPI_CS_MASK 0x78 - -#define FLASH_BLOCKSIZE (1024*64) -#define FLASH_NUMBLOCKS 64 -#define FLASH_TYPE "m25p32" -/* Reserve 1M for the kernel parition */ -#define FLASH_KERNEL_SIZE (1024 * 1024) - -#define M25P80_CS 5 -#define MMC_CS 6 - -#ifdef CONFIG_MTD_PARTITIONS -static struct mtd_partition stm25p_partitions[] = { - /* sflash */ - [0] = { - .name = "kernel", - .offset = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS - FLASH_KERNEL_SIZE, - .size = FLASH_KERNEL_SIZE, - .mask_flags = 0 - }, - [1] = { - .name = "image", - .offset = 0x00000000, - .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS - FLASH_KERNEL_SIZE, - .mask_flags = 0 - }, - [2] = { - .name = "all", - .offset = 0x00000000, - .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS, - .mask_flags = 0 - } -}; -#endif - -#else -#define SPI_NUM_CHIPSELECTS 0x04 -#define SPI_PAR_VAL 0x7F /* Enable DIN, DOUT, CLK, CS0 - CS4 */ -#endif - -#ifdef MMC_CS -static struct coldfire_spi_chip flash_chip_info = { - .mode = SPI_MODE_0, - .bits_per_word = 16, - .del_cs_to_clk = 17, - .del_after_trans = 1, - .void_write_data = 0 -}; - -static struct coldfire_spi_chip mmc_chip_info = { - .mode = SPI_MODE_0, - .bits_per_word = 16, - .del_cs_to_clk = 17, - .del_after_trans = 1, - .void_write_data = 0xFFFF -}; -#endif - -#ifdef M25P80_CS -static struct flash_platform_data stm25p80_platform_data = { - .name = "ST M25P80 SPI Flash chip", -#ifdef CONFIG_MTD_PARTITIONS - .parts = stm25p_partitions, - .nr_parts = sizeof(stm25p_partitions) / sizeof(*stm25p_partitions), -#endif - .type = FLASH_TYPE -}; -#endif - -static struct spi_board_info spi_board_info[] __initdata = { -#ifdef M25P80_CS - { - .modalias = "m25p80", - .max_speed_hz = 16000000, - .bus_num = 1, - .chip_select = M25P80_CS, - .platform_data = &stm25p80_platform_data, - .controller_data = &flash_chip_info - }, -#endif -#ifdef MMC_CS - { - .modalias = "mmc_spi", - .max_speed_hz = 16000000, - .bus_num = 1, - .chip_select = MMC_CS, - .controller_data = &mmc_chip_info - } -#endif -}; - -static struct coldfire_spi_master coldfire_master_info = { - .bus_num = 1, - .num_chipselect = SPI_NUM_CHIPSELECTS, - .irq_source = MCF5282_QSPI_IRQ_SOURCE, - .irq_vector = MCF5282_QSPI_IRQ_VECTOR, - .irq_mask = ((0x01 << MCF5282_QSPI_IRQ_SOURCE) | 0x01), - .irq_lp = 0x2B, /* Level 5 and Priority 3 */ - .par_val = SPI_PAR_VAL, - .cs_control = coldfire_qspi_cs_control, -}; - -static struct resource coldfire_spi_resources[] = { - [0] = { - .name = "qspi-par", - .start = MCF5282_QSPI_PAR, - .end = MCF5282_QSPI_PAR, - .flags = IORESOURCE_MEM - }, - - [1] = { - .name = "qspi-module", - .start = MCF5282_QSPI_QMR, - .end = MCF5282_QSPI_QMR + 0x18, - .flags = IORESOURCE_MEM - }, - - [2] = { - .name = "qspi-int-level", - .start = MCF5282_INTC0 + MCFINTC_ICR0 + MCF5282_QSPI_IRQ_SOURCE, - .end = MCF5282_INTC0 + MCFINTC_ICR0 + MCF5282_QSPI_IRQ_SOURCE, - .flags = IORESOURCE_MEM - }, - - [3] = { - .name = "qspi-int-mask", - .start = MCF5282_INTC0 + MCFINTC_IMRL, - .end = MCF5282_INTC0 + MCFINTC_IMRL, - .flags = IORESOURCE_MEM - } -}; - -static struct platform_device coldfire_spi = { - .name = "spi_coldfire", - .id = -1, - .resource = coldfire_spi_resources, - .num_resources = ARRAY_SIZE(coldfire_spi_resources), - .dev = { - .platform_data = &coldfire_master_info, - } -}; - -static void coldfire_qspi_cs_control(u8 cs, u8 command) -{ - u8 cs_bit = ((0x01 << cs) << 3) & SPI_CS_MASK; - -#if defined(CONFIG_WILDFIRE) - u8 cs_mask = ~(((0x01 << cs) << 3) & SPI_CS_MASK); -#endif -#if defined(CONFIG_WILDFIREMOD) - u8 cs_mask = (cs << 3) & SPI_CS_MASK; -#endif - - /* - * Don't do anything if the chip select is not - * one of the port qs pins. - */ - if (command & QSPI_CS_INIT) { -#if defined(CONFIG_WILDFIRE) - MCF5282_GPIO_DDRQS |= cs_bit; - MCF5282_GPIO_PQSPAR &= ~cs_bit; -#endif - -#if defined(CONFIG_WILDFIREMOD) - MCF5282_GPIO_DDRQS |= SPI_CS_MASK; - MCF5282_GPIO_PQSPAR &= ~SPI_CS_MASK; -#endif - } - - if (command & QSPI_CS_ASSERT) { - MCF5282_GPIO_PORTQS &= ~SPI_CS_MASK; - MCF5282_GPIO_PORTQS |= cs_mask; - } else if (command & QSPI_CS_DROP) { - MCF5282_GPIO_PORTQS |= SPI_CS_MASK; - } -} - -static int __init spi_dev_init(void) -{ - int retval; - - retval = platform_device_register(&coldfire_spi); - if (retval < 0) - return retval; - - if (ARRAY_SIZE(spi_board_info)) - retval = spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); - - return retval; -} - -#endif /* CONFIG_SPI */ /***************************************************************************/ @@ -342,43 +111,10 @@ void mcf_autovector(unsigned int vec) /***************************************************************************/ -#ifdef CONFIG_WILDFIRE -void wildfire_halt(void) -{ - writeb(0, 0x30000007); - writeb(0x2, 0x30000007); -} -#endif - -#ifdef CONFIG_WILDFIREMOD -void wildfiremod_halt(void) -{ - printk(KERN_INFO "WildFireMod hibernating...\n"); - - /* Set portE.5 to Digital IO */ - MCF5282_GPIO_PEPAR &= ~(1 << (5 * 2)); - - /* Make portE.5 an output */ - MCF5282_GPIO_DDRE |= (1 << 5); - - /* Now toggle portE.5 from low to high */ - MCF5282_GPIO_PORTE &= ~(1 << 5); - MCF5282_GPIO_PORTE |= (1 << 5); - - printk(KERN_EMERG "Failed to hibernate. Halting!\n"); -} -#endif - void __init config_BSP(char *commandp, int size) { mcf_disableall(); - -#ifdef CONFIG_WILDFIRE - mach_halt = wildfire_halt; -#endif -#ifdef CONFIG_WILDFIREMOD - mach_halt = wildfiremod_halt; -#endif + mach_reset = coldfire_reset; } /***************************************************************************/ diff --git a/trunk/arch/m68knommu/platform/5307/config.c b/trunk/arch/m68knommu/platform/5307/config.c index 11cff6625dcc..92dc862fa826 100644 --- a/trunk/arch/m68knommu/platform/5307/config.c +++ b/trunk/arch/m68knommu/platform/5307/config.c @@ -124,7 +124,8 @@ void __init config_BSP(char *commandp, int size) mcf_setimr(MCFSIM_IMR_MASKALL); #if defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \ - defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA) + defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \ + defined(CONFIG_CLEOPATRA) /* Copy command line from FLASH to local buffer... */ memcpy(commandp, (char *) 0xf0004000, size); commandp[size-1] = 0; diff --git a/trunk/arch/m68knommu/platform/coldfire/entry.S b/trunk/arch/m68knommu/platform/coldfire/entry.S index 1e3c0dcbd7ac..111b66dc737b 100644 --- a/trunk/arch/m68knommu/platform/coldfire/entry.S +++ b/trunk/arch/m68knommu/platform/coldfire/entry.S @@ -103,26 +103,9 @@ ret_from_signal: addql #4,%sp ret_from_exception: - move #0x2700,%sr /* disable intrs */ btst #5,%sp@(PT_SR) /* check if returning to kernel */ jeq Luser_return /* if so, skip resched, signals */ -#ifdef CONFIG_PREEMPT - movel %sp,%d1 /* get thread_info pointer */ - andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ - movel %d1,%a0 - movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ - andl #_TIF_NEED_RESCHED,%d1 - jeq Lkernel_return - - movel %a0@(TI_PREEMPTCOUNT),%d1 - cmpl #0,%d1 - jne Lkernel_return - - pea Lkernel_return - jmp preempt_schedule_irq /* preempt the kernel */ -#endif - Lkernel_return: moveml %sp@,%d1-%d5/%a0-%a2 lea %sp@(32),%sp /* space for 8 regs */ @@ -157,7 +140,6 @@ Lreturn: Lwork_to_do: movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ - move #0x2000,%sr /* enable intrs again */ btst #TIF_NEED_RESCHED,%d1 jne reschedule diff --git a/trunk/arch/mips/kernel/binfmt_elfn32.c b/trunk/arch/mips/kernel/binfmt_elfn32.c index 9fdd8bcdd21e..77db3473deab 100644 --- a/trunk/arch/mips/kernel/binfmt_elfn32.c +++ b/trunk/arch/mips/kernel/binfmt_elfn32.c @@ -54,7 +54,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; #include #include #include -#include #define elf_prstatus elf_prstatus32 struct elf_prstatus32 @@ -103,8 +102,8 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) * one divide. */ u64 nsec = (u64)jiffies * TICK_NSEC; - u32 rem; - value->tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem); + long rem; + value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &rem); value->tv_usec = rem / NSEC_PER_USEC; } diff --git a/trunk/arch/mips/kernel/binfmt_elfo32.c b/trunk/arch/mips/kernel/binfmt_elfo32.c index e1333d7319e2..08f4cd781ee3 100644 --- a/trunk/arch/mips/kernel/binfmt_elfo32.c +++ b/trunk/arch/mips/kernel/binfmt_elfo32.c @@ -56,7 +56,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; #include #include #include -#include #define elf_prstatus elf_prstatus32 struct elf_prstatus32 @@ -105,8 +104,8 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) * one divide. */ u64 nsec = (u64)jiffies * TICK_NSEC; - u32 rem; - value->tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem); + long rem; + value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &rem); value->tv_usec = rem / NSEC_PER_USEC; } diff --git a/trunk/arch/powerpc/kernel/time.c b/trunk/arch/powerpc/kernel/time.c index 73401e83739a..3b26fbd6bec9 100644 --- a/trunk/arch/powerpc/kernel/time.c +++ b/trunk/arch/powerpc/kernel/time.c @@ -149,7 +149,7 @@ EXPORT_SYMBOL(tb_ticks_per_sec); /* for cputime_t conversions */ u64 tb_to_xs; unsigned tb_to_us; -#define TICKLEN_SCALE NTP_SCALE_SHIFT +#define TICKLEN_SCALE TICK_LENGTH_SHIFT u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */ u64 ticklen_to_xs; /* 0.64 fraction */ @@ -1007,6 +1007,8 @@ void __init time_init(void) vdso_data->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC; vdso_data->tb_to_xs = tb_to_xs; + time_freq = 0; + write_sequnlock_irqrestore(&xtime_lock, flags); /* Register the clocksource, if we're not running on iSeries */ diff --git a/trunk/arch/x86/Kconfig b/trunk/arch/x86/Kconfig index c3f880902d66..f70e3e3a9fa7 100644 --- a/trunk/arch/x86/Kconfig +++ b/trunk/arch/x86/Kconfig @@ -25,18 +25,6 @@ config X86 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) select HAVE_ARCH_KGDB if !X86_VOYAGER -config DEFCONFIG_LIST - string - depends on X86_32 - option defconfig_list - default "arch/x86/configs/i386_defconfig" - -config DEFCONFIG_LIST - string - depends on X86_64 - option defconfig_list - default "arch/x86/configs/x86_64_defconfig" - config GENERIC_LOCKBREAK def_bool n @@ -192,7 +180,7 @@ config X86_HT config X86_BIOS_REBOOT bool - depends on !X86_VISWS && !X86_VOYAGER + depends on X86_32 && !(X86_VISWS || X86_VOYAGER) default y config X86_TRAMPOLINE @@ -1173,7 +1161,7 @@ source kernel/Kconfig.hz config KEXEC bool "kexec system call" - depends on X86_BIOS_REBOOT + depends on X86_64 || X86_BIOS_REBOOT help kexec is a system call that implements the ability to shutdown your current kernel, and to start another kernel. It is like a reboot diff --git a/trunk/arch/x86/Kconfig.cpu b/trunk/arch/x86/Kconfig.cpu index 2ad6301849a1..7ef18b01f0bc 100644 --- a/trunk/arch/x86/Kconfig.cpu +++ b/trunk/arch/x86/Kconfig.cpu @@ -278,6 +278,11 @@ config GENERIC_CPU endchoice +config X86_CPU + def_bool y + select GENERIC_FIND_FIRST_BIT + select GENERIC_FIND_NEXT_BIT + config X86_GENERIC bool "Generic x86 support" depends on X86_32 @@ -292,11 +297,6 @@ config X86_GENERIC endif -config X86_CPU - def_bool y - select GENERIC_FIND_FIRST_BIT - select GENERIC_FIND_NEXT_BIT - # # Define implied options from the CPU selection here config X86_L1_CACHE_BYTES diff --git a/trunk/arch/x86/Kconfig.debug b/trunk/arch/x86/Kconfig.debug index ac1e31ba4795..5b1979a45a1e 100644 --- a/trunk/arch/x86/Kconfig.debug +++ b/trunk/arch/x86/Kconfig.debug @@ -118,6 +118,7 @@ config DEBUG_NX_TEST config 4KSTACKS bool "Use 4Kb for kernel stacks instead of 8Kb" depends on X86_32 + default y help If you say Y here the kernel will use a 4Kb stacksize for the kernel stack attached to each process/thread. This facilitates @@ -255,9 +256,11 @@ config CPA_DEBUG help Do change_page_attr() self-tests every 30 seconds. +endmenu + config OPTIMIZE_INLINING bool "Allow gcc to uninline functions marked 'inline'" - depends on BROKEN + default y help This option determines if the kernel forces gcc to inline the functions developers have marked 'inline'. Doing so takes away freedom from gcc to @@ -267,6 +270,3 @@ config OPTIMIZE_INLINING this algorithm is so good that allowing gcc4 to make the decision can become the default in the future, until then this option is there to test gcc for this. - -endmenu - diff --git a/trunk/arch/x86/kernel/Makefile b/trunk/arch/x86/kernel/Makefile index bbdacb398d48..30d54ed27e55 100644 --- a/trunk/arch/x86/kernel/Makefile +++ b/trunk/arch/x86/kernel/Makefile @@ -40,6 +40,7 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-y += cpu/ obj-y += acpi/ obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o +obj-$(CONFIG_X86_64) += reboot.o obj-$(CONFIG_MCA) += mca_32.o obj-$(CONFIG_X86_MSR) += msr.o obj-$(CONFIG_X86_CPUID) += cpuid.o diff --git a/trunk/arch/x86/kernel/genapic_64.c b/trunk/arch/x86/kernel/genapic_64.c index cbaaf69bedb2..021624c83583 100644 --- a/trunk/arch/x86/kernel/genapic_64.c +++ b/trunk/arch/x86/kernel/genapic_64.c @@ -83,7 +83,7 @@ unsigned int read_apic_id(void) { unsigned int id; - WARN_ON(preemptible() && num_online_cpus() > 1); + WARN_ON(preemptible()); id = apic_read(APIC_ID); if (uv_system_type >= UV_X2APIC) id |= __get_cpu_var(x2apic_extra_bits); diff --git a/trunk/arch/x86/kernel/head_32.S b/trunk/arch/x86/kernel/head_32.S index b2cc73768a9d..90f038af3adc 100644 --- a/trunk/arch/x86/kernel/head_32.S +++ b/trunk/arch/x86/kernel/head_32.S @@ -656,16 +656,15 @@ int_msg: .asciz "Unknown interrupt or fault at EIP %p %p %p\n" fault_msg: -/* fault info: */ - .ascii "BUG: Int %d: CR2 %p\n" -/* pusha regs: */ - .ascii " EDI %p ESI %p EBP %p ESP %p\n" - .ascii " EBX %p EDX %p ECX %p EAX %p\n" -/* fault frame: */ - .ascii " err %p EIP %p CS %p flg %p\n" - .ascii "Stack: %p %p %p %p %p %p %p %p\n" - .ascii " %p %p %p %p %p %p %p %p\n" - .asciz " %p %p %p %p %p %p %p %p\n" + .asciz \ +/* fault info: */ "BUG: Int %d: CR2 %p\n" \ +/* pusha regs: */ " EDI %p ESI %p EBP %p ESP %p\n" \ + " EBX %p EDX %p ECX %p EAX %p\n" \ +/* fault frame: */ " err %p EIP %p CS %p flg %p\n" \ + \ + "Stack: %p %p %p %p %p %p %p %p\n" \ + " %p %p %p %p %p %p %p %p\n" \ + " %p %p %p %p %p %p %p %p\n" #include "../../x86/xen/xen-head.S" diff --git a/trunk/arch/x86/kernel/hpet.c b/trunk/arch/x86/kernel/hpet.c index 9b5cfcdfc426..9007f9ea64ee 100644 --- a/trunk/arch/x86/kernel/hpet.c +++ b/trunk/arch/x86/kernel/hpet.c @@ -137,10 +137,9 @@ static void hpet_reserve_platform_timers(unsigned long id) hd.hd_irq[0] = HPET_LEGACY_8254; hd.hd_irq[1] = HPET_LEGACY_RTC; - for (i = 2; i < nrtimers; timer++, i++) { - hd.hd_irq[i] = (readl(&timer->hpet_config) & Tn_INT_ROUTE_CNF_MASK) >> + for (i = 2; i < nrtimers; timer++, i++) + hd.hd_irq[i] = (timer->hpet_config & Tn_INT_ROUTE_CNF_MASK) >> Tn_INT_ROUTE_CNF_SHIFT; - } hpet_alloc(&hd); diff --git a/trunk/arch/x86/kernel/pci-dma.c b/trunk/arch/x86/kernel/pci-dma.c index 0c37f16b6950..388b113a7d88 100644 --- a/trunk/arch/x86/kernel/pci-dma.c +++ b/trunk/arch/x86/kernel/pci-dma.c @@ -14,7 +14,7 @@ EXPORT_SYMBOL(forbid_dac); const struct dma_mapping_ops *dma_ops; EXPORT_SYMBOL(dma_ops); -static int iommu_sac_force __read_mostly; +int iommu_sac_force __read_mostly = 0; #ifdef CONFIG_IOMMU_DEBUG int panic_on_overflow __read_mostly = 1; diff --git a/trunk/arch/x86/kernel/reboot.c b/trunk/arch/x86/kernel/reboot.c index 07c6d42ab5ff..a4a838306b2c 100644 --- a/trunk/arch/x86/kernel/reboot.c +++ b/trunk/arch/x86/kernel/reboot.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include diff --git a/trunk/arch/x86/kvm/i8254.c b/trunk/arch/x86/kvm/i8254.c index 4c943eabacc3..361e31611276 100644 --- a/trunk/arch/x86/kvm/i8254.c +++ b/trunk/arch/x86/kvm/i8254.c @@ -35,7 +35,7 @@ #include "i8254.h" #ifndef CONFIG_X86_64 -#define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) +#define mod_64(x, y) ((x) - (y) * div64_64(x, y)) #else #define mod_64(x, y) ((x) % (y)) #endif @@ -60,8 +60,8 @@ static u64 muldiv64(u64 a, u32 b, u32 c) rl = (u64)u.l.low * (u64)b; rh = (u64)u.l.high * (u64)b; rh += (rl >> 32); - res.l.high = div64_u64(rh, c); - res.l.low = div64_u64(((mod_64(rh, c) << 32) + (rl & 0xffffffff)), c); + res.l.high = div64_64(rh, c); + res.l.low = div64_64(((mod_64(rh, c) << 32) + (rl & 0xffffffff)), c); return res.ll; } diff --git a/trunk/arch/x86/kvm/lapic.c b/trunk/arch/x86/kvm/lapic.c index 36809d79788b..57ac4e4c556a 100644 --- a/trunk/arch/x86/kvm/lapic.c +++ b/trunk/arch/x86/kvm/lapic.c @@ -25,13 +25,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include "irq.h" #define PRId64 "d" @@ -526,8 +526,8 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) } else passed = ktime_sub(now, apic->timer.last_update); - counter_passed = div64_u64(ktime_to_ns(passed), - (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); + counter_passed = div64_64(ktime_to_ns(passed), + (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); if (counter_passed > tmcct) { if (unlikely(!apic_lvtt_period(apic))) { diff --git a/trunk/arch/x86/mach-voyager/voyager_cat.c b/trunk/arch/x86/mach-voyager/voyager_cat.c index 2ad598c104af..ecab9fff0fd1 100644 --- a/trunk/arch/x86/mach-voyager/voyager_cat.c +++ b/trunk/arch/x86/mach-voyager/voyager_cat.c @@ -877,7 +877,7 @@ void __init voyager_cat_init(void) request_resource(&iomem_resource, res); } - qic_addr = (unsigned long)ioremap_cache(qic_addr, 0x400); + qic_addr = (unsigned long)ioremap(qic_addr, 0x400); for (j = 0; j < 4; j++) { __u8 cpu; diff --git a/trunk/arch/x86/mm/highmem_32.c b/trunk/arch/x86/mm/highmem_32.c index 165c871ba9af..9cf33d3ee5bc 100644 --- a/trunk/arch/x86/mm/highmem_32.c +++ b/trunk/arch/x86/mm/highmem_32.c @@ -155,3 +155,4 @@ EXPORT_SYMBOL(kmap); EXPORT_SYMBOL(kunmap); EXPORT_SYMBOL(kmap_atomic); EXPORT_SYMBOL(kunmap_atomic); +EXPORT_SYMBOL(kmap_atomic_to_page); diff --git a/trunk/arch/x86/mm/ioremap.c b/trunk/arch/x86/mm/ioremap.c index 71bb3159031a..804de18abcc2 100644 --- a/trunk/arch/x86/mm/ioremap.c +++ b/trunk/arch/x86/mm/ioremap.c @@ -149,8 +149,7 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, * Don't allow anybody to remap normal RAM that we're using.. */ for (pfn = phys_addr >> PAGE_SHIFT; - (pfn << PAGE_SHIFT) < (last_addr & PAGE_MASK); - pfn++) { + (pfn << PAGE_SHIFT) < last_addr; pfn++) { int is_ram = page_is_ram(pfn); @@ -177,11 +176,11 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, /* * Do not fallback to certain memory types with certain * requested type: - * - request is uc-, return cannot be write-back - * - request is uc-, return cannot be write-combine + * - request is uncached, return cannot be write-back + * - request is uncached, return cannot be write-combine * - request is write-combine, return cannot be write-back */ - if ((prot_val == _PAGE_CACHE_UC_MINUS && + if ((prot_val == _PAGE_CACHE_UC && (new_prot_val == _PAGE_CACHE_WB || new_prot_val == _PAGE_CACHE_WC)) || (prot_val == _PAGE_CACHE_WC && @@ -202,9 +201,6 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, default: prot = PAGE_KERNEL_NOCACHE; break; - case _PAGE_CACHE_UC_MINUS: - prot = PAGE_KERNEL_UC_MINUS; - break; case _PAGE_CACHE_WC: prot = PAGE_KERNEL_WC; break; @@ -259,16 +255,7 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, */ void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size) { - /* - * Ideally, this should be: - * pat_wc_enabled ? _PAGE_CACHE_UC : _PAGE_CACHE_UC_MINUS; - * - * Till we fix all X drivers to use ioremap_wc(), we will use - * UC MINUS. - */ - unsigned long val = _PAGE_CACHE_UC_MINUS; - - return __ioremap_caller(phys_addr, size, val, + return __ioremap_caller(phys_addr, size, _PAGE_CACHE_UC, __builtin_return_address(0)); } EXPORT_SYMBOL(ioremap_nocache); diff --git a/trunk/arch/x86/mm/pageattr.c b/trunk/arch/x86/mm/pageattr.c index 60bcb5b6a37e..bd5e05c654dc 100644 --- a/trunk/arch/x86/mm/pageattr.c +++ b/trunk/arch/x86/mm/pageattr.c @@ -777,20 +777,14 @@ static inline int change_page_attr_clear(unsigned long addr, int numpages, int _set_memory_uc(unsigned long addr, int numpages) { - /* - * for now UC MINUS. see comments in ioremap_nocache() - */ return change_page_attr_set(addr, numpages, - __pgprot(_PAGE_CACHE_UC_MINUS)); + __pgprot(_PAGE_CACHE_UC)); } int set_memory_uc(unsigned long addr, int numpages) { - /* - * for now UC MINUS. see comments in ioremap_nocache() - */ if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, - _PAGE_CACHE_UC_MINUS, NULL)) + _PAGE_CACHE_UC, NULL)) return -EINVAL; return _set_memory_uc(addr, numpages); diff --git a/trunk/arch/x86/pci/Makefile_32 b/trunk/arch/x86/pci/Makefile_32 index 7fa519868d70..2a1516efb542 100644 --- a/trunk/arch/x86/pci/Makefile_32 +++ b/trunk/arch/x86/pci/Makefile_32 @@ -9,8 +9,8 @@ pci-y := fixup.o pci-$(CONFIG_ACPI) += acpi.o pci-y += legacy.o irq.o -pci-$(CONFIG_X86_VISWS) += visws.o fixup.o -pci-$(CONFIG_X86_NUMAQ) += numa.o irq.o +pci-$(CONFIG_X86_VISWS) := visws.o fixup.o +pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o pci-$(CONFIG_NUMA) += mp_bus_to_node.o obj-y += $(pci-y) common.o early.o diff --git a/trunk/arch/x86/pci/i386.c b/trunk/arch/x86/pci/i386.c index 8af0f0bae2af..94f6c73a53d0 100644 --- a/trunk/arch/x86/pci/i386.c +++ b/trunk/arch/x86/pci/i386.c @@ -301,13 +301,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, prot = pgprot_val(vma->vm_page_prot); if (pat_wc_enabled && write_combine) prot |= _PAGE_CACHE_WC; - else if (pat_wc_enabled) - /* - * ioremap() and ioremap_nocache() defaults to UC MINUS for now. - * To avoid attribute conflicts, request UC MINUS here - * aswell. - */ - prot |= _PAGE_CACHE_UC_MINUS; else if (boot_cpu_data.x86 > 3) prot |= _PAGE_CACHE_UC; @@ -326,8 +319,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, * - request is uncached, return cannot be write-combine * - request is write-combine, return cannot be write-back */ - if ((flags == _PAGE_CACHE_UC_MINUS && - (new_flags == _PAGE_CACHE_WB)) || + if ((flags == _PAGE_CACHE_UC && + (new_flags == _PAGE_CACHE_WB || + new_flags == _PAGE_CACHE_WC)) || (flags == _PAGE_CACHE_WC && new_flags == _PAGE_CACHE_WB)) { free_memtype(addr, addr+len); diff --git a/trunk/arch/x86/vdso/vdso32-setup.c b/trunk/arch/x86/vdso/vdso32-setup.c index 4dceeb1fc5e0..e2af8eee80e3 100644 --- a/trunk/arch/x86/vdso/vdso32-setup.c +++ b/trunk/arch/x86/vdso/vdso32-setup.c @@ -303,6 +303,8 @@ int __init sysenter_setup(void) #ifdef CONFIG_X86_32 gate_vma_init(); + + printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO)); #endif if (!vdso32_sysenter()) { diff --git a/trunk/block/blk-barrier.c b/trunk/block/blk-barrier.c index a09ead19f9c5..66e55288178c 100644 --- a/trunk/block/blk-barrier.c +++ b/trunk/block/blk-barrier.c @@ -26,7 +26,8 @@ int blk_queue_ordered(struct request_queue *q, unsigned ordered, { if (ordered & (QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH) && prepare_flush_fn == NULL) { - printk(KERN_ERR "%s: prepare_flush_fn required\n", __func__); + printk(KERN_ERR "%s: prepare_flush_fn required\n", + __FUNCTION__); return -EINVAL; } diff --git a/trunk/block/blk-core.c b/trunk/block/blk-core.c index b754a4a2f9bd..5d09f8c56024 100644 --- a/trunk/block/blk-core.c +++ b/trunk/block/blk-core.c @@ -136,7 +136,7 @@ static void req_bio_endio(struct request *rq, struct bio *bio, if (unlikely(nbytes > bio->bi_size)) { printk(KERN_ERR "%s: want %u bytes done, %u left\n", - __func__, nbytes, bio->bi_size); + __FUNCTION__, nbytes, bio->bi_size); nbytes = bio->bi_size; } @@ -1566,7 +1566,8 @@ static int __end_that_request_first(struct request *req, int error, if (unlikely(bio->bi_idx >= bio->bi_vcnt)) { blk_dump_rq_flags(req, "__end_that"); printk(KERN_ERR "%s: bio idx %d >= vcnt %d\n", - __func__, bio->bi_idx, bio->bi_vcnt); + __FUNCTION__, bio->bi_idx, + bio->bi_vcnt); break; } diff --git a/trunk/block/blk-settings.c b/trunk/block/blk-settings.c index bb93d4c32775..6089384ab064 100644 --- a/trunk/block/blk-settings.c +++ b/trunk/block/blk-settings.c @@ -168,8 +168,8 @@ void blk_queue_max_sectors(struct request_queue *q, unsigned int max_sectors) { if ((max_sectors << 9) < PAGE_CACHE_SIZE) { max_sectors = 1 << (PAGE_CACHE_SHIFT - 9); - printk(KERN_INFO "%s: set to minimum %d\n", - __func__, max_sectors); + printk(KERN_INFO "%s: set to minimum %d\n", __FUNCTION__, + max_sectors); } if (BLK_DEF_MAX_SECTORS > max_sectors) @@ -196,8 +196,8 @@ void blk_queue_max_phys_segments(struct request_queue *q, { if (!max_segments) { max_segments = 1; - printk(KERN_INFO "%s: set to minimum %d\n", - __func__, max_segments); + printk(KERN_INFO "%s: set to minimum %d\n", __FUNCTION__, + max_segments); } q->max_phys_segments = max_segments; @@ -220,8 +220,8 @@ void blk_queue_max_hw_segments(struct request_queue *q, { if (!max_segments) { max_segments = 1; - printk(KERN_INFO "%s: set to minimum %d\n", - __func__, max_segments); + printk(KERN_INFO "%s: set to minimum %d\n", __FUNCTION__, + max_segments); } q->max_hw_segments = max_segments; @@ -241,8 +241,8 @@ void blk_queue_max_segment_size(struct request_queue *q, unsigned int max_size) { if (max_size < PAGE_CACHE_SIZE) { max_size = PAGE_CACHE_SIZE; - printk(KERN_INFO "%s: set to minimum %d\n", - __func__, max_size); + printk(KERN_INFO "%s: set to minimum %d\n", __FUNCTION__, + max_size); } q->max_segment_size = max_size; @@ -357,8 +357,8 @@ void blk_queue_segment_boundary(struct request_queue *q, unsigned long mask) { if (mask < PAGE_CACHE_SIZE - 1) { mask = PAGE_CACHE_SIZE - 1; - printk(KERN_INFO "%s: set to minimum %lx\n", - __func__, mask); + printk(KERN_INFO "%s: set to minimum %lx\n", __FUNCTION__, + mask); } q->seg_boundary_mask = mask; diff --git a/trunk/block/blk-tag.c b/trunk/block/blk-tag.c index de64e0429977..e176ddbe599e 100644 --- a/trunk/block/blk-tag.c +++ b/trunk/block/blk-tag.c @@ -112,7 +112,7 @@ init_tag_map(struct request_queue *q, struct blk_queue_tag *tags, int depth) if (q && depth > q->nr_requests * 2) { depth = q->nr_requests * 2; printk(KERN_ERR "%s: adjusted depth to %d\n", - __func__, depth); + __FUNCTION__, depth); } tag_index = kzalloc(depth * sizeof(struct request *), GFP_ATOMIC); @@ -296,13 +296,13 @@ void blk_queue_end_tag(struct request_queue *q, struct request *rq) if (unlikely(bqt->tag_index[tag] == NULL)) printk(KERN_ERR "%s: tag %d is missing\n", - __func__, tag); + __FUNCTION__, tag); bqt->tag_index[tag] = NULL; if (unlikely(!test_bit(tag, bqt->tag_map))) { printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n", - __func__, tag); + __FUNCTION__, tag); return; } /* @@ -340,7 +340,7 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq) if (unlikely((rq->cmd_flags & REQ_QUEUED))) { printk(KERN_ERR "%s: request %p for device [%s] already tagged %d", - __func__, rq, + __FUNCTION__, rq, rq->rq_disk ? rq->rq_disk->disk_name : "?", rq->tag); BUG(); } diff --git a/trunk/block/bsg.c b/trunk/block/bsg.c index fa796b605f55..23ea4fd1a66d 100644 --- a/trunk/block/bsg.c +++ b/trunk/block/bsg.c @@ -57,7 +57,7 @@ enum { #undef BSG_DEBUG #ifdef BSG_DEBUG -#define dprintk(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ##args) +#define dprintk(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ##args) #else #define dprintk(fmt, args...) #endif diff --git a/trunk/block/elevator.c b/trunk/block/elevator.c index 980f8ae147b4..ac5310ef8270 100644 --- a/trunk/block/elevator.c +++ b/trunk/block/elevator.c @@ -650,7 +650,7 @@ void elv_insert(struct request_queue *q, struct request *rq, int where) default: printk(KERN_ERR "%s: bad insertion point %d\n", - __func__, where); + __FUNCTION__, where); BUG(); } @@ -808,7 +808,8 @@ struct request *elv_next_request(struct request_queue *q) rq->cmd_flags |= REQ_QUIET; end_queued_request(rq, 0); } else { - printk(KERN_ERR "%s: bad return=%d\n", __func__, ret); + printk(KERN_ERR "%s: bad return=%d\n", __FUNCTION__, + ret); break; } } diff --git a/trunk/crypto/authenc.c b/trunk/crypto/authenc.c index 4b226768752a..ed8ac5a6fa5f 100644 --- a/trunk/crypto/authenc.c +++ b/trunk/crypto/authenc.c @@ -217,10 +217,9 @@ static void crypto_authenc_givencrypt_done(struct crypto_async_request *req, int err) { if (!err) { - struct aead_request *areq = req->data; - struct skcipher_givcrypt_request *greq = aead_request_ctx(areq); + struct aead_givcrypt_request *greq = req->data; - err = crypto_authenc_genicv(areq, greq->giv, 0); + err = crypto_authenc_genicv(&greq->areq, greq->giv, 0); } aead_request_complete(req->data, err); diff --git a/trunk/crypto/cryptd.c b/trunk/crypto/cryptd.c index b150de562057..250425263e00 100644 --- a/trunk/crypto/cryptd.c +++ b/trunk/crypto/cryptd.c @@ -190,10 +190,8 @@ static struct crypto_instance *cryptd_alloc_instance(struct crypto_alg *alg, int err; inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL); - if (!inst) { - inst = ERR_PTR(-ENOMEM); + if (IS_ERR(inst)) goto out; - } err = -ENAMETOOLONG; if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, diff --git a/trunk/crypto/eseqiv.c b/trunk/crypto/eseqiv.c index 881d30910434..b14f14e314b6 100644 --- a/trunk/crypto/eseqiv.c +++ b/trunk/crypto/eseqiv.c @@ -136,8 +136,7 @@ static int eseqiv_givencrypt(struct skcipher_givcrypt_request *req) } ablkcipher_request_set_crypt(subreq, reqctx->src, dst, - req->creq.nbytes + ivsize, - req->creq.info); + req->creq.nbytes, req->creq.info); memcpy(req->creq.info, ctx->salt, ivsize); diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index 5e5dda3a3027..f7eb12e55602 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -1070,7 +1070,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) device_dir->owner = THIS_MODULE; /* 'info' [R] */ - entry = proc_create_data("info", S_IRUGO, device_dir, + entry = proc_create_data("info", S_IRUGO, acpi_device_dir(device), &acpi_video_device_info_fops, acpi_driver_data(device)); if (!entry) goto err_remove_dir; @@ -1078,7 +1078,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) /* 'state' [R/W] */ acpi_video_device_state_fops.write = acpi_video_device_write_state; entry = proc_create_data("state", S_IFREG | S_IRUGO | S_IWUSR, - device_dir, + acpi_device_dir(device), &acpi_video_device_state_fops, acpi_driver_data(device)); if (!entry) @@ -1088,21 +1088,19 @@ static int acpi_video_device_add_fs(struct acpi_device *device) acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; entry = proc_create_data("brightness", S_IFREG | S_IRUGO | S_IWUSR, - device_dir, + acpi_device_dir(device), &acpi_video_device_brightness_fops, acpi_driver_data(device)); if (!entry) goto err_remove_state; /* 'EDID' [R] */ - entry = proc_create_data("EDID", S_IRUGO, device_dir, + entry = proc_create_data("EDID", S_IRUGO, acpi_device_dir(device), &acpi_video_device_EDID_fops, acpi_driver_data(device)); if (!entry) goto err_remove_brightness; - acpi_device_dir(device) = device_dir; - return 0; err_remove_brightness: @@ -1348,21 +1346,21 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) device_dir->owner = THIS_MODULE; /* 'info' [R] */ - entry = proc_create_data("info", S_IRUGO, device_dir, + entry = proc_create_data("info", S_IRUGO, acpi_device_dir(device), &acpi_video_bus_info_fops, acpi_driver_data(device)); if (!entry) goto err_remove_dir; /* 'ROM' [R] */ - entry = proc_create_data("ROM", S_IRUGO, device_dir, + entry = proc_create_data("ROM", S_IRUGO, acpi_device_dir(device), &acpi_video_bus_ROM_fops, acpi_driver_data(device)); if (!entry) goto err_remove_info; /* 'POST_info' [R] */ - entry = proc_create_data("POST_info", S_IRUGO, device_dir, + entry = proc_create_data("POST_info", S_IRUGO, acpi_device_dir(device), &acpi_video_bus_POST_info_fops, acpi_driver_data(device)); if (!entry) @@ -1371,7 +1369,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) /* 'POST' [R/W] */ acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; entry = proc_create_data("POST", S_IFREG | S_IRUGO | S_IWUSR, - device_dir, + acpi_device_dir(device), &acpi_video_bus_POST_fops, acpi_driver_data(device)); if (!entry) @@ -1380,7 +1378,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) /* 'DOS' [R/W] */ acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; entry = proc_create_data("DOS", S_IFREG | S_IRUGO | S_IWUSR, - device_dir, + acpi_device_dir(device), &acpi_video_bus_DOS_fops, acpi_driver_data(device)); if (!entry) diff --git a/trunk/drivers/base/base.h b/trunk/drivers/base/base.h index 2c9ae43e2219..c0444146c09a 100644 --- a/trunk/drivers/base/base.h +++ b/trunk/drivers/base/base.h @@ -64,6 +64,17 @@ extern void sysdev_shutdown(void); extern int sysdev_suspend(pm_message_t state); extern int sysdev_resume(void); +static inline struct class_device *to_class_dev(struct kobject *obj) +{ + return container_of(obj, struct class_device, kobj); +} + +static inline +struct class_device_attribute *to_class_dev_attr(struct attribute *_attr) +{ + return container_of(_attr, struct class_device_attribute, attr); +} + extern char *make_class_name(const char *name, struct kobject *kobj); extern int devres_release_all(struct device *dev); diff --git a/trunk/drivers/base/class.c b/trunk/drivers/base/class.c index 0ef00e8d4153..b4901799308b 100644 --- a/trunk/drivers/base/class.c +++ b/trunk/drivers/base/class.c @@ -179,13 +179,27 @@ static void class_create_release(struct class *cls) kfree(cls); } +static void class_device_create_release(struct class_device *class_dev) +{ + pr_debug("%s called for %s\n", __func__, class_dev->class_id); + kfree(class_dev); +} + +/* needed to allow these devices to have parent class devices */ +static int class_device_create_uevent(struct class_device *class_dev, + struct kobj_uevent_env *env) +{ + pr_debug("%s called for %s\n", __func__, class_dev->class_id); + return 0; +} + /** * class_create - create a struct class structure * @owner: pointer to the module that is to "own" this struct class * @name: pointer to a string for the name of this class. * * This is used to create a struct class pointer that can then be used - * in calls to device_create(). + * in calls to class_device_create(). * * Note, the pointer created here is to be destroyed when finished by * making a call to class_destroy(). @@ -204,6 +218,7 @@ struct class *class_create(struct module *owner, const char *name) cls->name = name; cls->owner = owner; cls->class_release = class_create_release; + cls->release = class_device_create_release; retval = class_register(cls); if (retval) @@ -231,6 +246,113 @@ void class_destroy(struct class *cls) class_unregister(cls); } +/* Class Device Stuff */ + +int class_device_create_file(struct class_device *class_dev, + const struct class_device_attribute *attr) +{ + int error = -EINVAL; + if (class_dev) + error = sysfs_create_file(&class_dev->kobj, &attr->attr); + return error; +} + +void class_device_remove_file(struct class_device *class_dev, + const struct class_device_attribute *attr) +{ + if (class_dev) + sysfs_remove_file(&class_dev->kobj, &attr->attr); +} + +int class_device_create_bin_file(struct class_device *class_dev, + struct bin_attribute *attr) +{ + int error = -EINVAL; + if (class_dev) + error = sysfs_create_bin_file(&class_dev->kobj, attr); + return error; +} + +void class_device_remove_bin_file(struct class_device *class_dev, + struct bin_attribute *attr) +{ + if (class_dev) + sysfs_remove_bin_file(&class_dev->kobj, attr); +} + +static ssize_t class_device_attr_show(struct kobject *kobj, + struct attribute *attr, char *buf) +{ + struct class_device_attribute *class_dev_attr = to_class_dev_attr(attr); + struct class_device *cd = to_class_dev(kobj); + ssize_t ret = 0; + + if (class_dev_attr->show) + ret = class_dev_attr->show(cd, buf); + return ret; +} + +static ssize_t class_device_attr_store(struct kobject *kobj, + struct attribute *attr, + const char *buf, size_t count) +{ + struct class_device_attribute *class_dev_attr = to_class_dev_attr(attr); + struct class_device *cd = to_class_dev(kobj); + ssize_t ret = 0; + + if (class_dev_attr->store) + ret = class_dev_attr->store(cd, buf, count); + return ret; +} + +static struct sysfs_ops class_dev_sysfs_ops = { + .show = class_device_attr_show, + .store = class_device_attr_store, +}; + +static void class_dev_release(struct kobject *kobj) +{ + struct class_device *cd = to_class_dev(kobj); + struct class *cls = cd->class; + + pr_debug("device class '%s': release.\n", cd->class_id); + + if (cd->release) + cd->release(cd); + else if (cls->release) + cls->release(cd); + else { + printk(KERN_ERR "Class Device '%s' does not have a release() " + "function, it is broken and must be fixed.\n", + cd->class_id); + WARN_ON(1); + } +} + +static struct kobj_type class_device_ktype = { + .sysfs_ops = &class_dev_sysfs_ops, + .release = class_dev_release, +}; + +static int class_uevent_filter(struct kset *kset, struct kobject *kobj) +{ + struct kobj_type *ktype = get_ktype(kobj); + + if (ktype == &class_device_ktype) { + struct class_device *class_dev = to_class_dev(kobj); + if (class_dev->class) + return 1; + } + return 0; +} + +static const char *class_uevent_name(struct kset *kset, struct kobject *kobj) +{ + struct class_device *class_dev = to_class_dev(kobj); + + return class_dev->class->name; +} + #ifdef CONFIG_SYSFS_DEPRECATED char *make_class_name(const char *name, struct kobject *kobj) { @@ -248,8 +370,445 @@ char *make_class_name(const char *name, struct kobject *kobj) strcat(class_name, kobject_name(kobj)); return class_name; } + +static int make_deprecated_class_device_links(struct class_device *class_dev) +{ + char *class_name; + int error; + + if (!class_dev->dev) + return 0; + + class_name = make_class_name(class_dev->class->name, &class_dev->kobj); + if (class_name) + error = sysfs_create_link(&class_dev->dev->kobj, + &class_dev->kobj, class_name); + else + error = -ENOMEM; + kfree(class_name); + return error; +} + +static void remove_deprecated_class_device_links(struct class_device *class_dev) +{ + char *class_name; + + if (!class_dev->dev) + return; + + class_name = make_class_name(class_dev->class->name, &class_dev->kobj); + if (class_name) + sysfs_remove_link(&class_dev->dev->kobj, class_name); + kfree(class_name); +} +#else +static inline int make_deprecated_class_device_links(struct class_device *cd) +{ return 0; } +static void remove_deprecated_class_device_links(struct class_device *cd) +{ } #endif +static int class_uevent(struct kset *kset, struct kobject *kobj, + struct kobj_uevent_env *env) +{ + struct class_device *class_dev = to_class_dev(kobj); + struct device *dev = class_dev->dev; + int retval = 0; + + pr_debug("%s - name = %s\n", __func__, class_dev->class_id); + + if (MAJOR(class_dev->devt)) { + add_uevent_var(env, "MAJOR=%u", MAJOR(class_dev->devt)); + + add_uevent_var(env, "MINOR=%u", MINOR(class_dev->devt)); + } + + if (dev) { + const char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); + if (path) { + add_uevent_var(env, "PHYSDEVPATH=%s", path); + kfree(path); + } + + if (dev->bus) + add_uevent_var(env, "PHYSDEVBUS=%s", dev->bus->name); + + if (dev->driver) + add_uevent_var(env, "PHYSDEVDRIVER=%s", + dev->driver->name); + } + + if (class_dev->uevent) { + /* have the class device specific function add its stuff */ + retval = class_dev->uevent(class_dev, env); + if (retval) + pr_debug("class_dev->uevent() returned %d\n", retval); + } else if (class_dev->class->uevent) { + /* have the class specific function add its stuff */ + retval = class_dev->class->uevent(class_dev, env); + if (retval) + pr_debug("class->uevent() returned %d\n", retval); + } + + return retval; +} + +static struct kset_uevent_ops class_uevent_ops = { + .filter = class_uevent_filter, + .name = class_uevent_name, + .uevent = class_uevent, +}; + +/* + * DO NOT copy how this is created, kset_create_and_add() should be + * called, but this is a hold-over from the old-way and will be deleted + * entirely soon. + */ +static struct kset class_obj_subsys = { + .uevent_ops = &class_uevent_ops, +}; + +static int class_device_add_attrs(struct class_device *cd) +{ + int i; + int error = 0; + struct class *cls = cd->class; + + if (cls->class_dev_attrs) { + for (i = 0; attr_name(cls->class_dev_attrs[i]); i++) { + error = class_device_create_file(cd, + &cls->class_dev_attrs[i]); + if (error) + goto err; + } + } +done: + return error; +err: + while (--i >= 0) + class_device_remove_file(cd, &cls->class_dev_attrs[i]); + goto done; +} + +static void class_device_remove_attrs(struct class_device *cd) +{ + int i; + struct class *cls = cd->class; + + if (cls->class_dev_attrs) { + for (i = 0; attr_name(cls->class_dev_attrs[i]); i++) + class_device_remove_file(cd, &cls->class_dev_attrs[i]); + } +} + +static int class_device_add_groups(struct class_device *cd) +{ + int i; + int error = 0; + + if (cd->groups) { + for (i = 0; cd->groups[i]; i++) { + error = sysfs_create_group(&cd->kobj, cd->groups[i]); + if (error) { + while (--i >= 0) + sysfs_remove_group(&cd->kobj, + cd->groups[i]); + goto out; + } + } + } +out: + return error; +} + +static void class_device_remove_groups(struct class_device *cd) +{ + int i; + if (cd->groups) + for (i = 0; cd->groups[i]; i++) + sysfs_remove_group(&cd->kobj, cd->groups[i]); +} + +static ssize_t show_dev(struct class_device *class_dev, char *buf) +{ + return print_dev_t(buf, class_dev->devt); +} + +static struct class_device_attribute class_devt_attr = + __ATTR(dev, S_IRUGO, show_dev, NULL); + +static ssize_t store_uevent(struct class_device *class_dev, + const char *buf, size_t count) +{ + kobject_uevent(&class_dev->kobj, KOBJ_ADD); + return count; +} + +static struct class_device_attribute class_uevent_attr = + __ATTR(uevent, S_IWUSR, NULL, store_uevent); + +void class_device_initialize(struct class_device *class_dev) +{ + class_dev->kobj.kset = &class_obj_subsys; + kobject_init(&class_dev->kobj, &class_device_ktype); + INIT_LIST_HEAD(&class_dev->node); +} + +int class_device_add(struct class_device *class_dev) +{ + struct class *parent_class = NULL; + struct class_device *parent_class_dev = NULL; + struct class_interface *class_intf; + int error = -EINVAL; + + class_dev = class_device_get(class_dev); + if (!class_dev) + return -EINVAL; + + if (!strlen(class_dev->class_id)) + goto out1; + + parent_class = class_get(class_dev->class); + if (!parent_class) + goto out1; + + parent_class_dev = class_device_get(class_dev->parent); + + pr_debug("CLASS: registering class device: ID = '%s'\n", + class_dev->class_id); + + /* first, register with generic layer. */ + if (parent_class_dev) + class_dev->kobj.parent = &parent_class_dev->kobj; + else + class_dev->kobj.parent = &parent_class->subsys.kobj; + + error = kobject_add(&class_dev->kobj, class_dev->kobj.parent, + "%s", class_dev->class_id); + if (error) + goto out2; + + /* add the needed attributes to this device */ + error = sysfs_create_link(&class_dev->kobj, + &parent_class->subsys.kobj, "subsystem"); + if (error) + goto out3; + + error = class_device_create_file(class_dev, &class_uevent_attr); + if (error) + goto out3; + + if (MAJOR(class_dev->devt)) { + error = class_device_create_file(class_dev, &class_devt_attr); + if (error) + goto out4; + } + + error = class_device_add_attrs(class_dev); + if (error) + goto out5; + + if (class_dev->dev) { + error = sysfs_create_link(&class_dev->kobj, + &class_dev->dev->kobj, "device"); + if (error) + goto out6; + } + + error = class_device_add_groups(class_dev); + if (error) + goto out7; + + error = make_deprecated_class_device_links(class_dev); + if (error) + goto out8; + + kobject_uevent(&class_dev->kobj, KOBJ_ADD); + + /* notify any interfaces this device is now here */ + down(&parent_class->sem); + list_add_tail(&class_dev->node, &parent_class->children); + list_for_each_entry(class_intf, &parent_class->interfaces, node) { + if (class_intf->add) + class_intf->add(class_dev, class_intf); + } + up(&parent_class->sem); + + goto out1; + + out8: + class_device_remove_groups(class_dev); + out7: + if (class_dev->dev) + sysfs_remove_link(&class_dev->kobj, "device"); + out6: + class_device_remove_attrs(class_dev); + out5: + if (MAJOR(class_dev->devt)) + class_device_remove_file(class_dev, &class_devt_attr); + out4: + class_device_remove_file(class_dev, &class_uevent_attr); + out3: + kobject_del(&class_dev->kobj); + out2: + if (parent_class_dev) + class_device_put(parent_class_dev); + class_put(parent_class); + out1: + class_device_put(class_dev); + return error; +} + +int class_device_register(struct class_device *class_dev) +{ + class_device_initialize(class_dev); + return class_device_add(class_dev); +} + +/** + * class_device_create - creates a class device and registers it with sysfs + * @cls: pointer to the struct class that this device should be registered to. + * @parent: pointer to the parent struct class_device of this new device, if + * any. + * @devt: the dev_t for the char device to be added. + * @device: a pointer to a struct device that is assiociated with this class + * device. + * @fmt: string for the class device's name + * + * This function can be used by char device classes. A struct + * class_device will be created in sysfs, registered to the specified + * class. + * A "dev" file will be created, showing the dev_t for the device, if + * the dev_t is not 0,0. + * If a pointer to a parent struct class_device is passed in, the newly + * created struct class_device will be a child of that device in sysfs. + * The pointer to the struct class_device will be returned from the + * call. Any further sysfs files that might be required can be created + * using this pointer. + * + * Note: the struct class passed to this function must have previously + * been created with a call to class_create(). + */ +struct class_device *class_device_create(struct class *cls, + struct class_device *parent, + dev_t devt, + struct device *device, + const char *fmt, ...) +{ + va_list args; + struct class_device *class_dev = NULL; + int retval = -ENODEV; + + if (cls == NULL || IS_ERR(cls)) + goto error; + + class_dev = kzalloc(sizeof(*class_dev), GFP_KERNEL); + if (!class_dev) { + retval = -ENOMEM; + goto error; + } + + class_dev->devt = devt; + class_dev->dev = device; + class_dev->class = cls; + class_dev->parent = parent; + class_dev->release = class_device_create_release; + class_dev->uevent = class_device_create_uevent; + + va_start(args, fmt); + vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args); + va_end(args); + retval = class_device_register(class_dev); + if (retval) + goto error; + + return class_dev; + +error: + kfree(class_dev); + return ERR_PTR(retval); +} + +void class_device_del(struct class_device *class_dev) +{ + struct class *parent_class = class_dev->class; + struct class_device *parent_device = class_dev->parent; + struct class_interface *class_intf; + + if (parent_class) { + down(&parent_class->sem); + list_del_init(&class_dev->node); + list_for_each_entry(class_intf, &parent_class->interfaces, node) + if (class_intf->remove) + class_intf->remove(class_dev, class_intf); + up(&parent_class->sem); + } + + if (class_dev->dev) { + remove_deprecated_class_device_links(class_dev); + sysfs_remove_link(&class_dev->kobj, "device"); + } + sysfs_remove_link(&class_dev->kobj, "subsystem"); + class_device_remove_file(class_dev, &class_uevent_attr); + if (MAJOR(class_dev->devt)) + class_device_remove_file(class_dev, &class_devt_attr); + class_device_remove_attrs(class_dev); + class_device_remove_groups(class_dev); + + kobject_uevent(&class_dev->kobj, KOBJ_REMOVE); + kobject_del(&class_dev->kobj); + + class_device_put(parent_device); + class_put(parent_class); +} + +void class_device_unregister(struct class_device *class_dev) +{ + pr_debug("CLASS: Unregistering class device. ID = '%s'\n", + class_dev->class_id); + class_device_del(class_dev); + class_device_put(class_dev); +} + +/** + * class_device_destroy - removes a class device that was created with class_device_create() + * @cls: the pointer to the struct class that this device was registered * with. + * @devt: the dev_t of the device that was previously registered. + * + * This call unregisters and cleans up a class device that was created with a + * call to class_device_create() + */ +void class_device_destroy(struct class *cls, dev_t devt) +{ + struct class_device *class_dev = NULL; + struct class_device *class_dev_tmp; + + down(&cls->sem); + list_for_each_entry(class_dev_tmp, &cls->children, node) { + if (class_dev_tmp->devt == devt) { + class_dev = class_dev_tmp; + break; + } + } + up(&cls->sem); + + if (class_dev) + class_device_unregister(class_dev); +} + +struct class_device *class_device_get(struct class_device *class_dev) +{ + if (class_dev) + return to_class_dev(kobject_get(&class_dev->kobj)); + return NULL; +} + +void class_device_put(struct class_device *class_dev) +{ + if (class_dev) + kobject_put(&class_dev->kobj); +} + /** * class_for_each_device - device iterator * @class: the class we're iterating @@ -338,9 +897,56 @@ struct device *class_find_device(struct class *class, void *data, } EXPORT_SYMBOL_GPL(class_find_device); +/** + * class_find_child - device iterator for locating a particular class_device + * @class: the class we're iterating + * @data: data for the match function + * @match: function to check class_device + * + * This function returns a reference to a class_device that is 'found' for + * later use, as determined by the @match callback. + * + * The callback should return 0 if the class_device doesn't match and non-zero + * if it does. If the callback returns non-zero, this function will + * return to the caller and not iterate over any more class_devices. + * + * Note, you will need to drop the reference with class_device_put() after use. + * + * We hold class->sem in this function, so it can not be + * re-acquired in @match, otherwise it will self-deadlocking. For + * example, calls to add or remove class members would be verboten. + */ +struct class_device *class_find_child(struct class *class, void *data, + int (*match)(struct class_device *, void *)) +{ + struct class_device *dev; + int found = 0; + + if (!class) + return NULL; + + down(&class->sem); + list_for_each_entry(dev, &class->children, node) { + dev = class_device_get(dev); + if (dev) { + if (match(dev, data)) { + found = 1; + break; + } else + class_device_put(dev); + } else + break; + } + up(&class->sem); + + return found ? dev : NULL; +} +EXPORT_SYMBOL_GPL(class_find_child); + int class_interface_register(struct class_interface *class_intf) { struct class *parent; + struct class_device *class_dev; struct device *dev; if (!class_intf || !class_intf->class) @@ -352,6 +958,10 @@ int class_interface_register(struct class_interface *class_intf) down(&parent->sem); list_add_tail(&class_intf->node, &parent->interfaces); + if (class_intf->add) { + list_for_each_entry(class_dev, &parent->children, node) + class_intf->add(class_dev, class_intf); + } if (class_intf->add_dev) { list_for_each_entry(dev, &parent->devices, node) class_intf->add_dev(dev, class_intf); @@ -364,6 +974,7 @@ int class_interface_register(struct class_interface *class_intf) void class_interface_unregister(struct class_interface *class_intf) { struct class *parent = class_intf->class; + struct class_device *class_dev; struct device *dev; if (!parent) @@ -371,6 +982,10 @@ void class_interface_unregister(struct class_interface *class_intf) down(&parent->sem); list_del_init(&class_intf->node); + if (class_intf->remove) { + list_for_each_entry(class_dev, &parent->children, node) + class_intf->remove(class_dev, class_intf); + } if (class_intf->remove_dev) { list_for_each_entry(dev, &parent->devices, node) class_intf->remove_dev(dev, class_intf); @@ -385,6 +1000,13 @@ int __init classes_init(void) class_kset = kset_create_and_add("class", NULL, NULL); if (!class_kset) return -ENOMEM; + + /* ick, this is ugly, the things we go through to keep from showing up + * in sysfs... */ + kset_init(&class_obj_subsys); + kobject_set_name(&class_obj_subsys.kobj, "class_obj"); + if (!class_obj_subsys.kobj.parent) + class_obj_subsys.kobj.parent = &class_obj_subsys.kobj; return 0; } @@ -395,5 +1017,19 @@ EXPORT_SYMBOL_GPL(class_unregister); EXPORT_SYMBOL_GPL(class_create); EXPORT_SYMBOL_GPL(class_destroy); +EXPORT_SYMBOL_GPL(class_device_register); +EXPORT_SYMBOL_GPL(class_device_unregister); +EXPORT_SYMBOL_GPL(class_device_initialize); +EXPORT_SYMBOL_GPL(class_device_add); +EXPORT_SYMBOL_GPL(class_device_del); +EXPORT_SYMBOL_GPL(class_device_get); +EXPORT_SYMBOL_GPL(class_device_put); +EXPORT_SYMBOL_GPL(class_device_create); +EXPORT_SYMBOL_GPL(class_device_destroy); +EXPORT_SYMBOL_GPL(class_device_create_file); +EXPORT_SYMBOL_GPL(class_device_remove_file); +EXPORT_SYMBOL_GPL(class_device_create_bin_file); +EXPORT_SYMBOL_GPL(class_device_remove_bin_file); + EXPORT_SYMBOL_GPL(class_interface_register); EXPORT_SYMBOL_GPL(class_interface_unregister); diff --git a/trunk/drivers/base/cpu.c b/trunk/drivers/base/cpu.c index e38dfed41d80..6fe417429977 100644 --- a/trunk/drivers/base/cpu.c +++ b/trunk/drivers/base/cpu.c @@ -18,7 +18,7 @@ struct sysdev_class cpu_sysdev_class = { }; EXPORT_SYMBOL(cpu_sysdev_class); -static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices); +static struct sys_device *cpu_sys_devices[NR_CPUS]; #ifdef CONFIG_HOTPLUG_CPU static ssize_t show_online(struct sys_device *dev, char *buf) @@ -68,7 +68,7 @@ void unregister_cpu(struct cpu *cpu) sysdev_remove_file(&cpu->sysdev, &attr_online); sysdev_unregister(&cpu->sysdev); - per_cpu(cpu_sys_devices, logical_cpu) = NULL; + cpu_sys_devices[logical_cpu] = NULL; return; } #else /* ... !CONFIG_HOTPLUG_CPU */ @@ -167,7 +167,7 @@ int __cpuinit register_cpu(struct cpu *cpu, int num) if (!error && cpu->hotpluggable) register_cpu_control(cpu); if (!error) - per_cpu(cpu_sys_devices, num) = &cpu->sysdev; + cpu_sys_devices[num] = &cpu->sysdev; if (!error) register_cpu_under_node(num, cpu_to_node(num)); @@ -180,8 +180,8 @@ int __cpuinit register_cpu(struct cpu *cpu, int num) struct sys_device *get_cpu_sysdev(unsigned cpu) { - if (cpu < nr_cpu_ids && cpu_possible(cpu)) - return per_cpu(cpu_sys_devices, cpu); + if (cpu < NR_CPUS) + return cpu_sys_devices[cpu]; else return NULL; } diff --git a/trunk/drivers/base/driver.c b/trunk/drivers/base/driver.c index 2ef5acf4368b..9a6537f14401 100644 --- a/trunk/drivers/base/driver.c +++ b/trunk/drivers/base/driver.c @@ -217,22 +217,12 @@ static void driver_remove_groups(struct device_driver *drv, int driver_register(struct device_driver *drv) { int ret; - struct device_driver *other; if ((drv->bus->probe && drv->probe) || (drv->bus->remove && drv->remove) || (drv->bus->shutdown && drv->shutdown)) printk(KERN_WARNING "Driver '%s' needs updating - please use " "bus_type methods\n", drv->name); - - other = driver_find(drv->name, drv->bus); - if (other) { - put_driver(other); - printk(KERN_ERR "Error: Driver '%s' is already registered, " - "aborting...\n", drv->name); - return -EEXIST; - } - ret = bus_add_driver(drv); if (ret) return ret; diff --git a/trunk/drivers/block/cciss.c b/trunk/drivers/block/cciss.c index e336b05fe4a7..e539be5750dc 100644 --- a/trunk/drivers/block/cciss.c +++ b/trunk/drivers/block/cciss.c @@ -428,9 +428,13 @@ static void __devinit cciss_procinit(int i) proc_cciss = proc_mkdir("driver/cciss", NULL); if (!proc_cciss) return; - pde = proc_create_data(hba[i]->devname, S_IWUSR | S_IRUSR | S_IRGRP | + pde = proc_create(hba[i]->devname, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH, proc_cciss, - &cciss_proc_fops, hba[i]); + &cciss_proc_fops); + if (!pde) + return; + + pde->data = hba[i]; } #endif /* CONFIG_PROC_FS */ diff --git a/trunk/drivers/char/i8k.c b/trunk/drivers/char/i8k.c index b60d425ce8d1..f49037b744f9 100644 --- a/trunk/drivers/char/i8k.c +++ b/trunk/drivers/char/i8k.c @@ -77,10 +77,6 @@ static int power_status; module_param(power_status, bool, 0600); MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); -static int fan_mult = I8K_FAN_MULT; -module_param(fan_mult, int, 0); -MODULE_PARM_DESC(fan_mult, "Factor to multiply fan speed with"); - static int i8k_open_fs(struct inode *inode, struct file *file); static int i8k_ioctl(struct inode *, struct file *, unsigned int, unsigned long); @@ -243,7 +239,7 @@ static int i8k_get_fan_speed(int fan) struct smm_regs regs = { .eax = I8K_SMM_GET_SPEED, }; regs.ebx = fan & 0xff; - return i8k_smm(®s) ? : (regs.eax & 0xffff) * fan_mult; + return i8k_smm(®s) ? : (regs.eax & 0xffff) * I8K_FAN_MULT; } /* diff --git a/trunk/drivers/char/mmtimer.c b/trunk/drivers/char/mmtimer.c index 192961fd7173..d83db5d880e0 100644 --- a/trunk/drivers/char/mmtimer.c +++ b/trunk/drivers/char/mmtimer.c @@ -30,8 +30,6 @@ #include #include #include -#include -#include #include #include @@ -474,8 +472,8 @@ static int sgi_clock_get(clockid_t clockid, struct timespec *tp) nsec = rtc_time() * sgi_clock_period + sgi_clock_offset.tv_nsec; - *tp = ns_to_timespec(nsec); - tp->tv_sec += sgi_clock_offset.tv_sec; + tp->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tp->tv_nsec) + + sgi_clock_offset.tv_sec; return 0; }; @@ -483,11 +481,11 @@ static int sgi_clock_set(clockid_t clockid, struct timespec *tp) { u64 nsec; - u32 rem; + u64 rem; nsec = rtc_time() * sgi_clock_period; - sgi_clock_offset.tv_sec = tp->tv_sec - div_u64_rem(nsec, NSEC_PER_SEC, &rem); + sgi_clock_offset.tv_sec = tp->tv_sec - div_long_long_rem(nsec, NSEC_PER_SEC, &rem); if (rem <= tp->tv_nsec) sgi_clock_offset.tv_nsec = tp->tv_sec - rem; @@ -646,6 +644,9 @@ static int sgi_timer_del(struct k_itimer *timr) return 0; } +#define timespec_to_ns(x) ((x).tv_nsec + (x).tv_sec * NSEC_PER_SEC) +#define ns_to_timespec(ts, nsec) (ts).tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &(ts).tv_nsec) + /* Assumption: it_lock is already held with irq's disabled */ static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) { @@ -658,8 +659,9 @@ static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) return; } - cur_setting->it_interval = ns_to_timespec(timr->it.mmtimer.incr * sgi_clock_period); - cur_setting->it_value = ns_to_timespec((timr->it.mmtimer.expires - rtc_time()) * sgi_clock_period); + ns_to_timespec(cur_setting->it_interval, timr->it.mmtimer.incr * sgi_clock_period); + ns_to_timespec(cur_setting->it_value, (timr->it.mmtimer.expires - rtc_time())* sgi_clock_period); + return; } @@ -677,8 +679,8 @@ static int sgi_timer_set(struct k_itimer *timr, int flags, sgi_timer_get(timr, old_setting); sgi_timer_del(timr); - when = timespec_to_ns(&new_setting->it_value); - period = timespec_to_ns(&new_setting->it_interval); + when = timespec_to_ns(new_setting->it_value); + period = timespec_to_ns(new_setting->it_interval); if (when == 0) /* Clear timer */ @@ -693,7 +695,7 @@ static int sgi_timer_set(struct k_itimer *timr, int flags, unsigned long now; getnstimeofday(&n); - now = timespec_to_ns(&n); + now = timespec_to_ns(n); if (when > now) when -= now; else diff --git a/trunk/drivers/char/synclink.c b/trunk/drivers/char/synclink.c index ac5080df2565..513b7c2f3e26 100644 --- a/trunk/drivers/char/synclink.c +++ b/trunk/drivers/char/synclink.c @@ -2028,13 +2028,13 @@ static void mgsl_change_params(struct mgsl_struct *info) */ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) { - struct mgsl_struct *info = tty->driver_data; + struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; unsigned long flags; - int ret = 0; + int ret; - if (debug_level >= DEBUG_LEVEL_INFO) { - printk(KERN_DEBUG "%s(%d):mgsl_put_char(%d) on %s\n", - __FILE__, __LINE__, ch, info->device_name); + if ( debug_level >= DEBUG_LEVEL_INFO ) { + printk( "%s(%d):mgsl_put_char(%d) on %s\n", + __FILE__,__LINE__,ch,info->device_name); } if (mgsl_paranoia_check(info, tty->name, "mgsl_put_char")) @@ -2043,9 +2043,9 @@ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) if (!tty || !info->xmit_buf) return 0; - spin_lock_irqsave(&info->irq_spinlock, flags); + spin_lock_irqsave(&info->irq_spinlock,flags); - if ((info->params.mode == MGSL_MODE_ASYNC ) || !info->tx_active) { + if ( (info->params.mode == MGSL_MODE_ASYNC ) || !info->tx_active ) { if (info->xmit_cnt < SERIAL_XMIT_SIZE - 1) { info->xmit_buf[info->xmit_head++] = ch; info->xmit_head &= SERIAL_XMIT_SIZE-1; @@ -2053,7 +2053,7 @@ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) ret = 1; } } - spin_unlock_irqrestore(&info->irq_spinlock, flags); + spin_unlock_irqrestore(&info->irq_spinlock,flags); return ret; } /* end of mgsl_put_char() */ diff --git a/trunk/drivers/char/toshiba.c b/trunk/drivers/char/toshiba.c index 663cd15d7c78..64f1ceed0b2c 100644 --- a/trunk/drivers/char/toshiba.c +++ b/trunk/drivers/char/toshiba.c @@ -426,7 +426,7 @@ static int tosh_probe(void) int i,major,minor,day,year,month,flag; unsigned char signature[7] = { 0x54,0x4f,0x53,0x48,0x49,0x42,0x41 }; SMMRegisters regs; - void __iomem *bios = ioremap_cache(0xf0000, 0x10000); + void __iomem *bios = ioremap(0xf0000, 0x10000); if (!bios) return -ENOMEM; diff --git a/trunk/drivers/firewire/fw-sbp2.c b/trunk/drivers/firewire/fw-sbp2.c index 62e3c9190983..2a999373863e 100644 --- a/trunk/drivers/firewire/fw-sbp2.c +++ b/trunk/drivers/firewire/fw-sbp2.c @@ -784,7 +784,7 @@ static void sbp2_release_target(struct kref *kref) kfree(lu); } scsi_remove_host(shost); - fw_notify("released %s, target %d:0:0\n", tgt->bus_id, shost->host_no); + fw_notify("released %s\n", tgt->bus_id); fw_unit_put(tgt->unit); scsi_host_put(shost); diff --git a/trunk/drivers/gpio/pca953x.c b/trunk/drivers/gpio/pca953x.c index 93f916720b13..5a99e81d2784 100644 --- a/trunk/drivers/gpio/pca953x.c +++ b/trunk/drivers/gpio/pca953x.c @@ -30,8 +30,6 @@ static const struct i2c_device_id pca953x_id[] = { { "pca9537", 4, }, { "pca9538", 8, }, { "pca9539", 16, }, - { "pca9555", 16, }, - { "pca9557", 8, }, /* REVISIT several pca955x parts should work here too */ { } }; @@ -195,7 +193,7 @@ static int __devinit pca953x_probe(struct i2c_client *client, { struct pca953x_platform_data *pdata; struct pca953x_chip *chip; - int ret; + int ret, i; pdata = client->dev.platform_data; if (pdata == NULL) diff --git a/trunk/drivers/hwmon/adt7473.c b/trunk/drivers/hwmon/adt7473.c index c1009d6f9796..9587869bdba0 100644 --- a/trunk/drivers/hwmon/adt7473.c +++ b/trunk/drivers/hwmon/adt7473.c @@ -422,14 +422,18 @@ static ssize_t show_volt(struct device *dev, struct device_attribute *devattr, * number in the range -128 to 127, or as an unsigned number that must * be offset by 64. */ -static int decode_temp(u8 twos_complement, u8 raw) +static int decode_temp(struct adt7473_data *data, u8 raw) { - return twos_complement ? (s8)raw : raw - 64; + if (data->temp_twos_complement) + return (s8)raw; + return raw - 64; } -static u8 encode_temp(u8 twos_complement, int cooked) +static u8 encode_temp(struct adt7473_data *data, int cooked) { - return twos_complement ? cooked & 0xFF : cooked + 64; + if (data->temp_twos_complement) + return (cooked & 0xFF); + return cooked + 64; } static ssize_t show_temp_min(struct device *dev, @@ -438,9 +442,8 @@ static ssize_t show_temp_min(struct device *dev, { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct adt7473_data *data = adt7473_update_device(dev); - return sprintf(buf, "%d\n", 1000 * decode_temp( - data->temp_twos_complement, - data->temp_min[attr->index])); + return sprintf(buf, "%d\n", + 1000 * decode_temp(data, data->temp_min[attr->index])); } static ssize_t set_temp_min(struct device *dev, @@ -452,7 +455,7 @@ static ssize_t set_temp_min(struct device *dev, struct i2c_client *client = to_i2c_client(dev); struct adt7473_data *data = i2c_get_clientdata(client); int temp = simple_strtol(buf, NULL, 10) / 1000; - temp = encode_temp(data->temp_twos_complement, temp); + temp = encode_temp(data, temp); mutex_lock(&data->lock); data->temp_min[attr->index] = temp; @@ -469,9 +472,8 @@ static ssize_t show_temp_max(struct device *dev, { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct adt7473_data *data = adt7473_update_device(dev); - return sprintf(buf, "%d\n", 1000 * decode_temp( - data->temp_twos_complement, - data->temp_max[attr->index])); + return sprintf(buf, "%d\n", + 1000 * decode_temp(data, data->temp_max[attr->index])); } static ssize_t set_temp_max(struct device *dev, @@ -483,7 +485,7 @@ static ssize_t set_temp_max(struct device *dev, struct i2c_client *client = to_i2c_client(dev); struct adt7473_data *data = i2c_get_clientdata(client); int temp = simple_strtol(buf, NULL, 10) / 1000; - temp = encode_temp(data->temp_twos_complement, temp); + temp = encode_temp(data, temp); mutex_lock(&data->lock); data->temp_max[attr->index] = temp; @@ -499,9 +501,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct adt7473_data *data = adt7473_update_device(dev); - return sprintf(buf, "%d\n", 1000 * decode_temp( - data->temp_twos_complement, - data->temp[attr->index])); + return sprintf(buf, "%d\n", + 1000 * decode_temp(data, data->temp[attr->index])); } static ssize_t show_fan_min(struct device *dev, @@ -670,9 +671,8 @@ static ssize_t show_temp_tmax(struct device *dev, { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct adt7473_data *data = adt7473_update_device(dev); - return sprintf(buf, "%d\n", 1000 * decode_temp( - data->temp_twos_complement, - data->temp_tmax[attr->index])); + return sprintf(buf, "%d\n", + 1000 * decode_temp(data, data->temp_tmax[attr->index])); } static ssize_t set_temp_tmax(struct device *dev, @@ -684,7 +684,7 @@ static ssize_t set_temp_tmax(struct device *dev, struct i2c_client *client = to_i2c_client(dev); struct adt7473_data *data = i2c_get_clientdata(client); int temp = simple_strtol(buf, NULL, 10) / 1000; - temp = encode_temp(data->temp_twos_complement, temp); + temp = encode_temp(data, temp); mutex_lock(&data->lock); data->temp_tmax[attr->index] = temp; @@ -701,9 +701,8 @@ static ssize_t show_temp_tmin(struct device *dev, { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct adt7473_data *data = adt7473_update_device(dev); - return sprintf(buf, "%d\n", 1000 * decode_temp( - data->temp_twos_complement, - data->temp_tmin[attr->index])); + return sprintf(buf, "%d\n", + 1000 * decode_temp(data, data->temp_tmin[attr->index])); } static ssize_t set_temp_tmin(struct device *dev, @@ -715,7 +714,7 @@ static ssize_t set_temp_tmin(struct device *dev, struct i2c_client *client = to_i2c_client(dev); struct adt7473_data *data = i2c_get_clientdata(client); int temp = simple_strtol(buf, NULL, 10) / 1000; - temp = encode_temp(data->temp_twos_complement, temp); + temp = encode_temp(data, temp); mutex_lock(&data->lock); data->temp_tmin[attr->index] = temp; diff --git a/trunk/drivers/hwmon/asb100.c b/trunk/drivers/hwmon/asb100.c index fe2eea4d799b..84712a22acea 100644 --- a/trunk/drivers/hwmon/asb100.c +++ b/trunk/drivers/hwmon/asb100.c @@ -953,8 +953,12 @@ static void asb100_write_value(struct i2c_client *client, u16 reg, u16 value) static void asb100_init_client(struct i2c_client *client) { struct asb100_data *data = i2c_get_clientdata(client); + int vid = 0; + vid = asb100_read_value(client, ASB100_REG_VID_FANDIV) & 0x0f; + vid |= (asb100_read_value(client, ASB100_REG_CHIPID) & 0x01) << 4; data->vrm = vid_which_vrm(); + vid = vid_from_reg(vid, data->vrm); /* Start monitoring */ asb100_write_value(client, ASB100_REG_CONFIG, diff --git a/trunk/drivers/hwmon/lm75.c b/trunk/drivers/hwmon/lm75.c index fa7696905154..115f4090b98e 100644 --- a/trunk/drivers/hwmon/lm75.c +++ b/trunk/drivers/hwmon/lm75.c @@ -248,7 +248,7 @@ static int lm75_detach_client(struct i2c_client *client) /* All registers are word-sized, except for the configuration register. LM75 uses a high-byte first convention, which is exactly opposite to - the SMBus standard. */ + the usual practice. */ static int lm75_read_value(struct i2c_client *client, u8 reg) { if (reg == LM75_REG_CONF) @@ -257,6 +257,9 @@ static int lm75_read_value(struct i2c_client *client, u8 reg) return swab16(i2c_smbus_read_word_data(client, reg)); } +/* All registers are word-sized, except for the configuration register. + LM75 uses a high-byte first convention, which is exactly opposite to + the usual practice. */ static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) { if (reg == LM75_REG_CONF) diff --git a/trunk/drivers/hwmon/smsc47b397.c b/trunk/drivers/hwmon/smsc47b397.c index eb03544c731c..f61d8f4185b2 100644 --- a/trunk/drivers/hwmon/smsc47b397.c +++ b/trunk/drivers/hwmon/smsc47b397.c @@ -335,23 +335,11 @@ static int __init smsc47b397_device_add(unsigned short address) static int __init smsc47b397_find(unsigned short *addr) { u8 id, rev; - char *name; superio_enter(); id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); - switch(id) { - case 0x81: - name = "SCH5307-NS"; - break; - case 0x6f: - name = "LPC47B397-NC"; - break; - case 0x85: - case 0x8c: - name = "SCH5317"; - break; - default: + if ((id != 0x6f) && (id != 0x81) && (id != 0x85)) { superio_exit(); return -ENODEV; } @@ -364,7 +352,8 @@ static int __init smsc47b397_find(unsigned short *addr) printk(KERN_INFO DRVNAME ": found SMSC %s " "(base address 0x%04x, revision %u)\n", - name, *addr, rev); + id == 0x81 ? "SCH5307-NS" : id == 0x85 ? "SCH5317" : + "LPC47B397-NC", *addr, rev); superio_exit(); return 0; diff --git a/trunk/drivers/hwmon/w83793.c b/trunk/drivers/hwmon/w83793.c index ed3c019b78c7..ee35af93b574 100644 --- a/trunk/drivers/hwmon/w83793.c +++ b/trunk/drivers/hwmon/w83793.c @@ -1024,9 +1024,10 @@ static struct sensor_device_attribute_2 w83793_vid[] = { SENSOR_ATTR_2(cpu0_vid, S_IRUGO, show_vid, NULL, NOT_USED, 0), SENSOR_ATTR_2(cpu1_vid, S_IRUGO, show_vid, NULL, NOT_USED, 1), }; -static DEVICE_ATTR(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm); static struct sensor_device_attribute_2 sda_single_files[] = { + SENSOR_ATTR_2(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm, + NOT_USED, NOT_USED), SENSOR_ATTR_2(chassis, S_IWUSR | S_IRUGO, show_alarm_beep, store_chassis_clear, ALARM_STATUS, 30), SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_beep_enable, @@ -1079,7 +1080,6 @@ static int w83793_detach_client(struct i2c_client *client) for (i = 0; i < ARRAY_SIZE(w83793_vid); i++) device_remove_file(dev, &w83793_vid[i].dev_attr); - device_remove_file(dev, &dev_attr_vrm); for (i = 0; i < ARRAY_SIZE(w83793_left_fan); i++) device_remove_file(dev, &w83793_left_fan[i].dev_attr); @@ -1282,6 +1282,7 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) /* Initialize the chip */ w83793_init_client(client); + data->vrm = vid_which_vrm(); /* Only fan 1-5 has their own input pins, Pwm 1-3 has their own pins @@ -1292,9 +1293,7 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) val = w83793_read_value(client, W83793_REG_FANIN_CTRL); /* check the function of pins 49-56 */ - if (tmp & 0x80) { - data->has_vid |= 0x2; /* has VIDB */ - } else { + if (!(tmp & 0x80)) { data->has_pwm |= 0x18; /* pwm 4,5 */ if (val & 0x01) { /* fan 6 */ data->has_fan |= 0x20; @@ -1310,15 +1309,13 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) } } - /* check the function of pins 37-40 */ - if (!(tmp & 0x29)) - data->has_vid |= 0x1; /* has VIDA */ if (0x08 == (tmp & 0x0c)) { if (val & 0x08) /* fan 9 */ data->has_fan |= 0x100; if (val & 0x10) /* fan 10 */ data->has_fan |= 0x200; } + if (0x20 == (tmp & 0x30)) { if (val & 0x20) /* fan 11 */ data->has_fan |= 0x400; @@ -1362,6 +1359,13 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) if (tmp & 0x02) data->has_temp |= 0x20; + /* Detect the VID usage and ignore unused input */ + tmp = w83793_read_value(client, W83793_REG_MFC); + if (!(tmp & 0x29)) + data->has_vid |= 0x1; /* has VIDA */ + if (tmp & 0x80) + data->has_vid |= 0x2; /* has VIDB */ + /* Register sysfs hooks */ for (i = 0; i < ARRAY_SIZE(w83793_sensor_attr_2); i++) { err = device_create_file(dev, @@ -1377,12 +1381,6 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) if (err) goto exit_remove; } - if (data->has_vid) { - data->vrm = vid_which_vrm(); - err = device_create_file(dev, &dev_attr_vrm); - if (err) - goto exit_remove; - } for (i = 0; i < ARRAY_SIZE(sda_single_files); i++) { err = device_create_file(dev, &sda_single_files[i].dev_attr); diff --git a/trunk/drivers/hwmon/w83l785ts.c b/trunk/drivers/hwmon/w83l785ts.c index 52e268e25dab..77f2d482888b 100644 --- a/trunk/drivers/hwmon/w83l785ts.c +++ b/trunk/drivers/hwmon/w83l785ts.c @@ -301,8 +301,8 @@ static u8 w83l785ts_read_value(struct i2c_client *client, u8 reg, u8 defval) msleep(i); } - dev_err(&client->dev, "Couldn't read value from register 0x%02x.\n", - reg); + dev_err(&client->dev, "Couldn't read value from register 0x%02x. " + "Please report.\n", reg); return defval; } diff --git a/trunk/drivers/ide/ide-probe.c b/trunk/drivers/ide/ide-probe.c index 591deda3f86a..099a0fe1745b 100644 --- a/trunk/drivers/ide/ide-probe.c +++ b/trunk/drivers/ide/ide-probe.c @@ -1347,8 +1347,7 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) hwif->irq = port ? 15 : 14; - /* ->host_flags may be set by ->init_iops (or even earlier...) */ - hwif->host_flags |= d->host_flags; + hwif->host_flags = d->host_flags; hwif->pio_mask = d->pio_mask; /* ->set_pio_mode for DTC2278 is currently limited to port 0 */ diff --git a/trunk/drivers/ieee1394/nodemgr.c b/trunk/drivers/ieee1394/nodemgr.c index 05710c7c1220..29d833e71cbf 100644 --- a/trunk/drivers/ieee1394/nodemgr.c +++ b/trunk/drivers/ieee1394/nodemgr.c @@ -520,11 +520,8 @@ static ssize_t fw_show_drv_device_ids(struct device_driver *drv, char *buf) char *scratch = buf; driver = container_of(drv, struct hpsb_protocol_driver, driver); - id = driver->id_table; - if (!id) - return 0; - for (; id->match_flags != 0; id++) { + for (id = driver->id_table; id->match_flags != 0; id++) { int need_coma = 0; if (id->match_flags & IEEE1394_MATCH_VENDOR_ID) { diff --git a/trunk/drivers/isdn/hysdn/hysdn_procconf.c b/trunk/drivers/isdn/hysdn/hysdn_procconf.c index 15906d005b05..877be9922c3d 100644 --- a/trunk/drivers/isdn/hysdn/hysdn_procconf.c +++ b/trunk/drivers/isdn/hysdn/hysdn_procconf.c @@ -405,8 +405,7 @@ hysdn_procconf_init(void) sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid); if ((card->procconf = (void *) proc_create(conf_name, S_IFREG | S_IRUGO | S_IWUSR, - hysdn_proc_entry, - &conf_fops)) != NULL) { + hysdn_proc_entry)) != NULL) { hysdn_proclog_init(card); /* init the log file entry */ } card = card->next; /* next entry */ diff --git a/trunk/drivers/mtd/chips/cfi_cmdset_0001.c b/trunk/drivers/mtd/chips/cfi_cmdset_0001.c index fcd1aeccdf93..e812df607a5c 100644 --- a/trunk/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/trunk/drivers/mtd/chips/cfi_cmdset_0001.c @@ -82,8 +82,9 @@ static struct mtd_info *cfi_intelext_setup (struct mtd_info *); static int cfi_intelext_partition_fixup(struct mtd_info *, struct cfi_private **); static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys); -static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len); + size_t *retlen, u_char **mtdbuf); +static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, + size_t len); static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long adr, int mode); static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode); @@ -1239,8 +1240,7 @@ static int do_point_onechip (struct map_info *map, struct flchip *chip, loff_t a return ret; } -static int cfi_intelext_point(struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys) +static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf) { struct map_info *map = mtd->priv; struct cfi_private *cfi = map->fldrv_priv; @@ -1257,10 +1257,8 @@ static int cfi_intelext_point(struct mtd_info *mtd, loff_t from, size_t len, chipnum = (from >> cfi->chipshift); ofs = from - (chipnum << cfi->chipshift); - *virt = map->virt + cfi->chips[chipnum].start + ofs; + *mtdbuf = (void *)map->virt + cfi->chips[chipnum].start + ofs; *retlen = 0; - if (phys) - *phys = map->phys + cfi->chips[chipnum].start + ofs; while (len) { unsigned long thislen; @@ -1293,7 +1291,7 @@ static int cfi_intelext_point(struct mtd_info *mtd, loff_t from, size_t len, return 0; } -static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len) +static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) { struct map_info *map = mtd->priv; struct cfi_private *cfi = map->fldrv_priv; diff --git a/trunk/drivers/mtd/devices/mtdram.c b/trunk/drivers/mtd/devices/mtdram.c index 0399be178620..bf485ff49457 100644 --- a/trunk/drivers/mtd/devices/mtdram.c +++ b/trunk/drivers/mtd/devices/mtdram.c @@ -48,21 +48,18 @@ static int ram_erase(struct mtd_info *mtd, struct erase_info *instr) } static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys) + size_t *retlen, u_char **mtdbuf) { if (from + len > mtd->size) return -EINVAL; - /* can we return a physical address with this driver? */ - if (phys) - return -EINVAL; - - *virt = mtd->priv + from; + *mtdbuf = mtd->priv + from; *retlen = len; return 0; } -static void ram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) +static void ram_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, + size_t len) { } diff --git a/trunk/drivers/mtd/devices/phram.c b/trunk/drivers/mtd/devices/phram.c index c7987b1c5e01..5f960182da95 100644 --- a/trunk/drivers/mtd/devices/phram.c +++ b/trunk/drivers/mtd/devices/phram.c @@ -57,21 +57,20 @@ static int phram_erase(struct mtd_info *mtd, struct erase_info *instr) } static int phram_point(struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys) + size_t *retlen, u_char **mtdbuf) { - if (from + len > mtd->size) - return -EINVAL; + u_char *start = mtd->priv; - /* can we return a physical address with this driver? */ - if (phys) + if (from + len > mtd->size) return -EINVAL; - *virt = mtd->priv + from; + *mtdbuf = start + from; *retlen = len; return 0; } -static void phram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) +static void phram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, + size_t len) { } diff --git a/trunk/drivers/mtd/devices/pmc551.c b/trunk/drivers/mtd/devices/pmc551.c index bc9981749064..7060a0895ce2 100644 --- a/trunk/drivers/mtd/devices/pmc551.c +++ b/trunk/drivers/mtd/devices/pmc551.c @@ -134,8 +134,7 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) eoff_lo = end & (priv->asize - 1); soff_lo = instr->addr & (priv->asize - 1); - pmc551_point(mtd, instr->addr, instr->len, &retlen, - (void **)&ptr, NULL); + pmc551_point(mtd, instr->addr, instr->len, &retlen, &ptr); if (soff_hi == eoff_hi || mtd->size == priv->asize) { /* The whole thing fits within one access, so just one shot @@ -155,8 +154,7 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) } soff_hi += priv->asize; pmc551_point(mtd, (priv->base_map0 | soff_hi), - priv->asize, &retlen, - (void **)&ptr, NULL); + priv->asize, &retlen, &ptr); } memset(ptr, 0xff, eoff_lo); } @@ -172,7 +170,7 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) } static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys) + size_t * retlen, u_char ** mtdbuf) { struct mypriv *priv = mtd->priv; u32 soff_hi; @@ -190,10 +188,6 @@ static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, return -EINVAL; } - /* can we return a physical address with this driver? */ - if (phys) - return -EINVAL; - soff_hi = from & ~(priv->asize - 1); soff_lo = from & (priv->asize - 1); @@ -204,12 +198,13 @@ static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, priv->curr_map0 = soff_hi; } - *virt = priv->start + soff_lo; + *mtdbuf = priv->start + soff_lo; *retlen = len; return 0; } -static void pmc551_unpoint(struct mtd_info *mtd, loff_t from, size_t len) +static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, + size_t len) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_unpoint()\n"); @@ -247,7 +242,7 @@ static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, soff_lo = from & (priv->asize - 1); eoff_lo = end & (priv->asize - 1); - pmc551_point(mtd, from, len, retlen, (void **)&ptr, NULL); + pmc551_point(mtd, from, len, retlen, &ptr); if (soff_hi == eoff_hi) { /* The whole thing fits within one access, so just one shot @@ -268,8 +263,7 @@ static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, goto out; } soff_hi += priv->asize; - pmc551_point(mtd, soff_hi, priv->asize, retlen, - (void **)&ptr, NULL); + pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr); } memcpy(copyto, ptr, eoff_lo); copyto += eoff_lo; @@ -314,7 +308,7 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, soff_lo = to & (priv->asize - 1); eoff_lo = end & (priv->asize - 1); - pmc551_point(mtd, to, len, retlen, (void **)&ptr, NULL); + pmc551_point(mtd, to, len, retlen, &ptr); if (soff_hi == eoff_hi) { /* The whole thing fits within one access, so just one shot @@ -335,8 +329,7 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, goto out; } soff_hi += priv->asize; - pmc551_point(mtd, soff_hi, priv->asize, retlen, - (void **)&ptr, NULL); + pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr); } memcpy(ptr, copyfrom, eoff_lo); copyfrom += eoff_lo; diff --git a/trunk/drivers/mtd/devices/slram.c b/trunk/drivers/mtd/devices/slram.c index cb86db746f28..d293add1857c 100644 --- a/trunk/drivers/mtd/devices/slram.c +++ b/trunk/drivers/mtd/devices/slram.c @@ -76,9 +76,8 @@ static char *map; static slram_mtd_list_t *slram_mtdlist = NULL; static int slram_erase(struct mtd_info *, struct erase_info *); -static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, void **, - resource_size_t *); -static void slram_unpoint(struct mtd_info *, loff_t, size_t); +static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, u_char **); +static void slram_unpoint(struct mtd_info *, u_char *, loff_t, size_t); static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); @@ -105,23 +104,19 @@ static int slram_erase(struct mtd_info *mtd, struct erase_info *instr) } static int slram_point(struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys) + size_t *retlen, u_char **mtdbuf) { slram_priv_t *priv = mtd->priv; - /* can we return a physical address with this driver? */ - if (phys) - return -EINVAL; - if (from + len > mtd->size) return -EINVAL; - *virt = priv->start + from; + *mtdbuf = priv->start + from; *retlen = len; return(0); } -static void slram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) +static void slram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) { } diff --git a/trunk/drivers/mtd/maps/uclinux.c b/trunk/drivers/mtd/maps/uclinux.c index c42f4b83f686..14ffb1a9302a 100644 --- a/trunk/drivers/mtd/maps/uclinux.c +++ b/trunk/drivers/mtd/maps/uclinux.c @@ -40,12 +40,10 @@ struct mtd_partition uclinux_romfs[] = { /****************************************************************************/ int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys) + size_t *retlen, u_char **mtdbuf) { struct map_info *map = mtd->priv; - *virt = map->virt + from; - if (phys) - *phys = map->phys + from; + *mtdbuf = (u_char *) (map->virt + ((int) from)); *retlen = len; return(0); } diff --git a/trunk/drivers/mtd/mtdpart.c b/trunk/drivers/mtd/mtdpart.c index 07c701169344..c66902df3171 100644 --- a/trunk/drivers/mtd/mtdpart.c +++ b/trunk/drivers/mtd/mtdpart.c @@ -68,7 +68,7 @@ static int part_read (struct mtd_info *mtd, loff_t from, size_t len, } static int part_point (struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys) + size_t *retlen, u_char **buf) { struct mtd_part *part = PART(mtd); if (from >= mtd->size) @@ -76,14 +76,14 @@ static int part_point (struct mtd_info *mtd, loff_t from, size_t len, else if (from + len > mtd->size) len = mtd->size - from; return part->master->point (part->master, from + part->offset, - len, retlen, virt, phys); + len, retlen, buf); } -static void part_unpoint(struct mtd_info *mtd, loff_t from, size_t len) +static void part_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) { struct mtd_part *part = PART(mtd); - part->master->unpoint(part->master, from + part->offset, len); + part->master->unpoint (part->master, addr, from + part->offset, len); } static int part_read_oob(struct mtd_info *mtd, loff_t from, diff --git a/trunk/drivers/mtd/nand/at91_nand.c b/trunk/drivers/mtd/nand/at91_nand.c index 0adb287027a2..414ceaecdb3a 100644 --- a/trunk/drivers/mtd/nand/at91_nand.c +++ b/trunk/drivers/mtd/nand/at91_nand.c @@ -93,24 +93,6 @@ struct at91_nand_host { void __iomem *ecc; }; -/* - * Enable NAND. - */ -static void at91_nand_enable(struct at91_nand_host *host) -{ - if (host->board->enable_pin) - at91_set_gpio_value(host->board->enable_pin, 0); -} - -/* - * Disable NAND. - */ -static void at91_nand_disable(struct at91_nand_host *host) -{ - if (host->board->enable_pin) - at91_set_gpio_value(host->board->enable_pin, 1); -} - /* * Hardware specific access to control-lines */ @@ -119,11 +101,11 @@ static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) struct nand_chip *nand_chip = mtd->priv; struct at91_nand_host *host = nand_chip->priv; - if (ctrl & NAND_CTRL_CHANGE) { + if (host->board->enable_pin && (ctrl & NAND_CTRL_CHANGE)) { if (ctrl & NAND_NCE) - at91_nand_enable(host); + at91_set_gpio_value(host->board->enable_pin, 0); else - at91_nand_disable(host); + at91_set_gpio_value(host->board->enable_pin, 1); } if (cmd == NAND_CMD_NONE) return; @@ -145,6 +127,24 @@ static int at91_nand_device_ready(struct mtd_info *mtd) return at91_get_gpio_value(host->board->rdy_pin); } +/* + * Enable NAND. + */ +static void at91_nand_enable(struct at91_nand_host *host) +{ + if (host->board->enable_pin) + at91_set_gpio_value(host->board->enable_pin, 0); +} + +/* + * Disable NAND. + */ +static void at91_nand_disable(struct at91_nand_host *host) +{ + if (host->board->enable_pin) + at91_set_gpio_value(host->board->enable_pin, 1); +} + /* * write oob for small pages */ diff --git a/trunk/drivers/net/fec.c b/trunk/drivers/net/fec.c index 32a4f17d35fc..d7a3ea88eddb 100644 --- a/trunk/drivers/net/fec.c +++ b/trunk/drivers/net/fec.c @@ -67,10 +67,6 @@ #define FEC_MAX_PORTS 1 #endif -#if defined(CONFIG_FADS) || defined(CONFIG_RPXCLASSIC) || defined(CONFIG_M5272) -#define HAVE_mii_link_interrupt -#endif - /* * Define the fixed address of the FEC hardware. */ @@ -209,10 +205,7 @@ struct fec_enet_private { cbd_t *cur_rx, *cur_tx; /* The next free ring entry */ cbd_t *dirty_tx; /* The ring entries to be free()ed. */ uint tx_full; - /* hold while accessing the HW like ringbuffer for tx/rx but not MAC */ - spinlock_t hw_lock; - /* hold while accessing the mii_list_t() elements */ - spinlock_t mii_lock; + spinlock_t lock; uint phy_id; uint phy_id_done; @@ -316,7 +309,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) volatile fec_t *fecp; volatile cbd_t *bdp; unsigned short status; - unsigned long flags; fep = netdev_priv(dev); fecp = (volatile fec_t*)dev->base_addr; @@ -326,7 +318,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) return 1; } - spin_lock_irqsave(&fep->hw_lock, flags); /* Fill in a Tx ring entry */ bdp = fep->cur_tx; @@ -337,7 +328,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) * This should not happen, since dev->tbusy should be set. */ printk("%s: tx queue full!.\n", dev->name); - spin_unlock_irqrestore(&fep->hw_lock, flags); return 1; } #endif @@ -376,6 +366,8 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) flush_dcache_range((unsigned long)skb->data, (unsigned long)skb->data + skb->len); + spin_lock_irq(&fep->lock); + /* Send it on its way. Tell FEC it's ready, interrupt when done, * it's the last BD of the frame, and to put the CRC on the end. */ @@ -404,7 +396,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) fep->cur_tx = (cbd_t *)bdp; - spin_unlock_irqrestore(&fep->hw_lock, flags); + spin_unlock_irq(&fep->lock); return 0; } @@ -462,20 +454,19 @@ fec_enet_interrupt(int irq, void * dev_id) struct net_device *dev = dev_id; volatile fec_t *fecp; uint int_events; - irqreturn_t ret = IRQ_NONE; + int handled = 0; fecp = (volatile fec_t*)dev->base_addr; /* Get the interrupt events that caused us to be here. */ - do { - int_events = fecp->fec_ievent; + while ((int_events = fecp->fec_ievent) != 0) { fecp->fec_ievent = int_events; /* Handle receive event in its own function. */ if (int_events & FEC_ENET_RXF) { - ret = IRQ_HANDLED; + handled = 1; fec_enet_rx(dev); } @@ -484,18 +475,17 @@ fec_enet_interrupt(int irq, void * dev_id) them as part of the transmit process. */ if (int_events & FEC_ENET_TXF) { - ret = IRQ_HANDLED; + handled = 1; fec_enet_tx(dev); } if (int_events & FEC_ENET_MII) { - ret = IRQ_HANDLED; + handled = 1; fec_enet_mii(dev); } - } while (int_events); - - return ret; + } + return IRQ_RETVAL(handled); } @@ -508,7 +498,7 @@ fec_enet_tx(struct net_device *dev) struct sk_buff *skb; fep = netdev_priv(dev); - spin_lock_irq(&fep->hw_lock); + spin_lock(&fep->lock); bdp = fep->dirty_tx; while (((status = bdp->cbd_sc) & BD_ENET_TX_READY) == 0) { @@ -567,7 +557,7 @@ fec_enet_tx(struct net_device *dev) } } fep->dirty_tx = (cbd_t *)bdp; - spin_unlock_irq(&fep->hw_lock); + spin_unlock(&fep->lock); } @@ -594,8 +584,6 @@ fec_enet_rx(struct net_device *dev) fep = netdev_priv(dev); fecp = (volatile fec_t*)dev->base_addr; - spin_lock_irq(&fep->hw_lock); - /* First, grab all of the stats for the incoming packet. * These get messed up if we get called due to a busy condition. */ @@ -701,8 +689,6 @@ while (!((status = bdp->cbd_sc) & BD_ENET_RX_EMPTY)) { */ fecp->fec_r_des_active = 0; #endif - - spin_unlock_irq(&fep->hw_lock); } @@ -716,11 +702,11 @@ fec_enet_mii(struct net_device *dev) uint mii_reg; fep = netdev_priv(dev); - spin_lock_irq(&fep->mii_lock); - ep = fep->hwp; mii_reg = ep->fec_mii_data; + spin_lock(&fep->lock); + if ((mip = mii_head) == NULL) { printk("MII and no head!\n"); goto unlock; @@ -737,7 +723,7 @@ fec_enet_mii(struct net_device *dev) ep->fec_mii_data = mip->mii_regval; unlock: - spin_unlock_irq(&fep->mii_lock); + spin_unlock(&fep->lock); } static int @@ -751,11 +737,12 @@ mii_queue(struct net_device *dev, int regval, void (*func)(uint, struct net_devi /* Add PHY address to register command. */ fep = netdev_priv(dev); - spin_lock_irqsave(&fep->mii_lock, flags); - regval |= fep->phy_addr << 23; + retval = 0; + spin_lock_irqsave(&fep->lock,flags); + if ((mip = mii_free) != NULL) { mii_free = mip->mii_next; mip->mii_regval = regval; @@ -772,8 +759,9 @@ mii_queue(struct net_device *dev, int regval, void (*func)(uint, struct net_devi retval = 1; } - spin_unlock_irqrestore(&fep->mii_lock, flags); - return retval; + spin_unlock_irqrestore(&fep->lock,flags); + + return(retval); } static void mii_do_cmd(struct net_device *dev, const phy_cmd_t *c) @@ -1234,7 +1222,7 @@ static phy_info_t const * const phy_info[] = { }; /* ------------------------------------------------------------------------- */ -#ifdef HAVE_mii_link_interrupt +#if !defined(CONFIG_M532x) #ifdef CONFIG_RPXCLASSIC static void mii_link_interrupt(void *dev_id); @@ -1374,8 +1362,18 @@ static void __inline__ fec_request_intrs(struct net_device *dev) unsigned short irq; } *idp, id[] = { { "fec(TXF)", 23 }, + { "fec(TXB)", 24 }, + { "fec(TXFIFO)", 25 }, + { "fec(TXCR)", 26 }, { "fec(RXF)", 27 }, + { "fec(RXB)", 28 }, { "fec(MII)", 29 }, + { "fec(LC)", 30 }, + { "fec(HBERR)", 31 }, + { "fec(GRA)", 32 }, + { "fec(EBERR)", 33 }, + { "fec(BABT)", 34 }, + { "fec(BABR)", 35 }, { NULL }, }; @@ -1535,8 +1533,18 @@ static void __inline__ fec_request_intrs(struct net_device *dev) unsigned short irq; } *idp, id[] = { { "fec(TXF)", 23 }, + { "fec(TXB)", 24 }, + { "fec(TXFIFO)", 25 }, + { "fec(TXCR)", 26 }, { "fec(RXF)", 27 }, + { "fec(RXB)", 28 }, { "fec(MII)", 29 }, + { "fec(LC)", 30 }, + { "fec(HBERR)", 31 }, + { "fec(GRA)", 32 }, + { "fec(EBERR)", 33 }, + { "fec(BABT)", 34 }, + { "fec(BABR)", 35 }, { NULL }, }; @@ -1652,8 +1660,18 @@ static void __inline__ fec_request_intrs(struct net_device *dev) unsigned short irq; } *idp, id[] = { { "fec(TXF)", 36 }, + { "fec(TXB)", 37 }, + { "fec(TXFIFO)", 38 }, + { "fec(TXCR)", 39 }, { "fec(RXF)", 40 }, + { "fec(RXB)", 41 }, { "fec(MII)", 42 }, + { "fec(LC)", 43 }, + { "fec(HBERR)", 44 }, + { "fec(GRA)", 45 }, + { "fec(EBERR)", 46 }, + { "fec(BABT)", 47 }, + { "fec(BABR)", 48 }, { NULL }, }; @@ -2108,7 +2126,6 @@ mii_discover_phy(uint mii_reg, struct net_device *dev) /* This interrupt occurs when the PHY detects a link change. */ -#ifdef HAVE_mii_link_interrupt #ifdef CONFIG_RPXCLASSIC static void mii_link_interrupt(void *dev_id) @@ -2131,7 +2148,6 @@ mii_link_interrupt(int irq, void * dev_id) return IRQ_HANDLED; } -#endif static int fec_enet_open(struct net_device *dev) @@ -2227,13 +2243,13 @@ static void set_multicast_list(struct net_device *dev) /* Catch all multicast addresses, so set the * filter to all 1's. */ - ep->fec_grp_hash_table_high = 0xffffffff; - ep->fec_grp_hash_table_low = 0xffffffff; + ep->fec_hash_table_high = 0xffffffff; + ep->fec_hash_table_low = 0xffffffff; } else { /* Clear filter and add the addresses in hash register. */ - ep->fec_grp_hash_table_high = 0; - ep->fec_grp_hash_table_low = 0; + ep->fec_hash_table_high = 0; + ep->fec_hash_table_low = 0; dmi = dev->mc_list; @@ -2264,9 +2280,9 @@ static void set_multicast_list(struct net_device *dev) hash = (crc >> (32 - HASH_BITS)) & 0x3f; if (hash > 31) - ep->fec_grp_hash_table_high |= 1 << (hash - 32); + ep->fec_hash_table_high |= 1 << (hash - 32); else - ep->fec_grp_hash_table_low |= 1 << hash; + ep->fec_hash_table_low |= 1 << hash; } } } @@ -2316,9 +2332,6 @@ int __init fec_enet_init(struct net_device *dev) return -ENOMEM; } - spin_lock_init(&fep->hw_lock); - spin_lock_init(&fep->mii_lock); - /* Create an Ethernet device instance. */ fecp = (volatile fec_t *) fec_hw[index]; @@ -2417,15 +2430,11 @@ int __init fec_enet_init(struct net_device *dev) */ fec_request_intrs(dev); - fecp->fec_grp_hash_table_high = 0; - fecp->fec_grp_hash_table_low = 0; + fecp->fec_hash_table_high = 0; + fecp->fec_hash_table_low = 0; fecp->fec_r_buff_size = PKT_MAXBLR_SIZE; fecp->fec_ecntrl = 2; fecp->fec_r_des_active = 0; -#ifndef CONFIG_M5272 - fecp->fec_hash_table_high = 0; - fecp->fec_hash_table_low = 0; -#endif dev->base_addr = (unsigned long)fecp; @@ -2446,7 +2455,8 @@ int __init fec_enet_init(struct net_device *dev) /* Clear and enable interrupts */ fecp->fec_ievent = 0xffc00000; - fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII); + fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_TXB | + FEC_ENET_RXF | FEC_ENET_RXB | FEC_ENET_MII); /* Queue up command to detect the PHY and initialize the * remainder of the interface. @@ -2490,8 +2500,8 @@ fec_restart(struct net_device *dev, int duplex) /* Reset all multicast. */ - fecp->fec_grp_hash_table_high = 0; - fecp->fec_grp_hash_table_low = 0; + fecp->fec_hash_table_high = 0; + fecp->fec_hash_table_low = 0; /* Set maximum receive buffer size. */ @@ -2573,7 +2583,8 @@ fec_restart(struct net_device *dev, int duplex) /* Enable interrupts we wish to service. */ - fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII); + fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_TXB | + FEC_ENET_RXF | FEC_ENET_RXB | FEC_ENET_MII); } static void @@ -2613,7 +2624,7 @@ fec_stop(struct net_device *dev) static int __init fec_enet_module_init(void) { struct net_device *dev; - int i, err; + int i, j, err; DECLARE_MAC_BUF(mac); printk("FEC ENET Version 0.2\n"); diff --git a/trunk/drivers/net/fec.h b/trunk/drivers/net/fec.h index 292719daceff..1d421606984f 100644 --- a/trunk/drivers/net/fec.h +++ b/trunk/drivers/net/fec.h @@ -88,8 +88,8 @@ typedef struct fec { unsigned long fec_reserved7[158]; unsigned long fec_addr_low; /* Low 32bits MAC address */ unsigned long fec_addr_high; /* High 16bits MAC address */ - unsigned long fec_grp_hash_table_high;/* High 32bits hash table */ - unsigned long fec_grp_hash_table_low; /* Low 32bits hash table */ + unsigned long fec_hash_table_high; /* High 32bits hash table */ + unsigned long fec_hash_table_low; /* Low 32bits hash table */ unsigned long fec_r_des_start; /* Receive descriptor ring */ unsigned long fec_x_des_start; /* Transmit descriptor ring */ unsigned long fec_r_buff_size; /* Maximum receive buff size */ diff --git a/trunk/drivers/pcmcia/au1000_db1x00.c b/trunk/drivers/pcmcia/au1000_db1x00.c index c78d77fd7e3b..74e051535d6c 100644 --- a/trunk/drivers/pcmcia/au1000_db1x00.c +++ b/trunk/drivers/pcmcia/au1000_db1x00.c @@ -194,7 +194,7 @@ db1x00_pcmcia_configure_socket(struct au1000_pcmcia_socket *skt, struct socket_s default: pwr |= SET_VCC_VPP(0,0,sock); printk("%s: bad Vcc/Vpp (%d:%d)\n", - __func__, + __FUNCTION__, state->Vcc, state->Vpp); break; @@ -215,7 +215,7 @@ db1x00_pcmcia_configure_socket(struct au1000_pcmcia_socket *skt, struct socket_s default: pwr |= SET_VCC_VPP(0,0,sock); printk("%s: bad Vcc/Vpp (%d:%d)\n", - __func__, + __FUNCTION__, state->Vcc, state->Vpp); break; @@ -224,7 +224,7 @@ db1x00_pcmcia_configure_socket(struct au1000_pcmcia_socket *skt, struct socket_s default: /* what's this ? */ pwr |= SET_VCC_VPP(0,0,sock); printk(KERN_ERR "%s: bad Vcc %d\n", - __func__, state->Vcc); + __FUNCTION__, state->Vcc); break; } diff --git a/trunk/drivers/pcmcia/au1000_generic.c b/trunk/drivers/pcmcia/au1000_generic.c index 75e8f8505e47..b693367d38cd 100644 --- a/trunk/drivers/pcmcia/au1000_generic.c +++ b/trunk/drivers/pcmcia/au1000_generic.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -72,7 +71,7 @@ extern struct au1000_pcmcia_socket au1000_pcmcia_socket[]; u32 *pcmcia_base_vaddrs[2]; extern const unsigned long mips_io_port_base; -static DEFINE_MUTEX(pcmcia_sockets_lock); +DECLARE_MUTEX(pcmcia_sockets_lock); static int (*au1x00_pcmcia_hw_init[])(struct device *dev) = { au1x_board_init, @@ -473,7 +472,7 @@ int au1x00_drv_pcmcia_remove(struct device *dev) struct skt_dev_info *sinfo = dev_get_drvdata(dev); int i; - mutex_lock(&pcmcia_sockets_lock); + down(&pcmcia_sockets_lock); dev_set_drvdata(dev, NULL); for (i = 0; i < sinfo->nskt; i++) { @@ -489,7 +488,7 @@ int au1x00_drv_pcmcia_remove(struct device *dev) } kfree(sinfo); - mutex_unlock(&pcmcia_sockets_lock); + up(&pcmcia_sockets_lock); return 0; } @@ -502,13 +501,13 @@ static int au1x00_drv_pcmcia_probe(struct device *dev) { int i, ret = -ENODEV; - mutex_lock(&pcmcia_sockets_lock); + down(&pcmcia_sockets_lock); for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) { ret = au1x00_pcmcia_hw_init[i](dev); if (ret == 0) break; } - mutex_unlock(&pcmcia_sockets_lock); + up(&pcmcia_sockets_lock); return ret; } diff --git a/trunk/drivers/pcmcia/au1000_pb1x00.c b/trunk/drivers/pcmcia/au1000_pb1x00.c index 157e41423a0a..86c0808d6a05 100644 --- a/trunk/drivers/pcmcia/au1000_pb1x00.c +++ b/trunk/drivers/pcmcia/au1000_pb1x00.c @@ -244,7 +244,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ, configure->sock); printk("%s: bad Vcc/Vpp (%d:%d)\n", - __func__, + __FUNCTION__, configure->vcc, configure->vpp); break; @@ -272,7 +272,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ, configure->sock); printk("%s: bad Vcc/Vpp (%d:%d)\n", - __func__, + __FUNCTION__, configure->vcc, configure->vpp); break; @@ -300,7 +300,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ, configure->sock); printk("%s: bad Vcc/Vpp (%d:%d)\n", - __func__, + __FUNCTION__, configure->vcc, configure->vpp); break; @@ -309,7 +309,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) default: /* what's this ? */ pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ,configure->sock); printk(KERN_ERR "%s: bad Vcc %d\n", - __func__, configure->vcc); + __FUNCTION__, configure->vcc); break; } @@ -353,7 +353,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) default: pcr |= SET_VCC_VPP(0,0); printk("%s: bad Vcc/Vpp (%d:%d)\n", - __func__, + __FUNCTION__, configure->vcc, configure->vpp); break; @@ -374,7 +374,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) default: pcr |= SET_VCC_VPP(0,0); printk("%s: bad Vcc/Vpp (%d:%d)\n", - __func__, + __FUNCTION__, configure->vcc, configure->vpp); break; @@ -383,7 +383,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) default: /* what's this ? */ pcr |= SET_VCC_VPP(0,0); printk(KERN_ERR "%s: bad Vcc %d\n", - __func__, configure->vcc); + __FUNCTION__, configure->vcc); break; } diff --git a/trunk/drivers/pcmcia/au1000_xxs1500.c b/trunk/drivers/pcmcia/au1000_xxs1500.c index c78ed5347510..ce9d5c44a7b5 100644 --- a/trunk/drivers/pcmcia/au1000_xxs1500.c +++ b/trunk/drivers/pcmcia/au1000_xxs1500.c @@ -56,7 +56,7 @@ #define PCMCIA_IRQ AU1000_GPIO_4 #if 0 -#define DEBUG(x, args...) printk(__func__ ": " x, ##args) +#define DEBUG(x,args...) printk(__FUNCTION__ ": " x,##args) #else #define DEBUG(x,args...) #endif diff --git a/trunk/drivers/pcmcia/cardbus.c b/trunk/drivers/pcmcia/cardbus.c index fb2f38dc92c5..714baaeb6da1 100644 --- a/trunk/drivers/pcmcia/cardbus.c +++ b/trunk/drivers/pcmcia/cardbus.c @@ -209,7 +209,7 @@ static void cardbus_assign_irqs(struct pci_bus *bus, int irq) } } -int __ref cb_alloc(struct pcmcia_socket * s) +int cb_alloc(struct pcmcia_socket * s) { struct pci_bus *bus = s->cb_dev->subordinate; struct pci_dev *dev; diff --git a/trunk/drivers/pcmcia/cs.c b/trunk/drivers/pcmcia/cs.c index 29276bd28295..56230dbd347a 100644 --- a/trunk/drivers/pcmcia/cs.c +++ b/trunk/drivers/pcmcia/cs.c @@ -652,9 +652,6 @@ static int pccardd(void *__skt) complete(&skt->thread_done); return 0; } - ret = pccard_sysfs_add_socket(&skt->dev); - if (ret) - dev_warn(&skt->dev, "err %d adding socket attributes\n", ret); add_wait_queue(&skt->thread_wait, &wait); complete(&skt->thread_done); @@ -697,7 +694,6 @@ static int pccardd(void *__skt) remove_wait_queue(&skt->thread_wait, &wait); /* remove from the device core */ - pccard_sysfs_remove_socket(&skt->dev); device_unregister(&skt->dev); return 0; @@ -944,13 +940,20 @@ EXPORT_SYMBOL(pcmcia_socket_class); static int __init init_pcmcia_cs(void) { + int ret; + init_completion(&pcmcia_unload); - return class_register(&pcmcia_socket_class); + ret = class_register(&pcmcia_socket_class); + if (ret) + return (ret); + return class_interface_register(&pccard_sysfs_interface); } static void __exit exit_pcmcia_cs(void) { + class_interface_unregister(&pccard_sysfs_interface); class_unregister(&pcmcia_socket_class); + wait_for_completion(&pcmcia_unload); } diff --git a/trunk/drivers/pcmcia/cs_internal.h b/trunk/drivers/pcmcia/cs_internal.h index e7d5d141f24d..9fa207e3c7b3 100644 --- a/trunk/drivers/pcmcia/cs_internal.h +++ b/trunk/drivers/pcmcia/cs_internal.h @@ -121,8 +121,7 @@ struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align, void release_resource_db(struct pcmcia_socket *s); /* In socket_sysfs.c */ -extern int pccard_sysfs_add_socket(struct device *dev); -extern void pccard_sysfs_remove_socket(struct device *dev); +extern struct class_interface pccard_sysfs_interface; /* In cs.c */ extern struct rw_semaphore pcmcia_socket_list_rwsem; diff --git a/trunk/drivers/pcmcia/ds.c b/trunk/drivers/pcmcia/ds.c index e40775443d04..5a85871f5ee9 100644 --- a/trunk/drivers/pcmcia/ds.c +++ b/trunk/drivers/pcmcia/ds.c @@ -1520,7 +1520,7 @@ static void pcmcia_bus_remove_socket(struct device *dev, /* the pcmcia_bus_interface is used to handle pcmcia socket devices */ -static struct class_interface pcmcia_bus_interface __refdata = { +static struct class_interface pcmcia_bus_interface = { .class = &pcmcia_socket_class, .add_dev = &pcmcia_bus_add_socket, .remove_dev = &pcmcia_bus_remove_socket, diff --git a/trunk/drivers/pcmcia/i82092.c b/trunk/drivers/pcmcia/i82092.c index e13618656ff7..e54ecc580d9e 100644 --- a/trunk/drivers/pcmcia/i82092.c +++ b/trunk/drivers/pcmcia/i82092.c @@ -53,7 +53,7 @@ static int i82092aa_socket_resume (struct pci_dev *dev) } #endif -static struct pci_driver i82092aa_pci_driver = { +static struct pci_driver i82092aa_pci_drv = { .name = "i82092aa", .id_table = i82092aa_pci_ids, .probe = i82092aa_pci_probe, @@ -714,13 +714,13 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_ static int i82092aa_module_init(void) { - return pci_register_driver(&i82092aa_pci_driver); + return pci_register_driver(&i82092aa_pci_drv); } static void i82092aa_module_exit(void) { enter("i82092aa_module_exit"); - pci_unregister_driver(&i82092aa_pci_driver); + pci_unregister_driver(&i82092aa_pci_drv); if (sockets[0].io_base>0) release_region(sockets[0].io_base, 2); leave("i82092aa_module_exit"); diff --git a/trunk/drivers/pcmcia/omap_cf.c b/trunk/drivers/pcmcia/omap_cf.c index 46314b420765..bb6db3a582b2 100644 --- a/trunk/drivers/pcmcia/omap_cf.c +++ b/trunk/drivers/pcmcia/omap_cf.c @@ -153,7 +153,7 @@ omap_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) static int omap_cf_ss_suspend(struct pcmcia_socket *s) { - pr_debug("%s: %s\n", driver_name, __func__); + pr_debug("%s: %s\n", driver_name, __FUNCTION__); return omap_cf_set_socket(s, &dead_socket); } diff --git a/trunk/drivers/pcmcia/pd6729.c b/trunk/drivers/pcmcia/pd6729.c index 8bed1dab9039..abc10fe49bd8 100644 --- a/trunk/drivers/pcmcia/pd6729.c +++ b/trunk/drivers/pcmcia/pd6729.c @@ -778,7 +778,7 @@ static struct pci_device_id pd6729_pci_ids[] = { }; MODULE_DEVICE_TABLE(pci, pd6729_pci_ids); -static struct pci_driver pd6729_pci_driver = { +static struct pci_driver pd6729_pci_drv = { .name = "pd6729", .id_table = pd6729_pci_ids, .probe = pd6729_pci_probe, @@ -791,12 +791,12 @@ static struct pci_driver pd6729_pci_driver = { static int pd6729_module_init(void) { - return pci_register_driver(&pd6729_pci_driver); + return pci_register_driver(&pd6729_pci_drv); } static void pd6729_module_exit(void) { - pci_unregister_driver(&pd6729_pci_driver); + pci_unregister_driver(&pd6729_pci_drv); } module_init(pd6729_module_init); diff --git a/trunk/drivers/pcmcia/pxa2xx_lubbock.c b/trunk/drivers/pcmcia/pxa2xx_lubbock.c index 881ec8a8e389..4a05802213c8 100644 --- a/trunk/drivers/pcmcia/pxa2xx_lubbock.c +++ b/trunk/drivers/pcmcia/pxa2xx_lubbock.c @@ -87,7 +87,7 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, default: printk(KERN_ERR "%s(): unrecognized Vcc %u\n", - __func__, state->Vcc); + __FUNCTION__, state->Vcc); ret = -1; } @@ -104,7 +104,7 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, pa_dwr_set |= GPIO_A0; else { printk(KERN_ERR "%s(): unrecognized Vpp %u\n", - __func__, state->Vpp); + __FUNCTION__, state->Vpp); ret = -1; break; } @@ -128,14 +128,14 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, default: printk(KERN_ERR "%s(): unrecognized Vcc %u\n", - __func__, state->Vcc); + __FUNCTION__, state->Vcc); ret = -1; break; } if (state->Vpp != state->Vcc && state->Vpp != 0) { printk(KERN_ERR "%s(): CF slot cannot support Vpp %u\n", - __func__, state->Vpp); + __FUNCTION__, state->Vpp); ret = -1; break; } diff --git a/trunk/drivers/pcmcia/pxa2xx_mainstone.c b/trunk/drivers/pcmcia/pxa2xx_mainstone.c index 145b85e0f02c..6fa5eaaab8af 100644 --- a/trunk/drivers/pcmcia/pxa2xx_mainstone.c +++ b/trunk/drivers/pcmcia/pxa2xx_mainstone.c @@ -99,7 +99,7 @@ static int mst_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, case 50: power |= MST_PCMCIA_PWR_VCC_50; break; default: printk(KERN_ERR "%s(): bad Vcc %u\n", - __func__, state->Vcc); + __FUNCTION__, state->Vcc); ret = -1; } @@ -111,7 +111,7 @@ static int mst_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, power |= MST_PCMCIA_PWR_VPP_VCC; } else { printk(KERN_ERR "%s(): bad Vpp %u\n", - __func__, state->Vpp); + __FUNCTION__, state->Vpp); ret = -1; } } diff --git a/trunk/drivers/pcmcia/rsrc_nonstatic.c b/trunk/drivers/pcmcia/rsrc_nonstatic.c index 0fcf763b9175..a8d100707721 100644 --- a/trunk/drivers/pcmcia/rsrc_nonstatic.c +++ b/trunk/drivers/pcmcia/rsrc_nonstatic.c @@ -1045,7 +1045,7 @@ static void __devexit pccard_sysfs_remove_rsrc(struct device *dev, device_remove_file(dev, *attr); } -static struct class_interface pccard_rsrc_interface __refdata = { +static struct class_interface pccard_rsrc_interface = { .class = &pcmcia_socket_class, .add_dev = &pccard_sysfs_add_rsrc, .remove_dev = __devexit_p(&pccard_sysfs_remove_rsrc), diff --git a/trunk/drivers/pcmcia/sa1100_assabet.c b/trunk/drivers/pcmcia/sa1100_assabet.c index ce133ce81c10..7c57fdd3c8d7 100644 --- a/trunk/drivers/pcmcia/sa1100_assabet.c +++ b/trunk/drivers/pcmcia/sa1100_assabet.c @@ -66,14 +66,14 @@ assabet_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_stat case 50: printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V...\n", - __func__); + __FUNCTION__); case 33: /* Can only apply 3.3V to the CF slot. */ mask = ASSABET_BCR_CF_PWR; break; default: - printk(KERN_ERR "%s(): unrecognized Vcc %u\n", __func__, + printk(KERN_ERR "%s(): unrecognized Vcc %u\n", __FUNCTION__, state->Vcc); return -1; } diff --git a/trunk/drivers/pcmcia/sa1100_badge4.c b/trunk/drivers/pcmcia/sa1100_badge4.c index 607c3f326eca..62bfc7566ec2 100644 --- a/trunk/drivers/pcmcia/sa1100_badge4.c +++ b/trunk/drivers/pcmcia/sa1100_badge4.c @@ -82,14 +82,14 @@ badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state case 0: if ((state->Vcc != 0) && (state->Vcc != badge4_pcmvcc)) { - complain_about_jumpering(__func__, "pcmvcc", + complain_about_jumpering(__FUNCTION__, "pcmvcc", badge4_pcmvcc, state->Vcc); // Apply power regardless of the jumpering. // return -1; } if ((state->Vpp != 0) && (state->Vpp != badge4_pcmvpp)) { - complain_about_jumpering(__func__, "pcmvpp", + complain_about_jumpering(__FUNCTION__, "pcmvpp", badge4_pcmvpp, state->Vpp); return -1; } @@ -98,7 +98,7 @@ badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state case 1: if ((state->Vcc != 0) && (state->Vcc != badge4_cfvcc)) { - complain_about_jumpering(__func__, "cfvcc", + complain_about_jumpering(__FUNCTION__, "cfvcc", badge4_cfvcc, state->Vcc); return -1; } @@ -143,7 +143,7 @@ int pcmcia_badge4_init(struct device *dev) if (machine_is_badge4()) { printk(KERN_INFO "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", - __func__, + __FUNCTION__, badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); ret = sa11xx_drv_pcmcia_probe(dev, &badge4_pcmcia_ops, 0, 2); diff --git a/trunk/drivers/pcmcia/sa1100_cerf.c b/trunk/drivers/pcmcia/sa1100_cerf.c index 7c3951a2675d..549a1529fe35 100644 --- a/trunk/drivers/pcmcia/sa1100_cerf.c +++ b/trunk/drivers/pcmcia/sa1100_cerf.c @@ -63,7 +63,7 @@ cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, default: printk(KERN_ERR "%s(): unrecognized Vcc %u\n", - __func__, state->Vcc); + __FUNCTION__, state->Vcc); return -1; } diff --git a/trunk/drivers/pcmcia/sa1100_jornada720.c b/trunk/drivers/pcmcia/sa1100_jornada720.c index 2167e6714d2d..6284c35dabc6 100644 --- a/trunk/drivers/pcmcia/sa1100_jornada720.c +++ b/trunk/drivers/pcmcia/sa1100_jornada720.c @@ -42,7 +42,7 @@ jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s unsigned int pa_dwr_mask, pa_dwr_set; int ret; -printk("%s(): config socket %d vcc %d vpp %d\n", __func__, +printk("%s(): config socket %d vcc %d vpp %d\n", __FUNCTION__, skt->nr, state->Vcc, state->Vpp); switch (skt->nr) { @@ -74,7 +74,7 @@ printk("%s(): config socket %d vcc %d vpp %d\n", __func__, if (state->Vpp != state->Vcc && state->Vpp != 0) { printk(KERN_ERR "%s(): slot cannot support VPP %u\n", - __func__, state->Vpp); + __FUNCTION__, state->Vpp); return -1; } diff --git a/trunk/drivers/pcmcia/sa1100_neponset.c b/trunk/drivers/pcmcia/sa1100_neponset.c index 687492fcd5b4..5bc9e9532b9d 100644 --- a/trunk/drivers/pcmcia/sa1100_neponset.c +++ b/trunk/drivers/pcmcia/sa1100_neponset.c @@ -59,7 +59,7 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta ncr_set = NCR_A0VPP; else { printk(KERN_ERR "%s(): unrecognized VPP %u\n", - __func__, state->Vpp); + __FUNCTION__, state->Vpp); return -1; } break; @@ -71,7 +71,7 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta if (state->Vpp != state->Vcc && state->Vpp != 0) { printk(KERN_ERR "%s(): CF slot cannot support VPP %u\n", - __func__, state->Vpp); + __FUNCTION__, state->Vpp); return -1; } break; diff --git a/trunk/drivers/pcmcia/sa1100_shannon.c b/trunk/drivers/pcmcia/sa1100_shannon.c index 494912fccc0d..9456f5478d09 100644 --- a/trunk/drivers/pcmcia/sa1100_shannon.c +++ b/trunk/drivers/pcmcia/sa1100_shannon.c @@ -73,19 +73,19 @@ shannon_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, { switch (state->Vcc) { case 0: /* power off */ - printk(KERN_WARNING "%s(): CS asked for 0V, still applying 3.3V..\n", __func__); + printk(KERN_WARNING "%s(): CS asked for 0V, still applying 3.3V..\n", __FUNCTION__); break; case 50: - printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V..\n", __func__); + printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V..\n", __FUNCTION__); case 33: break; default: printk(KERN_ERR "%s(): unrecognized Vcc %u\n", - __func__, state->Vcc); + __FUNCTION__, state->Vcc); return -1; } - printk(KERN_WARNING "%s(): Warning, Can't perform reset\n", __func__); + printk(KERN_WARNING "%s(): Warning, Can't perform reset\n", __FUNCTION__); /* Silently ignore Vpp, output enable, speaker enable. */ diff --git a/trunk/drivers/pcmcia/sa1100_simpad.c b/trunk/drivers/pcmcia/sa1100_simpad.c index 42567de894b9..04d6f7f75f78 100644 --- a/trunk/drivers/pcmcia/sa1100_simpad.c +++ b/trunk/drivers/pcmcia/sa1100_simpad.c @@ -90,7 +90,7 @@ simpad_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, default: printk(KERN_ERR "%s(): unrecognized Vcc %u\n", - __func__, state->Vcc); + __FUNCTION__, state->Vcc); clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); local_irq_restore(flags); return -1; diff --git a/trunk/drivers/pcmcia/soc_common.c b/trunk/drivers/pcmcia/soc_common.c index 420a77540f41..aa7779d89752 100644 --- a/trunk/drivers/pcmcia/soc_common.c +++ b/trunk/drivers/pcmcia/soc_common.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -354,7 +353,7 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m (map->flags&MAP_PREFETCH)?"PREFETCH ":""); if (map->map >= MAX_IO_WIN) { - printk(KERN_ERR "%s(): map (%d) out of range\n", __func__, + printk(KERN_ERR "%s(): map (%d) out of range\n", __FUNCTION__, map->map); return -1; } @@ -579,7 +578,7 @@ EXPORT_SYMBOL(soc_pcmcia_enable_irqs); LIST_HEAD(soc_pcmcia_sockets); -static DEFINE_MUTEX(soc_pcmcia_sockets_lock); +DECLARE_MUTEX(soc_pcmcia_sockets_lock); static const char *skt_names[] = { "PCMCIA socket 0", @@ -602,11 +601,11 @@ soc_pcmcia_notifier(struct notifier_block *nb, unsigned long val, void *data) struct cpufreq_freqs *freqs = data; int ret = 0; - mutex_lock(&soc_pcmcia_sockets_lock); + down(&soc_pcmcia_sockets_lock); list_for_each_entry(skt, &soc_pcmcia_sockets, node) if ( skt->ops->frequency_change ) ret += skt->ops->frequency_change(skt, val, freqs); - mutex_unlock(&soc_pcmcia_sockets_lock); + up(&soc_pcmcia_sockets_lock); return ret; } @@ -643,7 +642,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops struct soc_pcmcia_socket *skt; int ret, i; - mutex_lock(&soc_pcmcia_sockets_lock); + down(&soc_pcmcia_sockets_lock); sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); if (!sinfo) { @@ -783,7 +782,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops kfree(sinfo); out: - mutex_unlock(&soc_pcmcia_sockets_lock); + up(&soc_pcmcia_sockets_lock); return ret; } @@ -794,7 +793,7 @@ int soc_common_drv_pcmcia_remove(struct device *dev) dev_set_drvdata(dev, NULL); - mutex_lock(&soc_pcmcia_sockets_lock); + down(&soc_pcmcia_sockets_lock); for (i = 0; i < sinfo->nskt; i++) { struct soc_pcmcia_socket *skt = &sinfo->skt[i]; @@ -819,7 +818,7 @@ int soc_common_drv_pcmcia_remove(struct device *dev) if (list_empty(&soc_pcmcia_sockets)) soc_pcmcia_cpufreq_unregister(); - mutex_unlock(&soc_pcmcia_sockets_lock); + up(&soc_pcmcia_sockets_lock); kfree(sinfo); diff --git a/trunk/drivers/pcmcia/soc_common.h b/trunk/drivers/pcmcia/soc_common.h index 1edc1da9d353..6f14126889b3 100644 --- a/trunk/drivers/pcmcia/soc_common.h +++ b/trunk/drivers/pcmcia/soc_common.h @@ -133,6 +133,7 @@ extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_ extern struct list_head soc_pcmcia_sockets; +extern struct semaphore soc_pcmcia_sockets_lock; extern int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr); extern int soc_common_drv_pcmcia_remove(struct device *dev); diff --git a/trunk/drivers/pcmcia/socket_sysfs.c b/trunk/drivers/pcmcia/socket_sysfs.c index 562384d6f321..b4409002b7f8 100644 --- a/trunk/drivers/pcmcia/socket_sysfs.c +++ b/trunk/drivers/pcmcia/socket_sysfs.c @@ -356,23 +356,19 @@ static ssize_t pccard_store_cis(struct kobject *kobj, } -static struct attribute *pccard_socket_attributes[] = { - &dev_attr_card_type.attr, - &dev_attr_card_voltage.attr, - &dev_attr_card_vpp.attr, - &dev_attr_card_vcc.attr, - &dev_attr_card_insert.attr, - &dev_attr_card_pm_state.attr, - &dev_attr_card_eject.attr, - &dev_attr_card_irq_mask.attr, - &dev_attr_available_resources_setup_done.attr, +static struct device_attribute *pccard_socket_attributes[] = { + &dev_attr_card_type, + &dev_attr_card_voltage, + &dev_attr_card_vpp, + &dev_attr_card_vcc, + &dev_attr_card_insert, + &dev_attr_card_pm_state, + &dev_attr_card_eject, + &dev_attr_card_irq_mask, + &dev_attr_available_resources_setup_done, NULL, }; -static const struct attribute_group socket_attrs = { - .attrs = pccard_socket_attributes, -}; - static struct bin_attribute pccard_cis_attr = { .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR }, .size = 0x200, @@ -380,21 +376,35 @@ static struct bin_attribute pccard_cis_attr = { .write = pccard_store_cis, }; -int pccard_sysfs_add_socket(struct device *dev) +static int __devinit pccard_sysfs_add_socket(struct device *dev, + struct class_interface *class_intf) { + struct device_attribute **attr; int ret = 0; - ret = sysfs_create_group(&dev->kobj, &socket_attrs); - if (!ret) { - ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr); + for (attr = pccard_socket_attributes; *attr; attr++) { + ret = device_create_file(dev, *attr); if (ret) - sysfs_remove_group(&dev->kobj, &socket_attrs); + break; } + if (!ret) + ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr); + return ret; } -void pccard_sysfs_remove_socket(struct device *dev) +static void __devexit pccard_sysfs_remove_socket(struct device *dev, + struct class_interface *class_intf) { + struct device_attribute **attr; + sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr); - sysfs_remove_group(&dev->kobj, &socket_attrs); + for (attr = pccard_socket_attributes; *attr; attr++) + device_remove_file(dev, *attr); } + +struct class_interface pccard_sysfs_interface = { + .class = &pcmcia_socket_class, + .add_dev = &pccard_sysfs_add_socket, + .remove_dev = __devexit_p(&pccard_sysfs_remove_socket), +}; diff --git a/trunk/drivers/pnp/pnpbios/rsparser.c b/trunk/drivers/pnp/pnpbios/rsparser.c index 5ff9a4c0447e..2e2c457a0fea 100644 --- a/trunk/drivers/pnp/pnpbios/rsparser.c +++ b/trunk/drivers/pnp/pnpbios/rsparser.c @@ -591,8 +591,7 @@ static void pnpbios_encode_irq(struct pnp_dev *dev, unsigned char *p, p[1] = map & 0xff; p[2] = (map >> 8) & 0xff; - dev_dbg(&dev->dev, " encode irq %llu\n", - (unsigned long long)res->start); + dev_dbg(&dev->dev, " encode irq %d\n", res->start); } static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p, @@ -603,8 +602,7 @@ static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p, map = 1 << res->start; p[1] = map & 0xff; - dev_dbg(&dev->dev, " encode dma %llu\n", - (unsigned long long)res->start); + dev_dbg(&dev->dev, " encode dma %d\n", res->start); } static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p, diff --git a/trunk/drivers/scsi/mvsas.c b/trunk/drivers/scsi/mvsas.c index 1dd70d7a4947..e55b9037adb2 100644 --- a/trunk/drivers/scsi/mvsas.c +++ b/trunk/drivers/scsi/mvsas.c @@ -2822,9 +2822,7 @@ static void mvs_update_phyinfo(struct mvs_info *mvi, int i, dev_printk(KERN_DEBUG, &pdev->dev, "phy[%d] Get Attached Address 0x%llX ," " SAS Address 0x%llX\n", - i, - (unsigned long long)phy->att_dev_sas_addr, - (unsigned long long)phy->dev_sas_addr); + i, phy->att_dev_sas_addr, phy->dev_sas_addr); dev_printk(KERN_DEBUG, &pdev->dev, "Rate = %x , type = %d\n", sas_phy->linkrate, phy->phy_type); diff --git a/trunk/drivers/scsi/ncr53c8xx.c b/trunk/drivers/scsi/ncr53c8xx.c index c57c94c0ffd2..ceab4f73caf1 100644 --- a/trunk/drivers/scsi/ncr53c8xx.c +++ b/trunk/drivers/scsi/ncr53c8xx.c @@ -8222,7 +8222,7 @@ static void process_waiting_list(struct ncb *np, int sts) #ifdef DEBUG_WAITING_LIST if (waiting_list) printk("%s: waiting_list=%lx processing sts=%d\n", ncr_name(np), (u_long) waiting_list, sts); #endif - while ((wcmd = waiting_list) != NULL) { + while (wcmd = waiting_list) { waiting_list = (struct scsi_cmnd *) wcmd->next_wcmd; wcmd->next_wcmd = NULL; if (sts == DID_OK) { diff --git a/trunk/drivers/serial/8250.c b/trunk/drivers/serial/8250.c index a1ca9b7bf2d5..ea41f2626458 100644 --- a/trunk/drivers/serial/8250.c +++ b/trunk/drivers/serial/8250.c @@ -2271,8 +2271,7 @@ static int serial8250_request_std_resource(struct uart_8250_port *up) } if (up->port.flags & UPF_IOREMAP) { - up->port.membase = ioremap_nocache(up->port.mapbase, - size); + up->port.membase = ioremap(up->port.mapbase, size); if (!up->port.membase) { release_mem_region(up->port.mapbase, size); ret = -ENOMEM; diff --git a/trunk/drivers/serial/8250_early.c b/trunk/drivers/serial/8250_early.c index f279745e9fef..cd898704ba4f 100644 --- a/trunk/drivers/serial/8250_early.c +++ b/trunk/drivers/serial/8250_early.c @@ -153,7 +153,7 @@ static int __init parse_options(struct early_serial8250_device *device, (void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE); port->membase += port->mapbase & ~PAGE_MASK; #else - port->membase = ioremap_nocache(port->mapbase, 64); + port->membase = ioremap(port->mapbase, 64); if (!port->membase) { printk(KERN_ERR "%s: Couldn't ioremap 0x%llx\n", __func__, diff --git a/trunk/drivers/serial/8250_pci.c b/trunk/drivers/serial/8250_pci.c index 53fa19cf2f06..6e57382b9137 100644 --- a/trunk/drivers/serial/8250_pci.c +++ b/trunk/drivers/serial/8250_pci.c @@ -86,7 +86,7 @@ setup_port(struct serial_private *priv, struct uart_port *port, len = pci_resource_len(dev, bar); if (!priv->remapped_bar[bar]) - priv->remapped_bar[bar] = ioremap_nocache(base, len); + priv->remapped_bar[bar] = ioremap(base, len); if (!priv->remapped_bar[bar]) return -ENOMEM; @@ -270,7 +270,7 @@ static int pci_plx9050_init(struct pci_dev *dev) /* * enable/disable interrupts */ - p = ioremap_nocache(pci_resource_start(dev, 0), 0x80); + p = ioremap(pci_resource_start(dev, 0), 0x80); if (p == NULL) return -ENOMEM; writel(irq_config, p + 0x4c); @@ -294,7 +294,7 @@ static void __devexit pci_plx9050_exit(struct pci_dev *dev) /* * disable interrupts */ - p = ioremap_nocache(pci_resource_start(dev, 0), 0x80); + p = ioremap(pci_resource_start(dev, 0), 0x80); if (p != NULL) { writel(0, p + 0x4c); @@ -341,8 +341,7 @@ static int sbs_init(struct pci_dev *dev) { u8 __iomem *p; - p = ioremap_nocache(pci_resource_start(dev, 0), - pci_resource_len(dev, 0)); + p = ioremap(pci_resource_start(dev, 0), pci_resource_len(dev, 0)); if (p == NULL) return -ENOMEM; @@ -366,8 +365,7 @@ static void __devexit sbs_exit(struct pci_dev *dev) { u8 __iomem *p; - p = ioremap_nocache(pci_resource_start(dev, 0), - pci_resource_len(dev, 0)); + p = ioremap(pci_resource_start(dev, 0), pci_resource_len(dev, 0)); /* FIXME: What if resource_len < OCT_REG_CR_OFF */ if (p != NULL) writeb(0, p + OCT_REG_CR_OFF); @@ -421,7 +419,7 @@ static int pci_siig10x_init(struct pci_dev *dev) break; } - p = ioremap_nocache(pci_resource_start(dev, 0), 0x80); + p = ioremap(pci_resource_start(dev, 0), 0x80); if (p == NULL) return -ENOMEM; diff --git a/trunk/drivers/serial/jsm/jsm.h b/trunk/drivers/serial/jsm/jsm.h index 8871aaa3dba6..12c934a1f274 100644 --- a/trunk/drivers/serial/jsm/jsm.h +++ b/trunk/drivers/serial/jsm/jsm.h @@ -373,7 +373,6 @@ struct neo_uart_struct { #define PCI_DEVICE_NEO_2DB9PRI_PCI_NAME "Neo 2 - DB9 Universal PCI - Powered Ring Indicator" #define PCI_DEVICE_NEO_2RJ45_PCI_NAME "Neo 2 - RJ45 Universal PCI" #define PCI_DEVICE_NEO_2RJ45PRI_PCI_NAME "Neo 2 - RJ45 Universal PCI - Powered Ring Indicator" -#define PCIE_DEVICE_NEO_IBM_PCI_NAME "Neo 4 - PCI Express - IBM" /* * Our Global Variables. diff --git a/trunk/drivers/serial/jsm/jsm_driver.c b/trunk/drivers/serial/jsm/jsm_driver.c index 338cf8a08b43..6767ee381cd1 100644 --- a/trunk/drivers/serial/jsm/jsm_driver.c +++ b/trunk/drivers/serial/jsm/jsm_driver.c @@ -82,10 +82,7 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent) /* store the info for the board we've found */ brd->boardnum = adapter_count++; brd->pci_dev = pdev; - if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM) - brd->maxports = 4; - else - brd->maxports = 2; + brd->maxports = 2; spin_lock_init(&brd->bd_lock); spin_lock_init(&brd->bd_intr_lock); @@ -211,7 +208,6 @@ static struct pci_device_id jsm_pci_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2DB9PRI), 0, 0, 1 }, { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 }, { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 }, - { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 }, { 0, } }; MODULE_DEVICE_TABLE(pci, jsm_pci_tbl); diff --git a/trunk/drivers/spi/spi_bfin5xx.c b/trunk/drivers/spi/spi_bfin5xx.c index 7fea3cf4588a..a9ac1fdb3094 100644 --- a/trunk/drivers/spi/spi_bfin5xx.c +++ b/trunk/drivers/spi/spi_bfin5xx.c @@ -608,7 +608,6 @@ static void pump_transfers(unsigned long data) u8 width; u16 cr, dma_width, dma_config; u32 tranf_success = 1; - u8 full_duplex = 0; /* Get current state information */ message = drv_data->cur_msg; @@ -659,7 +658,6 @@ static void pump_transfers(unsigned long data) } if (transfer->rx_buf != NULL) { - full_duplex = transfer->tx_buf != NULL; drv_data->rx = transfer->rx_buf; drv_data->rx_end = drv_data->rx + transfer->len; dev_dbg(&drv_data->pdev->dev, "rx_buf is %p, rx_end is %p\n", @@ -742,8 +740,7 @@ static void pump_transfers(unsigned long data) * successful use different way to r/w according to * drv_data->cur_chip->enable_dma */ - if (!full_duplex && drv_data->cur_chip->enable_dma - && drv_data->len > 6) { + if (drv_data->cur_chip->enable_dma && drv_data->len > 6) { disable_dma(drv_data->dma_channel); clear_dma_irqstat(drv_data->dma_channel); @@ -831,7 +828,7 @@ static void pump_transfers(unsigned long data) /* IO mode write then read */ dev_dbg(&drv_data->pdev->dev, "doing IO transfer\n"); - if (full_duplex) { + if (drv_data->tx != NULL && drv_data->rx != NULL) { /* full duplex mode */ BUG_ON((drv_data->tx_end - drv_data->tx) != (drv_data->rx_end - drv_data->rx)); diff --git a/trunk/drivers/spi/spi_s3c24xx.c b/trunk/drivers/spi/spi_s3c24xx.c index 0885cc357a37..34bfb7dd7764 100644 --- a/trunk/drivers/spi/spi_s3c24xx.c +++ b/trunk/drivers/spi/spi_s3c24xx.c @@ -125,10 +125,10 @@ static int s3c24xx_spi_setupxfer(struct spi_device *spi, /* is clk = pclk / (2 * (pre+1)), or is it * clk = (pclk * 2) / ( pre + 1) */ - div /= 2; + div = (div / 2) - 1; - if (div > 0) - div -= 1; + if (div < 0) + div = 1; if (div > 255) div = 255; diff --git a/trunk/fs/autofs4/expire.c b/trunk/fs/autofs4/expire.c index 894fee54d4d8..d96e5c14a9ca 100644 --- a/trunk/fs/autofs4/expire.c +++ b/trunk/fs/autofs4/expire.c @@ -73,8 +73,8 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) status = 0; done: DPRINTK("returning = %d", status); - dput(dentry); mntput(mnt); + dput(dentry); return status; } @@ -333,7 +333,7 @@ static struct dentry *autofs4_expire_indirect(struct super_block *sb, /* Can we expire this guy */ if (autofs4_can_expire(dentry, timeout, do_now)) { expired = dentry; - goto found; + break; } goto next; } @@ -352,7 +352,7 @@ static struct dentry *autofs4_expire_indirect(struct super_block *sb, inf->flags |= AUTOFS_INF_EXPIRING; spin_unlock(&sbi->fs_lock); expired = dentry; - goto found; + break; } spin_unlock(&sbi->fs_lock); /* @@ -363,7 +363,7 @@ static struct dentry *autofs4_expire_indirect(struct super_block *sb, expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); if (expired) { dput(dentry); - goto found; + break; } } next: @@ -371,16 +371,18 @@ static struct dentry *autofs4_expire_indirect(struct super_block *sb, spin_lock(&dcache_lock); next = next->next; } - spin_unlock(&dcache_lock); - return NULL; -found: - DPRINTK("returning %p %.*s", - expired, (int)expired->d_name.len, expired->d_name.name); - spin_lock(&dcache_lock); - list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); + if (expired) { + DPRINTK("returning %p %.*s", + expired, (int)expired->d_name.len, expired->d_name.name); + spin_lock(&dcache_lock); + list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); + spin_unlock(&dcache_lock); + return expired; + } spin_unlock(&dcache_lock); - return expired; + + return NULL; } /* Perform an expiry operation */ diff --git a/trunk/fs/autofs4/root.c b/trunk/fs/autofs4/root.c index edf5b6bddb52..aa4c5ff8a40d 100644 --- a/trunk/fs/autofs4/root.c +++ b/trunk/fs/autofs4/root.c @@ -146,17 +146,17 @@ static int autofs4_dir_open(struct inode *inode, struct file *file) if (d_mountpoint(dentry)) { struct file *fp = NULL; - struct path fp_path = { .dentry = dentry, .mnt = mnt }; + struct vfsmount *fp_mnt = mntget(mnt); + struct dentry *fp_dentry = dget(dentry); - path_get(&fp_path); - - if (!autofs4_follow_mount(&fp_path.mnt, &fp_path.dentry)) { - path_put(&fp_path); + if (!autofs4_follow_mount(&fp_mnt, &fp_dentry)) { + dput(fp_dentry); + mntput(fp_mnt); dcache_dir_close(inode, file); goto out; } - fp = dentry_open(fp_path.dentry, fp_path.mnt, file->f_flags); + fp = dentry_open(fp_dentry, fp_mnt, file->f_flags); status = PTR_ERR(fp); if (IS_ERR(fp)) { dcache_dir_close(inode, file); @@ -242,8 +242,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags) { struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); struct autofs_info *ino = autofs4_dentry_ino(dentry); - struct dentry *new; - int status; + int status = 0; /* Block on any pending expiry here; invalidate the dentry when expiration is done to trigger mount request with a new @@ -319,28 +318,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags) spin_lock(&dentry->d_lock); dentry->d_flags &= ~DCACHE_AUTOFS_PENDING; spin_unlock(&dentry->d_lock); - - /* - * The dentry that is passed in from lookup may not be the one - * we end up using, as mkdir can create a new one. If this - * happens, and another process tries the lookup at the same time, - * it will set the PENDING flag on this new dentry, but add itself - * to our waitq. Then, if after the lookup succeeds, the first - * process that requested the mount performs another lookup of the - * same directory, it will show up as still pending! So, we need - * to redo the lookup here and clear pending on that dentry. - */ - if (d_unhashed(dentry)) { - new = d_lookup(dentry->d_parent, &dentry->d_name); - if (new) { - spin_lock(&new->d_lock); - new->d_flags &= ~DCACHE_AUTOFS_PENDING; - spin_unlock(&new->d_lock); - dput(new); - } - } - - return 0; + return status; } /* For autofs direct mounts the follow link triggers the mount */ diff --git a/trunk/fs/autofs4/waitq.c b/trunk/fs/autofs4/waitq.c index 75e5955c3f6d..1fe28e4754c2 100644 --- a/trunk/fs/autofs4/waitq.c +++ b/trunk/fs/autofs4/waitq.c @@ -171,7 +171,7 @@ static int autofs4_getpath(struct autofs_sb_info *sbi, for (tmp = dentry ; tmp != root ; tmp = tmp->d_parent) len += tmp->d_name.len + 1; - if (!len || --len > NAME_MAX) { + if (--len > NAME_MAX) { spin_unlock(&dcache_lock); return 0; } diff --git a/trunk/fs/debugfs/file.c b/trunk/fs/debugfs/file.c index 159a5efd6a8a..fddffe4851f5 100644 --- a/trunk/fs/debugfs/file.c +++ b/trunk/fs/debugfs/file.c @@ -9,7 +9,7 @@ * 2 as published by the Free Software Foundation. * * debugfs is for people to use instead of /proc or /sys. - * See Documentation/DocBook/filesystems for more details. + * See Documentation/DocBook/kernel-api for more details. * */ diff --git a/trunk/fs/dnotify.c b/trunk/fs/dnotify.c index eaecc4cfe540..28d01ed66de0 100644 --- a/trunk/fs/dnotify.c +++ b/trunk/fs/dnotify.c @@ -20,7 +20,6 @@ #include #include #include -#include int dir_notify_enable __read_mostly = 1; @@ -67,7 +66,6 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) struct dnotify_struct **prev; struct inode *inode; fl_owner_t id = current->files; - struct file *f; int error = 0; if ((arg & ~DN_MULTISHOT) == 0) { @@ -94,15 +92,6 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) prev = &odn->dn_next; } - rcu_read_lock(); - f = fcheck(fd); - rcu_read_unlock(); - /* we'd lost the race with close(), sod off silently */ - /* note that inode->i_lock prevents reordering problems - * between accesses to descriptor table and ->i_dnotify */ - if (f != filp) - goto out_free; - error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); if (error) goto out_free; diff --git a/trunk/fs/fuse/file.c b/trunk/fs/fuse/file.c index f28cf8b46f80..9ced35b00686 100644 --- a/trunk/fs/fuse/file.c +++ b/trunk/fs/fuse/file.c @@ -934,7 +934,7 @@ static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf, nbytes = min(nbytes, (unsigned) FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT); npages = (nbytes + offset + PAGE_SIZE - 1) >> PAGE_SHIFT; - npages = clamp(npages, 1, FUSE_MAX_PAGES_PER_REQ); + npages = min(max(npages, 1), FUSE_MAX_PAGES_PER_REQ); down_read(¤t->mm->mmap_sem); npages = get_user_pages(current, current->mm, user_addr, npages, write, 0, req->pages, NULL); diff --git a/trunk/fs/jffs2/build.c b/trunk/fs/jffs2/build.c index c5e1450d79f9..d58f845ccb85 100644 --- a/trunk/fs/jffs2/build.c +++ b/trunk/fs/jffs2/build.c @@ -46,7 +46,7 @@ next_inode(int *i, struct jffs2_inode_cache *ic, struct jffs2_sb_info *c) static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, - struct jffs2_inode_cache *ic) + struct jffs2_inode_cache *ic) { struct jffs2_full_dirent *fd; @@ -68,17 +68,11 @@ static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, continue; } - if (fd->type == DT_DIR) { - if (child_ic->pino_nlink) { - JFFS2_ERROR("child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n", - fd->name, fd->ino, ic->ino); - /* TODO: What do we do about it? */ - } else { - child_ic->pino_nlink = ic->ino; - } - } else - child_ic->pino_nlink++; - + if (child_ic->nlink++ && fd->type == DT_DIR) { + JFFS2_ERROR("child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n", + fd->name, fd->ino, ic->ino); + /* TODO: What do we do about it? */ + } dbg_fsbuild("increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino); /* Can't free scan_dents so far. We might need them in pass 2 */ } @@ -131,7 +125,7 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c) dbg_fsbuild("pass 2 starting\n"); for_each_inode(i, c, ic) { - if (ic->pino_nlink) + if (ic->nlink) continue; jffs2_build_remove_unlinked_inode(c, ic, &dead_fds); @@ -238,19 +232,16 @@ static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *c, /* Reduce nlink of the child. If it's now zero, stick it on the dead_fds list to be cleaned up later. Else just free the fd */ - if (fd->type == DT_DIR) - child_ic->pino_nlink = 0; - else - child_ic->pino_nlink--; + child_ic->nlink--; - if (!child_ic->pino_nlink) { - dbg_fsbuild("inode #%u (\"%s\") now has no links; adding to dead_fds list.\n", + if (!child_ic->nlink) { + dbg_fsbuild("inode #%u (\"%s\") has now got zero nlink, adding to dead_fds list.\n", fd->ino, fd->name); fd->next = *dead_fds; *dead_fds = fd; } else { dbg_fsbuild("inode #%u (\"%s\") has now got nlink %d. Ignoring.\n", - fd->ino, fd->name, child_ic->pino_nlink); + fd->ino, fd->name, child_ic->nlink); jffs2_free_full_dirent(fd); } } diff --git a/trunk/fs/jffs2/dir.c b/trunk/fs/jffs2/dir.c index c0c141f6fde1..c63e7a96af0d 100644 --- a/trunk/fs/jffs2/dir.c +++ b/trunk/fs/jffs2/dir.c @@ -208,13 +208,6 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, f = JFFS2_INODE_INFO(inode); dir_f = JFFS2_INODE_INFO(dir_i); - /* jffs2_do_create() will want to lock it, _after_ reserving - space and taking c-alloc_sem. If we keep it locked here, - lockdep gets unhappy (although it's a false positive; - nothing else will be looking at this inode yet so there's - no chance of AB-BA deadlock involving its f->sem). */ - mutex_unlock(&f->sem); - ret = jffs2_do_create(c, dir_f, f, ri, dentry->d_name.name, dentry->d_name.len); if (ret) @@ -226,8 +219,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, d_instantiate(dentry, inode); D1(printk(KERN_DEBUG "jffs2_create: Created ino #%lu with mode %o, nlink %d(%d). nrpages %ld\n", - inode->i_ino, inode->i_mode, inode->i_nlink, - f->inocache->pino_nlink, inode->i_mapping->nrpages)); + inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->nlink, inode->i_mapping->nrpages)); return 0; fail: @@ -251,7 +243,7 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry) ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, dentry->d_name.len, dead_f, now); if (dead_f->inocache) - dentry->d_inode->i_nlink = dead_f->inocache->pino_nlink; + dentry->d_inode->i_nlink = dead_f->inocache->nlink; if (!ret) dir_i->i_mtime = dir_i->i_ctime = ITIME(now); return ret; @@ -284,7 +276,7 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de if (!ret) { mutex_lock(&f->sem); - old_dentry->d_inode->i_nlink = ++f->inocache->pino_nlink; + old_dentry->d_inode->i_nlink = ++f->inocache->nlink; mutex_unlock(&f->sem); d_instantiate(dentry, old_dentry->d_inode); dir_i->i_mtime = dir_i->i_ctime = ITIME(now); @@ -501,13 +493,10 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) inode->i_op = &jffs2_dir_inode_operations; inode->i_fop = &jffs2_dir_operations; - - f = JFFS2_INODE_INFO(inode); - /* Directories get nlink 2 at start */ inode->i_nlink = 2; - /* but ic->pino_nlink is the parent ino# */ - f->inocache->pino_nlink = dir_i->i_ino; + + f = JFFS2_INODE_INFO(inode); ri->data_crc = cpu_to_je32(0); ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); @@ -605,25 +594,17 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) { - struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); - struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode); struct jffs2_full_dirent *fd; int ret; - uint32_t now = get_seconds(); for (fd = f->dents ; fd; fd = fd->next) { if (fd->ino) return -ENOTEMPTY; } - - ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, - dentry->d_name.len, f, now); - if (!ret) { - dir_i->i_mtime = dir_i->i_ctime = ITIME(now); - clear_nlink(dentry->d_inode); + ret = jffs2_unlink(dir_i, dentry); + if (!ret) drop_nlink(dir_i); - } return ret; } @@ -836,10 +817,7 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, inode which didn't exist. */ if (victim_f->inocache) { mutex_lock(&victim_f->sem); - if (S_ISDIR(new_dentry->d_inode->i_mode)) - victim_f->inocache->pino_nlink = 0; - else - victim_f->inocache->pino_nlink--; + victim_f->inocache->nlink--; mutex_unlock(&victim_f->sem); } } @@ -860,8 +838,8 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_dentry->d_inode); mutex_lock(&f->sem); inc_nlink(old_dentry->d_inode); - if (f->inocache && !S_ISDIR(old_dentry->d_inode->i_mode)) - f->inocache->pino_nlink++; + if (f->inocache) + f->inocache->nlink++; mutex_unlock(&f->sem); printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret); diff --git a/trunk/fs/jffs2/erase.c b/trunk/fs/jffs2/erase.c index dddb2a6c9e2c..25a640e566d3 100644 --- a/trunk/fs/jffs2/erase.c +++ b/trunk/fs/jffs2/erase.c @@ -294,7 +294,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c, break; #endif default: - if (ic->nodes == (void *)ic && ic->pino_nlink == 0) + if (ic->nodes == (void *)ic && ic->nlink == 0) jffs2_del_ino_cache(c, ic); } } @@ -332,8 +332,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl if (c->mtd->point) { unsigned long *wordebuf; - ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, - &retlen, &ebuf, NULL); + ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, &retlen, (unsigned char **)&ebuf); if (ret) { D1(printk(KERN_DEBUG "MTD point failed %d\n", ret)); goto do_flash_read; @@ -341,7 +340,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl if (retlen < c->sector_size) { /* Don't muck about if it won't let us point to the whole erase sector */ D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen)); - c->mtd->unpoint(c->mtd, jeb->offset, retlen); + c->mtd->unpoint(c->mtd, ebuf, jeb->offset, retlen); goto do_flash_read; } wordebuf = ebuf-sizeof(*wordebuf); @@ -350,7 +349,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl if (*++wordebuf != ~0) break; } while(--retlen); - c->mtd->unpoint(c->mtd, jeb->offset, c->sector_size); + c->mtd->unpoint(c->mtd, ebuf, jeb->offset, c->sector_size); if (retlen) { printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf)); diff --git a/trunk/fs/jffs2/fs.c b/trunk/fs/jffs2/fs.c index 086c43830221..3eb1c84b0a33 100644 --- a/trunk/fs/jffs2/fs.c +++ b/trunk/fs/jffs2/fs.c @@ -273,7 +273,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime)); inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime)); - inode->i_nlink = f->inocache->pino_nlink; + inode->i_nlink = f->inocache->nlink; inode->i_blocks = (inode->i_size + 511) >> 9; @@ -286,12 +286,13 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) case S_IFDIR: { struct jffs2_full_dirent *fd; - inode->i_nlink = 2; /* parent and '.' */ for (fd=f->dents; fd; fd = fd->next) { if (fd->type == DT_DIR && fd->ino) inc_nlink(inode); } + /* and '..' */ + inc_nlink(inode); /* Root dir gets i_nlink 3 for some reason */ if (inode->i_ino == 1) inc_nlink(inode); @@ -585,12 +586,11 @@ void jffs2_gc_release_inode(struct jffs2_sb_info *c, } struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, - int inum, int unlinked) + int inum, int nlink) { struct inode *inode; struct jffs2_inode_cache *ic; - - if (unlinked) { + if (!nlink) { /* The inode has zero nlink but its nodes weren't yet marked obsolete. This has to be because we're still waiting for the final (close() and) iput() to happen. @@ -638,8 +638,8 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, return ERR_CAST(inode); } if (is_bad_inode(inode)) { - printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. unlinked %d\n", - inum, unlinked); + printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. nlink %d\n", + inum, nlink); /* NB. This will happen again. We need to do something appropriate here. */ iput(inode); return ERR_PTR(-EIO); diff --git a/trunk/fs/jffs2/gc.c b/trunk/fs/jffs2/gc.c index 090c556ffed2..bad005664e30 100644 --- a/trunk/fs/jffs2/gc.c +++ b/trunk/fs/jffs2/gc.c @@ -161,8 +161,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) continue; } - if (!ic->pino_nlink) { - D1(printk(KERN_DEBUG "Skipping check of ino #%d with nlink/pino zero\n", + if (!ic->nlink) { + D1(printk(KERN_DEBUG "Skipping check of ino #%d with nlink zero\n", ic->ino)); spin_unlock(&c->inocache_lock); jffs2_xattr_delete_inode(c, ic); @@ -398,10 +398,10 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) it's vaguely possible. */ inum = ic->ino; - nlink = ic->pino_nlink; + nlink = ic->nlink; spin_unlock(&c->inocache_lock); - f = jffs2_gc_fetch_inode(c, inum, !nlink); + f = jffs2_gc_fetch_inode(c, inum, nlink); if (IS_ERR(f)) { ret = PTR_ERR(f); goto release_sem; diff --git a/trunk/fs/jffs2/nodelist.h b/trunk/fs/jffs2/nodelist.h index 1750445556c3..8219df6eb6d8 100644 --- a/trunk/fs/jffs2/nodelist.h +++ b/trunk/fs/jffs2/nodelist.h @@ -177,10 +177,7 @@ struct jffs2_inode_cache { #ifdef CONFIG_JFFS2_FS_XATTR struct jffs2_xattr_ref *xref; #endif - uint32_t pino_nlink; /* Directories store parent inode - here; other inodes store nlink. - Zero always means that it's - completely unlinked. */ + int nlink; }; /* Inode states for 'state' above. We need the 'GC' state to prevent diff --git a/trunk/fs/jffs2/nodemgmt.c b/trunk/fs/jffs2/nodemgmt.c index a9bf9603c1ba..9df8f3ef20df 100644 --- a/trunk/fs/jffs2/nodemgmt.c +++ b/trunk/fs/jffs2/nodemgmt.c @@ -709,7 +709,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref break; #endif default: - if (ic->nodes == (void *)ic && ic->pino_nlink == 0) + if (ic->nodes == (void *)ic && ic->nlink == 0) jffs2_del_ino_cache(c, ic); break; } diff --git a/trunk/fs/jffs2/os-linux.h b/trunk/fs/jffs2/os-linux.h index 2cc866cf134f..1b10d2594092 100644 --- a/trunk/fs/jffs2/os-linux.h +++ b/trunk/fs/jffs2/os-linux.h @@ -187,7 +187,7 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent); void jffs2_gc_release_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f); struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, - int inum, int unlinked); + int inum, int nlink); unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, struct jffs2_inode_info *f, diff --git a/trunk/fs/jffs2/readinode.c b/trunk/fs/jffs2/readinode.c index 6ca08ad887c0..4cb4d76de07f 100644 --- a/trunk/fs/jffs2/readinode.c +++ b/trunk/fs/jffs2/readinode.c @@ -63,11 +63,10 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info /* TODO: instead, incapsulate point() stuff to jffs2_flash_read(), * adding and jffs2_flash_read_end() interface. */ if (c->mtd->point) { - err = c->mtd->point(c->mtd, ofs, len, &retlen, - (void **)&buffer, NULL); + err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer); if (!err && retlen < len) { JFFS2_WARNING("MTD point returned len too short: %zu instead of %u.\n", retlen, tn->csize); - c->mtd->unpoint(c->mtd, ofs, retlen); + c->mtd->unpoint(c->mtd, buffer, ofs, retlen); } else if (err) JFFS2_WARNING("MTD point failed: error code %d.\n", err); else @@ -101,7 +100,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info kfree(buffer); #ifndef __ECOS else - c->mtd->unpoint(c->mtd, ofs, len); + c->mtd->unpoint(c->mtd, buffer, ofs, len); #endif if (crc != tn->data_crc) { @@ -137,7 +136,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info kfree(buffer); #ifndef __ECOS else - c->mtd->unpoint(c->mtd, ofs, len); + c->mtd->unpoint(c->mtd, buffer, ofs, len); #endif return err; } @@ -1124,8 +1123,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c, size_t retlen; int ret; - dbg_readinode("ino #%u pino/nlink is %d\n", f->inocache->ino, - f->inocache->pino_nlink); + dbg_readinode("ino #%u nlink is %d\n", f->inocache->ino, f->inocache->nlink); memset(&rii, 0, sizeof(rii)); @@ -1360,7 +1358,7 @@ int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, } dbg_readinode("creating inocache for root inode\n"); memset(f->inocache, 0, sizeof(struct jffs2_inode_cache)); - f->inocache->ino = f->inocache->pino_nlink = 1; + f->inocache->ino = f->inocache->nlink = 1; f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; f->inocache->state = INO_STATE_READING; jffs2_add_ino_cache(c, f->inocache); @@ -1403,7 +1401,7 @@ void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f) jffs2_clear_acl(f); jffs2_xattr_delete_inode(c, f->inocache); mutex_lock(&f->sem); - deleted = f->inocache && !f->inocache->pino_nlink; + deleted = f->inocache && !f->inocache->nlink; if (f->inocache && f->inocache->state != INO_STATE_CHECKING) jffs2_set_inocache_state(c, f->inocache, INO_STATE_CLEARING); diff --git a/trunk/fs/jffs2/scan.c b/trunk/fs/jffs2/scan.c index 1d437de1e9a8..272872d27fd5 100644 --- a/trunk/fs/jffs2/scan.c +++ b/trunk/fs/jffs2/scan.c @@ -97,12 +97,11 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) size_t pointlen; if (c->mtd->point) { - ret = c->mtd->point(c->mtd, 0, c->mtd->size, &pointlen, - (void **)&flashbuf, NULL); + ret = c->mtd->point (c->mtd, 0, c->mtd->size, &pointlen, &flashbuf); if (!ret && pointlen < c->mtd->size) { /* Don't muck about if it won't let us point to the whole flash */ D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", pointlen)); - c->mtd->unpoint(c->mtd, 0, pointlen); + c->mtd->unpoint(c->mtd, flashbuf, 0, pointlen); flashbuf = NULL; } if (ret) @@ -268,7 +267,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) kfree(flashbuf); #ifndef __ECOS else - c->mtd->unpoint(c->mtd, 0, c->mtd->size); + c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size); #endif if (s) kfree(s); @@ -941,7 +940,7 @@ struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uin ic->nodes = (void *)ic; jffs2_add_ino_cache(c, ic); if (ino == 1) - ic->pino_nlink = 1; + ic->nlink = 1; return ic; } diff --git a/trunk/fs/jffs2/super.c b/trunk/fs/jffs2/super.c index 7da69eae49e4..f3353df178e7 100644 --- a/trunk/fs/jffs2/super.c +++ b/trunk/fs/jffs2/super.c @@ -31,12 +31,11 @@ static struct kmem_cache *jffs2_inode_cachep; static struct inode *jffs2_alloc_inode(struct super_block *sb) { - struct jffs2_inode_info *f; - - f = kmem_cache_alloc(jffs2_inode_cachep, GFP_KERNEL); - if (!f) + struct jffs2_inode_info *ei; + ei = (struct jffs2_inode_info *)kmem_cache_alloc(jffs2_inode_cachep, GFP_KERNEL); + if (!ei) return NULL; - return &f->vfs_inode; + return &ei->vfs_inode; } static void jffs2_destroy_inode(struct inode *inode) @@ -46,10 +45,10 @@ static void jffs2_destroy_inode(struct inode *inode) static void jffs2_i_init_once(struct kmem_cache *cachep, void *foo) { - struct jffs2_inode_info *f = foo; + struct jffs2_inode_info *ei = (struct jffs2_inode_info *) foo; - mutex_init(&f->sem); - inode_init_once(&f->vfs_inode); + mutex_init(&ei->sem); + inode_init_once(&ei->vfs_inode); } static int jffs2_sync_fs(struct super_block *sb, int wait) diff --git a/trunk/fs/jffs2/wbuf.c b/trunk/fs/jffs2/wbuf.c index 0e78b00035e4..8de52b607678 100644 --- a/trunk/fs/jffs2/wbuf.c +++ b/trunk/fs/jffs2/wbuf.c @@ -494,7 +494,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) /* If it's an in-core inode, then we have to adjust any full_dirent or full_dnode structure to point to the new version instead of the old */ - f = jffs2_gc_fetch_inode(c, ic->ino, !ic->pino_nlink); + f = jffs2_gc_fetch_inode(c, ic->ino, ic->nlink); if (IS_ERR(f)) { /* Should never happen; it _must_ be present */ JFFS2_ERROR("Failed to iget() ino #%u, err %ld\n", diff --git a/trunk/fs/jffs2/write.c b/trunk/fs/jffs2/write.c index ca29440e9435..665fce9797d3 100644 --- a/trunk/fs/jffs2/write.c +++ b/trunk/fs/jffs2/write.c @@ -19,8 +19,7 @@ #include "compr.h" -int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - uint32_t mode, struct jffs2_raw_inode *ri) +int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint32_t mode, struct jffs2_raw_inode *ri) { struct jffs2_inode_cache *ic; @@ -32,7 +31,7 @@ int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, memset(ic, 0, sizeof(*ic)); f->inocache = ic; - f->inocache->pino_nlink = 1; /* Will be overwritten shortly for directories */ + f->inocache->nlink = 1; f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; f->inocache->state = INO_STATE_PRESENT; @@ -439,10 +438,10 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str ret = jffs2_reserve_space(c, sizeof(*ri), &alloclen, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen)); - if (ret) + if (ret) { + mutex_unlock(&f->sem); return ret; - - mutex_lock(&f->sem); + } ri->data_crc = cpu_to_je32(0); ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); @@ -636,9 +635,9 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, jffs2_mark_node_obsolete(c, fd->raw); jffs2_free_full_dirent(fd); } - dead_f->inocache->pino_nlink = 0; - } else - dead_f->inocache->pino_nlink--; + } + + dead_f->inocache->nlink--; /* NB: Caller must set inode nlink if appropriate */ mutex_unlock(&dead_f->sem); } diff --git a/trunk/fs/jffs2/xattr.c b/trunk/fs/jffs2/xattr.c index 082e844ab2db..574cb7532d6c 100644 --- a/trunk/fs/jffs2/xattr.c +++ b/trunk/fs/jffs2/xattr.c @@ -592,7 +592,7 @@ void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache When an inode with XATTR is removed, those XATTRs must be removed. */ struct jffs2_xattr_ref *ref, *_ref; - if (!ic || ic->pino_nlink > 0) + if (!ic || ic->nlink > 0) return; down_write(&c->xattr_sem); @@ -829,7 +829,7 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c) ref->xd and ref->ic are not valid yet. */ xd = jffs2_find_xattr_datum(c, ref->xid); ic = jffs2_get_ino_cache(c, ref->ino); - if (!xd || !ic || !ic->pino_nlink) { + if (!xd || !ic || !ic->nlink) { dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) is orphan.\n", ref->ino, ref->xid, ref->xseqno); ref->xseqno |= XREF_DELETE_MARKER; diff --git a/trunk/fs/sysfs/inode.c b/trunk/fs/sysfs/inode.c index eb53c632f856..f8b82e73b3bf 100644 --- a/trunk/fs/sysfs/inode.c +++ b/trunk/fs/sysfs/inode.c @@ -59,8 +59,6 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) if (error) return error; - iattr->ia_valid &= ~ATTR_SIZE; /* ignore size changes */ - error = inode_setattr(inode, iattr); if (error) return error; diff --git a/trunk/fs/utimes.c b/trunk/fs/utimes.c index af059d5cb485..a2bef77dc9c9 100644 --- a/trunk/fs/utimes.c +++ b/trunk/fs/utimes.c @@ -40,14 +40,9 @@ asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times) #endif -static bool nsec_special(long nsec) -{ - return nsec == UTIME_OMIT || nsec == UTIME_NOW; -} - static bool nsec_valid(long nsec) { - if (nsec_special(nsec)) + if (nsec == UTIME_OMIT || nsec == UTIME_NOW) return true; return nsec >= 0 && nsec <= 999999999; @@ -124,15 +119,7 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags newattrs.ia_mtime.tv_nsec = times[1].tv_nsec; newattrs.ia_valid |= ATTR_MTIME_SET; } - } - - /* - * If times is NULL or both times are either UTIME_OMIT or - * UTIME_NOW, then need to check permissions, because - * inode_change_ok() won't do it. - */ - if (!times || (nsec_special(times[0].tv_nsec) && - nsec_special(times[1].tv_nsec))) { + } else { error = -EACCES; if (IS_IMMUTABLE(inode)) goto mnt_drop_write_and_out; diff --git a/trunk/include/asm-arm/div64.h b/trunk/include/asm-arm/div64.h index 5001390be958..0b5f881c3d85 100644 --- a/trunk/include/asm-arm/div64.h +++ b/trunk/include/asm-arm/div64.h @@ -224,4 +224,6 @@ #endif +extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); + #endif diff --git a/trunk/include/asm-frv/unaligned.h b/trunk/include/asm-frv/unaligned.h index 839a2fbffa0f..64ccc736f2d8 100644 --- a/trunk/include/asm-frv/unaligned.h +++ b/trunk/include/asm-frv/unaligned.h @@ -9,8 +9,8 @@ * 2 of the License, or (at your option) any later version. */ -#ifndef _ASM_UNALIGNED_H -#define _ASM_UNALIGNED_H +#ifndef _ASM_FRV_UNALIGNED_H +#define _ASM_FRV_UNALIGNED_H #include #include @@ -19,4 +19,4 @@ #define get_unaligned __get_unaligned_be #define put_unaligned __put_unaligned_be -#endif /* _ASM_UNALIGNED_H */ +#endif /* _ASM_FRV_UNALIGNED_H */ diff --git a/trunk/include/asm-generic/div64.h b/trunk/include/asm-generic/div64.h index 8f4e3193342e..a4a49370793c 100644 --- a/trunk/include/asm-generic/div64.h +++ b/trunk/include/asm-generic/div64.h @@ -30,6 +30,11 @@ __rem; \ }) +static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor) +{ + return dividend / divisor; +} + #elif BITS_PER_LONG == 32 extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); @@ -49,6 +54,8 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); __rem; \ }) +extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); + #else /* BITS_PER_LONG == ?? */ # error do_div() does not yet support the C64 diff --git a/trunk/include/asm-ia64/dmi.h b/trunk/include/asm-ia64/dmi.h index 00eb1b130b63..f3efaa229525 100644 --- a/trunk/include/asm-ia64/dmi.h +++ b/trunk/include/asm-ia64/dmi.h @@ -3,9 +3,4 @@ #include -/* Use normal IO mappings for DMI */ -#define dmi_ioremap ioremap -#define dmi_iounmap(x,l) iounmap(x) -#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC) - #endif diff --git a/trunk/include/asm-ia64/io.h b/trunk/include/asm-ia64/io.h index 260a85ac9d6a..4ebed77aa472 100644 --- a/trunk/include/asm-ia64/io.h +++ b/trunk/include/asm-ia64/io.h @@ -423,6 +423,11 @@ extern void __iomem * ioremap(unsigned long offset, unsigned long size); extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); extern void iounmap (volatile void __iomem *addr); +/* Use normal IO mappings for DMI */ +#define dmi_ioremap ioremap +#define dmi_iounmap(x,l) iounmap(x) +#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC) + /* * String version of IO memory access ops: */ diff --git a/trunk/include/asm-m68k/div64.h b/trunk/include/asm-m68k/div64.h index 8243c931b5c0..33caad1628d4 100644 --- a/trunk/include/asm-m68k/div64.h +++ b/trunk/include/asm-m68k/div64.h @@ -25,4 +25,5 @@ __rem; \ }) +extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); #endif /* _M68K_DIV64_H */ diff --git a/trunk/include/asm-m68knommu/dma.h b/trunk/include/asm-m68knommu/dma.h index 939a02056217..3f20419c633a 100644 --- a/trunk/include/asm-m68knommu/dma.h +++ b/trunk/include/asm-m68knommu/dma.h @@ -35,8 +35,7 @@ /* * Set number of channels of DMA on ColdFire for different implementations. */ -#if defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407) || \ - defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) +#if defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407) #define MAX_M68K_DMA_CHANNELS 4 #elif defined(CONFIG_M5272) #define MAX_M68K_DMA_CHANNELS 1 diff --git a/trunk/include/asm-m68knommu/param.h b/trunk/include/asm-m68knommu/param.h index 6044397adb64..96c451018324 100644 --- a/trunk/include/asm-m68knommu/param.h +++ b/trunk/include/asm-m68knommu/param.h @@ -1,16 +1,13 @@ #ifndef _M68KNOMMU_PARAM_H #define _M68KNOMMU_PARAM_H -#ifdef __KERNEL__ #define HZ CONFIG_HZ + +#ifdef __KERNEL__ #define USER_HZ HZ #define CLOCKS_PER_SEC (USER_HZ) #endif -#ifndef HZ -#define HZ 100 -#endif - #define EXEC_PAGESIZE 4096 #ifndef NOGROUP diff --git a/trunk/include/asm-mips/div64.h b/trunk/include/asm-mips/div64.h index d1d699105c11..716371bd0980 100644 --- a/trunk/include/asm-mips/div64.h +++ b/trunk/include/asm-mips/div64.h @@ -82,6 +82,7 @@ (n) = __quot; \ __mod; }) +extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); #endif /* (_MIPS_SZLONG == 32) */ #if (_MIPS_SZLONG == 64) @@ -105,6 +106,11 @@ (n) = __quot; \ __mod; }) +static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor) +{ + return dividend / divisor; +} + #endif /* (_MIPS_SZLONG == 64) */ #endif /* _ASM_DIV64_H */ diff --git a/trunk/include/asm-mn10300/div64.h b/trunk/include/asm-mn10300/div64.h index 3a8329b3e869..bf9c515a998c 100644 --- a/trunk/include/asm-mn10300/div64.h +++ b/trunk/include/asm-mn10300/div64.h @@ -97,4 +97,7 @@ signed __muldiv64s(signed val, signed mult, signed div) return result; } +extern __attribute__((const)) +uint64_t div64_64(uint64_t dividend, uint64_t divisor); + #endif /* _ASM_DIV64 */ diff --git a/trunk/include/asm-um/div64.h b/trunk/include/asm-um/div64.h index 1e17f7409cab..7b73b2cd5b34 100644 --- a/trunk/include/asm-um/div64.h +++ b/trunk/include/asm-um/div64.h @@ -3,4 +3,5 @@ #include "asm/arch/div64.h" +extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); #endif diff --git a/trunk/include/asm-x86/div64.h b/trunk/include/asm-x86/div64.h index 9a2d644c08ef..0dbf8bf3ef0a 100644 --- a/trunk/include/asm-x86/div64.h +++ b/trunk/include/asm-x86/div64.h @@ -33,25 +33,25 @@ __mod; \ }) -static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) +/* + * (long)X = ((long long)divs) / (long)div + * (long)rem = ((long long)divs) % (long)div + * + * Warning, this will do an exception if X overflows. + */ +#define div_long_long_rem(a, b, c) div_ll_X_l_rem(a, b, c) + +static inline long div_ll_X_l_rem(long long divs, long div, long *rem) { - union { - u64 v64; - u32 v32[2]; - } d = { dividend }; - u32 upper; - - upper = d.v32[1]; - d.v32[1] = 0; - if (upper >= divisor) { - d.v32[1] = upper / divisor; - upper %= divisor; - } - asm ("divl %2" : "=a" (d.v32[0]), "=d" (*remainder) : - "rm" (divisor), "0" (d.v32[0]), "1" (upper)); - return d.v64; + long dum2; + asm("divl %2":"=a"(dum2), "=d"(*rem) + : "rm"(div), "A"(divs)); + + return dum2; + } -#define div_u64_rem div_u64_rem + +extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); #else # include diff --git a/trunk/include/asm-x86/dmi.h b/trunk/include/asm-x86/dmi.h index 4edf7514a750..1241e6ad1935 100644 --- a/trunk/include/asm-x86/dmi.h +++ b/trunk/include/asm-x86/dmi.h @@ -27,7 +27,6 @@ static inline void *dmi_alloc(unsigned len) #endif -/* Use early IO mappings for DMI because it's initialized early */ #define dmi_ioremap early_ioremap #define dmi_iounmap early_iounmap diff --git a/trunk/include/asm-x86/io_32.h b/trunk/include/asm-x86/io_32.h index 049e81e797a0..6e73467a4fb1 100644 --- a/trunk/include/asm-x86/io_32.h +++ b/trunk/include/asm-x86/io_32.h @@ -133,6 +133,11 @@ extern void *early_ioremap(unsigned long offset, unsigned long size); extern void early_iounmap(void *addr, unsigned long size); extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); +/* Use early IO mappings for DMI because it's initialized early */ +#define dmi_ioremap early_ioremap +#define dmi_iounmap early_iounmap +#define dmi_alloc alloc_bootmem + /* * ISA I/O bus memory addresses are 1:1 with the physical address. */ diff --git a/trunk/include/asm-x86/mach-default/mach_apic.h b/trunk/include/asm-x86/mach-default/mach_apic.h index 21003b56ae95..0a6634f62abe 100644 --- a/trunk/include/asm-x86/mach-default/mach_apic.h +++ b/trunk/include/asm-x86/mach-default/mach_apic.h @@ -109,8 +109,13 @@ static inline int cpu_to_logical_apicid(int cpu) static inline int cpu_present_to_apicid(int mps_cpu) { - if (mps_cpu < NR_CPUS && cpu_present(mps_cpu)) +#ifdef CONFIG_X86_64 + if (cpu_present(mps_cpu)) return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); +#else + if (mps_cpu < get_physical_broadcast()) + return mps_cpu; +#endif else return BAD_APICID; } diff --git a/trunk/include/asm-x86/processor.h b/trunk/include/asm-x86/processor.h index 559105220a47..2e7974ec77ec 100644 --- a/trunk/include/asm-x86/processor.h +++ b/trunk/include/asm-x86/processor.h @@ -3,6 +3,9 @@ #include +/* migration helper, for KVM - will be removed in 2.6.25: */ +#define Xgt_desc_struct desc_ptr + /* Forward declaration, a strange C thing */ struct task_struct; struct mm_struct; diff --git a/trunk/include/asm-x86/proto.h b/trunk/include/asm-x86/proto.h index 6c8b41b03f6d..1e17bcce450e 100644 --- a/trunk/include/asm-x86/proto.h +++ b/trunk/include/asm-x86/proto.h @@ -20,11 +20,7 @@ extern void syscall32_cpu_init(void); extern void check_efer(void); -#ifdef CONFIG_X86_BIOS_REBOOT extern int reboot_force; -#else -static const int reboot_force = 0; -#endif long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); diff --git a/trunk/include/crypto/scatterwalk.h b/trunk/include/crypto/scatterwalk.h index 833d208c25d6..224658b8d806 100644 --- a/trunk/include/crypto/scatterwalk.h +++ b/trunk/include/crypto/scatterwalk.h @@ -57,14 +57,10 @@ static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num, struct scatterlist *sg2) { sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0); - sg1[num - 1].page_link &= ~0x02; } static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg) { - if (sg_is_last(sg)) - return NULL; - return (++sg)->length ? sg : (void *)sg_page(sg); } diff --git a/trunk/include/linux/calc64.h b/trunk/include/linux/calc64.h new file mode 100644 index 000000000000..ebf4b8f38d88 --- /dev/null +++ b/trunk/include/linux/calc64.h @@ -0,0 +1,49 @@ +#ifndef _LINUX_CALC64_H +#define _LINUX_CALC64_H + +#include +#include + +/* + * This is a generic macro which is used when the architecture + * specific div64.h does not provide a optimized one. + * + * The 64bit dividend is divided by the divisor (data type long), the + * result is returned and the remainder stored in the variable + * referenced by remainder (data type long *). In contrast to the + * do_div macro the dividend is kept intact. + */ +#ifndef div_long_long_rem +#define div_long_long_rem(dividend, divisor, remainder) \ + do_div_llr((dividend), divisor, remainder) + +static inline unsigned long do_div_llr(const long long dividend, + const long divisor, long *remainder) +{ + u64 result = dividend; + + *(remainder) = do_div(result, divisor); + return (unsigned long) result; +} +#endif + +/* + * Sign aware variation of the above. On some architectures a + * negative dividend leads to an divide overflow exception, which + * is avoided by the sign check. + */ +static inline long div_long_long_rem_signed(const long long dividend, + const long divisor, long *remainder) +{ + long res; + + if (unlikely(dividend < 0)) { + res = -div_long_long_rem(-dividend, divisor, remainder); + *remainder = -(*remainder); + } else + res = div_long_long_rem(dividend, divisor, remainder); + + return res; +} + +#endif diff --git a/trunk/include/linux/clocksource.h b/trunk/include/linux/clocksource.h index 55e434feec99..35094479ca55 100644 --- a/trunk/include/linux/clocksource.h +++ b/trunk/include/linux/clocksource.h @@ -93,8 +93,6 @@ struct clocksource { #endif }; -extern struct clocksource *clock; /* current clocksource */ - /* * Clock source flags bits:: */ diff --git a/trunk/include/linux/compat.h b/trunk/include/linux/compat.h index cf8d11cad5ae..8fa7857e153b 100644 --- a/trunk/include/linux/compat.h +++ b/trunk/include/linux/compat.h @@ -65,11 +65,10 @@ struct compat_timex { compat_long_t calcnt; compat_long_t errcnt; compat_long_t stbcnt; - compat_int_t tai; compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; - compat_int_t :32; compat_int_t :32; compat_int_t :32; + compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; }; #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) diff --git a/trunk/include/linux/device.h b/trunk/include/linux/device.h index 832fb0eb2933..1a060265acea 100644 --- a/trunk/include/linux/device.h +++ b/trunk/include/linux/device.h @@ -35,6 +35,7 @@ struct device; struct device_driver; struct driver_private; struct class; +struct class_device; struct bus_type; struct bus_type_private; @@ -189,10 +190,13 @@ struct class { struct kset class_dirs; struct semaphore sem; /* locks children, devices, interfaces */ struct class_attribute *class_attrs; + struct class_device_attribute *class_dev_attrs; struct device_attribute *dev_attrs; + int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); + void (*release)(struct class_device *dev); void (*class_release)(struct class *class); void (*dev_release)(struct device *dev); @@ -206,6 +210,9 @@ extern int class_for_each_device(struct class *class, void *data, int (*fn)(struct device *dev, void *data)); extern struct device *class_find_device(struct class *class, void *data, int (*match)(struct device *, void *)); +extern struct class_device *class_find_child(struct class *class, void *data, + int (*match)(struct class_device *, void *)); + struct class_attribute { struct attribute attr; @@ -221,10 +228,92 @@ extern int __must_check class_create_file(struct class *class, extern void class_remove_file(struct class *class, const struct class_attribute *attr); +struct class_device_attribute { + struct attribute attr; + ssize_t (*show)(struct class_device *, char *buf); + ssize_t (*store)(struct class_device *, const char *buf, size_t count); +}; + +#define CLASS_DEVICE_ATTR(_name, _mode, _show, _store) \ +struct class_device_attribute class_device_attr_##_name = \ + __ATTR(_name, _mode, _show, _store) + +extern int __must_check class_device_create_file(struct class_device *, + const struct class_device_attribute *); + +/** + * struct class_device - class devices + * @class: pointer to the parent class for this class device. This is required. + * @devt: for internal use by the driver core only. + * @node: for internal use by the driver core only. + * @kobj: for internal use by the driver core only. + * @groups: optional additional groups to be created + * @dev: if set, a symlink to the struct device is created in the sysfs + * directory for this struct class device. + * @class_data: pointer to whatever you want to store here for this struct + * class_device. Use class_get_devdata() and class_set_devdata() to get and + * set this pointer. + * @parent: pointer to a struct class_device that is the parent of this struct + * class_device. If NULL, this class_device will show up at the root of the + * struct class in sysfs (which is probably what you want to have happen.) + * @release: pointer to a release function for this struct class_device. If + * set, this will be called instead of the class specific release function. + * Only use this if you want to override the default release function, like + * when you are nesting class_device structures. + * @uevent: pointer to a uevent function for this struct class_device. If + * set, this will be called instead of the class specific uevent function. + * Only use this if you want to override the default uevent function, like + * when you are nesting class_device structures. + */ +struct class_device { + struct list_head node; + + struct kobject kobj; + struct class *class; + dev_t devt; + struct device *dev; + void *class_data; + struct class_device *parent; + struct attribute_group **groups; + + void (*release)(struct class_device *dev); + int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); + char class_id[BUS_ID_SIZE]; +}; + +static inline void *class_get_devdata(struct class_device *dev) +{ + return dev->class_data; +} + +static inline void class_set_devdata(struct class_device *dev, void *data) +{ + dev->class_data = data; +} + + +extern int __must_check class_device_register(struct class_device *); +extern void class_device_unregister(struct class_device *); +extern void class_device_initialize(struct class_device *); +extern int __must_check class_device_add(struct class_device *); +extern void class_device_del(struct class_device *); + +extern struct class_device *class_device_get(struct class_device *); +extern void class_device_put(struct class_device *); + +extern void class_device_remove_file(struct class_device *, + const struct class_device_attribute *); +extern int __must_check class_device_create_bin_file(struct class_device *, + struct bin_attribute *); +extern void class_device_remove_bin_file(struct class_device *, + struct bin_attribute *); + struct class_interface { struct list_head node; struct class *class; + int (*add) (struct class_device *, struct class_interface *); + void (*remove) (struct class_device *, struct class_interface *); int (*add_dev) (struct device *, struct class_interface *); void (*remove_dev) (struct device *, struct class_interface *); }; @@ -234,6 +323,13 @@ extern void class_interface_unregister(struct class_interface *); extern struct class *class_create(struct module *owner, const char *name); extern void class_destroy(struct class *cls); +extern struct class_device *class_device_create(struct class *cls, + struct class_device *parent, + dev_t devt, + struct device *device, + const char *fmt, ...) + __attribute__((format(printf, 5, 6))); +extern void class_device_destroy(struct class *cls, dev_t devt); /* * The type of device, "struct device" is embedded in. A class @@ -369,6 +465,7 @@ struct device { spinlock_t devres_lock; struct list_head devres_head; + /* class_device migration path */ struct list_head node; struct class *class; dev_t devt; /* dev_t, creates the sysfs "dev" */ diff --git a/trunk/include/linux/io.h b/trunk/include/linux/io.h index 3a03a3604cce..e3b2dda6c8eb 100644 --- a/trunk/include/linux/io.h +++ b/trunk/include/linux/io.h @@ -58,9 +58,9 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr) } #endif -void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, +void __iomem * devm_ioremap(struct device *dev, unsigned long offset, unsigned long size); -void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, +void __iomem * devm_ioremap_nocache(struct device *dev, unsigned long offset, unsigned long size); void devm_iounmap(struct device *dev, void __iomem *addr); int check_signature(const volatile void __iomem *io_addr, diff --git a/trunk/include/linux/jiffies.h b/trunk/include/linux/jiffies.h index abb6ac639e8e..33ef710dac24 100644 --- a/trunk/include/linux/jiffies.h +++ b/trunk/include/linux/jiffies.h @@ -1,7 +1,7 @@ #ifndef _LINUX_JIFFIES_H #define _LINUX_JIFFIES_H -#include +#include #include #include #include diff --git a/trunk/include/linux/klist.h b/trunk/include/linux/klist.h index 06c338ef7f1b..74071254c9d3 100644 --- a/trunk/include/linux/klist.h +++ b/trunk/include/linux/klist.h @@ -25,47 +25,37 @@ struct klist { void (*put)(struct klist_node *); }; -#define KLIST_INIT(_name, _get, _put) \ - { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \ - .k_list = LIST_HEAD_INIT(_name.k_list), \ - .get = _get, \ - .put = _put, } -#define DEFINE_KLIST(_name, _get, _put) \ - struct klist _name = KLIST_INIT(_name, _get, _put) - -extern void klist_init(struct klist *k, void (*get)(struct klist_node *), +extern void klist_init(struct klist * k, void (*get)(struct klist_node *), void (*put)(struct klist_node *)); struct klist_node { - struct klist *n_klist; + struct klist * n_klist; struct list_head n_node; struct kref n_ref; struct completion n_removed; }; -extern void klist_add_tail(struct klist_node *n, struct klist *k); -extern void klist_add_head(struct klist_node *n, struct klist *k); -extern void klist_add_after(struct klist_node *n, struct klist_node *pos); -extern void klist_add_before(struct klist_node *n, struct klist_node *pos); +extern void klist_add_tail(struct klist_node * n, struct klist * k); +extern void klist_add_head(struct klist_node * n, struct klist * k); -extern void klist_del(struct klist_node *n); -extern void klist_remove(struct klist_node *n); +extern void klist_del(struct klist_node * n); +extern void klist_remove(struct klist_node * n); -extern int klist_node_attached(struct klist_node *n); +extern int klist_node_attached(struct klist_node * n); struct klist_iter { - struct klist *i_klist; - struct list_head *i_head; - struct klist_node *i_cur; + struct klist * i_klist; + struct list_head * i_head; + struct klist_node * i_cur; }; -extern void klist_iter_init(struct klist *k, struct klist_iter *i); -extern void klist_iter_init_node(struct klist *k, struct klist_iter *i, - struct klist_node *n); -extern void klist_iter_exit(struct klist_iter *i); -extern struct klist_node *klist_next(struct klist_iter *i); +extern void klist_iter_init(struct klist * k, struct klist_iter * i); +extern void klist_iter_init_node(struct klist * k, struct klist_iter * i, + struct klist_node * n); +extern void klist_iter_exit(struct klist_iter * i); +extern struct klist_node * klist_next(struct klist_iter * i); #endif diff --git a/trunk/include/linux/math64.h b/trunk/include/linux/math64.h deleted file mode 100644 index c1a5f81501ff..000000000000 --- a/trunk/include/linux/math64.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef _LINUX_MATH64_H -#define _LINUX_MATH64_H - -#include -#include - -#if BITS_PER_LONG == 64 - -/** - * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder - * - * This is commonly provided by 32bit archs to provide an optimized 64bit - * divide. - */ -static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) -{ - *remainder = dividend % divisor; - return dividend / divisor; -} - -/** - * div_s64_rem - signed 64bit divide with 32bit divisor with remainder - */ -static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) -{ - *remainder = dividend % divisor; - return dividend / divisor; -} - -/** - * div64_u64 - unsigned 64bit divide with 64bit divisor - */ -static inline u64 div64_u64(u64 dividend, u64 divisor) -{ - return dividend / divisor; -} - -#elif BITS_PER_LONG == 32 - -#ifndef div_u64_rem -static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) -{ - *remainder = do_div(dividend, divisor); - return dividend; -} -#endif - -#ifndef div_s64_rem -extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder); -#endif - -#ifndef div64_u64 -extern u64 div64_u64(u64 dividend, u64 divisor); -#endif - -#endif /* BITS_PER_LONG */ - -/** - * div_u64 - unsigned 64bit divide with 32bit divisor - * - * This is the most common 64bit divide and should be used if possible, - * as many 32bit archs can optimize this variant better than a full 64bit - * divide. - */ -#ifndef div_u64 -static inline u64 div_u64(u64 dividend, u32 divisor) -{ - u32 remainder; - return div_u64_rem(dividend, divisor, &remainder); -} -#endif - -/** - * div_s64 - signed 64bit divide with 32bit divisor - */ -#ifndef div_s64 -static inline s64 div_s64(s64 dividend, s32 divisor) -{ - s32 remainder; - return div_s64_rem(dividend, divisor, &remainder); -} -#endif - -#endif /* _LINUX_MATH64_H */ diff --git a/trunk/include/linux/module.h b/trunk/include/linux/module.h index 3e03b1acbc94..819c4e889bf1 100644 --- a/trunk/include/linux/module.h +++ b/trunk/include/linux/module.h @@ -190,7 +190,7 @@ void *__symbol_get_gpl(const char *symbol); extern typeof(sym) sym; \ __CRC_SYMBOL(sym, sec) \ static const char __kstrtab_##sym[] \ - __attribute__((section("__ksymtab_strings"), aligned(1))) \ + __attribute__((section("__ksymtab_strings"))) \ = MODULE_SYMBOL_PREFIX #sym; \ static const struct kernel_symbol __ksymtab_##sym \ __used \ @@ -229,6 +229,23 @@ enum module_state MODULE_STATE_GOING, }; +/* Similar stuff for section attributes. */ +struct module_sect_attr +{ + struct module_attribute mattr; + char *name; + unsigned long address; +}; + +struct module_sect_attrs +{ + struct attribute_group grp; + int nsections; + struct module_sect_attr attrs[0]; +}; + +struct module_param_attrs; + struct module { enum module_state state; diff --git a/trunk/include/linux/mtd/jedec.h b/trunk/include/linux/mtd/jedec.h new file mode 100644 index 000000000000..9006feb218b9 --- /dev/null +++ b/trunk/include/linux/mtd/jedec.h @@ -0,0 +1,66 @@ + +/* JEDEC Flash Interface. + * This is an older type of interface for self programming flash. It is + * commonly use in older AMD chips and is obsolete compared with CFI. + * It is called JEDEC because the JEDEC association distributes the ID codes + * for the chips. + * + * See the AMD flash databook for information on how to operate the interface. + * + * $Id: jedec.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $ + */ + +#ifndef __LINUX_MTD_JEDEC_H__ +#define __LINUX_MTD_JEDEC_H__ + +#include + +#define MAX_JEDEC_CHIPS 16 + +// Listing of all supported chips and their information +struct JEDECTable +{ + __u16 jedec; + char *name; + unsigned long size; + unsigned long sectorsize; + __u32 capabilities; +}; + +// JEDEC being 0 is the end of the chip array +struct jedec_flash_chip +{ + __u16 jedec; + unsigned long size; + unsigned long sectorsize; + + // *(__u8*)(base + (adder << addrshift)) = data << datashift + // Address size = size << addrshift + unsigned long base; // Byte 0 of the flash, will be unaligned + unsigned int datashift; // Useful for 32bit/16bit accesses + unsigned int addrshift; + unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash + + __u32 capabilities; + + // These markers are filled in by the flash_chip_scan function + unsigned long start; + unsigned long length; +}; + +struct jedec_private +{ + unsigned long size; // Total size of all the devices + + /* Bank handling. If sum(bank_fill) == size then this is linear flash. + Otherwise the mapping has holes in it. bank_fill may be used to + find the holes, but in the common symetric case + bank_fill[0] == bank_fill[*], thus addresses may be computed + mathmatically. bank_fill must be powers of two */ + unsigned is_banked; + unsigned long bank_fill[MAX_JEDEC_CHIPS]; + + struct jedec_flash_chip chips[MAX_JEDEC_CHIPS]; +}; + +#endif diff --git a/trunk/include/linux/mtd/mtd.h b/trunk/include/linux/mtd/mtd.h index 245f9098e171..0a13bb35f044 100644 --- a/trunk/include/linux/mtd/mtd.h +++ b/trunk/include/linux/mtd/mtd.h @@ -143,12 +143,10 @@ struct mtd_info { int (*erase) (struct mtd_info *mtd, struct erase_info *instr); /* This stuff for eXecute-In-Place */ - /* phys is optional and may be set to NULL */ - int (*point) (struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys); + int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ - void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); + void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len); int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); diff --git a/trunk/include/linux/mtd/pmc551.h b/trunk/include/linux/mtd/pmc551.h index 5cc070c24d88..a7f6d20ad407 100644 --- a/trunk/include/linux/mtd/pmc551.h +++ b/trunk/include/linux/mtd/pmc551.h @@ -36,9 +36,8 @@ struct mypriv { * Function Prototypes */ static int pmc551_erase(struct mtd_info *, struct erase_info *); -static void pmc551_unpoint(struct mtd_info *, loff_t, size_t); -static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys); +static void pmc551_unpoint(struct mtd_info *, u_char *, loff_t, size_t); +static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); diff --git a/trunk/include/linux/pci_ids.h b/trunk/include/linux/pci_ids.h index cf6dbd759395..e5a53daf17f1 100644 --- a/trunk/include/linux/pci_ids.h +++ b/trunk/include/linux/pci_ids.h @@ -1429,7 +1429,6 @@ #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA #define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB -#define PCIE_DEVICE_ID_NEO_4_IBM 0x00F4 #define PCI_VENDOR_ID_XIRCOM 0x115d #define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101 diff --git a/trunk/include/linux/quota.h b/trunk/include/linux/quota.h index dcddfb200947..52e49dce6584 100644 --- a/trunk/include/linux/quota.h +++ b/trunk/include/linux/quota.h @@ -347,9 +347,6 @@ struct quota_info { ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \ (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED)) -#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \ - sb_has_quota_suspended(sb, GRPQUOTA)) - int register_quota_format(struct quota_format_type *fmt); void unregister_quota_format(struct quota_format_type *fmt); diff --git a/trunk/include/linux/string.h b/trunk/include/linux/string.h index efdc44593b52..c5d3fcad7b57 100644 --- a/trunk/include/linux/string.h +++ b/trunk/include/linux/string.h @@ -109,7 +109,5 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp); extern char **argv_split(gfp_t gfp, const char *str, int *argcp); extern void argv_free(char **argv); -extern bool sysfs_streq(const char *s1, const char *s2); - #endif #endif /* _LINUX_STRING_H_ */ diff --git a/trunk/include/linux/sysfs.h b/trunk/include/linux/sysfs.h index 27bad59dae79..add3c5a40827 100644 --- a/trunk/include/linux/sysfs.h +++ b/trunk/include/linux/sysfs.h @@ -190,18 +190,6 @@ static inline int sysfs_create_group(struct kobject *kobj, return 0; } -static inline int sysfs_update_group(struct kobject *kobj, - const struct attribute_group *grp) -{ - return 0; -} - -static inline int sysfs_update_group(struct kobject *kobj, - const struct attribute_group *grp) -{ - return 0; -} - static inline void sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp) { diff --git a/trunk/include/linux/timex.h b/trunk/include/linux/timex.h index fc6035d29d56..8ea3e71ba7fa 100644 --- a/trunk/include/linux/timex.h +++ b/trunk/include/linux/timex.h @@ -58,8 +58,6 @@ #include -#define NTP_API 4 /* NTP API version */ - /* * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen * for a slightly underdamped convergence characteristic. SHIFT_KH @@ -76,22 +74,24 @@ #define MAXTC 10 /* maximum time constant (shift) */ /* + * The SHIFT_UPDATE define establishes the decimal point of the + * time_offset variable which represents the current offset with + * respect to standard time. + * * SHIFT_USEC defines the scaling (shift) of the time_freq and * time_tolerance variables, which represent the current frequency * offset and maximum frequency tolerance. */ +#define SHIFT_UPDATE (SHIFT_HZ + 1) /* time offset scale (shift) */ #define SHIFT_USEC 16 /* frequency offset scale (shift) */ -#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) -#define PPM_SCALE_INV_SHIFT 20 -#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ - PPM_SCALE + 1) - -#define MAXPHASE 500000000l /* max phase error (ns) */ -#define MAXFREQ 500000 /* max frequency error (ns/s) */ -#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT) +#define SHIFT_NSEC 12 /* kernel frequency offset scale */ + +#define MAXPHASE 512000L /* max phase error (us) */ +#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ +#define MAXFREQ_NSEC (512000L << SHIFT_NSEC) /* max frequency error (ppb) */ #define MINSEC 256 /* min interval between updates (s) */ #define MAXSEC 2048 /* max interval between updates (s) */ -#define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */ +#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ /* * syscall interface - used (mainly by NTP daemon) @@ -121,11 +121,9 @@ struct timex { long errcnt; /* calibration errors (ro) */ long stbcnt; /* stability limit exceeded (ro) */ - int tai; /* TAI offset (ro) */ - int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; - int :32; int :32; int :32; + int :32; int :32; int :32; int :32; }; /* @@ -137,9 +135,6 @@ struct timex { #define ADJ_ESTERROR 0x0008 /* estimated time error */ #define ADJ_STATUS 0x0010 /* clock status */ #define ADJ_TIMECONST 0x0020 /* pll time constant */ -#define ADJ_TAI 0x0080 /* set TAI offset */ -#define ADJ_MICRO 0x1000 /* select microsecond resolution */ -#define ADJ_NANO 0x2000 /* select nanosecond resolution */ #define ADJ_TICK 0x4000 /* tick value */ #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ @@ -151,6 +146,8 @@ struct timex { #define MOD_ESTERROR ADJ_ESTERROR #define MOD_STATUS ADJ_STATUS #define MOD_TIMECONST ADJ_TIMECONST +#define MOD_CLKB ADJ_TICK +#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */ /* @@ -172,13 +169,9 @@ struct timex { #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ -#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ -#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ -#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ -/* read-only bits */ #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ - STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) + STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ /* * Clock states (time_state) @@ -210,9 +203,10 @@ extern int time_status; /* clock synchronization status bits */ extern long time_maxerror; /* maximum error */ extern long time_esterror; /* estimated error */ +extern long time_freq; /* frequency offset (scaled ppm) */ + extern long time_adjust; /* The amount of adjtime left */ -extern void ntp_init(void); extern void ntp_clear(void); /** @@ -231,7 +225,7 @@ static inline int ntp_synced(void) __x < 0 ? -(-__x >> __s) : __x >> __s; \ }) -#define NTP_SCALE_SHIFT 32 +#define TICK_LENGTH_SHIFT 32 #ifdef CONFIG_NO_HZ #define NTP_INTERVAL_FREQ (2) @@ -240,8 +234,8 @@ static inline int ntp_synced(void) #endif #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) -/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ -extern u64 tick_length; +/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ +extern u64 current_tick_length(void); extern void second_overflow(void); extern void update_ntp_one_tick(void); diff --git a/trunk/kernel/compat.c b/trunk/kernel/compat.c index 32c254a8ab9a..4a856a3643bb 100644 --- a/trunk/kernel/compat.c +++ b/trunk/kernel/compat.c @@ -955,8 +955,7 @@ asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp) __put_user(txc.jitcnt, &utp->jitcnt) || __put_user(txc.calcnt, &utp->calcnt) || __put_user(txc.errcnt, &utp->errcnt) || - __put_user(txc.stbcnt, &utp->stbcnt) || - __put_user(txc.tai, &utp->tai)) + __put_user(txc.stbcnt, &utp->stbcnt)) ret = -EFAULT; return ret; diff --git a/trunk/kernel/kexec.c b/trunk/kernel/kexec.c index 1c5fcacbcf33..cb85c79989b4 100644 --- a/trunk/kernel/kexec.c +++ b/trunk/kernel/kexec.c @@ -1217,7 +1217,7 @@ static int __init parse_crashkernel_mem(char *cmdline, } /* match ? */ - if (system_ram >= start && system_ram < end) { + if (system_ram >= start && system_ram <= end) { *crash_size = size; break; } diff --git a/trunk/kernel/module.c b/trunk/kernel/module.c index 8674a390a2e8..8d6cccc6c3cf 100644 --- a/trunk/kernel/module.c +++ b/trunk/kernel/module.c @@ -164,140 +164,131 @@ static const struct kernel_symbol *lookup_symbol(const char *name, return NULL; } -static bool always_ok(bool gplok, bool warn, const char *name) +static void printk_unused_warning(const char *name) { - return true; + printk(KERN_WARNING "Symbol %s is marked as UNUSED, " + "however this module is using it.\n", name); + printk(KERN_WARNING "This symbol will go away in the future.\n"); + printk(KERN_WARNING "Please evalute if this is the right api to use, " + "and if it really is, submit a report the linux kernel " + "mailinglist together with submitting your code for " + "inclusion.\n"); } -static bool printk_unused_warning(bool gplok, bool warn, const char *name) +/* Find a symbol, return value, crc and module which owns it */ +static unsigned long __find_symbol(const char *name, + struct module **owner, + const unsigned long **crc, + int gplok) { - if (warn) { - printk(KERN_WARNING "Symbol %s is marked as UNUSED, " - "however this module is using it.\n", name); - printk(KERN_WARNING - "This symbol will go away in the future.\n"); - printk(KERN_WARNING - "Please evalute if this is the right api to use and if " - "it really is, submit a report the linux kernel " - "mailinglist together with submitting your code for " - "inclusion.\n"); - } - return true; -} - -static bool gpl_only_unused_warning(bool gplok, bool warn, const char *name) -{ - if (!gplok) - return false; - return printk_unused_warning(gplok, warn, name); -} - -static bool gpl_only(bool gplok, bool warn, const char *name) -{ - return gplok; -} - -static bool warn_if_not_gpl(bool gplok, bool warn, const char *name) -{ - if (!gplok && warn) { - printk(KERN_WARNING "Symbol %s is being used " - "by a non-GPL module, which will not " - "be allowed in the future\n", name); - printk(KERN_WARNING "Please see the file " - "Documentation/feature-removal-schedule.txt " - "in the kernel source tree for more details.\n"); - } - return true; -} - -struct symsearch { - const struct kernel_symbol *start, *stop; - const unsigned long *crcs; - bool (*check)(bool gplok, bool warn, const char *name); -}; - -/* Look through this array of symbol tables for a symbol match which - * passes the check function. */ -static const struct kernel_symbol *search_symarrays(const struct symsearch *arr, - unsigned int num, - const char *name, - bool gplok, - bool warn, - const unsigned long **crc) -{ - unsigned int i; + struct module *mod; const struct kernel_symbol *ks; - for (i = 0; i < num; i++) { - ks = lookup_symbol(name, arr[i].start, arr[i].stop); - if (!ks || !arr[i].check(gplok, warn, name)) - continue; - - if (crc) - *crc = symversion(arr[i].crcs, ks - arr[i].start); - return ks; + /* Core kernel first. */ + *owner = NULL; + ks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab); + if (ks) { + *crc = symversion(__start___kcrctab, (ks - __start___ksymtab)); + return ks->value; + } + if (gplok) { + ks = lookup_symbol(name, __start___ksymtab_gpl, + __stop___ksymtab_gpl); + if (ks) { + *crc = symversion(__start___kcrctab_gpl, + (ks - __start___ksymtab_gpl)); + return ks->value; + } + } + ks = lookup_symbol(name, __start___ksymtab_gpl_future, + __stop___ksymtab_gpl_future); + if (ks) { + if (!gplok) { + printk(KERN_WARNING "Symbol %s is being used " + "by a non-GPL module, which will not " + "be allowed in the future\n", name); + printk(KERN_WARNING "Please see the file " + "Documentation/feature-removal-schedule.txt " + "in the kernel source tree for more " + "details.\n"); + } + *crc = symversion(__start___kcrctab_gpl_future, + (ks - __start___ksymtab_gpl_future)); + return ks->value; } - return NULL; -} -/* Find a symbol, return value, (optional) crc and (optional) module - * which owns it */ -static unsigned long find_symbol(const char *name, - struct module **owner, - const unsigned long **crc, - bool gplok, - bool warn) -{ - struct module *mod; - const struct kernel_symbol *ks; - const struct symsearch arr[] = { - { __start___ksymtab, __stop___ksymtab, __start___kcrctab, - always_ok }, - { __start___ksymtab_gpl, __stop___ksymtab_gpl, - __start___kcrctab_gpl, gpl_only }, - { __start___ksymtab_gpl_future, __stop___ksymtab_gpl_future, - __start___kcrctab_gpl_future, warn_if_not_gpl }, - { __start___ksymtab_unused, __stop___ksymtab_unused, - __start___kcrctab_unused, printk_unused_warning }, - { __start___ksymtab_unused_gpl, __stop___ksymtab_unused_gpl, - __start___kcrctab_unused_gpl, gpl_only_unused_warning }, - }; + ks = lookup_symbol(name, __start___ksymtab_unused, + __stop___ksymtab_unused); + if (ks) { + printk_unused_warning(name); + *crc = symversion(__start___kcrctab_unused, + (ks - __start___ksymtab_unused)); + return ks->value; + } - /* Core kernel first. */ - ks = search_symarrays(arr, ARRAY_SIZE(arr), name, gplok, warn, crc); + if (gplok) + ks = lookup_symbol(name, __start___ksymtab_unused_gpl, + __stop___ksymtab_unused_gpl); if (ks) { - if (owner) - *owner = NULL; + printk_unused_warning(name); + *crc = symversion(__start___kcrctab_unused_gpl, + (ks - __start___ksymtab_unused_gpl)); return ks->value; } /* Now try modules. */ list_for_each_entry(mod, &modules, list) { - struct symsearch arr[] = { - { mod->syms, mod->syms + mod->num_syms, mod->crcs, - always_ok }, - { mod->gpl_syms, mod->gpl_syms + mod->num_gpl_syms, - mod->gpl_crcs, gpl_only }, - { mod->gpl_future_syms, - mod->gpl_future_syms + mod->num_gpl_future_syms, - mod->gpl_future_crcs, warn_if_not_gpl }, - { mod->unused_syms, - mod->unused_syms + mod->num_unused_syms, - mod->unused_crcs, printk_unused_warning }, - { mod->unused_gpl_syms, - mod->unused_gpl_syms + mod->num_unused_gpl_syms, - mod->unused_gpl_crcs, gpl_only_unused_warning }, - }; - - ks = search_symarrays(arr, ARRAY_SIZE(arr), - name, gplok, warn, crc); + *owner = mod; + ks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms); if (ks) { - if (owner) - *owner = mod; + *crc = symversion(mod->crcs, (ks - mod->syms)); return ks->value; } - } + if (gplok) { + ks = lookup_symbol(name, mod->gpl_syms, + mod->gpl_syms + mod->num_gpl_syms); + if (ks) { + *crc = symversion(mod->gpl_crcs, + (ks - mod->gpl_syms)); + return ks->value; + } + } + ks = lookup_symbol(name, mod->unused_syms, mod->unused_syms + mod->num_unused_syms); + if (ks) { + printk_unused_warning(name); + *crc = symversion(mod->unused_crcs, (ks - mod->unused_syms)); + return ks->value; + } + + if (gplok) { + ks = lookup_symbol(name, mod->unused_gpl_syms, + mod->unused_gpl_syms + mod->num_unused_gpl_syms); + if (ks) { + printk_unused_warning(name); + *crc = symversion(mod->unused_gpl_crcs, + (ks - mod->unused_gpl_syms)); + return ks->value; + } + } + ks = lookup_symbol(name, mod->gpl_future_syms, + (mod->gpl_future_syms + + mod->num_gpl_future_syms)); + if (ks) { + if (!gplok) { + printk(KERN_WARNING "Symbol %s is being used " + "by a non-GPL module, which will not " + "be allowed in the future\n", name); + printk(KERN_WARNING "Please see the file " + "Documentation/feature-removal-schedule.txt " + "in the kernel source tree for more " + "details.\n"); + } + *crc = symversion(mod->gpl_future_crcs, + (ks - mod->gpl_future_syms)); + return ks->value; + } + } DEBUGP("Failed to find symbol %s\n", name); return -ENOENT; } @@ -745,13 +736,12 @@ sys_delete_module(const char __user *name_user, unsigned int flags) if (!forced && module_refcount(mod) != 0) wait_for_zero_refcount(mod); - mutex_unlock(&module_mutex); /* Final destruction now noone is using it. */ - if (mod->exit != NULL) + if (mod->exit != NULL) { + mutex_unlock(&module_mutex); mod->exit(); - blocking_notifier_call_chain(&module_notify_list, - MODULE_STATE_GOING, mod); - mutex_lock(&module_mutex); + mutex_lock(&module_mutex); + } /* Store the name of the last unloaded module for diagnostic purposes */ strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); free_module(mod); @@ -787,9 +777,10 @@ static void print_unload_info(struct seq_file *m, struct module *mod) void __symbol_put(const char *symbol) { struct module *owner; + const unsigned long *crc; preempt_disable(); - if (IS_ERR_VALUE(find_symbol(symbol, &owner, NULL, true, false))) + if (IS_ERR_VALUE(__find_symbol(symbol, &owner, &crc, 1))) BUG(); module_put(owner); preempt_enable(); @@ -933,10 +924,13 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, struct module *mod) { const unsigned long *crc; + struct module *owner; - if (IS_ERR_VALUE(find_symbol("struct_module", NULL, &crc, true, false))) + if (IS_ERR_VALUE(__find_symbol("struct_module", + &owner, &crc, 1))) BUG(); - return check_version(sechdrs, versindex, "struct_module", mod, crc); + return check_version(sechdrs, versindex, "struct_module", mod, + crc); } /* First part is kernel version, which we ignore. */ @@ -980,8 +974,8 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs, unsigned long ret; const unsigned long *crc; - ret = find_symbol(name, &owner, &crc, - !(mod->taints & TAINT_PROPRIETARY_MODULE), true); + ret = __find_symbol(name, &owner, &crc, + !(mod->taints & TAINT_PROPRIETARY_MODULE)); if (!IS_ERR_VALUE(ret)) { /* use_module can fail due to OOM, or module initialization or unloading */ @@ -997,20 +991,6 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs, * J. Corbet */ #if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS) -struct module_sect_attr -{ - struct module_attribute mattr; - char *name; - unsigned long address; -}; - -struct module_sect_attrs -{ - struct attribute_group grp; - unsigned int nsections; - struct module_sect_attr attrs[0]; -}; - static ssize_t module_sect_show(struct module_attribute *mattr, struct module *mod, char *buf) { @@ -1021,7 +1001,7 @@ static ssize_t module_sect_show(struct module_attribute *mattr, static void free_sect_attrs(struct module_sect_attrs *sect_attrs) { - unsigned int section; + int section; for (section = 0; section < sect_attrs->nsections; section++) kfree(sect_attrs->attrs[section].name); @@ -1382,9 +1362,10 @@ void *__symbol_get(const char *symbol) { struct module *owner; unsigned long value; + const unsigned long *crc; preempt_disable(); - value = find_symbol(symbol, &owner, NULL, true, true); + value = __find_symbol(symbol, &owner, &crc, 1); if (IS_ERR_VALUE(value)) value = 0; else if (strong_try_module_get(owner)) @@ -1401,33 +1382,33 @@ EXPORT_SYMBOL_GPL(__symbol_get); */ static int verify_export_symbols(struct module *mod) { - unsigned int i; + const char *name = NULL; + unsigned long i, ret = 0; struct module *owner; - const struct kernel_symbol *s; - struct { - const struct kernel_symbol *sym; - unsigned int num; - } arr[] = { - { mod->syms, mod->num_syms }, - { mod->gpl_syms, mod->num_gpl_syms }, - { mod->gpl_future_syms, mod->num_gpl_future_syms }, - { mod->unused_syms, mod->num_unused_syms }, - { mod->unused_gpl_syms, mod->num_unused_gpl_syms }, - }; + const unsigned long *crc; - for (i = 0; i < ARRAY_SIZE(arr); i++) { - for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) { - if (!IS_ERR_VALUE(find_symbol(s->name, &owner, - NULL, true, false))) { - printk(KERN_ERR - "%s: exports duplicate symbol %s" - " (owned by %s)\n", - mod->name, s->name, module_name(owner)); - return -ENOEXEC; - } + for (i = 0; i < mod->num_syms; i++) + if (!IS_ERR_VALUE(__find_symbol(mod->syms[i].name, + &owner, &crc, 1))) { + name = mod->syms[i].name; + ret = -ENOEXEC; + goto dup; } - } - return 0; + + for (i = 0; i < mod->num_gpl_syms; i++) + if (!IS_ERR_VALUE(__find_symbol(mod->gpl_syms[i].name, + &owner, &crc, 1))) { + name = mod->gpl_syms[i].name; + ret = -ENOEXEC; + goto dup; + } + +dup: + if (ret) + printk(KERN_ERR "%s: exports duplicate symbol %s (owned by %s)\n", + mod->name, name, module_name(owner)); + + return ret; } /* Change all symbols so that st_value encodes the pointer directly. */ @@ -1833,9 +1814,8 @@ static struct module *load_module(void __user *umod, unwindex = find_sec(hdr, sechdrs, secstrings, ARCH_UNWIND_SECTION_NAME); #endif - /* Don't keep modinfo and version sections. */ + /* Don't keep modinfo section */ sechdrs[infoindex].sh_flags &= ~(unsigned long)SHF_ALLOC; - sechdrs[versindex].sh_flags &= ~(unsigned long)SHF_ALLOC; #ifdef CONFIG_KALLSYMS /* Keep symbol and string tables for decoding later. */ sechdrs[symindex].sh_flags |= SHF_ALLOC; @@ -1997,8 +1977,7 @@ static struct module *load_module(void __user *umod, mod->unused_crcs = (void *)sechdrs[unusedcrcindex].sh_addr; mod->unused_gpl_syms = (void *)sechdrs[unusedgplindex].sh_addr; if (unusedgplcrcindex) - mod->unused_gpl_crcs - = (void *)sechdrs[unusedgplcrcindex].sh_addr; + mod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr; #ifdef CONFIG_MODVERSIONS if ((mod->num_syms && !crcindex) || @@ -2192,8 +2171,6 @@ sys_init_module(void __user *umod, mod->state = MODULE_STATE_GOING; synchronize_sched(); module_put(mod); - blocking_notifier_call_chain(&module_notify_list, - MODULE_STATE_GOING, mod); mutex_lock(&module_mutex); free_module(mod); mutex_unlock(&module_mutex); diff --git a/trunk/kernel/posix-cpu-timers.c b/trunk/kernel/posix-cpu-timers.c index f1525ad06cb3..ae5c6c147c4b 100644 --- a/trunk/kernel/posix-cpu-timers.c +++ b/trunk/kernel/posix-cpu-timers.c @@ -4,9 +4,8 @@ #include #include -#include -#include #include +#include static int check_clock(const clockid_t which_clock) { @@ -48,10 +47,12 @@ static void sample_to_timespec(const clockid_t which_clock, union cpu_time_count cpu, struct timespec *tp) { - if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) - *tp = ns_to_timespec(cpu.sched); - else + if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) { + tp->tv_sec = div_long_long_rem(cpu.sched, + NSEC_PER_SEC, &tp->tv_nsec); + } else { cputime_to_timespec(cpu.cpu, tp); + } } static inline int cpu_time_before(const clockid_t which_clock, diff --git a/trunk/kernel/ptrace.c b/trunk/kernel/ptrace.c index 6c19e94fd0a5..dcc199c43a12 100644 --- a/trunk/kernel/ptrace.c +++ b/trunk/kernel/ptrace.c @@ -534,6 +534,7 @@ struct task_struct *ptrace_get_task_struct(pid_t pid) #define arch_ptrace_attach(child) do { } while (0) #endif +#ifndef __ARCH_SYS_PTRACE asmlinkage long sys_ptrace(long request, long pid, long addr, long data) { struct task_struct *child; @@ -581,6 +582,7 @@ asmlinkage long sys_ptrace(long request, long pid, long addr, long data) unlock_kernel(); return ret; } +#endif /* __ARCH_SYS_PTRACE */ int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data) { diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index 34bcc5bc120e..e2f7f5acc807 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -8025,7 +8025,7 @@ static void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, se->my_q = cfs_rq; se->load.weight = tg->shares; - se->load.inv_weight = div64_u64(1ULL<<32, se->load.weight); + se->load.inv_weight = div64_64(1ULL<<32, se->load.weight); se->parent = parent; } #endif @@ -8692,7 +8692,7 @@ static void __set_se_shares(struct sched_entity *se, unsigned long shares) dequeue_entity(cfs_rq, se, 0); se->load.weight = shares; - se->load.inv_weight = div64_u64((1ULL<<32), shares); + se->load.inv_weight = div64_64((1ULL<<32), shares); if (on_rq) enqueue_entity(cfs_rq, se, 0); @@ -8787,7 +8787,7 @@ static unsigned long to_ratio(u64 period, u64 runtime) if (runtime == RUNTIME_INF) return 1ULL << 16; - return div64_u64(runtime << 16, period); + return div64_64(runtime << 16, period); } #ifdef CONFIG_CGROUP_SCHED diff --git a/trunk/kernel/sched_debug.c b/trunk/kernel/sched_debug.c index 6b4a12558e88..8a9498e7c831 100644 --- a/trunk/kernel/sched_debug.c +++ b/trunk/kernel/sched_debug.c @@ -357,8 +357,8 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) avg_per_cpu = p->se.sum_exec_runtime; if (p->se.nr_migrations) { - avg_per_cpu = div64_u64(avg_per_cpu, - p->se.nr_migrations); + avg_per_cpu = div64_64(avg_per_cpu, + p->se.nr_migrations); } else { avg_per_cpu = -1LL; } diff --git a/trunk/kernel/softirq.c b/trunk/kernel/softirq.c index 36e061740047..3c44956ee7e2 100644 --- a/trunk/kernel/softirq.c +++ b/trunk/kernel/softirq.c @@ -589,20 +589,16 @@ static void takeover_tasklets(unsigned int cpu) local_irq_disable(); /* Find end, append list for that CPU. */ - if (&per_cpu(tasklet_vec, cpu).head != per_cpu(tasklet_vec, cpu).tail) { - *(__get_cpu_var(tasklet_vec).tail) = per_cpu(tasklet_vec, cpu).head; - __get_cpu_var(tasklet_vec).tail = per_cpu(tasklet_vec, cpu).tail; - per_cpu(tasklet_vec, cpu).head = NULL; - per_cpu(tasklet_vec, cpu).tail = &per_cpu(tasklet_vec, cpu).head; - } + *__get_cpu_var(tasklet_vec).tail = per_cpu(tasklet_vec, cpu).head; + __get_cpu_var(tasklet_vec).tail = per_cpu(tasklet_vec, cpu).tail; + per_cpu(tasklet_vec, cpu).head = NULL; + per_cpu(tasklet_vec, cpu).tail = &per_cpu(tasklet_vec, cpu).head; raise_softirq_irqoff(TASKLET_SOFTIRQ); - if (&per_cpu(tasklet_hi_vec, cpu).head != per_cpu(tasklet_hi_vec, cpu).tail) { - *__get_cpu_var(tasklet_hi_vec).tail = per_cpu(tasklet_hi_vec, cpu).head; - __get_cpu_var(tasklet_hi_vec).tail = per_cpu(tasklet_hi_vec, cpu).tail; - per_cpu(tasklet_hi_vec, cpu).head = NULL; - per_cpu(tasklet_hi_vec, cpu).tail = &per_cpu(tasklet_hi_vec, cpu).head; - } + *__get_cpu_var(tasklet_hi_vec).tail = per_cpu(tasklet_hi_vec, cpu).head; + __get_cpu_var(tasklet_hi_vec).tail = per_cpu(tasklet_hi_vec, cpu).tail; + per_cpu(tasklet_hi_vec, cpu).head = NULL; + per_cpu(tasklet_hi_vec, cpu).tail = &per_cpu(tasklet_hi_vec, cpu).head; raise_softirq_irqoff(HI_SOFTIRQ); local_irq_enable(); diff --git a/trunk/kernel/time.c b/trunk/kernel/time.c index cbe0d5a222ff..86729042e4cd 100644 --- a/trunk/kernel/time.c +++ b/trunk/kernel/time.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -392,17 +391,13 @@ EXPORT_SYMBOL(set_normalized_timespec); struct timespec ns_to_timespec(const s64 nsec) { struct timespec ts; - s32 rem; if (!nsec) return (struct timespec) {0, 0}; - ts.tv_sec = div_s64_rem(nsec, NSEC_PER_SEC, &rem); - if (unlikely(rem < 0)) { - ts.tv_sec--; - rem += NSEC_PER_SEC; - } - ts.tv_nsec = rem; + ts.tv_sec = div_long_long_rem_signed(nsec, NSEC_PER_SEC, &ts.tv_nsec); + if (unlikely(nsec < 0)) + set_normalized_timespec(&ts, ts.tv_sec, ts.tv_nsec); return ts; } @@ -532,10 +527,8 @@ jiffies_to_timespec(const unsigned long jiffies, struct timespec *value) * Convert jiffies to nanoseconds and separate with * one divide. */ - u32 rem; - value->tv_sec = div_u64_rem((u64)jiffies * TICK_NSEC, - NSEC_PER_SEC, &rem); - value->tv_nsec = rem; + u64 nsec = (u64)jiffies * TICK_NSEC; + value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_nsec); } EXPORT_SYMBOL(jiffies_to_timespec); @@ -573,11 +566,12 @@ void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) * Convert jiffies to nanoseconds and separate with * one divide. */ - u32 rem; + u64 nsec = (u64)jiffies * TICK_NSEC; + long tv_usec; - value->tv_sec = div_u64_rem((u64)jiffies * TICK_NSEC, - NSEC_PER_SEC, &rem); - value->tv_usec = rem / NSEC_PER_USEC; + value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tv_usec); + tv_usec /= NSEC_PER_USEC; + value->tv_usec = tv_usec; } EXPORT_SYMBOL(jiffies_to_timeval); @@ -593,7 +587,9 @@ clock_t jiffies_to_clock_t(long x) return x / (HZ / USER_HZ); # endif #else - return div_u64((u64)x * TICK_NSEC, NSEC_PER_SEC / USER_HZ); + u64 tmp = (u64)x * TICK_NSEC; + do_div(tmp, (NSEC_PER_SEC / USER_HZ)); + return (long)tmp; #endif } EXPORT_SYMBOL(jiffies_to_clock_t); @@ -605,12 +601,16 @@ unsigned long clock_t_to_jiffies(unsigned long x) return ~0UL; return x * (HZ / USER_HZ); #else + u64 jif; + /* Don't worry about loss of precision here .. */ if (x >= ~0UL / HZ * USER_HZ) return ~0UL; /* .. but do try to contain it here */ - return div_u64((u64)x * HZ, USER_HZ); + jif = x * (u64) HZ; + do_div(jif, USER_HZ); + return jif; #endif } EXPORT_SYMBOL(clock_t_to_jiffies); @@ -619,9 +619,10 @@ u64 jiffies_64_to_clock_t(u64 x) { #if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0 # if HZ < USER_HZ - x = div_u64(x * USER_HZ, HZ); + x *= USER_HZ; + do_div(x, HZ); # elif HZ > USER_HZ - x = div_u64(x, HZ / USER_HZ); + do_div(x, HZ / USER_HZ); # else /* Nothing to do */ # endif @@ -631,7 +632,8 @@ u64 jiffies_64_to_clock_t(u64 x) * but even this doesn't overflow in hundreds of years * in 64 bits, so.. */ - x = div_u64(x * TICK_NSEC, (NSEC_PER_SEC / USER_HZ)); + x *= TICK_NSEC; + do_div(x, (NSEC_PER_SEC / USER_HZ)); #endif return x; } @@ -640,17 +642,21 @@ EXPORT_SYMBOL(jiffies_64_to_clock_t); u64 nsec_to_clock_t(u64 x) { #if (NSEC_PER_SEC % USER_HZ) == 0 - return div_u64(x, NSEC_PER_SEC / USER_HZ); + do_div(x, (NSEC_PER_SEC / USER_HZ)); #elif (USER_HZ % 512) == 0 - return div_u64(x * USER_HZ / 512, NSEC_PER_SEC / 512); + x *= USER_HZ/512; + do_div(x, (NSEC_PER_SEC / 512)); #else /* * max relative error 5.7e-8 (1.8s per year) for USER_HZ <= 1024, * overflow after 64.99 years. * exact for HZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ... */ - return div_u64(x * 9, (9ull * NSEC_PER_SEC + (USER_HZ / 2)) / USER_HZ); + x *= 9; + do_div(x, (unsigned long)((9ull * NSEC_PER_SEC + (USER_HZ/2)) / + USER_HZ)); #endif + return x; } #if (BITS_PER_LONG < 64) diff --git a/trunk/kernel/time/ntp.c b/trunk/kernel/time/ntp.c index 5125ddd8196b..5fd9b9469770 100644 --- a/trunk/kernel/time/ntp.c +++ b/trunk/kernel/time/ntp.c @@ -15,8 +15,7 @@ #include #include #include -#include -#include +#include #include /* @@ -24,14 +23,11 @@ */ unsigned long tick_usec = TICK_USEC; /* USER_HZ period (usec) */ unsigned long tick_nsec; /* ACTHZ period (nsec) */ -u64 tick_length; -static u64 tick_length_base; - -static struct hrtimer leap_timer; +static u64 tick_length, tick_length_base; #define MAX_TICKADJ 500 /* microsecs */ #define MAX_TICKADJ_SCALED (((u64)(MAX_TICKADJ * NSEC_PER_USEC) << \ - NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ) + TICK_LENGTH_SHIFT) / NTP_INTERVAL_FREQ) /* * phase-lock loop variables @@ -39,12 +35,11 @@ static struct hrtimer leap_timer; /* TIME_ERROR prevents overwriting the CMOS clock */ static int time_state = TIME_OK; /* clock synchronization status */ int time_status = STA_UNSYNC; /* clock status bits */ -static long time_tai; /* TAI offset (s) */ -static s64 time_offset; /* time adjustment (ns) */ +static s64 time_offset; /* time adjustment (ns) */ static long time_constant = 2; /* pll time constant */ long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ -static s64 time_freq; /* frequency offset (scaled ns/s)*/ +long time_freq; /* frequency offset (scaled ppm)*/ static long time_reftime; /* time at last adjustment (s) */ long time_adjust; static long ntp_tick_adj; @@ -52,56 +47,16 @@ static long ntp_tick_adj; static void ntp_update_frequency(void) { u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) - << NTP_SCALE_SHIFT; - second_length += (s64)ntp_tick_adj << NTP_SCALE_SHIFT; - second_length += time_freq; + << TICK_LENGTH_SHIFT; + second_length += (s64)ntp_tick_adj << TICK_LENGTH_SHIFT; + second_length += (s64)time_freq << (TICK_LENGTH_SHIFT - SHIFT_NSEC); tick_length_base = second_length; - tick_nsec = div_u64(second_length, HZ) >> NTP_SCALE_SHIFT; - tick_length_base = div_u64(tick_length_base, NTP_INTERVAL_FREQ); -} - -static void ntp_update_offset(long offset) -{ - long mtemp; - s64 freq_adj; - - if (!(time_status & STA_PLL)) - return; + do_div(second_length, HZ); + tick_nsec = second_length >> TICK_LENGTH_SHIFT; - if (!(time_status & STA_NANO)) - offset *= NSEC_PER_USEC; - - /* - * Scale the phase adjustment and - * clamp to the operating range. - */ - offset = min(offset, MAXPHASE); - offset = max(offset, -MAXPHASE); - - /* - * Select how the frequency is to be controlled - * and in which mode (PLL or FLL). - */ - if (time_status & STA_FREQHOLD || time_reftime == 0) - time_reftime = xtime.tv_sec; - mtemp = xtime.tv_sec - time_reftime; - time_reftime = xtime.tv_sec; - - freq_adj = (s64)offset * mtemp; - freq_adj <<= NTP_SCALE_SHIFT - 2 * (SHIFT_PLL + 2 + time_constant); - time_status &= ~STA_MODE; - if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { - freq_adj += div_s64((s64)offset << (NTP_SCALE_SHIFT - SHIFT_FLL), - mtemp); - time_status |= STA_MODE; - } - freq_adj += time_freq; - freq_adj = min(freq_adj, MAXFREQ_SCALED); - time_freq = max(freq_adj, -MAXFREQ_SCALED); - - time_offset = div_s64((s64)offset << NTP_SCALE_SHIFT, NTP_INTERVAL_FREQ); + do_div(tick_length_base, NTP_INTERVAL_FREQ); } /** @@ -123,70 +78,62 @@ void ntp_clear(void) } /* - * Leap second processing. If in leap-insert state at the end of the - * day, the system clock is set back one second; if in leap-delete - * state, the system clock is set ahead one second. + * this routine handles the overflow of the microsecond field + * + * The tricky bits of code to handle the accurate clock support + * were provided by Dave Mills (Mills@UDEL.EDU) of NTP fame. + * They were originally developed for SUN and DEC kernels. + * All the kudos should go to Dave for this stuff. */ -static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) +void second_overflow(void) { - enum hrtimer_restart res = HRTIMER_NORESTART; + long time_adj; - write_seqlock_irq(&xtime_lock); + /* Bump the maxerror field */ + time_maxerror += MAXFREQ >> SHIFT_USEC; + if (time_maxerror > NTP_PHASE_LIMIT) { + time_maxerror = NTP_PHASE_LIMIT; + time_status |= STA_UNSYNC; + } + /* + * Leap second processing. If in leap-insert state at the end of the + * day, the system clock is set back one second; if in leap-delete + * state, the system clock is set ahead one second. The microtime() + * routine or external clock driver will insure that reported time is + * always monotonic. The ugly divides should be replaced. + */ switch (time_state) { case TIME_OK: + if (time_status & STA_INS) + time_state = TIME_INS; + else if (time_status & STA_DEL) + time_state = TIME_DEL; break; case TIME_INS: - xtime.tv_sec--; - wall_to_monotonic.tv_sec++; - time_state = TIME_OOP; - printk(KERN_NOTICE "Clock: " - "inserting leap second 23:59:60 UTC\n"); - leap_timer.expires = ktime_add_ns(leap_timer.expires, - NSEC_PER_SEC); - res = HRTIMER_RESTART; + if (xtime.tv_sec % 86400 == 0) { + xtime.tv_sec--; + wall_to_monotonic.tv_sec++; + time_state = TIME_OOP; + printk(KERN_NOTICE "Clock: inserting leap second " + "23:59:60 UTC\n"); + } break; case TIME_DEL: - xtime.tv_sec++; - time_tai--; - wall_to_monotonic.tv_sec--; - time_state = TIME_WAIT; - printk(KERN_NOTICE "Clock: " - "deleting leap second 23:59:59 UTC\n"); + if ((xtime.tv_sec + 1) % 86400 == 0) { + xtime.tv_sec++; + wall_to_monotonic.tv_sec--; + time_state = TIME_WAIT; + printk(KERN_NOTICE "Clock: deleting leap second " + "23:59:59 UTC\n"); + } break; case TIME_OOP: - time_tai++; time_state = TIME_WAIT; - /* fall through */ + break; case TIME_WAIT: if (!(time_status & (STA_INS | STA_DEL))) - time_state = TIME_OK; - break; - } - update_vsyscall(&xtime, clock); - - write_sequnlock_irq(&xtime_lock); - - return res; -} - -/* - * this routine handles the overflow of the microsecond field - * - * The tricky bits of code to handle the accurate clock support - * were provided by Dave Mills (Mills@UDEL.EDU) of NTP fame. - * They were originally developed for SUN and DEC kernels. - * All the kudos should go to Dave for this stuff. - */ -void second_overflow(void) -{ - s64 time_adj; - - /* Bump the maxerror field */ - time_maxerror += MAXFREQ / NSEC_PER_USEC; - if (time_maxerror > NTP_PHASE_LIMIT) { - time_maxerror = NTP_PHASE_LIMIT; - time_status |= STA_UNSYNC; + time_state = TIME_OK; } /* @@ -196,7 +143,7 @@ void second_overflow(void) tick_length = tick_length_base; time_adj = shift_right(time_offset, SHIFT_PLL + time_constant); time_offset -= time_adj; - tick_length += time_adj; + tick_length += (s64)time_adj << (TICK_LENGTH_SHIFT - SHIFT_UPDATE); if (unlikely(time_adjust)) { if (time_adjust > MAX_TICKADJ) { @@ -207,12 +154,25 @@ void second_overflow(void) tick_length -= MAX_TICKADJ_SCALED; } else { tick_length += (s64)(time_adjust * NSEC_PER_USEC / - NTP_INTERVAL_FREQ) << NTP_SCALE_SHIFT; + NTP_INTERVAL_FREQ) << TICK_LENGTH_SHIFT; time_adjust = 0; } } } +/* + * Return how long ticks are at the moment, that is, how much time + * update_wall_time_one_tick will add to xtime next time we call it + * (assuming no calls to do_adjtimex in the meantime). + * The return value is in fixed-point nanoseconds shifted by the + * specified number of bits to the right of the binary point. + * This function has no side-effects. + */ +u64 current_tick_length(void) +{ + return tick_length; +} + #ifdef CONFIG_GENERIC_CMOS_UPDATE /* Disable the cmos update - used by virtualization and embedded */ @@ -276,8 +236,8 @@ static inline void notify_cmos_timer(void) { } */ int do_adjtimex(struct timex *txc) { - struct timespec ts; - long save_adjust, sec; + long mtemp, save_adjust, rem; + s64 freq_adj, temp64; int result; /* In order to modify anything, you gotta be super-user! */ @@ -287,132 +247,147 @@ int do_adjtimex(struct timex *txc) /* Now we validate the data before disabling interrupts */ if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) { - /* singleshot must not be used with any other mode bits */ - if (txc->modes & ~ADJ_OFFSET_SS_READ) + /* singleshot must not be used with any other mode bits */ + if (txc->modes != ADJ_OFFSET_SINGLESHOT && + txc->modes != ADJ_OFFSET_SS_READ) return -EINVAL; } + if (txc->modes != ADJ_OFFSET_SINGLESHOT && (txc->modes & ADJ_OFFSET)) + /* adjustment Offset limited to +- .512 seconds */ + if (txc->offset <= - MAXPHASE || txc->offset >= MAXPHASE ) + return -EINVAL; + /* if the quartz is off by more than 10% something is VERY wrong ! */ if (txc->modes & ADJ_TICK) if (txc->tick < 900000/USER_HZ || txc->tick > 1100000/USER_HZ) return -EINVAL; - if (time_state != TIME_OK && txc->modes & ADJ_STATUS) - hrtimer_cancel(&leap_timer); - getnstimeofday(&ts); - write_seqlock_irq(&xtime_lock); + result = time_state; /* mostly `TIME_OK' */ /* Save for later - semantics of adjtime is to return old value */ save_adjust = time_adjust; +#if 0 /* STA_CLOCKERR is never set yet */ + time_status &= ~STA_CLOCKERR; /* reset STA_CLOCKERR */ +#endif /* If there are input parameters, then process them */ - if (txc->modes) { - if (txc->modes & ADJ_STATUS) { - if ((time_status & STA_PLL) && - !(txc->status & STA_PLL)) { - time_state = TIME_OK; - time_status = STA_UNSYNC; - } - /* only set allowed bits */ - time_status &= STA_RONLY; - time_status |= txc->status & ~STA_RONLY; - - switch (time_state) { - case TIME_OK: - start_timer: - sec = ts.tv_sec; - if (time_status & STA_INS) { - time_state = TIME_INS; - sec += 86400 - sec % 86400; - hrtimer_start(&leap_timer, ktime_set(sec, 0), HRTIMER_MODE_ABS); - } else if (time_status & STA_DEL) { - time_state = TIME_DEL; - sec += 86400 - (sec + 1) % 86400; - hrtimer_start(&leap_timer, ktime_set(sec, 0), HRTIMER_MODE_ABS); - } - break; - case TIME_INS: - case TIME_DEL: - time_state = TIME_OK; - goto start_timer; - break; - case TIME_WAIT: - if (!(time_status & (STA_INS | STA_DEL))) - time_state = TIME_OK; - break; - case TIME_OOP: - hrtimer_restart(&leap_timer); - break; - } + if (txc->modes) + { + if (txc->modes & ADJ_STATUS) /* only set allowed bits */ + time_status = (txc->status & ~STA_RONLY) | + (time_status & STA_RONLY); + + if (txc->modes & ADJ_FREQUENCY) { /* p. 22 */ + if (txc->freq > MAXFREQ || txc->freq < -MAXFREQ) { + result = -EINVAL; + goto leave; } - - if (txc->modes & ADJ_NANO) - time_status |= STA_NANO; - if (txc->modes & ADJ_MICRO) - time_status &= ~STA_NANO; - - if (txc->modes & ADJ_FREQUENCY) { - time_freq = (s64)txc->freq * PPM_SCALE; - time_freq = min(time_freq, MAXFREQ_SCALED); - time_freq = max(time_freq, -MAXFREQ_SCALED); + time_freq = ((s64)txc->freq * NSEC_PER_USEC) + >> (SHIFT_USEC - SHIFT_NSEC); + } + + if (txc->modes & ADJ_MAXERROR) { + if (txc->maxerror < 0 || txc->maxerror >= NTP_PHASE_LIMIT) { + result = -EINVAL; + goto leave; } + time_maxerror = txc->maxerror; + } - if (txc->modes & ADJ_MAXERROR) - time_maxerror = txc->maxerror; - if (txc->modes & ADJ_ESTERROR) - time_esterror = txc->esterror; - - if (txc->modes & ADJ_TIMECONST) { - time_constant = txc->constant; - if (!(time_status & STA_NANO)) - time_constant += 4; - time_constant = min(time_constant, (long)MAXTC); - time_constant = max(time_constant, 0l); + if (txc->modes & ADJ_ESTERROR) { + if (txc->esterror < 0 || txc->esterror >= NTP_PHASE_LIMIT) { + result = -EINVAL; + goto leave; } + time_esterror = txc->esterror; + } - if (txc->modes & ADJ_TAI && txc->constant > 0) - time_tai = txc->constant; - - if (txc->modes & ADJ_OFFSET) { - if (txc->modes == ADJ_OFFSET_SINGLESHOT) - /* adjtime() is independent from ntp_adjtime() */ - time_adjust = txc->offset; - else - ntp_update_offset(txc->offset); + if (txc->modes & ADJ_TIMECONST) { /* p. 24 */ + if (txc->constant < 0) { /* NTP v4 uses values > 6 */ + result = -EINVAL; + goto leave; } - if (txc->modes & ADJ_TICK) - tick_usec = txc->tick; + time_constant = min(txc->constant + 4, (long)MAXTC); + } - if (txc->modes & (ADJ_TICK|ADJ_FREQUENCY|ADJ_OFFSET)) - ntp_update_frequency(); - } - - result = time_state; /* mostly `TIME_OK' */ - if (time_status & (STA_UNSYNC|STA_CLOCKERR)) + if (txc->modes & ADJ_OFFSET) { /* values checked earlier */ + if (txc->modes == ADJ_OFFSET_SINGLESHOT) { + /* adjtime() is independent from ntp_adjtime() */ + time_adjust = txc->offset; + } + else if (time_status & STA_PLL) { + time_offset = txc->offset * NSEC_PER_USEC; + + /* + * Scale the phase adjustment and + * clamp to the operating range. + */ + time_offset = min(time_offset, (s64)MAXPHASE * NSEC_PER_USEC); + time_offset = max(time_offset, (s64)-MAXPHASE * NSEC_PER_USEC); + + /* + * Select whether the frequency is to be controlled + * and in which mode (PLL or FLL). Clamp to the operating + * range. Ugly multiply/divide should be replaced someday. + */ + + if (time_status & STA_FREQHOLD || time_reftime == 0) + time_reftime = xtime.tv_sec; + mtemp = xtime.tv_sec - time_reftime; + time_reftime = xtime.tv_sec; + + freq_adj = time_offset * mtemp; + freq_adj = shift_right(freq_adj, time_constant * 2 + + (SHIFT_PLL + 2) * 2 - SHIFT_NSEC); + if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { + u64 utemp64; + temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL); + if (time_offset < 0) { + utemp64 = -temp64; + do_div(utemp64, mtemp); + freq_adj -= utemp64; + } else { + utemp64 = temp64; + do_div(utemp64, mtemp); + freq_adj += utemp64; + } + } + freq_adj += time_freq; + freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC); + time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC); + time_offset = div_long_long_rem_signed(time_offset, + NTP_INTERVAL_FREQ, + &rem); + time_offset <<= SHIFT_UPDATE; + } /* STA_PLL */ + } /* txc->modes & ADJ_OFFSET */ + if (txc->modes & ADJ_TICK) + tick_usec = txc->tick; + + if (txc->modes & (ADJ_TICK|ADJ_FREQUENCY|ADJ_OFFSET)) + ntp_update_frequency(); + } /* txc->modes */ +leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) result = TIME_ERROR; if ((txc->modes == ADJ_OFFSET_SINGLESHOT) || - (txc->modes == ADJ_OFFSET_SS_READ)) + (txc->modes == ADJ_OFFSET_SS_READ)) txc->offset = save_adjust; - else { - txc->offset = shift_right(time_offset * NTP_INTERVAL_FREQ, - NTP_SCALE_SHIFT); - if (!(time_status & STA_NANO)) - txc->offset /= NSEC_PER_USEC; - } - txc->freq = shift_right((s32)(time_freq >> PPM_SCALE_INV_SHIFT) * - (s64)PPM_SCALE_INV, - NTP_SCALE_SHIFT); + else + txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) * + NTP_INTERVAL_FREQ / 1000; + txc->freq = (time_freq / NSEC_PER_USEC) << + (SHIFT_USEC - SHIFT_NSEC); txc->maxerror = time_maxerror; txc->esterror = time_esterror; txc->status = time_status; txc->constant = time_constant; txc->precision = 1; - txc->tolerance = MAXFREQ_SCALED / PPM_SCALE; + txc->tolerance = MAXFREQ; txc->tick = tick_usec; - txc->tai = time_tai; /* PPS is not implemented, so these are zero */ txc->ppsfreq = 0; @@ -424,15 +399,9 @@ int do_adjtimex(struct timex *txc) txc->errcnt = 0; txc->stbcnt = 0; write_sequnlock_irq(&xtime_lock); - - txc->time.tv_sec = ts.tv_sec; - txc->time.tv_usec = ts.tv_nsec; - if (!(time_status & STA_NANO)) - txc->time.tv_usec /= NSEC_PER_USEC; - + do_gettimeofday(&txc->time); notify_cmos_timer(); - - return result; + return(result); } static int __init ntp_tick_adj_setup(char *str) @@ -442,10 +411,3 @@ static int __init ntp_tick_adj_setup(char *str) } __setup("ntp_tick_adj=", ntp_tick_adj_setup); - -void __init ntp_init(void) -{ - ntp_clear(); - hrtimer_init(&leap_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); - leap_timer.function = ntp_leap_second; -} diff --git a/trunk/kernel/time/timekeeping.c b/trunk/kernel/time/timekeeping.c index e91c29f961c9..2d6087c7cf98 100644 --- a/trunk/kernel/time/timekeeping.c +++ b/trunk/kernel/time/timekeeping.c @@ -53,7 +53,7 @@ void update_xtime_cache(u64 nsec) timespec_add_ns(&xtime_cache, nsec); } -struct clocksource *clock; +static struct clocksource *clock; /* pointer to current clocksource */ #ifdef CONFIG_GENERIC_TIME @@ -246,7 +246,7 @@ void __init timekeeping_init(void) write_seqlock_irqsave(&xtime_lock, flags); - ntp_init(); + ntp_clear(); clock = clocksource_get_next(); clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); @@ -371,7 +371,7 @@ static __always_inline int clocksource_bigadjust(s64 error, s64 *interval, * here. This is tuned so that an error of about 1 msec is adjusted * within about 1 sec (or 2^20 nsec in 2^SHIFT_HZ ticks). */ - error2 = clock->error >> (NTP_SCALE_SHIFT + 22 - 2 * SHIFT_HZ); + error2 = clock->error >> (TICK_LENGTH_SHIFT + 22 - 2 * SHIFT_HZ); error2 = abs(error2); for (look_ahead = 0; error2 > 0; look_ahead++) error2 >>= 2; @@ -380,7 +380,8 @@ static __always_inline int clocksource_bigadjust(s64 error, s64 *interval, * Now calculate the error in (1 << look_ahead) ticks, but first * remove the single look ahead already included in the error. */ - tick_error = tick_length >> (NTP_SCALE_SHIFT - clock->shift + 1); + tick_error = current_tick_length() >> + (TICK_LENGTH_SHIFT - clock->shift + 1); tick_error -= clock->xtime_interval >> 1; error = ((error - tick_error) >> look_ahead) + tick_error; @@ -411,7 +412,7 @@ static void clocksource_adjust(s64 offset) s64 error, interval = clock->cycle_interval; int adj; - error = clock->error >> (NTP_SCALE_SHIFT - clock->shift - 1); + error = clock->error >> (TICK_LENGTH_SHIFT - clock->shift - 1); if (error > interval) { error >>= 2; if (likely(error <= interval)) @@ -433,7 +434,7 @@ static void clocksource_adjust(s64 offset) clock->xtime_interval += interval; clock->xtime_nsec -= offset; clock->error -= (interval - offset) << - (NTP_SCALE_SHIFT - clock->shift); + (TICK_LENGTH_SHIFT - clock->shift); } /** @@ -472,8 +473,8 @@ void update_wall_time(void) } /* accumulate error between NTP and clock interval */ - clock->error += tick_length; - clock->error -= clock->xtime_interval << (NTP_SCALE_SHIFT - clock->shift); + clock->error += current_tick_length(); + clock->error -= clock->xtime_interval << (TICK_LENGTH_SHIFT - clock->shift); } /* correct the clock when NTP error is too big */ diff --git a/trunk/kernel/workqueue.c b/trunk/kernel/workqueue.c index 29fc39f1029c..721093a22561 100644 --- a/trunk/kernel/workqueue.c +++ b/trunk/kernel/workqueue.c @@ -195,6 +195,7 @@ static void delayed_work_timer_fn(unsigned long __data) int queue_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork, unsigned long delay) { + timer_stats_timer_set_start_info(&dwork->timer); if (delay == 0) return queue_work(wq, &dwork->work); @@ -218,12 +219,11 @@ int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, struct timer_list *timer = &dwork->timer; struct work_struct *work = &dwork->work; + timer_stats_timer_set_start_info(&dwork->timer); if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) { BUG_ON(timer_pending(timer)); BUG_ON(!list_empty(&work->entry)); - timer_stats_timer_set_start_info(&dwork->timer); - /* This stores cwq for the moment, for the timer_fn */ set_wq_data(work, wq_per_cpu(wq, raw_smp_processor_id())); timer->expires = jiffies + delay; @@ -564,6 +564,7 @@ EXPORT_SYMBOL(schedule_work); int schedule_delayed_work(struct delayed_work *dwork, unsigned long delay) { + timer_stats_timer_set_start_info(&dwork->timer); return queue_delayed_work(keventd_wq, dwork, delay); } EXPORT_SYMBOL(schedule_delayed_work); @@ -580,6 +581,7 @@ EXPORT_SYMBOL(schedule_delayed_work); int schedule_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay) { + timer_stats_timer_set_start_info(&dwork->timer); return queue_delayed_work_on(cpu, keventd_wq, dwork, delay); } EXPORT_SYMBOL(schedule_delayed_work_on); diff --git a/trunk/lib/devres.c b/trunk/lib/devres.c index 26c87c49d776..edc27a5d1b73 100644 --- a/trunk/lib/devres.c +++ b/trunk/lib/devres.c @@ -20,7 +20,7 @@ static int devm_ioremap_match(struct device *dev, void *res, void *match_data) * * Managed ioremap(). Map is automatically unmapped on driver detach. */ -void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, +void __iomem *devm_ioremap(struct device *dev, unsigned long offset, unsigned long size) { void __iomem **ptr, *addr; @@ -49,7 +49,7 @@ EXPORT_SYMBOL(devm_ioremap); * Managed ioremap_nocache(). Map is automatically unmapped on driver * detach. */ -void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, +void __iomem *devm_ioremap_nocache(struct device *dev, unsigned long offset, unsigned long size) { void __iomem **ptr, *addr; diff --git a/trunk/lib/div64.c b/trunk/lib/div64.c index bb5bd0c0f030..b71cf93c529a 100644 --- a/trunk/lib/div64.c +++ b/trunk/lib/div64.c @@ -16,8 +16,9 @@ * assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S. */ +#include #include -#include +#include /* Not needed on 64bit architectures */ #if BITS_PER_LONG == 32 @@ -57,31 +58,10 @@ uint32_t __attribute__((weak)) __div64_32(uint64_t *n, uint32_t base) EXPORT_SYMBOL(__div64_32); -#ifndef div_s64_rem -s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) -{ - u64 quotient; - - if (dividend < 0) { - quotient = div_u64_rem(-dividend, abs(divisor), (u32 *)remainder); - *remainder = -*remainder; - if (divisor > 0) - quotient = -quotient; - } else { - quotient = div_u64_rem(dividend, abs(divisor), (u32 *)remainder); - if (divisor < 0) - quotient = -quotient; - } - return quotient; -} -EXPORT_SYMBOL(div_s64_rem); -#endif - /* 64bit divisor, dividend and result. dynamic precision */ -#ifndef div64_u64 -u64 div64_u64(u64 dividend, u64 divisor) +uint64_t div64_64(uint64_t dividend, uint64_t divisor) { - u32 high, d; + uint32_t high, d; high = divisor >> 32; if (high) { @@ -92,9 +72,10 @@ u64 div64_u64(u64 dividend, u64 divisor) } else d = divisor; - return div_u64(dividend, d); + do_div(dividend, d); + + return dividend; } -EXPORT_SYMBOL(div64_u64); -#endif +EXPORT_SYMBOL(div64_64); #endif /* BITS_PER_LONG == 32 */ diff --git a/trunk/lib/idr.c b/trunk/lib/idr.c index 7a02e173f027..8368c81fcb7d 100644 --- a/trunk/lib/idr.c +++ b/trunk/lib/idr.c @@ -385,8 +385,8 @@ void idr_remove(struct idr *idp, int id) while (idp->id_free_cnt >= IDR_FREE_MAX) { p = alloc_layer(idp); kmem_cache_free(idr_layer_cache, p); + return; } - return; } EXPORT_SYMBOL(idr_remove); diff --git a/trunk/lib/klist.c b/trunk/lib/klist.c index cca37f96faa2..120bd175aa78 100644 --- a/trunk/lib/klist.c +++ b/trunk/lib/klist.c @@ -1,37 +1,38 @@ /* - * klist.c - Routines for manipulating klists. + * klist.c - Routines for manipulating klists. * - * Copyright (C) 2005 Patrick Mochel * - * This file is released under the GPL v2. + * This klist interface provides a couple of structures that wrap around + * struct list_head to provide explicit list "head" (struct klist) and + * list "node" (struct klist_node) objects. For struct klist, a spinlock + * is included that protects access to the actual list itself. struct + * klist_node provides a pointer to the klist that owns it and a kref + * reference count that indicates the number of current users of that node + * in the list. * - * This klist interface provides a couple of structures that wrap around - * struct list_head to provide explicit list "head" (struct klist) and list - * "node" (struct klist_node) objects. For struct klist, a spinlock is - * included that protects access to the actual list itself. struct - * klist_node provides a pointer to the klist that owns it and a kref - * reference count that indicates the number of current users of that node - * in the list. + * The entire point is to provide an interface for iterating over a list + * that is safe and allows for modification of the list during the + * iteration (e.g. insertion and removal), including modification of the + * current node on the list. * - * The entire point is to provide an interface for iterating over a list - * that is safe and allows for modification of the list during the - * iteration (e.g. insertion and removal), including modification of the - * current node on the list. + * It works using a 3rd object type - struct klist_iter - that is declared + * and initialized before an iteration. klist_next() is used to acquire the + * next element in the list. It returns NULL if there are no more items. + * Internally, that routine takes the klist's lock, decrements the reference + * count of the previous klist_node and increments the count of the next + * klist_node. It then drops the lock and returns. * - * It works using a 3rd object type - struct klist_iter - that is declared - * and initialized before an iteration. klist_next() is used to acquire the - * next element in the list. It returns NULL if there are no more items. - * Internally, that routine takes the klist's lock, decrements the - * reference count of the previous klist_node and increments the count of - * the next klist_node. It then drops the lock and returns. + * There are primitives for adding and removing nodes to/from a klist. + * When deleting, klist_del() will simply decrement the reference count. + * Only when the count goes to 0 is the node removed from the list. + * klist_remove() will try to delete the node from the list and block + * until it is actually removed. This is useful for objects (like devices) + * that have been removed from the system and must be freed (but must wait + * until all accessors have finished). * - * There are primitives for adding and removing nodes to/from a klist. - * When deleting, klist_del() will simply decrement the reference count. - * Only when the count goes to 0 is the node removed from the list. - * klist_remove() will try to delete the node from the list and block until - * it is actually removed. This is useful for objects (like devices) that - * have been removed from the system and must be freed (but must wait until - * all accessors have finished). + * Copyright (C) 2005 Patrick Mochel + * + * This file is released under the GPL v2. */ #include @@ -39,10 +40,10 @@ /** - * klist_init - Initialize a klist structure. - * @k: The klist we're initializing. - * @get: The get function for the embedding object (NULL if none) - * @put: The put function for the embedding object (NULL if none) + * klist_init - Initialize a klist structure. + * @k: The klist we're initializing. + * @get: The get function for the embedding object (NULL if none) + * @put: The put function for the embedding object (NULL if none) * * Initialises the klist structure. If the klist_node structures are * going to be embedded in refcounted objects (necessary for safe @@ -50,7 +51,8 @@ * functions that take and release references on the embedding * objects. */ -void klist_init(struct klist *k, void (*get)(struct klist_node *), + +void klist_init(struct klist * k, void (*get)(struct klist_node *), void (*put)(struct klist_node *)) { INIT_LIST_HEAD(&k->k_list); @@ -58,23 +60,26 @@ void klist_init(struct klist *k, void (*get)(struct klist_node *), k->get = get; k->put = put; } + EXPORT_SYMBOL_GPL(klist_init); -static void add_head(struct klist *k, struct klist_node *n) + +static void add_head(struct klist * k, struct klist_node * n) { spin_lock(&k->k_lock); list_add(&n->n_node, &k->k_list); spin_unlock(&k->k_lock); } -static void add_tail(struct klist *k, struct klist_node *n) +static void add_tail(struct klist * k, struct klist_node * n) { spin_lock(&k->k_lock); list_add_tail(&n->n_node, &k->k_list); spin_unlock(&k->k_lock); } -static void klist_node_init(struct klist *k, struct klist_node *n) + +static void klist_node_init(struct klist * k, struct klist_node * n) { INIT_LIST_HEAD(&n->n_node); init_completion(&n->n_removed); @@ -84,83 +89,60 @@ static void klist_node_init(struct klist *k, struct klist_node *n) k->get(n); } + /** - * klist_add_head - Initialize a klist_node and add it to front. - * @n: node we're adding. - * @k: klist it's going on. + * klist_add_head - Initialize a klist_node and add it to front. + * @n: node we're adding. + * @k: klist it's going on. */ -void klist_add_head(struct klist_node *n, struct klist *k) + +void klist_add_head(struct klist_node * n, struct klist * k) { klist_node_init(k, n); add_head(k, n); } + EXPORT_SYMBOL_GPL(klist_add_head); -/** - * klist_add_tail - Initialize a klist_node and add it to back. - * @n: node we're adding. - * @k: klist it's going on. - */ -void klist_add_tail(struct klist_node *n, struct klist *k) -{ - klist_node_init(k, n); - add_tail(k, n); -} -EXPORT_SYMBOL_GPL(klist_add_tail); /** - * klist_add_after - Init a klist_node and add it after an existing node - * @n: node we're adding. - * @pos: node to put @n after + * klist_add_tail - Initialize a klist_node and add it to back. + * @n: node we're adding. + * @k: klist it's going on. */ -void klist_add_after(struct klist_node *n, struct klist_node *pos) -{ - struct klist *k = pos->n_klist; +void klist_add_tail(struct klist_node * n, struct klist * k) +{ klist_node_init(k, n); - spin_lock(&k->k_lock); - list_add(&n->n_node, &pos->n_node); - spin_unlock(&k->k_lock); + add_tail(k, n); } -EXPORT_SYMBOL_GPL(klist_add_after); -/** - * klist_add_before - Init a klist_node and add it before an existing node - * @n: node we're adding. - * @pos: node to put @n after - */ -void klist_add_before(struct klist_node *n, struct klist_node *pos) -{ - struct klist *k = pos->n_klist; +EXPORT_SYMBOL_GPL(klist_add_tail); - klist_node_init(k, n); - spin_lock(&k->k_lock); - list_add_tail(&n->n_node, &pos->n_node); - spin_unlock(&k->k_lock); -} -EXPORT_SYMBOL_GPL(klist_add_before); -static void klist_release(struct kref *kref) +static void klist_release(struct kref * kref) { - struct klist_node *n = container_of(kref, struct klist_node, n_ref); + struct klist_node * n = container_of(kref, struct klist_node, n_ref); list_del(&n->n_node); complete(&n->n_removed); n->n_klist = NULL; } -static int klist_dec_and_del(struct klist_node *n) +static int klist_dec_and_del(struct klist_node * n) { return kref_put(&n->n_ref, klist_release); } + /** - * klist_del - Decrement the reference count of node and try to remove. - * @n: node we're deleting. + * klist_del - Decrement the reference count of node and try to remove. + * @n: node we're deleting. */ -void klist_del(struct klist_node *n) + +void klist_del(struct klist_node * n) { - struct klist *k = n->n_klist; + struct klist * k = n->n_klist; void (*put)(struct klist_node *) = k->put; spin_lock(&k->k_lock); @@ -170,40 +152,48 @@ void klist_del(struct klist_node *n) if (put) put(n); } + EXPORT_SYMBOL_GPL(klist_del); + /** - * klist_remove - Decrement the refcount of node and wait for it to go away. - * @n: node we're removing. + * klist_remove - Decrement the refcount of node and wait for it to go away. + * @n: node we're removing. */ -void klist_remove(struct klist_node *n) + +void klist_remove(struct klist_node * n) { klist_del(n); wait_for_completion(&n->n_removed); } + EXPORT_SYMBOL_GPL(klist_remove); + /** - * klist_node_attached - Say whether a node is bound to a list or not. - * @n: Node that we're testing. + * klist_node_attached - Say whether a node is bound to a list or not. + * @n: Node that we're testing. */ -int klist_node_attached(struct klist_node *n) + +int klist_node_attached(struct klist_node * n) { return (n->n_klist != NULL); } + EXPORT_SYMBOL_GPL(klist_node_attached); + /** - * klist_iter_init_node - Initialize a klist_iter structure. - * @k: klist we're iterating. - * @i: klist_iter we're filling. - * @n: node to start with. + * klist_iter_init_node - Initialize a klist_iter structure. + * @k: klist we're iterating. + * @i: klist_iter we're filling. + * @n: node to start with. * - * Similar to klist_iter_init(), but starts the action off with @n, - * instead of with the list head. + * Similar to klist_iter_init(), but starts the action off with @n, + * instead of with the list head. */ -void klist_iter_init_node(struct klist *k, struct klist_iter *i, - struct klist_node *n) + +void klist_iter_init_node(struct klist * k, struct klist_iter * i, struct klist_node * n) { i->i_klist = k; i->i_head = &k->k_list; @@ -211,56 +201,66 @@ void klist_iter_init_node(struct klist *k, struct klist_iter *i, if (n) kref_get(&n->n_ref); } + EXPORT_SYMBOL_GPL(klist_iter_init_node); + /** - * klist_iter_init - Iniitalize a klist_iter structure. - * @k: klist we're iterating. - * @i: klist_iter structure we're filling. + * klist_iter_init - Iniitalize a klist_iter structure. + * @k: klist we're iterating. + * @i: klist_iter structure we're filling. * - * Similar to klist_iter_init_node(), but start with the list head. + * Similar to klist_iter_init_node(), but start with the list head. */ -void klist_iter_init(struct klist *k, struct klist_iter *i) + +void klist_iter_init(struct klist * k, struct klist_iter * i) { klist_iter_init_node(k, i, NULL); } + EXPORT_SYMBOL_GPL(klist_iter_init); + /** - * klist_iter_exit - Finish a list iteration. - * @i: Iterator structure. + * klist_iter_exit - Finish a list iteration. + * @i: Iterator structure. * - * Must be called when done iterating over list, as it decrements the - * refcount of the current node. Necessary in case iteration exited before - * the end of the list was reached, and always good form. + * Must be called when done iterating over list, as it decrements the + * refcount of the current node. Necessary in case iteration exited before + * the end of the list was reached, and always good form. */ -void klist_iter_exit(struct klist_iter *i) + +void klist_iter_exit(struct klist_iter * i) { if (i->i_cur) { klist_del(i->i_cur); i->i_cur = NULL; } } + EXPORT_SYMBOL_GPL(klist_iter_exit); -static struct klist_node *to_klist_node(struct list_head *n) + +static struct klist_node * to_klist_node(struct list_head * n) { return container_of(n, struct klist_node, n_node); } + /** - * klist_next - Ante up next node in list. - * @i: Iterator structure. + * klist_next - Ante up next node in list. + * @i: Iterator structure. * - * First grab list lock. Decrement the reference count of the previous - * node, if there was one. Grab the next node, increment its reference - * count, drop the lock, and return that next node. + * First grab list lock. Decrement the reference count of the previous + * node, if there was one. Grab the next node, increment its reference + * count, drop the lock, and return that next node. */ -struct klist_node *klist_next(struct klist_iter *i) + +struct klist_node * klist_next(struct klist_iter * i) { - struct list_head *next; - struct klist_node *lnode = i->i_cur; - struct klist_node *knode = NULL; + struct list_head * next; + struct klist_node * lnode = i->i_cur; + struct klist_node * knode = NULL; void (*put)(struct klist_node *) = i->i_klist->put; spin_lock(&i->i_klist->k_lock); @@ -281,4 +281,7 @@ struct klist_node *klist_next(struct klist_iter *i) put(lnode); return knode; } + EXPORT_SYMBOL_GPL(klist_next); + + diff --git a/trunk/lib/kobject.c b/trunk/lib/kobject.c index 718e5101c263..fd7874032163 100644 --- a/trunk/lib/kobject.c +++ b/trunk/lib/kobject.c @@ -216,12 +216,21 @@ static int kobject_add_internal(struct kobject *kobj) static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list vargs) { + va_list aq; + char *name; + + va_copy(aq, vargs); + name = kvasprintf(GFP_KERNEL, fmt, vargs); + va_end(aq); + + if (!name) + return -ENOMEM; + /* Free the old name, if necessary. */ kfree(kobj->name); - kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); - if (!kobj->name) - return -ENOMEM; + /* Now, set the new name */ + kobj->name = name; return 0; } @@ -237,12 +246,12 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, */ int kobject_set_name(struct kobject *kobj, const char *fmt, ...) { - va_list vargs; + va_list args; int retval; - va_start(vargs, fmt); - retval = kobject_set_name_vargs(kobj, fmt, vargs); - va_end(vargs); + va_start(args, fmt); + retval = kobject_set_name_vargs(kobj, fmt, args); + va_end(args); return retval; } @@ -292,9 +301,12 @@ EXPORT_SYMBOL(kobject_init); static int kobject_add_varg(struct kobject *kobj, struct kobject *parent, const char *fmt, va_list vargs) { + va_list aq; int retval; - retval = kobject_set_name_vargs(kobj, fmt, vargs); + va_copy(aq, vargs); + retval = kobject_set_name_vargs(kobj, fmt, aq); + va_end(aq); if (retval) { printk(KERN_ERR "kobject: can not set name properly!\n"); return retval; diff --git a/trunk/lib/string.c b/trunk/lib/string.c index b19b87af65a3..5efafed3d6b6 100644 --- a/trunk/lib/string.c +++ b/trunk/lib/string.c @@ -493,33 +493,6 @@ char *strsep(char **s, const char *ct) EXPORT_SYMBOL(strsep); #endif -/** - * sysfs_streq - return true if strings are equal, modulo trailing newline - * @s1: one string - * @s2: another string - * - * This routine returns true iff two strings are equal, treating both - * NUL and newline-then-NUL as equivalent string terminations. It's - * geared for use with sysfs input strings, which generally terminate - * with newlines but are compared against values without newlines. - */ -bool sysfs_streq(const char *s1, const char *s2) -{ - while (*s1 && *s1 == *s2) { - s1++; - s2++; - } - - if (*s1 == *s2) - return true; - if (!*s1 && *s2 == '\n' && !s2[1]) - return true; - if (*s1 == '\n' && !s1[1] && !*s2) - return true; - return false; -} -EXPORT_SYMBOL(sysfs_streq); - #ifndef __HAVE_ARCH_MEMSET /** * memset - Fill a region of memory with the given value diff --git a/trunk/mm/memcontrol.c b/trunk/mm/memcontrol.c index e46451e1d9b7..33add96cd5fb 100644 --- a/trunk/mm/memcontrol.c +++ b/trunk/mm/memcontrol.c @@ -48,8 +48,6 @@ enum mem_cgroup_stat_index { */ MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */ MEM_CGROUP_STAT_RSS, /* # of pages charged as rss */ - MEM_CGROUP_STAT_PGPGIN_COUNT, /* # of pages paged in */ - MEM_CGROUP_STAT_PGPGOUT_COUNT, /* # of pages paged out */ MEM_CGROUP_STAT_NSTATS, }; @@ -201,13 +199,6 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *mem, int flags, __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_CACHE, val); else __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_RSS, val); - - if (charge) - __mem_cgroup_stat_add_safe(stat, - MEM_CGROUP_STAT_PGPGIN_COUNT, 1); - else - __mem_cgroup_stat_add_safe(stat, - MEM_CGROUP_STAT_PGPGOUT_COUNT, 1); } static struct mem_cgroup_per_zone * @@ -893,8 +884,6 @@ static const struct mem_cgroup_stat_desc { } mem_cgroup_stat_desc[] = { [MEM_CGROUP_STAT_CACHE] = { "cache", PAGE_SIZE, }, [MEM_CGROUP_STAT_RSS] = { "rss", PAGE_SIZE, }, - [MEM_CGROUP_STAT_PGPGIN_COUNT] = {"pgpgin", 1, }, - [MEM_CGROUP_STAT_PGPGOUT_COUNT] = {"pgpgout", 1, }, }; static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft, diff --git a/trunk/mm/slub.c b/trunk/mm/slub.c index 32b62623846a..70db2897c1ea 100644 --- a/trunk/mm/slub.c +++ b/trunk/mm/slub.c @@ -22,7 +22,6 @@ #include #include #include -#include /* * Lock order: @@ -3622,10 +3621,12 @@ static int list_locations(struct kmem_cache *s, char *buf, len += sprintf(buf + len, ""); if (l->sum_time != l->min_time) { + unsigned long remainder; + len += sprintf(buf + len, " age=%ld/%ld/%ld", - l->min_time, - (long)div_u64(l->sum_time, l->count), - l->max_time); + l->min_time, + div_long_long_rem(l->sum_time, l->count, &remainder), + l->max_time); } else len += sprintf(buf + len, " age=%ld", l->min_time); diff --git a/trunk/mm/vmalloc.c b/trunk/mm/vmalloc.c index 6e45b0f3d125..2a39cf128aba 100644 --- a/trunk/mm/vmalloc.c +++ b/trunk/mm/vmalloc.c @@ -547,7 +547,6 @@ void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot) * @gfp_mask: flags for the page level allocator * @prot: protection mask for the allocated pages * @node: node to use for allocation or -1 - * @caller: caller's return address * * Allocate enough pages to cover @size from the page level * allocator with @gfp_mask flags. Map them into contiguous diff --git a/trunk/net/ipv4/tcp_cubic.c b/trunk/net/ipv4/tcp_cubic.c index 4a1221e5e8ee..eb5b9854c8c7 100644 --- a/trunk/net/ipv4/tcp_cubic.c +++ b/trunk/net/ipv4/tcp_cubic.c @@ -15,8 +15,8 @@ #include #include -#include #include +#include #define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation * max_cwnd = snd_cwnd * beta @@ -128,7 +128,7 @@ static u32 cubic_root(u64 a) * x = ( 2 * x + a / x ) / 3 * k+1 k k */ - x = (2 * x + (u32)div64_u64(a, (u64)x * (u64)(x - 1))); + x = (2 * x + (u32)div64_64(a, (u64)x * (u64)(x - 1))); x = ((x * 341) >> 10); return x; } diff --git a/trunk/net/ipv6/ipv6_sockglue.c b/trunk/net/ipv6/ipv6_sockglue.c index 56d55fecf8ec..b4a26f2505f8 100644 --- a/trunk/net/ipv6/ipv6_sockglue.c +++ b/trunk/net/ipv6/ipv6_sockglue.c @@ -1089,6 +1089,10 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname, if(level != SOL_IPV6) return -ENOPROTOOPT; + if (optname == MCAST_MSFILTER) + return compat_mc_getsockopt(sk, level, optname, optval, optlen, + ipv6_getsockopt); + err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); #ifdef CONFIG_NETFILTER /* we need to exclude all possible ENOPROTOOPTs except default case */ @@ -1127,10 +1131,6 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname, if (level != SOL_IPV6) return -ENOPROTOOPT; - if (optname == MCAST_MSFILTER) - return compat_mc_getsockopt(sk, level, optname, optval, optlen, - ipv6_getsockopt); - err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); #ifdef CONFIG_NETFILTER /* we need to exclude all possible ENOPROTOOPTs except default case */ diff --git a/trunk/net/netfilter/xt_connbytes.c b/trunk/net/netfilter/xt_connbytes.c index d7e8983cd37f..b15e7e2fa143 100644 --- a/trunk/net/netfilter/xt_connbytes.c +++ b/trunk/net/netfilter/xt_connbytes.c @@ -4,11 +4,12 @@ #include #include #include -#include #include #include #include +#include + MODULE_LICENSE("GPL"); MODULE_AUTHOR("Harald Welte "); MODULE_DESCRIPTION("Xtables: Number of packets/bytes per connection matching"); @@ -81,7 +82,7 @@ connbytes_mt(const struct sk_buff *skb, const struct net_device *in, break; } if (pkts != 0) - what = div64_u64(bytes, pkts); + what = div64_64(bytes, pkts); break; } diff --git a/trunk/scripts/kconfig/lxdialog/check-lxdialog.sh b/trunk/scripts/kconfig/lxdialog/check-lxdialog.sh index 5552154cbedb..62e1e02126e6 100644 --- a/trunk/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/trunk/scripts/kconfig/lxdialog/check-lxdialog.sh @@ -36,10 +36,8 @@ trap "rm -f $tmp" 0 1 2 3 15 # Check if we can link to ncurses check() { - $cc -xc - -o $tmp 2>/dev/null <<'EOF' -#include CURSES_LOC -main() {} -EOF + echo -e " #include CURSES_LOC \n main() {}" | + $cc -xc - -o $tmp 2> /dev/null if [ $? != 0 ]; then echo " *** Unable to find the ncurses libraries or the" 1>&2 echo " *** required header files." 1>&2