diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/audit.c | 16 | ||||
| -rw-r--r-- | kernel/cpu.c | 32 | ||||
| -rw-r--r-- | kernel/exit.c | 2 | ||||
| -rw-r--r-- | kernel/hrtimer.c | 22 | ||||
| -rw-r--r-- | kernel/irq/devres.c | 2 | ||||
| -rw-r--r-- | kernel/kallsyms.c | 23 | ||||
| -rw-r--r-- | kernel/module.c | 22 | ||||
| -rw-r--r-- | kernel/params.c | 4 | ||||
| -rw-r--r-- | kernel/power/disk.c | 88 | ||||
| -rw-r--r-- | kernel/power/main.c | 41 | ||||
| -rw-r--r-- | kernel/power/swsusp.c | 2 | ||||
| -rw-r--r-- | kernel/power/user.c | 3 | ||||
| -rw-r--r-- | kernel/resource.c | 21 | ||||
| -rw-r--r-- | kernel/sched.c | 38 | ||||
| -rw-r--r-- | kernel/sysctl.c | 2 | ||||
| -rw-r--r-- | kernel/taskstats.c | 4 | ||||
| -rw-r--r-- | kernel/time.c | 4 | ||||
| -rw-r--r-- | kernel/time/clockevents.c | 69 | ||||
| -rw-r--r-- | kernel/time/jiffies.c | 2 | ||||
| -rw-r--r-- | kernel/time/ntp.c | 30 | ||||
| -rw-r--r-- | kernel/timer.c | 4 | 
21 files changed, 199 insertions, 232 deletions
| diff --git a/kernel/audit.c b/kernel/audit.c index 76c9a11b72d6..4e9d20829681 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
| @@ -151,7 +151,7 @@ struct audit_buffer { | |||
| 151 | 151 | ||
| 152 | static void audit_set_pid(struct audit_buffer *ab, pid_t pid) | 152 | static void audit_set_pid(struct audit_buffer *ab, pid_t pid) | 
| 153 | { | 153 | { | 
| 154 | struct nlmsghdr *nlh = (struct nlmsghdr *)ab->skb->data; | 154 | struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); | 
| 155 | nlh->nlmsg_pid = pid; | 155 | nlh->nlmsg_pid = pid; | 
| 156 | } | 156 | } | 
| 157 | 157 | ||
| @@ -750,7 +750,7 @@ static void audit_receive_skb(struct sk_buff *skb) | |||
| 750 | u32 rlen; | 750 | u32 rlen; | 
| 751 | 751 | ||
| 752 | while (skb->len >= NLMSG_SPACE(0)) { | 752 | while (skb->len >= NLMSG_SPACE(0)) { | 
| 753 | nlh = (struct nlmsghdr *)skb->data; | 753 | nlh = nlmsg_hdr(skb); | 
| 754 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) | 754 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) | 
| 755 | return; | 755 | return; | 
| 756 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); | 756 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); | 
| @@ -795,7 +795,7 @@ static int __init audit_init(void) | |||
| 795 | printk(KERN_INFO "audit: initializing netlink socket (%s)\n", | 795 | printk(KERN_INFO "audit: initializing netlink socket (%s)\n", | 
| 796 | audit_default ? "enabled" : "disabled"); | 796 | audit_default ? "enabled" : "disabled"); | 
| 797 | audit_sock = netlink_kernel_create(NETLINK_AUDIT, 0, audit_receive, | 797 | audit_sock = netlink_kernel_create(NETLINK_AUDIT, 0, audit_receive, | 
| 798 | THIS_MODULE); | 798 | NULL, THIS_MODULE); | 
| 799 | if (!audit_sock) | 799 | if (!audit_sock) | 
| 800 | audit_panic("cannot initialize netlink socket"); | 800 | audit_panic("cannot initialize netlink socket"); | 
| 801 | else | 801 | else | 
| @@ -1073,7 +1073,7 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt, | |||
| 1073 | goto out; | 1073 | goto out; | 
| 1074 | } | 1074 | } | 
| 1075 | va_copy(args2, args); | 1075 | va_copy(args2, args); | 
| 1076 | len = vsnprintf(skb->tail, avail, fmt, args); | 1076 | len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args); | 
| 1077 | if (len >= avail) { | 1077 | if (len >= avail) { | 
| 1078 | /* The printk buffer is 1024 bytes long, so if we get | 1078 | /* The printk buffer is 1024 bytes long, so if we get | 
| 1079 | * here and AUDIT_BUFSIZ is at least 1024, then we can | 1079 | * here and AUDIT_BUFSIZ is at least 1024, then we can | 
| @@ -1082,7 +1082,7 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt, | |||
| 1082 | max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail)); | 1082 | max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail)); | 
| 1083 | if (!avail) | 1083 | if (!avail) | 
| 1084 | goto out; | 1084 | goto out; | 
| 1085 | len = vsnprintf(skb->tail, avail, fmt, args2); | 1085 | len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args2); | 
| 1086 | } | 1086 | } | 
| 1087 | if (len > 0) | 1087 | if (len > 0) | 
| 1088 | skb_put(skb, len); | 1088 | skb_put(skb, len); | 
| @@ -1143,7 +1143,7 @@ void audit_log_hex(struct audit_buffer *ab, const unsigned char *buf, | |||
| 1143 | return; | 1143 | return; | 
| 1144 | } | 1144 | } | 
| 1145 | 1145 | ||
| 1146 | ptr = skb->tail; | 1146 | ptr = skb_tail_pointer(skb); | 
| 1147 | for (i=0; i<len; i++) { | 1147 | for (i=0; i<len; i++) { | 
| 1148 | *ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */ | 1148 | *ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */ | 
| 1149 | *ptr++ = hex[buf[i] & 0x0F]; /* Lower nibble */ | 1149 | *ptr++ = hex[buf[i] & 0x0F]; /* Lower nibble */ | 
| @@ -1175,7 +1175,7 @@ static void audit_log_n_string(struct audit_buffer *ab, size_t slen, | |||
| 1175 | if (!avail) | 1175 | if (!avail) | 
| 1176 | return; | 1176 | return; | 
| 1177 | } | 1177 | } | 
| 1178 | ptr = skb->tail; | 1178 | ptr = skb_tail_pointer(skb); | 
| 1179 | *ptr++ = '"'; | 1179 | *ptr++ = '"'; | 
| 1180 | memcpy(ptr, string, slen); | 1180 | memcpy(ptr, string, slen); | 
| 1181 | ptr += slen; | 1181 | ptr += slen; | 
| @@ -1268,7 +1268,7 @@ void audit_log_end(struct audit_buffer *ab) | |||
| 1268 | audit_log_lost("rate limit exceeded"); | 1268 | audit_log_lost("rate limit exceeded"); | 
| 1269 | } else { | 1269 | } else { | 
| 1270 | if (audit_pid) { | 1270 | if (audit_pid) { | 
| 1271 | struct nlmsghdr *nlh = (struct nlmsghdr *)ab->skb->data; | 1271 | struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); | 
| 1272 | nlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0); | 1272 | nlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0); | 
| 1273 | skb_queue_tail(&audit_skb_queue, ab->skb); | 1273 | skb_queue_tail(&audit_skb_queue, ab->skb); | 
| 1274 | ab->skb = NULL; | 1274 | ab->skb = NULL; | 
| diff --git a/kernel/cpu.c b/kernel/cpu.c index 3d4206ada5c9..36e70845cfc3 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
| @@ -254,6 +254,12 @@ int __cpuinit cpu_up(unsigned int cpu) | |||
| 254 | } | 254 | } | 
| 255 | 255 | ||
| 256 | #ifdef CONFIG_SUSPEND_SMP | 256 | #ifdef CONFIG_SUSPEND_SMP | 
| 257 | /* Needed to prevent the microcode driver from requesting firmware in its CPU | ||
| 258 | * hotplug notifier during the suspend/resume. | ||
| 259 | */ | ||
| 260 | int suspend_cpu_hotplug; | ||
| 261 | EXPORT_SYMBOL(suspend_cpu_hotplug); | ||
| 262 | |||
| 257 | static cpumask_t frozen_cpus; | 263 | static cpumask_t frozen_cpus; | 
| 258 | 264 | ||
| 259 | int disable_nonboot_cpus(void) | 265 | int disable_nonboot_cpus(void) | 
| @@ -261,16 +267,8 @@ int disable_nonboot_cpus(void) | |||
| 261 | int cpu, first_cpu, error = 0; | 267 | int cpu, first_cpu, error = 0; | 
| 262 | 268 | ||
| 263 | mutex_lock(&cpu_add_remove_lock); | 269 | mutex_lock(&cpu_add_remove_lock); | 
| 264 | first_cpu = first_cpu(cpu_present_map); | 270 | suspend_cpu_hotplug = 1; | 
| 265 | if (!cpu_online(first_cpu)) { | 271 | first_cpu = first_cpu(cpu_online_map); | 
| 266 | error = _cpu_up(first_cpu); | ||
| 267 | if (error) { | ||
| 268 | printk(KERN_ERR "Could not bring CPU%d up.\n", | ||
| 269 | first_cpu); | ||
| 270 | goto out; | ||
| 271 | } | ||
| 272 | } | ||
| 273 | |||
| 274 | /* We take down all of the non-boot CPUs in one shot to avoid races | 272 | /* We take down all of the non-boot CPUs in one shot to avoid races | 
| 275 | * with the userspace trying to use the CPU hotplug at the same time | 273 | * with the userspace trying to use the CPU hotplug at the same time | 
| 276 | */ | 274 | */ | 
| @@ -296,7 +294,7 @@ int disable_nonboot_cpus(void) | |||
| 296 | } else { | 294 | } else { | 
| 297 | printk(KERN_ERR "Non-boot CPUs are not disabled\n"); | 295 | printk(KERN_ERR "Non-boot CPUs are not disabled\n"); | 
| 298 | } | 296 | } | 
| 299 | out: | 297 | suspend_cpu_hotplug = 0; | 
| 300 | mutex_unlock(&cpu_add_remove_lock); | 298 | mutex_unlock(&cpu_add_remove_lock); | 
| 301 | return error; | 299 | return error; | 
| 302 | } | 300 | } | 
| @@ -308,20 +306,22 @@ void enable_nonboot_cpus(void) | |||
| 308 | /* Allow everyone to use the CPU hotplug again */ | 306 | /* Allow everyone to use the CPU hotplug again */ | 
| 309 | mutex_lock(&cpu_add_remove_lock); | 307 | mutex_lock(&cpu_add_remove_lock); | 
| 310 | cpu_hotplug_disabled = 0; | 308 | cpu_hotplug_disabled = 0; | 
| 311 | mutex_unlock(&cpu_add_remove_lock); | ||
| 312 | if (cpus_empty(frozen_cpus)) | 309 | if (cpus_empty(frozen_cpus)) | 
| 313 | return; | 310 | goto out; | 
| 314 | 311 | ||
| 312 | suspend_cpu_hotplug = 1; | ||
| 315 | printk("Enabling non-boot CPUs ...\n"); | 313 | printk("Enabling non-boot CPUs ...\n"); | 
| 316 | for_each_cpu_mask(cpu, frozen_cpus) { | 314 | for_each_cpu_mask(cpu, frozen_cpus) { | 
| 317 | error = cpu_up(cpu); | 315 | error = _cpu_up(cpu); | 
| 318 | if (!error) { | 316 | if (!error) { | 
| 319 | printk("CPU%d is up\n", cpu); | 317 | printk("CPU%d is up\n", cpu); | 
| 320 | continue; | 318 | continue; | 
| 321 | } | 319 | } | 
| 322 | printk(KERN_WARNING "Error taking CPU%d up: %d\n", | 320 | printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error); | 
| 323 | cpu, error); | ||
| 324 | } | 321 | } | 
| 325 | cpus_clear(frozen_cpus); | 322 | cpus_clear(frozen_cpus); | 
| 323 | suspend_cpu_hotplug = 0; | ||
| 324 | out: | ||
| 325 | mutex_unlock(&cpu_add_remove_lock); | ||
| 326 | } | 326 | } | 
| 327 | #endif | 327 | #endif | 
| diff --git a/kernel/exit.c b/kernel/exit.c index f132349c0325..b55ed4cc9104 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
| @@ -790,7 +790,7 @@ static void exit_notify(struct task_struct *tsk) | |||
| 790 | 790 | ||
| 791 | pgrp = task_pgrp(tsk); | 791 | pgrp = task_pgrp(tsk); | 
| 792 | if ((task_pgrp(t) != pgrp) && | 792 | if ((task_pgrp(t) != pgrp) && | 
| 793 | (task_session(t) != task_session(tsk)) && | 793 | (task_session(t) == task_session(tsk)) && | 
| 794 | will_become_orphaned_pgrp(pgrp, tsk) && | 794 | will_become_orphaned_pgrp(pgrp, tsk) && | 
| 795 | has_stopped_jobs(pgrp)) { | 795 | has_stopped_jobs(pgrp)) { | 
| 796 | __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); | 796 | __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); | 
| diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 6a7938a0d513..1b3033105b40 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
| @@ -59,6 +59,7 @@ ktime_t ktime_get(void) | |||
| 59 | 59 | ||
| 60 | return timespec_to_ktime(now); | 60 | return timespec_to_ktime(now); | 
| 61 | } | 61 | } | 
| 62 | EXPORT_SYMBOL_GPL(ktime_get); | ||
| 62 | 63 | ||
| 63 | /** | 64 | /** | 
| 64 | * ktime_get_real - get the real (wall-) time in ktime_t format | 65 | * ktime_get_real - get the real (wall-) time in ktime_t format | 
| @@ -278,6 +279,8 @@ ktime_t ktime_add_ns(const ktime_t kt, u64 nsec) | |||
| 278 | 279 | ||
| 279 | return ktime_add(kt, tmp); | 280 | return ktime_add(kt, tmp); | 
| 280 | } | 281 | } | 
| 282 | |||
| 283 | EXPORT_SYMBOL_GPL(ktime_add_ns); | ||
| 281 | # endif /* !CONFIG_KTIME_SCALAR */ | 284 | # endif /* !CONFIG_KTIME_SCALAR */ | 
| 282 | 285 | ||
| 283 | /* | 286 | /* | 
| @@ -459,6 +462,18 @@ void clock_was_set(void) | |||
| 459 | } | 462 | } | 
| 460 | 463 | ||
| 461 | /* | 464 | /* | 
| 465 | * During resume we might have to reprogram the high resolution timer | ||
| 466 | * interrupt (on the local CPU): | ||
| 467 | */ | ||
| 468 | void hres_timers_resume(void) | ||
| 469 | { | ||
| 470 | WARN_ON_ONCE(num_online_cpus() > 1); | ||
| 471 | |||
| 472 | /* Retrigger the CPU local events: */ | ||
| 473 | retrigger_next_event(NULL); | ||
| 474 | } | ||
| 475 | |||
| 476 | /* | ||
| 462 | * Check, whether the timer is on the callback pending list | 477 | * Check, whether the timer is on the callback pending list | 
| 463 | */ | 478 | */ | 
| 464 | static inline int hrtimer_cb_pending(const struct hrtimer *timer) | 479 | static inline int hrtimer_cb_pending(const struct hrtimer *timer) | 
| @@ -814,7 +829,12 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode) | |||
| 814 | 829 | ||
| 815 | timer_stats_hrtimer_set_start_info(timer); | 830 | timer_stats_hrtimer_set_start_info(timer); | 
| 816 | 831 | ||
| 817 | enqueue_hrtimer(timer, new_base, base == new_base); | 832 | /* | 
| 833 | * Only allow reprogramming if the new base is on this CPU. | ||
| 834 | * (it might still be on another CPU if the timer was pending) | ||
| 835 | */ | ||
| 836 | enqueue_hrtimer(timer, new_base, | ||
| 837 | new_base->cpu_base == &__get_cpu_var(hrtimer_bases)); | ||
| 818 | 838 | ||
| 819 | unlock_hrtimer_base(timer, &flags); | 839 | unlock_hrtimer_base(timer, &flags); | 
| 820 | 840 | ||
| diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c index 85a430da0fb6..d8ee241115f5 100644 --- a/kernel/irq/devres.c +++ b/kernel/irq/devres.c | |||
| @@ -54,7 +54,7 @@ int devm_request_irq(struct device *dev, unsigned int irq, | |||
| 54 | 54 | ||
| 55 | rc = request_irq(irq, handler, irqflags, devname, dev_id); | 55 | rc = request_irq(irq, handler, irqflags, devname, dev_id); | 
| 56 | if (rc) { | 56 | if (rc) { | 
| 57 | kfree(dr); | 57 | devres_free(dr); | 
| 58 | return rc; | 58 | return rc; | 
| 59 | } | 59 | } | 
| 60 | 60 | ||
| diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 6f294ff4f9ee..5a0de8409739 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c | |||
| @@ -267,27 +267,33 @@ const char *kallsyms_lookup(unsigned long addr, | |||
| 267 | return NULL; | 267 | return NULL; | 
| 268 | } | 268 | } | 
| 269 | 269 | ||
| 270 | /* Replace "%s" in format with address, or returns -errno. */ | 270 | /* Look up a kernel symbol and return it in a text buffer. */ | 
| 271 | void __print_symbol(const char *fmt, unsigned long address) | 271 | int sprint_symbol(char *buffer, unsigned long address) | 
| 272 | { | 272 | { | 
| 273 | char *modname; | 273 | char *modname; | 
| 274 | const char *name; | 274 | const char *name; | 
| 275 | unsigned long offset, size; | 275 | unsigned long offset, size; | 
| 276 | char namebuf[KSYM_NAME_LEN+1]; | 276 | char namebuf[KSYM_NAME_LEN+1]; | 
| 277 | char buffer[sizeof("%s+%#lx/%#lx [%s]") + KSYM_NAME_LEN + | ||
| 278 | 2*(BITS_PER_LONG*3/10) + MODULE_NAME_LEN + 1]; | ||
| 279 | 277 | ||
| 280 | name = kallsyms_lookup(address, &size, &offset, &modname, namebuf); | 278 | name = kallsyms_lookup(address, &size, &offset, &modname, namebuf); | 
| 281 | |||
| 282 | if (!name) | 279 | if (!name) | 
| 283 | sprintf(buffer, "0x%lx", address); | 280 | return sprintf(buffer, "0x%lx", address); | 
| 284 | else { | 281 | else { | 
| 285 | if (modname) | 282 | if (modname) | 
| 286 | sprintf(buffer, "%s+%#lx/%#lx [%s]", name, offset, | 283 | return sprintf(buffer, "%s+%#lx/%#lx [%s]", name, offset, | 
| 287 | size, modname); | 284 | size, modname); | 
| 288 | else | 285 | else | 
| 289 | sprintf(buffer, "%s+%#lx/%#lx", name, offset, size); | 286 | return sprintf(buffer, "%s+%#lx/%#lx", name, offset, size); | 
| 290 | } | 287 | } | 
| 288 | } | ||
| 289 | |||
| 290 | /* Look up a kernel symbol and print it to the kernel messages. */ | ||
| 291 | void __print_symbol(const char *fmt, unsigned long address) | ||
| 292 | { | ||
| 293 | char buffer[KSYM_SYMBOL_LEN]; | ||
| 294 | |||
| 295 | sprint_symbol(buffer, address); | ||
| 296 | |||
| 291 | printk(fmt, buffer); | 297 | printk(fmt, buffer); | 
| 292 | } | 298 | } | 
| 293 | 299 | ||
| @@ -452,3 +458,4 @@ static int __init kallsyms_init(void) | |||
| 452 | __initcall(kallsyms_init); | 458 | __initcall(kallsyms_init); | 
| 453 | 459 | ||
| 454 | EXPORT_SYMBOL(__print_symbol); | 460 | EXPORT_SYMBOL(__print_symbol); | 
| 461 | EXPORT_SYMBOL_GPL(sprint_symbol); | ||
| diff --git a/kernel/module.c b/kernel/module.c index fbc51de6444e..9da5af668a20 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -1148,8 +1148,10 @@ int mod_sysfs_setup(struct module *mod, | |||
| 1148 | goto out; | 1148 | goto out; | 
| 1149 | 1149 | ||
| 1150 | mod->holders_dir = kobject_add_dir(&mod->mkobj.kobj, "holders"); | 1150 | mod->holders_dir = kobject_add_dir(&mod->mkobj.kobj, "holders"); | 
| 1151 | if (!mod->holders_dir) | 1151 | if (!mod->holders_dir) { | 
| 1152 | err = -ENOMEM; | ||
| 1152 | goto out_unreg; | 1153 | goto out_unreg; | 
| 1154 | } | ||
| 1153 | 1155 | ||
| 1154 | err = module_param_sysfs_setup(mod, kparam, num_params); | 1156 | err = module_param_sysfs_setup(mod, kparam, num_params); | 
| 1155 | if (err) | 1157 | if (err) | 
| @@ -2384,8 +2386,13 @@ void module_add_driver(struct module *mod, struct device_driver *drv) | |||
| 2384 | 2386 | ||
| 2385 | /* Lookup built-in module entry in /sys/modules */ | 2387 | /* Lookup built-in module entry in /sys/modules */ | 
| 2386 | mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name); | 2388 | mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name); | 
| 2387 | if (mkobj) | 2389 | if (mkobj) { | 
| 2388 | mk = container_of(mkobj, struct module_kobject, kobj); | 2390 | mk = container_of(mkobj, struct module_kobject, kobj); | 
| 2391 | /* remember our module structure */ | ||
| 2392 | drv->mkobj = mk; | ||
| 2393 | /* kset_find_obj took a reference */ | ||
| 2394 | kobject_put(mkobj); | ||
| 2395 | } | ||
| 2389 | } | 2396 | } | 
| 2390 | 2397 | ||
| 2391 | if (!mk) | 2398 | if (!mk) | 
| @@ -2405,17 +2412,22 @@ EXPORT_SYMBOL(module_add_driver); | |||
| 2405 | 2412 | ||
| 2406 | void module_remove_driver(struct device_driver *drv) | 2413 | void module_remove_driver(struct device_driver *drv) | 
| 2407 | { | 2414 | { | 
| 2415 | struct module_kobject *mk = NULL; | ||
| 2408 | char *driver_name; | 2416 | char *driver_name; | 
| 2409 | 2417 | ||
| 2410 | if (!drv) | 2418 | if (!drv) | 
| 2411 | return; | 2419 | return; | 
| 2412 | 2420 | ||
| 2413 | sysfs_remove_link(&drv->kobj, "module"); | 2421 | sysfs_remove_link(&drv->kobj, "module"); | 
| 2414 | if (drv->owner && drv->owner->mkobj.drivers_dir) { | 2422 | |
| 2423 | if (drv->owner) | ||
| 2424 | mk = &drv->owner->mkobj; | ||
| 2425 | else if (drv->mkobj) | ||
| 2426 | mk = drv->mkobj; | ||
| 2427 | if (mk && mk->drivers_dir) { | ||
| 2415 | driver_name = make_driver_name(drv); | 2428 | driver_name = make_driver_name(drv); | 
| 2416 | if (driver_name) { | 2429 | if (driver_name) { | 
| 2417 | sysfs_remove_link(drv->owner->mkobj.drivers_dir, | 2430 | sysfs_remove_link(mk->drivers_dir, driver_name); | 
| 2418 | driver_name); | ||
| 2419 | kfree(driver_name); | 2431 | kfree(driver_name); | 
| 2420 | } | 2432 | } | 
| 2421 | } | 2433 | } | 
| diff --git a/kernel/params.c b/kernel/params.c index e265b13195b1..1fc4ac746cd8 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
| @@ -356,6 +356,10 @@ int param_set_copystring(const char *val, struct kernel_param *kp) | |||
| 356 | { | 356 | { | 
| 357 | struct kparam_string *kps = kp->arg; | 357 | struct kparam_string *kps = kp->arg; | 
| 358 | 358 | ||
| 359 | if (!val) { | ||
| 360 | printk(KERN_ERR "%s: missing param set value\n", kp->name); | ||
| 361 | return -EINVAL; | ||
| 362 | } | ||
| 359 | if (strlen(val)+1 > kps->maxlen) { | 363 | if (strlen(val)+1 > kps->maxlen) { | 
| 360 | printk(KERN_ERR "%s: string doesn't fit in %u chars.\n", | 364 | printk(KERN_ERR "%s: string doesn't fit in %u chars.\n", | 
| 361 | kp->name, kps->maxlen-1); | 365 | kp->name, kps->maxlen-1); | 
| diff --git a/kernel/power/disk.c b/kernel/power/disk.c index dee0ff40befd..02e4fb69111a 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
| @@ -39,7 +39,13 @@ static inline int platform_prepare(void) | |||
| 39 | { | 39 | { | 
| 40 | int error = 0; | 40 | int error = 0; | 
| 41 | 41 | ||
| 42 | if (pm_disk_mode == PM_DISK_PLATFORM) { | 42 | switch (pm_disk_mode) { | 
| 43 | case PM_DISK_TEST: | ||
| 44 | case PM_DISK_TESTPROC: | ||
| 45 | case PM_DISK_SHUTDOWN: | ||
| 46 | case PM_DISK_REBOOT: | ||
| 47 | break; | ||
| 48 | default: | ||
| 43 | if (pm_ops && pm_ops->prepare) | 49 | if (pm_ops && pm_ops->prepare) | 
| 44 | error = pm_ops->prepare(PM_SUSPEND_DISK); | 50 | error = pm_ops->prepare(PM_SUSPEND_DISK); | 
| 45 | } | 51 | } | 
| @@ -48,41 +54,48 @@ static inline int platform_prepare(void) | |||
| 48 | 54 | ||
| 49 | /** | 55 | /** | 
| 50 | * power_down - Shut machine down for hibernate. | 56 | * power_down - Shut machine down for hibernate. | 
| 51 | * @mode: Suspend-to-disk mode | ||
| 52 | * | 57 | * | 
| 53 | * Use the platform driver, if configured so, and return gracefully if it | 58 | * Use the platform driver, if configured so; otherwise try | 
| 54 | * fails. | 59 | * to power off or reboot. | 
| 55 | * Otherwise, try to power off and reboot. If they fail, halt the machine, | ||
| 56 | * there ain't no turning back. | ||
| 57 | */ | 60 | */ | 
| 58 | 61 | ||
| 59 | static void power_down(suspend_disk_method_t mode) | 62 | static void power_down(void) | 
| 60 | { | 63 | { | 
| 61 | disable_nonboot_cpus(); | 64 | switch (pm_disk_mode) { | 
| 62 | switch(mode) { | 65 | case PM_DISK_TEST: | 
| 63 | case PM_DISK_PLATFORM: | 66 | case PM_DISK_TESTPROC: | 
| 64 | if (pm_ops && pm_ops->enter) { | 67 | break; | 
| 65 | kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); | ||
| 66 | pm_ops->enter(PM_SUSPEND_DISK); | ||
| 67 | break; | ||
| 68 | } | ||
| 69 | case PM_DISK_SHUTDOWN: | 68 | case PM_DISK_SHUTDOWN: | 
| 70 | kernel_power_off(); | 69 | kernel_power_off(); | 
| 71 | break; | 70 | break; | 
| 72 | case PM_DISK_REBOOT: | 71 | case PM_DISK_REBOOT: | 
| 73 | kernel_restart(NULL); | 72 | kernel_restart(NULL); | 
| 74 | break; | 73 | break; | 
| 74 | default: | ||
| 75 | if (pm_ops && pm_ops->enter) { | ||
| 76 | kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); | ||
| 77 | pm_ops->enter(PM_SUSPEND_DISK); | ||
| 78 | break; | ||
| 79 | } | ||
| 75 | } | 80 | } | 
| 76 | kernel_halt(); | 81 | kernel_halt(); | 
| 77 | /* Valid image is on the disk, if we continue we risk serious data corruption | 82 | /* | 
| 78 | after resume. */ | 83 | * Valid image is on the disk, if we continue we risk serious data | 
| 84 | * corruption after resume. | ||
| 85 | */ | ||
| 79 | printk(KERN_CRIT "Please power me down manually\n"); | 86 | printk(KERN_CRIT "Please power me down manually\n"); | 
| 80 | while(1); | 87 | while(1); | 
| 81 | } | 88 | } | 
| 82 | 89 | ||
| 83 | static inline void platform_finish(void) | 90 | static inline void platform_finish(void) | 
| 84 | { | 91 | { | 
| 85 | if (pm_disk_mode == PM_DISK_PLATFORM) { | 92 | switch (pm_disk_mode) { | 
| 93 | case PM_DISK_TEST: | ||
| 94 | case PM_DISK_TESTPROC: | ||
| 95 | case PM_DISK_SHUTDOWN: | ||
| 96 | case PM_DISK_REBOOT: | ||
| 97 | break; | ||
| 98 | default: | ||
| 86 | if (pm_ops && pm_ops->finish) | 99 | if (pm_ops && pm_ops->finish) | 
| 87 | pm_ops->finish(PM_SUSPEND_DISK); | 100 | pm_ops->finish(PM_SUSPEND_DISK); | 
| 88 | } | 101 | } | 
| @@ -109,8 +122,6 @@ static int prepare_processes(void) | |||
| 109 | /** | 122 | /** | 
| 110 | * pm_suspend_disk - The granpappy of hibernation power management. | 123 | * pm_suspend_disk - The granpappy of hibernation power management. | 
| 111 | * | 124 | * | 
| 112 | * If we're going through the firmware, then get it over with quickly. | ||
| 113 | * | ||
| 114 | * If not, then call swsusp to do its thing, then figure out how | 125 | * If not, then call swsusp to do its thing, then figure out how | 
| 115 | * to power down the system. | 126 | * to power down the system. | 
| 116 | */ | 127 | */ | 
| @@ -167,7 +178,7 @@ int pm_suspend_disk(void) | |||
| 167 | pr_debug("PM: writing image.\n"); | 178 | pr_debug("PM: writing image.\n"); | 
| 168 | error = swsusp_write(); | 179 | error = swsusp_write(); | 
| 169 | if (!error) | 180 | if (!error) | 
| 170 | power_down(pm_disk_mode); | 181 | power_down(); | 
| 171 | else { | 182 | else { | 
| 172 | swsusp_free(); | 183 | swsusp_free(); | 
| 173 | goto Thaw; | 184 | goto Thaw; | 
| @@ -279,7 +290,6 @@ late_initcall(software_resume); | |||
| 279 | 290 | ||
| 280 | 291 | ||
| 281 | static const char * const pm_disk_modes[] = { | 292 | static const char * const pm_disk_modes[] = { | 
| 282 | [PM_DISK_FIRMWARE] = "firmware", | ||
| 283 | [PM_DISK_PLATFORM] = "platform", | 293 | [PM_DISK_PLATFORM] = "platform", | 
| 284 | [PM_DISK_SHUTDOWN] = "shutdown", | 294 | [PM_DISK_SHUTDOWN] = "shutdown", | 
| 285 | [PM_DISK_REBOOT] = "reboot", | 295 | [PM_DISK_REBOOT] = "reboot", | 
| @@ -290,27 +300,25 @@ static const char * const pm_disk_modes[] = { | |||
| 290 | /** | 300 | /** | 
| 291 | * disk - Control suspend-to-disk mode | 301 | * disk - Control suspend-to-disk mode | 
| 292 | * | 302 | * | 
| 293 | * Suspend-to-disk can be handled in several ways. The greatest | 303 | * Suspend-to-disk can be handled in several ways. We have a few options | 
| 294 | * distinction is who writes memory to disk - the firmware or the OS. | 304 | * for putting the system to sleep - using the platform driver (e.g. ACPI | 
| 295 | * If the firmware does it, we assume that it also handles suspending | 305 | * or other pm_ops), powering off the system or rebooting the system | 
| 296 | * the system. | 306 | * (for testing) as well as the two test modes. | 
| 297 | * If the OS does it, then we have three options for putting the system | ||
| 298 | * to sleep - using the platform driver (e.g. ACPI or other PM registers), | ||
| 299 | * powering off the system or rebooting the system (for testing). | ||
| 300 | * | 307 | * | 
| 301 | * The system will support either 'firmware' or 'platform', and that is | 308 | * The system can support 'platform', and that is known a priori (and | 
| 302 | * known a priori (and encoded in pm_ops). But, the user may choose | 309 | * encoded in pm_ops). However, the user may choose 'shutdown' or 'reboot' | 
| 303 | * 'shutdown' or 'reboot' as alternatives. | 310 | * as alternatives, as well as the test modes 'test' and 'testproc'. | 
| 304 | * | 311 | * | 
| 305 | * show() will display what the mode is currently set to. | 312 | * show() will display what the mode is currently set to. | 
| 306 | * store() will accept one of | 313 | * store() will accept one of | 
| 307 | * | 314 | * | 
| 308 | * 'firmware' | ||
| 309 | * 'platform' | 315 | * 'platform' | 
| 310 | * 'shutdown' | 316 | * 'shutdown' | 
| 311 | * 'reboot' | 317 | * 'reboot' | 
| 318 | * 'test' | ||
| 319 | * 'testproc' | ||
| 312 | * | 320 | * | 
| 313 | * It will only change to 'firmware' or 'platform' if the system | 321 | * It will only change to 'platform' if the system | 
| 314 | * supports it (as determined from pm_ops->pm_disk_mode). | 322 | * supports it (as determined from pm_ops->pm_disk_mode). | 
| 315 | */ | 323 | */ | 
| 316 | 324 | ||
| @@ -332,17 +340,21 @@ static ssize_t disk_store(struct subsystem * s, const char * buf, size_t n) | |||
| 332 | len = p ? p - buf : n; | 340 | len = p ? p - buf : n; | 
| 333 | 341 | ||
| 334 | mutex_lock(&pm_mutex); | 342 | mutex_lock(&pm_mutex); | 
| 335 | for (i = PM_DISK_FIRMWARE; i < PM_DISK_MAX; i++) { | 343 | for (i = PM_DISK_PLATFORM; i < PM_DISK_MAX; i++) { | 
| 336 | if (!strncmp(buf, pm_disk_modes[i], len)) { | 344 | if (!strncmp(buf, pm_disk_modes[i], len)) { | 
| 337 | mode = i; | 345 | mode = i; | 
| 338 | break; | 346 | break; | 
| 339 | } | 347 | } | 
| 340 | } | 348 | } | 
| 341 | if (mode) { | 349 | if (mode) { | 
| 342 | if (mode == PM_DISK_SHUTDOWN || mode == PM_DISK_REBOOT || | 350 | switch (mode) { | 
| 343 | mode == PM_DISK_TEST || mode == PM_DISK_TESTPROC) { | 351 | case PM_DISK_SHUTDOWN: | 
| 352 | case PM_DISK_REBOOT: | ||
| 353 | case PM_DISK_TEST: | ||
| 354 | case PM_DISK_TESTPROC: | ||
| 344 | pm_disk_mode = mode; | 355 | pm_disk_mode = mode; | 
| 345 | } else { | 356 | break; | 
| 357 | default: | ||
| 346 | if (pm_ops && pm_ops->enter && | 358 | if (pm_ops && pm_ops->enter && | 
| 347 | (mode == pm_ops->pm_disk_mode)) | 359 | (mode == pm_ops->pm_disk_mode)) | 
| 348 | pm_disk_mode = mode; | 360 | pm_disk_mode = mode; | 
| diff --git a/kernel/power/main.c b/kernel/power/main.c index a064dfd8877a..72419a3b1beb 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | DEFINE_MUTEX(pm_mutex); | 30 | DEFINE_MUTEX(pm_mutex); | 
| 31 | 31 | ||
| 32 | struct pm_ops *pm_ops; | 32 | struct pm_ops *pm_ops; | 
| 33 | suspend_disk_method_t pm_disk_mode = PM_DISK_PLATFORM; | 33 | suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN; | 
| 34 | 34 | ||
| 35 | /** | 35 | /** | 
| 36 | * pm_set_ops - Set the global power method table. | 36 | * pm_set_ops - Set the global power method table. | 
| @@ -41,9 +41,26 @@ void pm_set_ops(struct pm_ops * ops) | |||
| 41 | { | 41 | { | 
| 42 | mutex_lock(&pm_mutex); | 42 | mutex_lock(&pm_mutex); | 
| 43 | pm_ops = ops; | 43 | pm_ops = ops; | 
| 44 | if (ops && ops->pm_disk_mode != PM_DISK_INVALID) { | ||
| 45 | pm_disk_mode = ops->pm_disk_mode; | ||
| 46 | } else | ||
| 47 | pm_disk_mode = PM_DISK_SHUTDOWN; | ||
| 44 | mutex_unlock(&pm_mutex); | 48 | mutex_unlock(&pm_mutex); | 
| 45 | } | 49 | } | 
| 46 | 50 | ||
| 51 | /** | ||
| 52 | * pm_valid_only_mem - generic memory-only valid callback | ||
| 53 | * | ||
| 54 | * pm_ops drivers that implement mem suspend only and only need | ||
| 55 | * to check for that in their .valid callback can use this instead | ||
| 56 | * of rolling their own .valid callback. | ||
| 57 | */ | ||
| 58 | int pm_valid_only_mem(suspend_state_t state) | ||
| 59 | { | ||
| 60 | return state == PM_SUSPEND_MEM; | ||
| 61 | } | ||
| 62 | |||
| 63 | |||
| 47 | static inline void pm_finish(suspend_state_t state) | 64 | static inline void pm_finish(suspend_state_t state) | 
| 48 | { | 65 | { | 
| 49 | if (pm_ops->finish) | 66 | if (pm_ops->finish) | 
| @@ -111,13 +128,24 @@ static int suspend_prepare(suspend_state_t state) | |||
| 111 | return error; | 128 | return error; | 
| 112 | } | 129 | } | 
| 113 | 130 | ||
| 131 | /* default implementation */ | ||
| 132 | void __attribute__ ((weak)) arch_suspend_disable_irqs(void) | ||
| 133 | { | ||
| 134 | local_irq_disable(); | ||
| 135 | } | ||
| 136 | |||
| 137 | /* default implementation */ | ||
| 138 | void __attribute__ ((weak)) arch_suspend_enable_irqs(void) | ||
| 139 | { | ||
| 140 | local_irq_enable(); | ||
| 141 | } | ||
| 114 | 142 | ||
| 115 | int suspend_enter(suspend_state_t state) | 143 | int suspend_enter(suspend_state_t state) | 
| 116 | { | 144 | { | 
| 117 | int error = 0; | 145 | int error = 0; | 
| 118 | unsigned long flags; | ||
| 119 | 146 | ||
| 120 | local_irq_save(flags); | 147 | arch_suspend_disable_irqs(); | 
| 148 | BUG_ON(!irqs_disabled()); | ||
| 121 | 149 | ||
| 122 | if ((error = device_power_down(PMSG_SUSPEND))) { | 150 | if ((error = device_power_down(PMSG_SUSPEND))) { | 
| 123 | printk(KERN_ERR "Some devices failed to power down\n"); | 151 | printk(KERN_ERR "Some devices failed to power down\n"); | 
| @@ -126,7 +154,8 @@ int suspend_enter(suspend_state_t state) | |||
| 126 | error = pm_ops->enter(state); | 154 | error = pm_ops->enter(state); | 
| 127 | device_power_up(); | 155 | device_power_up(); | 
| 128 | Done: | 156 | Done: | 
| 129 | local_irq_restore(flags); | 157 | arch_suspend_enable_irqs(); | 
| 158 | BUG_ON(irqs_disabled()); | ||
| 130 | return error; | 159 | return error; | 
| 131 | } | 160 | } | 
| 132 | 161 | ||
| @@ -169,8 +198,8 @@ static inline int valid_state(suspend_state_t state) | |||
| 169 | 198 | ||
| 170 | /* all other states need lowlevel support and need to be | 199 | /* all other states need lowlevel support and need to be | 
| 171 | * valid to the lowlevel implementation, no valid callback | 200 | * valid to the lowlevel implementation, no valid callback | 
| 172 | * implies that all are valid. */ | 201 | * implies that none are valid. */ | 
| 173 | if (!pm_ops || (pm_ops->valid && !pm_ops->valid(state))) | 202 | if (!pm_ops || !pm_ops->valid || !pm_ops->valid(state)) | 
| 174 | return 0; | 203 | return 0; | 
| 175 | return 1; | 204 | return 1; | 
| 176 | } | 205 | } | 
| diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index 7fb834397a0d..175370824f37 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
| @@ -229,13 +229,13 @@ int swsusp_shrink_memory(void) | |||
| 229 | size += highmem_size; | 229 | size += highmem_size; | 
| 230 | for_each_zone (zone) | 230 | for_each_zone (zone) | 
| 231 | if (populated_zone(zone)) { | 231 | if (populated_zone(zone)) { | 
| 232 | tmp += snapshot_additional_pages(zone); | ||
| 232 | if (is_highmem(zone)) { | 233 | if (is_highmem(zone)) { | 
| 233 | highmem_size -= | 234 | highmem_size -= | 
| 234 | zone_page_state(zone, NR_FREE_PAGES); | 235 | zone_page_state(zone, NR_FREE_PAGES); | 
| 235 | } else { | 236 | } else { | 
| 236 | tmp -= zone_page_state(zone, NR_FREE_PAGES); | 237 | tmp -= zone_page_state(zone, NR_FREE_PAGES); | 
| 237 | tmp += zone->lowmem_reserve[ZONE_NORMAL]; | 238 | tmp += zone->lowmem_reserve[ZONE_NORMAL]; | 
| 238 | tmp += snapshot_additional_pages(zone); | ||
| 239 | } | 239 | } | 
| 240 | } | 240 | } | 
| 241 | 241 | ||
| diff --git a/kernel/power/user.c b/kernel/power/user.c index bf211fee1222..7cf6713b2325 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
| @@ -401,10 +401,9 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
| 401 | 401 | ||
| 402 | case PMOPS_ENTER: | 402 | case PMOPS_ENTER: | 
| 403 | if (data->platform_suspend) { | 403 | if (data->platform_suspend) { | 
| 404 | disable_nonboot_cpus(); | ||
| 405 | kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); | 404 | kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); | 
| 406 | error = pm_ops->enter(PM_SUSPEND_DISK); | 405 | error = pm_ops->enter(PM_SUSPEND_DISK); | 
| 407 | enable_nonboot_cpus(); | 406 | error = 0; | 
| 408 | } | 407 | } | 
| 409 | break; | 408 | break; | 
| 410 | 409 | ||
| diff --git a/kernel/resource.c b/kernel/resource.c index bdb55a33f969..9bd14fd3e6de 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
| @@ -213,27 +213,6 @@ int request_resource(struct resource *root, struct resource *new) | |||
| 213 | EXPORT_SYMBOL(request_resource); | 213 | EXPORT_SYMBOL(request_resource); | 
| 214 | 214 | ||
| 215 | /** | 215 | /** | 
| 216 | * ____request_resource - reserve a resource, with resource conflict returned | ||
| 217 | * @root: root resource descriptor | ||
| 218 | * @new: resource descriptor desired by caller | ||
| 219 | * | ||
| 220 | * Returns: | ||
| 221 | * On success, NULL is returned. | ||
| 222 | * On error, a pointer to the conflicting resource is returned. | ||
| 223 | */ | ||
| 224 | struct resource *____request_resource(struct resource *root, struct resource *new) | ||
| 225 | { | ||
| 226 | struct resource *conflict; | ||
| 227 | |||
| 228 | write_lock(&resource_lock); | ||
| 229 | conflict = __request_resource(root, new); | ||
| 230 | write_unlock(&resource_lock); | ||
| 231 | return conflict; | ||
| 232 | } | ||
| 233 | |||
| 234 | EXPORT_SYMBOL(____request_resource); | ||
| 235 | |||
| 236 | /** | ||
| 237 | * release_resource - release a previously reserved resource | 216 | * release_resource - release a previously reserved resource | 
| 238 | * @old: resource pointer | 217 | * @old: resource pointer | 
| 239 | */ | 218 | */ | 
| diff --git a/kernel/sched.c b/kernel/sched.c index a4ca632c477c..960d7c5fca39 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -4687,32 +4687,10 @@ out_unlock: | |||
| 4687 | return retval; | 4687 | return retval; | 
| 4688 | } | 4688 | } | 
| 4689 | 4689 | ||
| 4690 | static inline struct task_struct *eldest_child(struct task_struct *p) | ||
| 4691 | { | ||
| 4692 | if (list_empty(&p->children)) | ||
| 4693 | return NULL; | ||
| 4694 | return list_entry(p->children.next,struct task_struct,sibling); | ||
| 4695 | } | ||
| 4696 | |||
| 4697 | static inline struct task_struct *older_sibling(struct task_struct *p) | ||
| 4698 | { | ||
| 4699 | if (p->sibling.prev==&p->parent->children) | ||
| 4700 | return NULL; | ||
| 4701 | return list_entry(p->sibling.prev,struct task_struct,sibling); | ||
| 4702 | } | ||
| 4703 | |||
| 4704 | static inline struct task_struct *younger_sibling(struct task_struct *p) | ||
| 4705 | { | ||
| 4706 | if (p->sibling.next==&p->parent->children) | ||
| 4707 | return NULL; | ||
| 4708 | return list_entry(p->sibling.next,struct task_struct,sibling); | ||
| 4709 | } | ||
| 4710 | |||
| 4711 | static const char stat_nam[] = "RSDTtZX"; | 4690 | static const char stat_nam[] = "RSDTtZX"; | 
| 4712 | 4691 | ||
| 4713 | static void show_task(struct task_struct *p) | 4692 | static void show_task(struct task_struct *p) | 
| 4714 | { | 4693 | { | 
| 4715 | struct task_struct *relative; | ||
| 4716 | unsigned long free = 0; | 4694 | unsigned long free = 0; | 
| 4717 | unsigned state; | 4695 | unsigned state; | 
| 4718 | 4696 | ||
| @@ -4738,19 +4716,7 @@ static void show_task(struct task_struct *p) | |||
| 4738 | free = (unsigned long)n - (unsigned long)end_of_stack(p); | 4716 | free = (unsigned long)n - (unsigned long)end_of_stack(p); | 
| 4739 | } | 4717 | } | 
| 4740 | #endif | 4718 | #endif | 
| 4741 | printk("%5lu %5d %6d ", free, p->pid, p->parent->pid); | 4719 | printk("%5lu %5d %6d", free, p->pid, p->parent->pid); | 
| 4742 | if ((relative = eldest_child(p))) | ||
| 4743 | printk("%5d ", relative->pid); | ||
| 4744 | else | ||
| 4745 | printk(" "); | ||
| 4746 | if ((relative = younger_sibling(p))) | ||
| 4747 | printk("%7d", relative->pid); | ||
| 4748 | else | ||
| 4749 | printk(" "); | ||
| 4750 | if ((relative = older_sibling(p))) | ||
| 4751 | printk(" %5d", relative->pid); | ||
| 4752 | else | ||
| 4753 | printk(" "); | ||
| 4754 | if (!p->mm) | 4720 | if (!p->mm) | 
| 4755 | printk(" (L-TLB)\n"); | 4721 | printk(" (L-TLB)\n"); | 
| 4756 | else | 4722 | else | 
| @@ -4780,7 +4746,7 @@ void show_state_filter(unsigned long state_filter) | |||
| 4780 | * console might take alot of time: | 4746 | * console might take alot of time: | 
| 4781 | */ | 4747 | */ | 
| 4782 | touch_nmi_watchdog(); | 4748 | touch_nmi_watchdog(); | 
| 4783 | if (p->state & state_filter) | 4749 | if (!state_filter || (p->state & state_filter)) | 
| 4784 | show_task(p); | 4750 | show_task(p); | 
| 4785 | } while_each_thread(g, p); | 4751 | } while_each_thread(g, p); | 
| 4786 | 4752 | ||
| diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 1b255df4fcd0..c904748f2290 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -1676,7 +1676,7 @@ static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp, | |||
| 1676 | { | 1676 | { | 
| 1677 | int op; | 1677 | int op; | 
| 1678 | 1678 | ||
| 1679 | if (!capable(CAP_SYS_ADMIN)) | 1679 | if (write && !capable(CAP_SYS_ADMIN)) | 
| 1680 | return -EPERM; | 1680 | return -EPERM; | 
| 1681 | 1681 | ||
| 1682 | op = OP_OR; | 1682 | op = OP_OR; | 
| diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 4c3476fa058d..ad7d2392cb0e 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
| @@ -102,7 +102,7 @@ static int prepare_reply(struct genl_info *info, u8 cmd, struct sk_buff **skbp, | |||
| 102 | */ | 102 | */ | 
| 103 | static int send_reply(struct sk_buff *skb, pid_t pid) | 103 | static int send_reply(struct sk_buff *skb, pid_t pid) | 
| 104 | { | 104 | { | 
| 105 | struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data); | 105 | struct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb)); | 
| 106 | void *reply = genlmsg_data(genlhdr); | 106 | void *reply = genlmsg_data(genlhdr); | 
| 107 | int rc; | 107 | int rc; | 
| 108 | 108 | ||
| @@ -121,7 +121,7 @@ static int send_reply(struct sk_buff *skb, pid_t pid) | |||
| 121 | static void send_cpu_listeners(struct sk_buff *skb, | 121 | static void send_cpu_listeners(struct sk_buff *skb, | 
| 122 | struct listener_list *listeners) | 122 | struct listener_list *listeners) | 
| 123 | { | 123 | { | 
| 124 | struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data); | 124 | struct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb)); | 
| 125 | struct listener *s, *tmp; | 125 | struct listener *s, *tmp; | 
| 126 | struct sk_buff *skb_next, *skb_cur = skb; | 126 | struct sk_buff *skb_next, *skb_cur = skb; | 
| 127 | void *reply = genlmsg_data(genlhdr); | 127 | void *reply = genlmsg_data(genlhdr); | 
| diff --git a/kernel/time.c b/kernel/time.c index c6c80ea5d0ea..ba18ec4899bd 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
| @@ -452,6 +452,7 @@ struct timespec ns_to_timespec(const s64 nsec) | |||
| 452 | 452 | ||
| 453 | return ts; | 453 | return ts; | 
| 454 | } | 454 | } | 
| 455 | EXPORT_SYMBOL(ns_to_timespec); | ||
| 455 | 456 | ||
| 456 | /** | 457 | /** | 
| 457 | * ns_to_timeval - Convert nanoseconds to timeval | 458 | * ns_to_timeval - Convert nanoseconds to timeval | 
| @@ -469,6 +470,7 @@ struct timeval ns_to_timeval(const s64 nsec) | |||
| 469 | 470 | ||
| 470 | return tv; | 471 | return tv; | 
| 471 | } | 472 | } | 
| 473 | EXPORT_SYMBOL(ns_to_timeval); | ||
| 472 | 474 | ||
| 473 | /* | 475 | /* | 
| 474 | * Convert jiffies to milliseconds and back. | 476 | * Convert jiffies to milliseconds and back. | 
| @@ -635,6 +637,7 @@ timeval_to_jiffies(const struct timeval *value) | |||
| 635 | (((u64)usec * USEC_CONVERSION + USEC_ROUND) >> | 637 | (((u64)usec * USEC_CONVERSION + USEC_ROUND) >> | 
| 636 | (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; | 638 | (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; | 
| 637 | } | 639 | } | 
| 640 | EXPORT_SYMBOL(timeval_to_jiffies); | ||
| 638 | 641 | ||
| 639 | void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) | 642 | void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) | 
| 640 | { | 643 | { | 
| @@ -649,6 +652,7 @@ void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) | |||
| 649 | tv_usec /= NSEC_PER_USEC; | 652 | tv_usec /= NSEC_PER_USEC; | 
| 650 | value->tv_usec = tv_usec; | 653 | value->tv_usec = tv_usec; | 
| 651 | } | 654 | } | 
| 655 | EXPORT_SYMBOL(jiffies_to_timeval); | ||
| 652 | 656 | ||
| 653 | /* | 657 | /* | 
| 654 | * Convert jiffies/jiffies_64 to clock_t and back. | 658 | * Convert jiffies/jiffies_64 to clock_t and back. | 
| diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 67932ea78c17..76212b2a99de 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
| @@ -274,72 +274,3 @@ void clockevents_notify(unsigned long reason, void *arg) | |||
| 274 | } | 274 | } | 
| 275 | EXPORT_SYMBOL_GPL(clockevents_notify); | 275 | EXPORT_SYMBOL_GPL(clockevents_notify); | 
| 276 | 276 | ||
| 277 | #ifdef CONFIG_SYSFS | ||
| 278 | |||
| 279 | /** | ||
| 280 | * clockevents_show_registered - sysfs interface for listing clockevents | ||
| 281 | * @dev: unused | ||
| 282 | * @buf: char buffer to be filled with clock events list | ||
| 283 | * | ||
| 284 | * Provides sysfs interface for listing registered clock event devices | ||
| 285 | */ | ||
| 286 | static ssize_t clockevents_show_registered(struct sys_device *dev, char *buf) | ||
| 287 | { | ||
| 288 | struct list_head *tmp; | ||
| 289 | char *p = buf; | ||
| 290 | int cpu; | ||
| 291 | |||
| 292 | spin_lock(&clockevents_lock); | ||
| 293 | |||
| 294 | list_for_each(tmp, &clockevent_devices) { | ||
| 295 | struct clock_event_device *ce; | ||
| 296 | |||
| 297 | ce = list_entry(tmp, struct clock_event_device, list); | ||
| 298 | p += sprintf(p, "%-20s F:%04x M:%d", ce->name, | ||
| 299 | ce->features, ce->mode); | ||
| 300 | p += sprintf(p, " C:"); | ||
| 301 | if (!cpus_equal(ce->cpumask, cpu_possible_map)) { | ||
| 302 | for_each_cpu_mask(cpu, ce->cpumask) | ||
| 303 | p += sprintf(p, " %d", cpu); | ||
| 304 | } else { | ||
| 305 | /* | ||
| 306 | * FIXME: Add the cpu which is handling this sucker | ||
| 307 | */ | ||
| 308 | } | ||
| 309 | p += sprintf(p, "\n"); | ||
| 310 | } | ||
| 311 | |||
| 312 | spin_unlock(&clockevents_lock); | ||
| 313 | |||
| 314 | return p - buf; | ||
| 315 | } | ||
| 316 | |||
| 317 | /* | ||
| 318 | * Sysfs setup bits: | ||
| 319 | */ | ||
| 320 | static SYSDEV_ATTR(registered, 0600, | ||
| 321 | clockevents_show_registered, NULL); | ||
| 322 | |||
| 323 | static struct sysdev_class clockevents_sysclass = { | ||
| 324 | set_kset_name("clockevents"), | ||
| 325 | }; | ||
| 326 | |||
| 327 | static struct sys_device clockevents_sys_device = { | ||
| 328 | .id = 0, | ||
| 329 | .cls = &clockevents_sysclass, | ||
| 330 | }; | ||
| 331 | |||
| 332 | static int __init clockevents_sysfs_init(void) | ||
| 333 | { | ||
| 334 | int error = sysdev_class_register(&clockevents_sysclass); | ||
| 335 | |||
| 336 | if (!error) | ||
| 337 | error = sysdev_register(&clockevents_sys_device); | ||
| 338 | if (!error) | ||
| 339 | error = sysdev_create_file( | ||
| 340 | &clockevents_sys_device, | ||
| 341 | &attr_registered); | ||
| 342 | return error; | ||
| 343 | } | ||
| 344 | device_initcall(clockevents_sysfs_init); | ||
| 345 | #endif | ||
| diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c index 3be8da8fed7e..4c256fdb8875 100644 --- a/kernel/time/jiffies.c +++ b/kernel/time/jiffies.c | |||
| @@ -69,4 +69,4 @@ static int __init init_jiffies_clocksource(void) | |||
| 69 | return clocksource_register(&clocksource_jiffies); | 69 | return clocksource_register(&clocksource_jiffies); | 
| 70 | } | 70 | } | 
| 71 | 71 | ||
| 72 | module_init(init_jiffies_clocksource); | 72 | core_initcall(init_jiffies_clocksource); | 
| diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index eb12509e00bd..cb25649c6f50 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
| @@ -32,7 +32,7 @@ static u64 tick_length, tick_length_base; | |||
| 32 | /* TIME_ERROR prevents overwriting the CMOS clock */ | 32 | /* TIME_ERROR prevents overwriting the CMOS clock */ | 
| 33 | static int time_state = TIME_OK; /* clock synchronization status */ | 33 | static int time_state = TIME_OK; /* clock synchronization status */ | 
| 34 | int time_status = STA_UNSYNC; /* clock status bits */ | 34 | int time_status = STA_UNSYNC; /* clock status bits */ | 
| 35 | static long time_offset; /* time adjustment (ns) */ | 35 | static s64 time_offset; /* time adjustment (ns) */ | 
| 36 | static long time_constant = 2; /* pll time constant */ | 36 | static long time_constant = 2; /* pll time constant */ | 
| 37 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ | 37 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ | 
| 38 | long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ | 38 | long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ | 
| @@ -196,7 +196,7 @@ void __attribute__ ((weak)) notify_arch_cmos_timer(void) | |||
| 196 | */ | 196 | */ | 
| 197 | int do_adjtimex(struct timex *txc) | 197 | int do_adjtimex(struct timex *txc) | 
| 198 | { | 198 | { | 
| 199 | long ltemp, mtemp, save_adjust; | 199 | long mtemp, save_adjust, rem; | 
| 200 | s64 freq_adj, temp64; | 200 | s64 freq_adj, temp64; | 
| 201 | int result; | 201 | int result; | 
| 202 | 202 | ||
| @@ -277,14 +277,14 @@ int do_adjtimex(struct timex *txc) | |||
| 277 | time_adjust = txc->offset; | 277 | time_adjust = txc->offset; | 
| 278 | } | 278 | } | 
| 279 | else if (time_status & STA_PLL) { | 279 | else if (time_status & STA_PLL) { | 
| 280 | ltemp = txc->offset * NSEC_PER_USEC; | 280 | time_offset = txc->offset * NSEC_PER_USEC; | 
| 281 | 281 | ||
| 282 | /* | 282 | /* | 
| 283 | * Scale the phase adjustment and | 283 | * Scale the phase adjustment and | 
| 284 | * clamp to the operating range. | 284 | * clamp to the operating range. | 
| 285 | */ | 285 | */ | 
| 286 | time_offset = min(ltemp, MAXPHASE * NSEC_PER_USEC); | 286 | time_offset = min(time_offset, (s64)MAXPHASE * NSEC_PER_USEC); | 
| 287 | time_offset = max(time_offset, -MAXPHASE * NSEC_PER_USEC); | 287 | time_offset = max(time_offset, (s64)-MAXPHASE * NSEC_PER_USEC); | 
| 288 | 288 | ||
| 289 | /* | 289 | /* | 
| 290 | * Select whether the frequency is to be controlled | 290 | * Select whether the frequency is to be controlled | 
| @@ -297,11 +297,11 @@ int do_adjtimex(struct timex *txc) | |||
| 297 | mtemp = xtime.tv_sec - time_reftime; | 297 | mtemp = xtime.tv_sec - time_reftime; | 
| 298 | time_reftime = xtime.tv_sec; | 298 | time_reftime = xtime.tv_sec; | 
| 299 | 299 | ||
| 300 | freq_adj = (s64)time_offset * mtemp; | 300 | freq_adj = time_offset * mtemp; | 
| 301 | freq_adj = shift_right(freq_adj, time_constant * 2 + | 301 | freq_adj = shift_right(freq_adj, time_constant * 2 + | 
| 302 | (SHIFT_PLL + 2) * 2 - SHIFT_NSEC); | 302 | (SHIFT_PLL + 2) * 2 - SHIFT_NSEC); | 
| 303 | if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { | 303 | if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { | 
| 304 | temp64 = (s64)time_offset << (SHIFT_NSEC - SHIFT_FLL); | 304 | temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL); | 
| 305 | if (time_offset < 0) { | 305 | if (time_offset < 0) { | 
| 306 | temp64 = -temp64; | 306 | temp64 = -temp64; | 
| 307 | do_div(temp64, mtemp); | 307 | do_div(temp64, mtemp); | 
| @@ -314,8 +314,10 @@ int do_adjtimex(struct timex *txc) | |||
| 314 | freq_adj += time_freq; | 314 | freq_adj += time_freq; | 
| 315 | freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC); | 315 | freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC); | 
| 316 | time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC); | 316 | time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC); | 
| 317 | time_offset = (time_offset / NTP_INTERVAL_FREQ) | 317 | time_offset = div_long_long_rem_signed(time_offset, | 
| 318 | << SHIFT_UPDATE; | 318 | NTP_INTERVAL_FREQ, | 
| 319 | &rem); | ||
| 320 | time_offset <<= SHIFT_UPDATE; | ||
| 319 | } /* STA_PLL */ | 321 | } /* STA_PLL */ | 
| 320 | } /* txc->modes & ADJ_OFFSET */ | 322 | } /* txc->modes & ADJ_OFFSET */ | 
| 321 | if (txc->modes & ADJ_TICK) | 323 | if (txc->modes & ADJ_TICK) | 
| @@ -328,12 +330,12 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) | |||
| 328 | result = TIME_ERROR; | 330 | result = TIME_ERROR; | 
| 329 | 331 | ||
| 330 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) | 332 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) | 
| 331 | txc->offset = save_adjust; | 333 | txc->offset = save_adjust; | 
| 332 | else | 334 | else | 
| 333 | txc->offset = shift_right(time_offset, SHIFT_UPDATE) | 335 | txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) * | 
| 334 | * NTP_INTERVAL_FREQ / 1000; | 336 | NTP_INTERVAL_FREQ / 1000; | 
| 335 | txc->freq = (time_freq / NSEC_PER_USEC) | 337 | txc->freq = (time_freq / NSEC_PER_USEC) << | 
| 336 | << (SHIFT_USEC - SHIFT_NSEC); | 338 | (SHIFT_USEC - SHIFT_NSEC); | 
| 337 | txc->maxerror = time_maxerror; | 339 | txc->maxerror = time_maxerror; | 
| 338 | txc->esterror = time_esterror; | 340 | txc->esterror = time_esterror; | 
| 339 | txc->status = time_status; | 341 | txc->status = time_status; | 
| diff --git a/kernel/timer.c b/kernel/timer.c index 440048acaea1..b22bd39740dd 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
| @@ -505,6 +505,8 @@ out: | |||
| 505 | return ret; | 505 | return ret; | 
| 506 | } | 506 | } | 
| 507 | 507 | ||
| 508 | EXPORT_SYMBOL(try_to_del_timer_sync); | ||
| 509 | |||
| 508 | /** | 510 | /** | 
| 509 | * del_timer_sync - deactivate a timer and wait for the handler to finish. | 511 | * del_timer_sync - deactivate a timer and wait for the handler to finish. | 
| 510 | * @timer: the timer to be deactivated | 512 | * @timer: the timer to be deactivated | 
| @@ -1016,7 +1018,7 @@ static int timekeeping_resume(struct sys_device *dev) | |||
| 1016 | clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL); | 1018 | clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL); | 
| 1017 | 1019 | ||
| 1018 | /* Resume hrtimers */ | 1020 | /* Resume hrtimers */ | 
| 1019 | clock_was_set(); | 1021 | hres_timers_resume(); | 
| 1020 | 1022 | ||
| 1021 | return 0; | 1023 | return 0; | 
| 1022 | } | 1024 | } | 
