From 6d7b23fc350cade17e71a3a892353e9c1b8858fe Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sat, 22 Jan 2011 02:08:30 +0100 Subject: [PATCH] --- yaml --- r: 233772 b: refs/heads/master c: 0a85b4827e9960295fbf4ca0f32bb357693cc5f7 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/powerpc/include/asm/machdep.h | 6 --- trunk/arch/powerpc/kernel/machine_kexec.c | 5 +-- trunk/arch/powerpc/kernel/process.c | 8 ++-- trunk/arch/powerpc/mm/tlb_hash64.c | 6 +-- trunk/arch/x86/include/asm/msr-index.h | 5 --- .../arch/x86/kernel/cpu/cpufreq/p4-clockmod.c | 6 +-- .../arch/x86/kernel/cpu/cpufreq/powernow-k8.c | 13 ++---- trunk/drivers/acpi/acpica/aclocal.h | 7 +--- trunk/drivers/acpi/acpica/evgpe.c | 17 ++------ trunk/drivers/acpi/acpica/evxfgpe.c | 42 ++++--------------- trunk/drivers/acpi/debugfs.c | 20 +++------ trunk/drivers/cpufreq/cpufreq.c | 27 ++++++------ trunk/drivers/idle/intel_idle.c | 24 ----------- trunk/drivers/mfd/asic3.c | 4 +- trunk/fs/ext2/namei.c | 9 +++- 16 files changed, 55 insertions(+), 146 deletions(-) diff --git a/[refs] b/[refs] index 257d85b0d735..05514dce37fa 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 25271d8c84dabd926bbf8727d2f6e90fcbce30b6 +refs/heads/master: 0a85b4827e9960295fbf4ca0f32bb357693cc5f7 diff --git a/trunk/arch/powerpc/include/asm/machdep.h b/trunk/arch/powerpc/include/asm/machdep.h index fe56a23e1ff0..991d5998d6be 100644 --- a/trunk/arch/powerpc/include/asm/machdep.h +++ b/trunk/arch/powerpc/include/asm/machdep.h @@ -240,12 +240,6 @@ struct machdep_calls { * claims to support kexec. */ int (*machine_kexec_prepare)(struct kimage *image); - - /* Called to perform the _real_ kexec. - * Do NOT allocate memory or fail here. We are past the point of - * no return. - */ - void (*machine_kexec)(struct kimage *image); #endif /* CONFIG_KEXEC */ #ifdef CONFIG_SUSPEND diff --git a/trunk/arch/powerpc/kernel/machine_kexec.c b/trunk/arch/powerpc/kernel/machine_kexec.c index a5f8672eeff3..49a170af8145 100644 --- a/trunk/arch/powerpc/kernel/machine_kexec.c +++ b/trunk/arch/powerpc/kernel/machine_kexec.c @@ -87,10 +87,7 @@ void machine_kexec(struct kimage *image) save_ftrace_enabled = __ftrace_enabled_save(); - if (ppc_md.machine_kexec) - ppc_md.machine_kexec(image); - else - default_machine_kexec(image); + default_machine_kexec(image); __ftrace_enabled_restore(save_ftrace_enabled); diff --git a/trunk/arch/powerpc/kernel/process.c b/trunk/arch/powerpc/kernel/process.c index 8303a6c65ef7..7a1d5cb76932 100644 --- a/trunk/arch/powerpc/kernel/process.c +++ b/trunk/arch/powerpc/kernel/process.c @@ -353,7 +353,6 @@ static void switch_booke_debug_regs(struct thread_struct *new_thread) prime_debug_regs(new_thread); } #else /* !CONFIG_PPC_ADV_DEBUG_REGS */ -#ifndef CONFIG_HAVE_HW_BREAKPOINT static void set_debug_reg_defaults(struct thread_struct *thread) { if (thread->dabr) { @@ -361,7 +360,6 @@ static void set_debug_reg_defaults(struct thread_struct *thread) set_dabr(0); } } -#endif /* !CONFIG_HAVE_HW_BREAKPOINT */ #endif /* CONFIG_PPC_ADV_DEBUG_REGS */ int set_dabr(unsigned long dabr) @@ -672,11 +670,11 @@ void flush_thread(void) { discard_lazy_cpu_state(); -#ifdef CONFIG_HAVE_HW_BREAKPOINT +#ifdef CONFIG_HAVE_HW_BREAKPOINTS flush_ptrace_hw_breakpoint(current); -#else /* CONFIG_HAVE_HW_BREAKPOINT */ +#else /* CONFIG_HAVE_HW_BREAKPOINTS */ set_debug_reg_defaults(¤t->thread); -#endif /* CONFIG_HAVE_HW_BREAKPOINT */ +#endif /* CONFIG_HAVE_HW_BREAKPOINTS */ } void diff --git a/trunk/arch/powerpc/mm/tlb_hash64.c b/trunk/arch/powerpc/mm/tlb_hash64.c index c14d09f614f3..1ec06576f619 100644 --- a/trunk/arch/powerpc/mm/tlb_hash64.c +++ b/trunk/arch/powerpc/mm/tlb_hash64.c @@ -38,11 +38,13 @@ DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); * neesd to be flushed. This function will either perform the flush * immediately or will batch it up if the current CPU has an active * batch on it. + * + * Must be called from within some kind of spinlock/non-preempt region... */ void hpte_need_flush(struct mm_struct *mm, unsigned long addr, pte_t *ptep, unsigned long pte, int huge) { - struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch); + struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); unsigned long vsid, vaddr; unsigned int psize; int ssize; @@ -97,7 +99,6 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr, */ if (!batch->active) { flush_hash_page(vaddr, rpte, psize, ssize, 0); - put_cpu_var(ppc64_tlb_batch); return; } @@ -126,7 +127,6 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr, batch->index = ++i; if (i >= PPC64_TLB_BATCH_NR) __flush_tlb_pending(batch); - put_cpu_var(ppc64_tlb_batch); } /* diff --git a/trunk/arch/x86/include/asm/msr-index.h b/trunk/arch/x86/include/asm/msr-index.h index 43a18c77676d..4d0dfa0d998e 100644 --- a/trunk/arch/x86/include/asm/msr-index.h +++ b/trunk/arch/x86/include/asm/msr-index.h @@ -36,11 +36,6 @@ #define MSR_IA32_PERFCTR1 0x000000c2 #define MSR_FSB_FREQ 0x000000cd -#define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x000000e2 -#define NHM_C3_AUTO_DEMOTE (1UL << 25) -#define NHM_C1_AUTO_DEMOTE (1UL << 26) -#define ATM_LNC_C6_AUTO_DEMOTE (1UL << 25) - #define MSR_MTRRcap 0x000000fe #define MSR_IA32_BBL_CR_CTL 0x00000119 diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c index 52c93648e492..bd1cac747f67 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c @@ -158,9 +158,9 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) { if (c->x86 == 0x06) { if (cpu_has(c, X86_FEATURE_EST)) - printk_once(KERN_WARNING PFX "Warning: EST-capable " - "CPU detected. The acpi-cpufreq module offers " - "voltage scaling in addition to frequency " + printk(KERN_WARNING PFX "Warning: EST-capable CPU " + "detected. The acpi-cpufreq module offers " + "voltage scaling in addition of frequency " "scaling. You should use that instead of " "p4-clockmod, if possible.\n"); switch (c->x86_model) { diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index c567dec854f6..35c7e65e59be 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k8.c @@ -1537,7 +1537,6 @@ static struct notifier_block cpb_nb = { static int __cpuinit powernowk8_init(void) { unsigned int i, supported_cpus = 0, cpu; - int rv; for_each_online_cpu(i) { int rc; @@ -1556,14 +1555,14 @@ static int __cpuinit powernowk8_init(void) cpb_capable = true; + register_cpu_notifier(&cpb_nb); + msrs = msrs_alloc(); if (!msrs) { printk(KERN_ERR "%s: Error allocating msrs!\n", __func__); return -ENOMEM; } - register_cpu_notifier(&cpb_nb); - rdmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs); for_each_cpu(cpu, cpu_online_mask) { @@ -1575,13 +1574,7 @@ static int __cpuinit powernowk8_init(void) (cpb_enabled ? "on" : "off")); } - rv = cpufreq_register_driver(&cpufreq_amd64_driver); - if (rv < 0 && boot_cpu_has(X86_FEATURE_CPB)) { - unregister_cpu_notifier(&cpb_nb); - msrs_free(msrs); - msrs = NULL; - } - return rv; + return cpufreq_register_driver(&cpufreq_amd64_driver); } /* driver entry point for term */ diff --git a/trunk/drivers/acpi/acpica/aclocal.h b/trunk/drivers/acpi/acpica/aclocal.h index edc25867ad9d..54784bb42cec 100644 --- a/trunk/drivers/acpi/acpica/aclocal.h +++ b/trunk/drivers/acpi/acpica/aclocal.h @@ -416,15 +416,10 @@ struct acpi_gpe_handler_info { u8 originally_enabled; /* True if GPE was originally enabled */ }; -struct acpi_gpe_notify_object { - struct acpi_namespace_node *node; - struct acpi_gpe_notify_object *next; -}; - union acpi_gpe_dispatch_info { struct acpi_namespace_node *method_node; /* Method node for this GPE level */ struct acpi_gpe_handler_info *handler; /* Installed GPE handler */ - struct acpi_gpe_notify_object device; /* List of _PRW devices for implicit notify */ + struct acpi_namespace_node *device_node; /* Parent _PRW device for implicit notify */ }; /* diff --git a/trunk/drivers/acpi/acpica/evgpe.c b/trunk/drivers/acpi/acpica/evgpe.c index f4725212eb48..14988a86066f 100644 --- a/trunk/drivers/acpi/acpica/evgpe.c +++ b/trunk/drivers/acpi/acpica/evgpe.c @@ -457,7 +457,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) acpi_status status; struct acpi_gpe_event_info *local_gpe_event_info; struct acpi_evaluate_info *info; - struct acpi_gpe_notify_object *notify_object; ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method); @@ -509,18 +508,10 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) * from this thread -- because handlers may in turn run other * control methods. */ - status = acpi_ev_queue_notify_request( - local_gpe_event_info->dispatch.device.node, - ACPI_NOTIFY_DEVICE_WAKE); - - notify_object = local_gpe_event_info->dispatch.device.next; - while (ACPI_SUCCESS(status) && notify_object) { - status = acpi_ev_queue_notify_request( - notify_object->node, - ACPI_NOTIFY_DEVICE_WAKE); - notify_object = notify_object->next; - } - + status = + acpi_ev_queue_notify_request(local_gpe_event_info->dispatch. + device_node, + ACPI_NOTIFY_DEVICE_WAKE); break; case ACPI_GPE_DISPATCH_METHOD: diff --git a/trunk/drivers/acpi/acpica/evxfgpe.c b/trunk/drivers/acpi/acpica/evxfgpe.c index 52aaff3df562..3b20a3401b64 100644 --- a/trunk/drivers/acpi/acpica/evxfgpe.c +++ b/trunk/drivers/acpi/acpica/evxfgpe.c @@ -198,9 +198,7 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device, acpi_status status = AE_BAD_PARAMETER; struct acpi_gpe_event_info *gpe_event_info; struct acpi_namespace_node *device_node; - struct acpi_gpe_notify_object *notify_object; acpi_cpu_flags flags; - u8 gpe_dispatch_mask; ACPI_FUNCTION_TRACE(acpi_setup_gpe_for_wake); @@ -223,49 +221,27 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device, goto unlock_and_exit; } - if (wake_device == ACPI_ROOT_OBJECT) { - goto out; - } - /* * If there is no method or handler for this GPE, then the * wake_device will be notified whenever this GPE fires (aka * "implicit notify") Note: The GPE is assumed to be * level-triggered (for windows compatibility). */ - gpe_dispatch_mask = gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK; - if (gpe_dispatch_mask != ACPI_GPE_DISPATCH_NONE - && gpe_dispatch_mask != ACPI_GPE_DISPATCH_NOTIFY) { - goto out; - } + if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_NONE) && (wake_device != ACPI_ROOT_OBJECT)) { - /* Validate wake_device is of type Device */ + /* Validate wake_device is of type Device */ - device_node = ACPI_CAST_PTR(struct acpi_namespace_node, wake_device); - if (device_node->type != ACPI_TYPE_DEVICE) { - goto unlock_and_exit; - } - - if (gpe_dispatch_mask == ACPI_GPE_DISPATCH_NONE) { - gpe_event_info->flags = (ACPI_GPE_DISPATCH_NOTIFY | - ACPI_GPE_LEVEL_TRIGGERED); - gpe_event_info->dispatch.device.node = device_node; - gpe_event_info->dispatch.device.next = NULL; - } else { - /* There are multiple devices to notify implicitly. */ - - notify_object = ACPI_ALLOCATE_ZEROED(sizeof(*notify_object)); - if (!notify_object) { - status = AE_NO_MEMORY; + device_node = ACPI_CAST_PTR(struct acpi_namespace_node, + wake_device); + if (device_node->type != ACPI_TYPE_DEVICE) { goto unlock_and_exit; } - - notify_object->node = device_node; - notify_object->next = gpe_event_info->dispatch.device.next; - gpe_event_info->dispatch.device.next = notify_object; + gpe_event_info->flags = (ACPI_GPE_DISPATCH_NOTIFY | + ACPI_GPE_LEVEL_TRIGGERED); + gpe_event_info->dispatch.device_node = device_node; } - out: gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; status = AE_OK; diff --git a/trunk/drivers/acpi/debugfs.c b/trunk/drivers/acpi/debugfs.c index 384f7abcff77..5df67f1d6c61 100644 --- a/trunk/drivers/acpi/debugfs.c +++ b/trunk/drivers/acpi/debugfs.c @@ -26,9 +26,7 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, size_t count, loff_t *ppos) { static char *buf; - static u32 max_size; - static u32 uncopied_bytes; - + static int uncopied_bytes; struct acpi_table_header table; acpi_status status; @@ -39,24 +37,19 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, if (copy_from_user(&table, user_buf, sizeof(struct acpi_table_header))) return -EFAULT; - uncopied_bytes = max_size = table.length; - buf = kzalloc(max_size, GFP_KERNEL); + uncopied_bytes = table.length; + buf = kzalloc(uncopied_bytes, GFP_KERNEL); if (!buf) return -ENOMEM; } - if (buf == NULL) - return -EINVAL; - - if ((*ppos > max_size) || - (*ppos + count > max_size) || - (*ppos + count < count) || - (count > uncopied_bytes)) + if (uncopied_bytes < count) { + kfree(buf); return -EINVAL; + } if (copy_from_user(buf + (*ppos), user_buf, count)) { kfree(buf); - buf = NULL; return -EFAULT; } @@ -66,7 +59,6 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, if (!uncopied_bytes) { status = acpi_install_method(buf); kfree(buf); - buf = NULL; if (ACPI_FAILURE(status)) return -EINVAL; add_taint(TAINT_OVERRIDDEN_ACPI_TABLE); diff --git a/trunk/drivers/cpufreq/cpufreq.c b/trunk/drivers/cpufreq/cpufreq.c index 5cb4d09919d6..1109f6848a43 100644 --- a/trunk/drivers/cpufreq/cpufreq.c +++ b/trunk/drivers/cpufreq/cpufreq.c @@ -1919,10 +1919,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) ret = sysdev_driver_register(&cpu_sysdev_class, &cpufreq_sysdev_driver); - if (ret) - goto err_null_driver; - if (!(cpufreq_driver->flags & CPUFREQ_STICKY)) { + if ((!ret) && !(cpufreq_driver->flags & CPUFREQ_STICKY)) { int i; ret = -ENODEV; @@ -1937,22 +1935,21 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) if (ret) { dprintk("no CPU initialized for driver %s\n", driver_data->name); - goto err_sysdev_unreg; + sysdev_driver_unregister(&cpu_sysdev_class, + &cpufreq_sysdev_driver); + + spin_lock_irqsave(&cpufreq_driver_lock, flags); + cpufreq_driver = NULL; + spin_unlock_irqrestore(&cpufreq_driver_lock, flags); } } - register_hotcpu_notifier(&cpufreq_cpu_notifier); - dprintk("driver %s up and running\n", driver_data->name); - cpufreq_debug_enable_ratelimit(); + if (!ret) { + register_hotcpu_notifier(&cpufreq_cpu_notifier); + dprintk("driver %s up and running\n", driver_data->name); + cpufreq_debug_enable_ratelimit(); + } - return 0; -err_sysdev_unreg: - sysdev_driver_unregister(&cpu_sysdev_class, - &cpufreq_sysdev_driver); -err_null_driver: - spin_lock_irqsave(&cpufreq_driver_lock, flags); - cpufreq_driver = NULL; - spin_unlock_irqrestore(&cpufreq_driver_lock, flags); return ret; } EXPORT_SYMBOL_GPL(cpufreq_register_driver); diff --git a/trunk/drivers/idle/intel_idle.c b/trunk/drivers/idle/intel_idle.c index 4a5c4a44ffb1..1fa091e05690 100644 --- a/trunk/drivers/idle/intel_idle.c +++ b/trunk/drivers/idle/intel_idle.c @@ -62,7 +62,6 @@ #include #include #include -#include #define INTEL_IDLE_VERSION "0.4" #define PREFIX "intel_idle: " @@ -85,12 +84,6 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state); static struct cpuidle_state *cpuidle_state_table; -/* - * Hardware C-state auto-demotion may not always be optimal. - * Indicate which enable bits to clear here. - */ -static unsigned long long auto_demotion_disable_flags; - /* * Set this flag for states where the HW flushes the TLB for us * and so we don't need cross-calls to keep it consistent. @@ -288,15 +281,6 @@ static struct notifier_block setup_broadcast_notifier = { .notifier_call = setup_broadcast_cpuhp_notify, }; -static void auto_demotion_disable(void *dummy) -{ - unsigned long long msr_bits; - - rdmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits); - msr_bits &= ~auto_demotion_disable_flags; - wrmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits); -} - /* * intel_idle_probe() */ @@ -340,17 +324,11 @@ static int intel_idle_probe(void) case 0x25: /* Westmere */ case 0x2C: /* Westmere */ cpuidle_state_table = nehalem_cstates; - auto_demotion_disable_flags = - (NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE); break; case 0x1C: /* 28 - Atom Processor */ - cpuidle_state_table = atom_cstates; - break; - case 0x26: /* 38 - Lincroft Atom Processor */ cpuidle_state_table = atom_cstates; - auto_demotion_disable_flags = ATM_LNC_C6_AUTO_DEMOTE; break; case 0x2A: /* SNB */ @@ -458,8 +436,6 @@ static int intel_idle_cpuidle_devices_init(void) return -EIO; } } - if (auto_demotion_disable_flags) - smp_call_function(auto_demotion_disable, NULL, 1); return 0; } diff --git a/trunk/drivers/mfd/asic3.c b/trunk/drivers/mfd/asic3.c index 6a1f94042612..c45e6305b26f 100644 --- a/trunk/drivers/mfd/asic3.c +++ b/trunk/drivers/mfd/asic3.c @@ -143,9 +143,9 @@ static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc) unsigned long flags; struct asic3 *asic; - desc->chip->ack(irq); + desc->irq_data.chip->irq_ack(&desc->irq_data); - asic = desc->handler_data; + asic = get_irq_data(irq); for (iter = 0 ; iter < MAX_ASIC_ISR_LOOPS; iter++) { u32 status; diff --git a/trunk/fs/ext2/namei.c b/trunk/fs/ext2/namei.c index adb91855ccd0..2e1d8341d827 100644 --- a/trunk/fs/ext2/namei.c +++ b/trunk/fs/ext2/namei.c @@ -344,6 +344,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, new_de = ext2_find_entry (new_dir, &new_dentry->d_name, &new_page); if (!new_de) goto out_dir; + inode_inc_link_count(old_inode); ext2_set_link(new_dir, new_de, new_page, old_inode, 1); new_inode->i_ctime = CURRENT_TIME_SEC; if (dir_de) @@ -355,9 +356,12 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, if (new_dir->i_nlink >= EXT2_LINK_MAX) goto out_dir; } + inode_inc_link_count(old_inode); err = ext2_add_link(new_dentry, old_inode); - if (err) + if (err) { + inode_dec_link_count(old_inode); goto out_dir; + } if (dir_de) inode_inc_link_count(new_dir); } @@ -365,11 +369,12 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, /* * Like most other Unix systems, set the ctime for inodes on a * rename. + * inode_dec_link_count() will mark the inode dirty. */ old_inode->i_ctime = CURRENT_TIME_SEC; - mark_inode_dirty(old_inode); ext2_delete_entry (old_de, old_page); + inode_dec_link_count(old_inode); if (dir_de) { if (old_dir != new_dir)