summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <greg@kroah.com>2003-02-26 21:49:57 -0800
committerGreg Kroah-Hartman <greg@kroah.com>2003-02-26 21:49:57 -0800
commitfffd915522cb703e95381fc52c0ac3843f013f18 (patch)
tree7efd17b1bd1a584a7fa10633d26b4b5e99283deb /kernel
parenta6cc5237a1f189c30cd06d05e2955e5bc63d8913 (diff)
parentbe8013e867207d570f33cc1c66bd06797f1eed6b (diff)
Merge kroah.com:/home/greg/linux/BK/bleed-2.5
into kroah.com:/home/greg/linux/BK/pci-2.5
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpufreq.c4
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/fork.c4
-rw-r--r--kernel/futex.c4
-rw-r--r--kernel/module.c171
-rw-r--r--kernel/pm.c6
-rw-r--r--kernel/posix-timers.c2
-rw-r--r--kernel/suspend.c2
-rw-r--r--kernel/sys.c2
-rw-r--r--kernel/timer.c11
10 files changed, 74 insertions, 134 deletions
diff --git a/kernel/cpufreq.c b/kernel/cpufreq.c
index 5a1118709aed..17d2845accfd 100644
--- a/kernel/cpufreq.c
+++ b/kernel/cpufreq.c
@@ -1078,11 +1078,11 @@ int cpufreq_set_policy(struct cpufreq_policy *policy)
down(&cpufreq_notifier_sem);
- /* adjust if neccessary - all reasons */
+ /* adjust if necessary - all reasons */
notifier_call_chain(&cpufreq_policy_notifier_list, CPUFREQ_ADJUST,
policy);
- /* adjust if neccessary - hardware incompatibility*/
+ /* adjust if necessary - hardware incompatibility*/
notifier_call_chain(&cpufreq_policy_notifier_list, CPUFREQ_INCOMPATIBLE,
policy);
diff --git a/kernel/exit.c b/kernel/exit.c
index f01c77dfcee1..ffc0973ab074 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -482,7 +482,7 @@ static inline void choose_new_parent(task_t *p, task_t *reaper, task_t *child_re
static inline void reparent_thread(task_t *p, task_t *father, int traced)
{
- /* We dont want people slaying init. */
+ /* We don't want people slaying init. */
if (p->exit_signal != -1)
p->exit_signal = SIGCHLD;
p->self_exec_id++;
diff --git a/kernel/fork.c b/kernel/fork.c
index 8a6032c5f7ec..ce4d721d0ced 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -446,7 +446,7 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
tsk->clear_child_tid = NULL;
/*
- * We dont check the error code - if userspace has
+ * We don't check the error code - if userspace has
* not set up a proper pointer then tough luck.
*/
put_user(0, tidptr);
@@ -901,7 +901,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
/*
* Share the timeslice between parent and child, thus the
- * total amount of pending timeslices in the system doesnt change,
+ * total amount of pending timeslices in the system doesn't change,
* resulting in more scheduling fairness.
*/
local_irq_disable();
diff --git a/kernel/futex.c b/kernel/futex.c
index 4cade10892db..dfd03a0cdad8 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -39,7 +39,7 @@
/*
* We use this hashed waitqueue instead of a normal wait_queue_t, so
- * we can wake only the relevent ones (hashed queues may be shared):
+ * we can wake only the relevant ones (hashed queues may be shared):
*/
struct futex_q {
struct list_head list;
@@ -297,7 +297,7 @@ static int futex_wait(unsigned long uaddr,
time = schedule_timeout(time);
set_current_state(TASK_RUNNING);
/*
- * NOTE: we dont remove ourselves from the waitqueue because
+ * NOTE: we don't remove ourselves from the waitqueue because
* we are the only user of it.
*/
if (time == 0) {
diff --git a/kernel/module.c b/kernel/module.c
index 00d8b07c4fd1..bf6859b3cd73 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -76,6 +76,22 @@ int init_module(void)
}
EXPORT_SYMBOL(init_module);
+/* Find a module section: 0 means not found. */
+static unsigned int find_sec(Elf_Ehdr *hdr,
+ Elf_Shdr *sechdrs,
+ const char *secstrings,
+ const char *name)
+{
+ unsigned int i;
+
+ for (i = 1; i < hdr->e_shnum; i++)
+ /* Alloc bit cleared means "ignore it." */
+ if ((sechdrs[i].sh_flags & SHF_ALLOC)
+ && strcmp(secstrings+sechdrs[i].sh_name, name) == 0)
+ return i;
+ return 0;
+}
+
/* Find a symbol, return value and the symbol group */
static unsigned long __find_symbol(const char *name,
struct kernel_symbol_group **group,
@@ -173,16 +189,19 @@ static int use_module(struct module *a, struct module *b)
struct module_use *use;
if (b == NULL || already_uses(a, b)) return 1;
+ if (!strong_try_module_get(b))
+ return 0;
+
DEBUGP("Allocating new usage for %s.\n", a->name);
use = kmalloc(sizeof(*use), GFP_ATOMIC);
if (!use) {
printk("%s: out of memory loading\n", a->name);
+ module_put(b);
return 0;
}
use->module_which_uses = a;
list_add(&use->list, &b->modules_which_use_me);
- try_module_get(b); /* Can't fail */
return 1;
}
@@ -875,45 +894,6 @@ void *__symbol_get(const char *symbol)
}
EXPORT_SYMBOL_GPL(__symbol_get);
-/* Deal with the given section */
-static int handle_section(const char *name,
- Elf_Shdr *sechdrs,
- unsigned int strindex,
- unsigned int symindex,
- unsigned int i,
- struct module *mod)
-{
- int ret;
- const char *strtab = (char *)sechdrs[strindex].sh_addr;
-
- switch (sechdrs[i].sh_type) {
- case SHT_REL:
- ret = apply_relocate(sechdrs, strtab, symindex, i, mod);
- break;
- case SHT_RELA:
- ret = apply_relocate_add(sechdrs, strtab, symindex, i, mod);
- break;
- default:
- DEBUGP("Ignoring section %u: %s\n", i,
- sechdrs[i].sh_type==SHT_NULL ? "NULL":
- sechdrs[i].sh_type==SHT_PROGBITS ? "PROGBITS":
- sechdrs[i].sh_type==SHT_SYMTAB ? "SYMTAB":
- sechdrs[i].sh_type==SHT_STRTAB ? "STRTAB":
- sechdrs[i].sh_type==SHT_RELA ? "RELA":
- sechdrs[i].sh_type==SHT_HASH ? "HASH":
- sechdrs[i].sh_type==SHT_DYNAMIC ? "DYNAMIC":
- sechdrs[i].sh_type==SHT_NOTE ? "NOTE":
- sechdrs[i].sh_type==SHT_NOBITS ? "NOBITS":
- sechdrs[i].sh_type==SHT_REL ? "REL":
- sechdrs[i].sh_type==SHT_SHLIB ? "SHLIB":
- sechdrs[i].sh_type==SHT_DYNSYM ? "DYNSYM":
- sechdrs[i].sh_type==SHT_NUM ? "NUM":
- "UNKNOWN");
- ret = 0;
- }
- return ret;
-}
-
/* Change all symbols so that sh_value encodes the pointer directly. */
static int simplify_symbols(Elf_Shdr *sechdrs,
unsigned int symindex,
@@ -1103,93 +1083,19 @@ static struct module *load_module(void *umod,
sechdrs = (void *)hdr + hdr->e_shoff;
secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
- /* May not export symbols, or have setup params, so these may
- not exist */
- exportindex = setupindex = obsparmindex = gplindex = licenseindex
- = crcindex = gplcrcindex = versindex = 0;
-
/* And these should exist, but gcc whinges if we don't init them */
- symindex = strindex = exindex = modindex = vmagindex = 0;
+ symindex = strindex = 0;
- /* Find where important sections are */
for (i = 1; i < hdr->e_shnum; i++) {
/* Mark all sections sh_addr with their address in the
temporary image. */
sechdrs[i].sh_addr = (size_t)hdr + sechdrs[i].sh_offset;
+ /* Internal symbols and strings. */
if (sechdrs[i].sh_type == SHT_SYMTAB) {
- /* Internal symbols */
- DEBUGP("Symbol table in section %u\n", i);
symindex = i;
- /* Strings */
strindex = sechdrs[i].sh_link;
- DEBUGP("String table found in section %u\n", strindex);
- } else if (strcmp(secstrings+sechdrs[i].sh_name,
- ".gnu.linkonce.this_module") == 0) {
- /* The module struct */
- DEBUGP("Module in section %u\n", i);
- modindex = i;
- } else if (strcmp(secstrings+sechdrs[i].sh_name, "__ksymtab")
- == 0) {
- /* Exported symbols. */
- DEBUGP("EXPORT table in section %u\n", i);
- exportindex = i;
- } else if (strcmp(secstrings+sechdrs[i].sh_name,
- "__ksymtab_gpl") == 0) {
- /* Exported symbols. (GPL) */
- DEBUGP("GPL symbols found in section %u\n", i);
- gplindex = i;
- } else if (strcmp(secstrings+sechdrs[i].sh_name, "__kcrctab")
- == 0) {
- /* Exported symbols CRCs. */
- DEBUGP("CRC table in section %u\n", i);
- crcindex = i;
- } else if (strcmp(secstrings+sechdrs[i].sh_name, "__kcrctab_gpl")
- == 0) {
- /* Exported symbols CRCs. (GPL)*/
- DEBUGP("CRC table in section %u\n", i);
- gplcrcindex = i;
- } else if (strcmp(secstrings+sechdrs[i].sh_name, "__param")
- == 0) {
- /* Setup parameter info */
- DEBUGP("Setup table found in section %u\n", i);
- setupindex = i;
- } else if (strcmp(secstrings+sechdrs[i].sh_name, "__ex_table")
- == 0) {
- /* Exception table */
- DEBUGP("Exception table found in section %u\n", i);
- exindex = i;
- } else if (strcmp(secstrings+sechdrs[i].sh_name, "__obsparm")
- == 0) {
- /* Obsolete MODULE_PARM() table */
- DEBUGP("Obsolete param found in section %u\n", i);
- obsparmindex = i;
- } else if (strcmp(secstrings+sechdrs[i].sh_name,".init.license")
- == 0) {
- /* MODULE_LICENSE() */
- DEBUGP("Licence found in section %u\n", i);
- licenseindex = i;
- sechdrs[i].sh_flags &= ~(unsigned long)SHF_ALLOC;
- } else if (strcmp(secstrings+sechdrs[i].sh_name,
- "__vermagic") == 0 &&
- (sechdrs[i].sh_flags & SHF_ALLOC)) {
- /* Version magic. */
- DEBUGP("Version magic found in section %u\n", i);
- vmagindex = i;
- sechdrs[i].sh_flags &= ~(unsigned long)SHF_ALLOC;
- } else if (strcmp(secstrings+sechdrs[i].sh_name,
- "__versions") == 0 &&
- (sechdrs[i].sh_flags & SHF_ALLOC)) {
- /* Module version info (both exported and needed) */
- DEBUGP("Versions found in section %u\n", i);
- versindex = i;
- sechdrs[i].sh_flags &= ~(unsigned long)SHF_ALLOC;
}
-#ifdef CONFIG_KALLSYMS
- /* symbol and string tables for decoding later. */
- if (sechdrs[i].sh_type == SHT_SYMTAB || i == strindex)
- sechdrs[i].sh_flags |= SHF_ALLOC;
-#endif
#ifndef CONFIG_MODULE_UNLOAD
/* Don't load .exit sections */
if (strstr(secstrings+sechdrs[i].sh_name, ".exit"))
@@ -1197,6 +1103,14 @@ static struct module *load_module(void *umod,
#endif
}
+#ifdef CONFIG_KALLSYMS
+ /* Keep symbol and string tables for decoding later. */
+ sechdrs[symindex].sh_flags |= SHF_ALLOC;
+ sechdrs[strindex].sh_flags |= SHF_ALLOC;
+#endif
+
+ modindex = find_sec(hdr, sechdrs, secstrings,
+ ".gnu.linkonce.this_module");
if (!modindex) {
printk(KERN_WARNING "No module found in object\n");
err = -ENOEXEC;
@@ -1204,6 +1118,18 @@ static struct module *load_module(void *umod,
}
mod = (void *)sechdrs[modindex].sh_addr;
+ /* Optional sections */
+ exportindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab");
+ gplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl");
+ crcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab");
+ gplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl");
+ setupindex = find_sec(hdr, sechdrs, secstrings, "__param");
+ exindex = find_sec(hdr, sechdrs, secstrings, "__ex_table");
+ obsparmindex = find_sec(hdr, sechdrs, secstrings, "__obsparm");
+ licenseindex = find_sec(hdr, sechdrs, secstrings, ".init.license");
+ vmagindex = find_sec(hdr, sechdrs, secstrings, "__vermagic");
+ versindex = find_sec(hdr, sechdrs, secstrings, "__versions");
+
/* Check module struct version now, before we try to use module. */
if (!check_modstruct_version(sechdrs, versindex, mod)) {
err = -ENOEXEC;
@@ -1336,10 +1262,15 @@ static struct module *load_module(void *umod,
mod->extable.entry = (void *)sechdrs[exindex].sh_addr;
}
- /* Now handle each section. */
+ /* Now do relocations. */
for (i = 1; i < hdr->e_shnum; i++) {
- err = handle_section(secstrings + sechdrs[i].sh_name,
- sechdrs, strindex, symindex, i, mod);
+ const char *strtab = (char *)sechdrs[strindex].sh_addr;
+ if (sechdrs[i].sh_type == SHT_REL)
+ err = apply_relocate(sechdrs, strtab, symindex, i,
+ mod);
+ else if (sechdrs[i].sh_type == SHT_RELA)
+ err = apply_relocate_add(sechdrs, strtab, symindex, i,
+ mod);
if (err < 0)
goto cleanup;
}
@@ -1456,10 +1387,12 @@ sys_init_module(void *umod,
}
/* Now it's a first class citizen! */
+ down(&module_mutex);
mod->state = MODULE_STATE_LIVE;
module_free(mod, mod->module_init);
mod->module_init = NULL;
mod->init_size = 0;
+ up(&module_mutex);
return 0;
}
diff --git a/kernel/pm.c b/kernel/pm.c
index a710764606ba..afffd046c2f6 100644
--- a/kernel/pm.c
+++ b/kernel/pm.c
@@ -141,11 +141,11 @@ void pm_unregister_all(pm_callback callback)
* data field must hold the intended next state. No call is made
* if the state matches.
*
- * BUGS: what stops two power management requests occuring in parallel
+ * BUGS: what stops two power management requests occurring in parallel
* and conflicting.
*
* WARNING: Calling pm_send directly is not generally recommended, in
- * paticular there is no locking against the pm_dev going away. The
+ * particular there is no locking against the pm_dev going away. The
* caller must maintain all needed locking or have 'inside knowledge'
* on the safety. Also remember that this function is not locked against
* pm_unregister. This means that you must handle SMP races on callback
@@ -227,7 +227,7 @@ static void pm_undo_all(struct pm_dev *last)
* Zero is returned on success. If a suspend fails then the status
* from the device that vetoes the suspend is returned.
*
- * BUGS: what stops two power management requests occuring in parallel
+ * BUGS: what stops two power management requests occurring in parallel
* and conflicting.
*/
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 95ada3e0f563..add2e8abd710 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -1207,7 +1207,7 @@ do_clock_nanosleep(clockid_t which_clock, int flags, struct timespec *tsave)
{
struct timespec t;
struct timer_list new_timer;
- struct abs_struct abs_struct = { list:{next:0} };
+ struct abs_struct abs_struct = { .list = { .next = 0 } };
int abs;
int rtn = 0;
int active;
diff --git a/kernel/suspend.c b/kernel/suspend.c
index 5bcf2e90b48a..5801413eeb62 100644
--- a/kernel/suspend.c
+++ b/kernel/suspend.c
@@ -961,7 +961,7 @@ static int relocate_pagedir(void)
printk("Relocating pagedir");
if(!does_collide_order(old_pagedir, (unsigned long)old_pagedir, pagedir_order)) {
- printk("not neccessary\n");
+ printk("not necessary\n");
return 0;
}
diff --git a/kernel/sys.c b/kernel/sys.c
index afa6d2fc1372..8e3fb524d641 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -870,7 +870,7 @@ asmlinkage long sys_times(struct tms * tbuf)
if (copy_to_user(tbuf, &tmp, sizeof(struct tms)))
return -EFAULT;
}
- return jiffies_to_clock_t(jiffies);
+ return (long) jiffies_64_to_clock_t(get_jiffies_64());
}
/*
diff --git a/kernel/timer.c b/kernel/timer.c
index cabdff7716e7..6e7e23cb95ba 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -757,7 +757,7 @@ static inline void calc_load(unsigned long ticks)
}
/* jiffies at the most recent update of wall time */
-unsigned long wall_jiffies;
+unsigned long wall_jiffies = INITIAL_JIFFIES;
/*
* This read-write spinlock protects us from races in SMP while
@@ -1104,7 +1104,7 @@ asmlinkage long sys_sysinfo(struct sysinfo *info)
do {
seq = read_seqbegin(&xtime_lock);
- uptime = jiffies_64;
+ uptime = jiffies_64 - INITIAL_JIFFIES;
do_div(uptime, HZ);
val.uptime = (unsigned long) uptime;
@@ -1180,6 +1180,13 @@ static void __devinit init_timers_cpu(int cpu)
}
for (j = 0; j < TVR_SIZE; j++)
INIT_LIST_HEAD(base->tv1.vec + j);
+
+ base->timer_jiffies = INITIAL_JIFFIES;
+ base->tv1.index = INITIAL_JIFFIES & TVR_MASK;
+ base->tv2.index = (INITIAL_JIFFIES >> TVR_BITS) & TVN_MASK;
+ base->tv3.index = (INITIAL_JIFFIES >> (TVR_BITS+TVN_BITS)) & TVN_MASK;
+ base->tv4.index = (INITIAL_JIFFIES >> (TVR_BITS+2*TVN_BITS)) & TVN_MASK;
+ base->tv5.index = (INITIAL_JIFFIES >> (TVR_BITS+3*TVN_BITS)) & TVN_MASK;
}
static int __devinit timer_cpu_notify(struct notifier_block *self,