From da5d0f0f27b26d55fb0c6ae8bcb2a000274957c6 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Wed, 17 Jun 2009 13:13:56 -0700 Subject: [PATCH] --- yaml --- r: 157116 b: refs/heads/master c: dac9ff79a8122b30176e23359bb879b3144d7f1f h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/acpi/processor_core.c | 6 ---- trunk/drivers/acpi/processor_thermal.c | 6 ++-- trunk/drivers/acpi/processor_throttling.c | 30 ++++++++--------- trunk/drivers/leds/ledtrig-gpio.c | 24 ++++--------- trunk/drivers/macintosh/via-maciisi.c | 2 +- trunk/drivers/platform/x86/wmi.c | 8 ++--- trunk/drivers/pps/pps.c | 2 +- trunk/drivers/thermal/thermal_sys.c | 9 +---- trunk/include/acpi/processor.h | 5 ++- trunk/include/linux/flex_array.h | 12 +++---- trunk/kernel/fork.c | 20 ++++++++--- trunk/lib/flex_array.c | 41 +++++++++++------------ trunk/mm/rmap.c | 1 - trunk/mm/vmscan.c | 9 ++--- 15 files changed, 76 insertions(+), 101 deletions(-) diff --git a/[refs] b/[refs] index d3baed694d32..2ffc44958136 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cc674c81f01a6151ca00c617e5efa0812ee5fdbe +refs/heads/master: dac9ff79a8122b30176e23359bb879b3144d7f1f diff --git a/trunk/drivers/acpi/processor_core.c b/trunk/drivers/acpi/processor_core.c index 2cc4b3033872..84e0f3c07442 100644 --- a/trunk/drivers/acpi/processor_core.c +++ b/trunk/drivers/acpi/processor_core.c @@ -1151,9 +1151,6 @@ static int __init acpi_processor_init(void) { int result = 0; - if (acpi_disabled) - return 0; - memset(&errata, 0, sizeof(errata)); #ifdef CONFIG_SMP @@ -1200,9 +1197,6 @@ static int __init acpi_processor_init(void) static void __exit acpi_processor_exit(void) { - if (acpi_disabled) - return; - acpi_processor_ppc_exit(); acpi_thermal_cpufreq_exit(); diff --git a/trunk/drivers/acpi/processor_thermal.c b/trunk/drivers/acpi/processor_thermal.c index 31adda1099e0..39838c666032 100644 --- a/trunk/drivers/acpi/processor_thermal.c +++ b/trunk/drivers/acpi/processor_thermal.c @@ -66,7 +66,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) if (pr->limit.thermal.tx > tx) tx = pr->limit.thermal.tx; - result = acpi_processor_set_throttling(pr, tx, false); + result = acpi_processor_set_throttling(pr, tx); if (result) goto end; } @@ -421,12 +421,12 @@ processor_set_cur_state(struct thermal_cooling_device *cdev, if (state <= max_pstate) { if (pr->flags.throttling && pr->throttling.state) - result = acpi_processor_set_throttling(pr, 0, false); + result = acpi_processor_set_throttling(pr, 0); cpufreq_set_cur_state(pr->id, state); } else { cpufreq_set_cur_state(pr->id, max_pstate); result = acpi_processor_set_throttling(pr, - state - max_pstate, false); + state - max_pstate); } return result; } diff --git a/trunk/drivers/acpi/processor_throttling.c b/trunk/drivers/acpi/processor_throttling.c index ae39797aab55..227543789ba9 100644 --- a/trunk/drivers/acpi/processor_throttling.c +++ b/trunk/drivers/acpi/processor_throttling.c @@ -62,8 +62,7 @@ struct throttling_tstate { #define THROTTLING_POSTCHANGE (2) static int acpi_processor_get_throttling(struct acpi_processor *pr); -int acpi_processor_set_throttling(struct acpi_processor *pr, - int state, bool force); +int acpi_processor_set_throttling(struct acpi_processor *pr, int state); static int acpi_processor_update_tsd_coord(void) { @@ -362,7 +361,7 @@ int acpi_processor_tstate_has_changed(struct acpi_processor *pr) */ target_state = throttling_limit; } - return acpi_processor_set_throttling(pr, target_state, false); + return acpi_processor_set_throttling(pr, target_state); } /* @@ -840,10 +839,10 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) if (ret >= 0) { state = acpi_get_throttling_state(pr, value); if (state == -1) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Invalid throttling state, reset\n")); + ACPI_WARNING((AE_INFO, + "Invalid throttling state, reset")); state = 0; - ret = acpi_processor_set_throttling(pr, state, true); + ret = acpi_processor_set_throttling(pr, state); if (ret) return ret; } @@ -916,7 +915,7 @@ static int acpi_processor_get_fadt_info(struct acpi_processor *pr) } static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, - int state, bool force) + int state) { u32 value = 0; u32 duty_mask = 0; @@ -931,7 +930,7 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, if (!pr->flags.throttling) return -ENODEV; - if (!force && (state == pr->throttling.state)) + if (state == pr->throttling.state) return 0; if (state < pr->throttling_platform_limit) @@ -989,7 +988,7 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, } static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, - int state, bool force) + int state) { int ret; acpi_integer value; @@ -1003,7 +1002,7 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, if (!pr->flags.throttling) return -ENODEV; - if (!force && (state == pr->throttling.state)) + if (state == pr->throttling.state) return 0; if (state < pr->throttling_platform_limit) @@ -1019,8 +1018,7 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, return 0; } -int acpi_processor_set_throttling(struct acpi_processor *pr, - int state, bool force) +int acpi_processor_set_throttling(struct acpi_processor *pr, int state) { cpumask_var_t saved_mask; int ret = 0; @@ -1072,7 +1070,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, /* FIXME: use work_on_cpu() */ set_cpus_allowed_ptr(current, cpumask_of(pr->id)); ret = p_throttling->acpi_processor_set_throttling(pr, - t_state.target_state, force); + t_state.target_state); } else { /* * When the T-state coordination is SW_ALL or HW_ALL, @@ -1105,7 +1103,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, set_cpus_allowed_ptr(current, cpumask_of(i)); ret = match_pr->throttling. acpi_processor_set_throttling( - match_pr, t_state.target_state, force); + match_pr, t_state.target_state); } } /* @@ -1203,7 +1201,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabling throttling (was T%d)\n", pr->throttling.state)); - result = acpi_processor_set_throttling(pr, 0, false); + result = acpi_processor_set_throttling(pr, 0); if (result) goto end; } @@ -1309,7 +1307,7 @@ static ssize_t acpi_processor_write_throttling(struct file *file, if (strcmp(tmpbuf, charp) != 0) return -EINVAL; - result = acpi_processor_set_throttling(pr, state_val, false); + result = acpi_processor_set_throttling(pr, state_val); if (result) return result; diff --git a/trunk/drivers/leds/ledtrig-gpio.c b/trunk/drivers/leds/ledtrig-gpio.c index 1bc5db4ece0d..a247ae63374f 100644 --- a/trunk/drivers/leds/ledtrig-gpio.c +++ b/trunk/drivers/leds/ledtrig-gpio.c @@ -117,9 +117,6 @@ static ssize_t gpio_trig_inverted_store(struct device *dev, gpio_data->inverted = !!inverted; - /* After inverting, we need to update the LED. */ - schedule_work(&gpio_data->work); - return n; } static DEVICE_ATTR(inverted, 0644, gpio_trig_inverted_show, @@ -149,26 +146,20 @@ static ssize_t gpio_trig_gpio_store(struct device *dev, return -EINVAL; } - if (gpio_data->gpio == gpio) - return n; - if (!gpio) { - if (gpio_data->gpio != 0) - free_irq(gpio_to_irq(gpio_data->gpio), led); - gpio_data->gpio = 0; + free_irq(gpio_to_irq(gpio_data->gpio), led); return n; } + if (gpio_data->gpio > 0 && gpio_data->gpio != gpio) + free_irq(gpio_to_irq(gpio_data->gpio), led); + + gpio_data->gpio = gpio; ret = request_irq(gpio_to_irq(gpio), gpio_trig_irq, IRQF_SHARED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "ledtrig-gpio", led); - if (ret) { + if (ret) dev_err(dev, "request_irq failed with error %d\n", ret); - } else { - if (gpio_data->gpio != 0) - free_irq(gpio_to_irq(gpio_data->gpio), led); - gpio_data->gpio = gpio; - } return ret ? ret : n; } @@ -220,8 +211,7 @@ static void gpio_trig_deactivate(struct led_classdev *led) device_remove_file(led->dev, &dev_attr_inverted); device_remove_file(led->dev, &dev_attr_desired_brightness); flush_work(&gpio_data->work); - if (gpio_data->gpio != 0) - free_irq(gpio_to_irq(gpio_data->gpio), led); + free_irq(gpio_to_irq(gpio_data->gpio),led); kfree(gpio_data); } } diff --git a/trunk/drivers/macintosh/via-maciisi.c b/trunk/drivers/macintosh/via-maciisi.c index 4d686c0bdea0..9ab5b0c34f0d 100644 --- a/trunk/drivers/macintosh/via-maciisi.c +++ b/trunk/drivers/macintosh/via-maciisi.c @@ -288,7 +288,7 @@ static void maciisi_sync(struct adb_request *req) } /* This could be BAD... when the ADB controller doesn't respond * for this long, it's probably not coming back :-( */ - if(count >= 50) /* Hopefully shouldn't happen */ + if (count > 50) /* Hopefully shouldn't happen */ printk(KERN_ERR "maciisi_send_request: poll timed out!\n"); } diff --git a/trunk/drivers/platform/x86/wmi.c b/trunk/drivers/platform/x86/wmi.c index f215a5919192..043b208d971d 100644 --- a/trunk/drivers/platform/x86/wmi.c +++ b/trunk/drivers/platform/x86/wmi.c @@ -270,7 +270,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out) acpi_status status; struct acpi_object_list input; union acpi_object params[3]; - char method[5] = "WM"; + char method[4] = "WM"; if (!find_guid(guid_string, &wblock)) return AE_ERROR; @@ -328,8 +328,8 @@ struct acpi_buffer *out) acpi_status status, wc_status = AE_ERROR; struct acpi_object_list input, wc_input; union acpi_object wc_params[1], wq_params[1]; - char method[5]; - char wc_method[5] = "WC"; + char method[4]; + char wc_method[4] = "WC"; if (!guid_string || !out) return AE_BAD_PARAMETER; @@ -410,7 +410,7 @@ const struct acpi_buffer *in) acpi_handle handle; struct acpi_object_list input; union acpi_object params[2]; - char method[5] = "WS"; + char method[4] = "WS"; if (!guid_string || !in) return AE_BAD_DATA; diff --git a/trunk/drivers/pps/pps.c b/trunk/drivers/pps/pps.c index fea17e7805e9..ac8cc8cea1e3 100644 --- a/trunk/drivers/pps/pps.c +++ b/trunk/drivers/pps/pps.c @@ -244,7 +244,7 @@ int pps_register_cdev(struct pps_device *pps) } pps->dev = device_create(pps_class, pps->info.dev, pps->devno, NULL, "pps%d", pps->id); - if (IS_ERR(pps->dev)) + if (err) goto del_cdev; dev_set_drvdata(pps->dev, pps); diff --git a/trunk/drivers/thermal/thermal_sys.c b/trunk/drivers/thermal/thermal_sys.c index 4e83c297ec9e..0a69672097a8 100644 --- a/trunk/drivers/thermal/thermal_sys.c +++ b/trunk/drivers/thermal/thermal_sys.c @@ -953,12 +953,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) mutex_lock(&tz->lock); - if (tz->ops->get_temp(tz, &temp)) { - /* get_temp failed - retry it later */ - printk(KERN_WARNING PREFIX "failed to read out thermal zone " - "%d\n", tz->id); - goto leave; - } + tz->ops->get_temp(tz, &temp); for (count = 0; count < tz->trips; count++) { tz->ops->get_trip_type(tz, count, &trip_type); @@ -1010,8 +1005,6 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) THERMAL_TRIPS_NONE); tz->last_temperature = temp; - - leave: if (tz->passive) thermal_zone_device_set_polling(tz, tz->passive_delay); else if (tz->polling_delay) diff --git a/trunk/include/acpi/processor.h b/trunk/include/acpi/processor.h index 740ac3ad8fd0..baf1e0a9a7ee 100644 --- a/trunk/include/acpi/processor.h +++ b/trunk/include/acpi/processor.h @@ -174,7 +174,7 @@ struct acpi_processor_throttling { cpumask_var_t shared_cpu_map; int (*acpi_processor_get_throttling) (struct acpi_processor * pr); int (*acpi_processor_set_throttling) (struct acpi_processor * pr, - int state, bool force); + int state); u32 address; u8 duty_offset; @@ -321,8 +321,7 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) /* in processor_throttling.c */ int acpi_processor_tstate_has_changed(struct acpi_processor *pr); int acpi_processor_get_throttling_info(struct acpi_processor *pr); -extern int acpi_processor_set_throttling(struct acpi_processor *pr, - int state, bool force); +extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state); extern const struct file_operations acpi_processor_throttling_fops; extern void acpi_processor_throttling_init(void); /* in processor_idle.c */ diff --git a/trunk/include/linux/flex_array.h b/trunk/include/linux/flex_array.h index 45ff18491514..23c1ec79a31b 100644 --- a/trunk/include/linux/flex_array.h +++ b/trunk/include/linux/flex_array.h @@ -21,7 +21,7 @@ struct flex_array { struct { int element_size; int total_nr_elements; - struct flex_array_part *parts[]; + struct flex_array_part *parts[0]; }; /* * This little trick makes sure that @@ -36,14 +36,12 @@ struct flex_array { .total_nr_elements = (total), \ } } } -struct flex_array *flex_array_alloc(int element_size, unsigned int total, - gfp_t flags); -int flex_array_prealloc(struct flex_array *fa, unsigned int start, - unsigned int end, gfp_t flags); +struct flex_array *flex_array_alloc(int element_size, int total, gfp_t flags); +int flex_array_prealloc(struct flex_array *fa, int start, int end, gfp_t flags); void flex_array_free(struct flex_array *fa); void flex_array_free_parts(struct flex_array *fa); -int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, +int flex_array_put(struct flex_array *fa, int element_nr, void *src, gfp_t flags); -void *flex_array_get(struct flex_array *fa, unsigned int element_nr); +void *flex_array_get(struct flex_array *fa, int element_nr); #endif /* _FLEX_ARRAY_H */ diff --git a/trunk/kernel/fork.c b/trunk/kernel/fork.c index e6c04d462ab2..144326b7af50 100644 --- a/trunk/kernel/fork.c +++ b/trunk/kernel/fork.c @@ -815,8 +815,11 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) { struct signal_struct *sig; - if (clone_flags & CLONE_THREAD) + if (clone_flags & CLONE_THREAD) { + atomic_inc(¤t->signal->count); + atomic_inc(¤t->signal->live); return 0; + } sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); tsk->signal = sig; @@ -874,6 +877,16 @@ void __cleanup_signal(struct signal_struct *sig) kmem_cache_free(signal_cachep, sig); } +static void cleanup_signal(struct task_struct *tsk) +{ + struct signal_struct *sig = tsk->signal; + + atomic_dec(&sig->live); + + if (atomic_dec_and_test(&sig->count)) + __cleanup_signal(sig); +} + static void copy_flags(unsigned long clone_flags, struct task_struct *p) { unsigned long new_flags = p->flags; @@ -1226,8 +1239,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, } if (clone_flags & CLONE_THREAD) { - atomic_inc(¤t->signal->count); - atomic_inc(¤t->signal->live); p->group_leader = current->group_leader; list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group); } @@ -1271,8 +1282,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, if (p->mm) mmput(p->mm); bad_fork_cleanup_signal: - if (!(clone_flags & CLONE_THREAD)) - __cleanup_signal(p->signal); + cleanup_signal(p); bad_fork_cleanup_sighand: __cleanup_sighand(p->sighand); bad_fork_cleanup_fs: diff --git a/trunk/lib/flex_array.c b/trunk/lib/flex_array.c index 7baed2fc3bc8..08f1636d296a 100644 --- a/trunk/lib/flex_array.c +++ b/trunk/lib/flex_array.c @@ -99,8 +99,7 @@ static inline int elements_fit_in_base(struct flex_array *fa) * capacity in the base structure. Also note that no effort is made * to efficiently pack objects across page boundaries. */ -struct flex_array *flex_array_alloc(int element_size, unsigned int total, - gfp_t flags) +struct flex_array *flex_array_alloc(int element_size, int total, gfp_t flags) { struct flex_array *ret; int max_size = nr_base_part_ptrs() * __elements_per_part(element_size); @@ -116,14 +115,16 @@ struct flex_array *flex_array_alloc(int element_size, unsigned int total, return ret; } -static int fa_element_to_part_nr(struct flex_array *fa, - unsigned int element_nr) +static int fa_element_to_part_nr(struct flex_array *fa, int element_nr) { return element_nr / __elements_per_part(fa->element_size); } /** * flex_array_free_parts - just free the second-level pages + * @src: address of data to copy into the array + * @element_nr: index of the position in which to insert + * the new element. * * This is to be used in cases where the base 'struct flex_array' * has been statically allocated and should not be free. @@ -145,12 +146,14 @@ void flex_array_free(struct flex_array *fa) kfree(fa); } -static unsigned int index_inside_part(struct flex_array *fa, - unsigned int element_nr) +static int fa_index_inside_part(struct flex_array *fa, int element_nr) { - unsigned int part_offset; + return element_nr % __elements_per_part(fa->element_size); +} - part_offset = element_nr % __elements_per_part(fa->element_size); +static int index_inside_part(struct flex_array *fa, int element_nr) +{ + int part_offset = fa_index_inside_part(fa, element_nr); return part_offset * fa->element_size; } @@ -185,8 +188,7 @@ __fa_get_part(struct flex_array *fa, int part_nr, gfp_t flags) * * Locking must be provided by the caller. */ -int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, - gfp_t flags) +int flex_array_put(struct flex_array *fa, int element_nr, void *src, gfp_t flags) { int part_nr = fa_element_to_part_nr(fa, element_nr); struct flex_array_part *part; @@ -196,11 +198,10 @@ int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, return -ENOSPC; if (elements_fit_in_base(fa)) part = (struct flex_array_part *)&fa->parts[0]; - else { + else part = __fa_get_part(fa, part_nr, flags); - if (!part) - return -ENOMEM; - } + if (!part) + return -ENOMEM; dst = &part->elements[index_inside_part(fa, element_nr)]; memcpy(dst, src, fa->element_size); return 0; @@ -218,8 +219,7 @@ int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, * * Locking must be provided by the caller. */ -int flex_array_prealloc(struct flex_array *fa, unsigned int start, - unsigned int end, gfp_t flags) +int flex_array_prealloc(struct flex_array *fa, int start, int end, gfp_t flags) { int start_part; int end_part; @@ -250,19 +250,18 @@ int flex_array_prealloc(struct flex_array *fa, unsigned int start, * * Locking must be provided by the caller. */ -void *flex_array_get(struct flex_array *fa, unsigned int element_nr) +void *flex_array_get(struct flex_array *fa, int element_nr) { int part_nr = fa_element_to_part_nr(fa, element_nr); struct flex_array_part *part; if (element_nr >= fa->total_nr_elements) return NULL; + if (!fa->parts[part_nr]) + return NULL; if (elements_fit_in_base(fa)) part = (struct flex_array_part *)&fa->parts[0]; - else { + else part = fa->parts[part_nr]; - if (!part) - return NULL; - } return &part->elements[index_inside_part(fa, element_nr)]; } diff --git a/trunk/mm/rmap.c b/trunk/mm/rmap.c index 0895b5c7cbff..836c6c63e1f2 100644 --- a/trunk/mm/rmap.c +++ b/trunk/mm/rmap.c @@ -358,7 +358,6 @@ static int page_referenced_one(struct page *page, */ if (vma->vm_flags & VM_LOCKED) { *mapcount = 1; /* break early from loop */ - *vm_flags |= VM_LOCKED; goto out_unmap; } diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index 94e86dd6954c..dea7abd31098 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -630,14 +630,9 @@ static unsigned long shrink_page_list(struct list_head *page_list, referenced = page_referenced(page, 1, sc->mem_cgroup, &vm_flags); - /* - * In active use or really unfreeable? Activate it. - * If page which have PG_mlocked lost isoltation race, - * try_to_unmap moves it to unevictable list - */ + /* In active use or really unfreeable? Activate it. */ if (sc->order <= PAGE_ALLOC_COSTLY_ORDER && - referenced && page_mapping_inuse(page) - && !(vm_flags & VM_LOCKED)) + referenced && page_mapping_inuse(page)) goto activate_locked; /*