From 5aea0fac0fb295b0f2528cd03f93541bcd5c78e3 Mon Sep 17 00:00:00 2001 From: Huang Weiyi Date: Sat, 10 Oct 2009 06:56:45 +0000 Subject: [PATCH 1/8] parisc: remove duplicated #include Remove duplicated #include('s) in arch/parisc/kernel/signal.c Signed-off-by: Huang Weiyi Signed-off-by: Kyle McMartin --- arch/parisc/kernel/signal.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index e8467e4aa8d..fb37ac52e46 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include From b29f90379eb5def21ca3fdf576079c285b815e6a Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sat, 10 Oct 2009 11:01:30 +0000 Subject: [PATCH 2/8] parisc: remove unused IRQSTAT_SIRQ_PEND and IRQSTAT_SZ defines Signed-off-by: Kyle McMartin --- arch/parisc/kernel/asm-offsets.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/parisc/kernel/asm-offsets.c b/arch/parisc/kernel/asm-offsets.c index fcd3c707bf1..ec787b411e9 100644 --- a/arch/parisc/kernel/asm-offsets.c +++ b/arch/parisc/kernel/asm-offsets.c @@ -244,9 +244,6 @@ int main(void) DEFINE(THREAD_SZ, sizeof(struct thread_info)); DEFINE(THREAD_SZ_ALGN, align(sizeof(struct thread_info), 64)); BLANK(); - DEFINE(IRQSTAT_SIRQ_PEND, offsetof(irq_cpustat_t, __softirq_pending)); - DEFINE(IRQSTAT_SZ, sizeof(irq_cpustat_t)); - BLANK(); DEFINE(ICACHE_BASE, offsetof(struct pdc_cache_info, ic_base)); DEFINE(ICACHE_STRIDE, offsetof(struct pdc_cache_info, ic_stride)); DEFINE(ICACHE_COUNT, offsetof(struct pdc_cache_info, ic_count)); From 11e178091f6a9c5ca479f8a276b9dd0dfacf8fc4 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sun, 25 Oct 2009 21:48:36 +0000 Subject: [PATCH 3/8] parisc: add CALLER_ADDR{0-6} macros Signed-off-by: Helge Deller Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/ftrace.h | 14 ++++++++++++++ arch/parisc/kernel/unwind.c | 27 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/arch/parisc/include/asm/ftrace.h b/arch/parisc/include/asm/ftrace.h index 2fa05dd6aee..72c0fafaa03 100644 --- a/arch/parisc/include/asm/ftrace.h +++ b/arch/parisc/include/asm/ftrace.h @@ -20,6 +20,20 @@ struct ftrace_ret_stack { * Defined in entry.S */ extern void return_to_handler(void); + + +extern unsigned long return_address(unsigned int); + +#define HAVE_ARCH_CALLER_ADDR + +#define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) +#define CALLER_ADDR1 return_address(1) +#define CALLER_ADDR2 return_address(2) +#define CALLER_ADDR3 return_address(3) +#define CALLER_ADDR4 return_address(4) +#define CALLER_ADDR5 return_address(5) +#define CALLER_ADDR6 return_address(6) + #endif /* __ASSEMBLY__ */ #endif /* _ASM_PARISC_FTRACE_H */ diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c index a36799e8569..f03f6fb0ec8 100644 --- a/arch/parisc/kernel/unwind.c +++ b/arch/parisc/kernel/unwind.c @@ -417,3 +417,30 @@ int unwind_to_user(struct unwind_frame_info *info) return ret; } + +unsigned long return_address(unsigned int level) +{ + struct unwind_frame_info info; + struct pt_regs r; + unsigned long sp; + + /* initialize unwind info */ + asm volatile ("copy %%r30, %0" : "=r"(sp)); + memset(&r, 0, sizeof(struct pt_regs)); + r.iaoq[0] = (unsigned long) current_text_addr(); + r.gr[2] = (unsigned long) __builtin_return_address(0); + r.gr[30] = sp; + unwind_frame_init(&info, current, &r); + + /* unwind stack */ + ++level; + do { + if (unwind_once(&info) < 0 || info.ip == 0) + return 0; + if (!__kernel_text_address(info.ip)) { + return 0; + } + } while (info.ip && level--); + + return info.ip; +} From 8f78df872d463ac43315916663b3e688ebb2422f Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Fri, 6 Nov 2009 23:07:42 +0000 Subject: [PATCH 4/8] parisc: use sort() instead of home-made implementation (v2) Signed-off-by: Helge Deller Signed-off-by: Randolph Chung Signed-off-by: Kyle McMartin --- arch/parisc/kernel/unwind.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c index f03f6fb0ec8..d58eac1a828 100644 --- a/arch/parisc/kernel/unwind.c +++ b/arch/parisc/kernel/unwind.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -115,24 +116,18 @@ unwind_table_init(struct unwind_table *table, const char *name, } } +static int cmp_unwind_table_entry(const void *a, const void *b) +{ + return ((const struct unwind_table_entry *)a)->region_start + - ((const struct unwind_table_entry *)b)->region_start; +} + static void unwind_table_sort(struct unwind_table_entry *start, struct unwind_table_entry *finish) { - struct unwind_table_entry el, *p, *q; - - for (p = start + 1; p < finish; ++p) { - if (p[0].region_start < p[-1].region_start) { - el = *p; - q = p; - do { - q[0] = q[-1]; - --q; - } while (q > start && - el.region_start < q[-1].region_start); - *q = el; - } - } + sort(start, finish - start, sizeof(struct unwind_table_entry), + cmp_unwind_table_entry, NULL); } struct unwind_table * From 6ad6c4245e4ed0b88f5ee379c04c834b52b272a6 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 6 Nov 2009 22:41:51 +0000 Subject: [PATCH 5/8] parisc: Replace old style lock init in smp.c SPIN_LOCK_UNLOCKED is deprecated. Init the per cpu locks at runtime instead. (Also kills the unused smp_lock --kyle) Signed-off-by: Thomas Gleixner Signed-off-by: Kyle McMartin --- arch/parisc/kernel/smp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index 1fd0f0cec03..3f2fce8ce6b 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c @@ -60,8 +60,6 @@ static int smp_debug_lvl = 0; #define smp_debug(lvl, ...) do { } while(0) #endif /* DEBUG_SMP */ -DEFINE_SPINLOCK(smp_lock); - volatile struct task_struct *smp_init_current_idle_task; /* track which CPU is booting */ @@ -69,7 +67,7 @@ static volatile int cpu_now_booting __cpuinitdata; static int parisc_max_cpus __cpuinitdata = 1; -DEFINE_PER_CPU(spinlock_t, ipi_lock) = SPIN_LOCK_UNLOCKED; +static DEFINE_PER_CPU(spinlock_t, ipi_lock); enum ipi_message_type { IPI_NOP=0, @@ -438,6 +436,11 @@ void __init smp_prepare_boot_cpu(void) */ void __init smp_prepare_cpus(unsigned int max_cpus) { + int cpu; + + for_each_possible_cpu(cpu) + spin_lock_init(&per_cpu(ipi_lock, cpu)); + init_cpu_present(cpumask_of(0)); parisc_max_cpus = max_cpus; From 05920797ca4c55b3c0629bc0eeb6fe634c196952 Mon Sep 17 00:00:00 2001 From: David Daney Date: Thu, 10 Dec 2009 17:28:18 +0000 Subject: [PATCH 6/8] parisc: Convert BUG() to use unreachable() Use the new unreachable() macro instead of for(;;); Signed-off-by: David Daney Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/bug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h index 8cfc553fc83..75e46c557a1 100644 --- a/arch/parisc/include/asm/bug.h +++ b/arch/parisc/include/asm/bug.h @@ -32,14 +32,14 @@ "\t.popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ "i" (0), "i" (sizeof(struct bug_entry)) ); \ - for(;;) ; \ + unreachable(); \ } while(0) #else #define BUG() \ do { \ asm volatile(PARISC_BUG_BREAK_ASM : : ); \ - for(;;) ; \ + unreachable(); \ } while(0) #endif From 217bfb5190813d97e6003f7692f8014655ffc02a Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Fri, 27 Nov 2009 06:51:12 +0000 Subject: [PATCH 7/8] parisc: convert /proc/pdc/{lcd,led} to seq_file Convert code away from ->read_proc/->write_proc interfaces. Switch to proc_create()/proc_create_data() which make addition of proc entries reliable wrt NULL ->proc_fops, NULL ->data and so on. Problem with ->read_proc et al is described here commit 786d7e1612f0b0adb6046f19b906609e4fe8b1ba "Fix rmmod/read/write races in /proc entries" Signed-off-by: Alexey Dobriyan Reviewed-by: Grant Grundler Signed-off-by: Kyle McMartin --- drivers/parisc/led.c | 61 ++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index 79caf1ca4a2..188bc8496a2 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -147,41 +148,34 @@ device_initcall(start_task); static void (*led_func_ptr) (unsigned char) __read_mostly; #ifdef CONFIG_PROC_FS -static int led_proc_read(char *page, char **start, off_t off, int count, - int *eof, void *data) +static int led_proc_show(struct seq_file *m, void *v) { - char *out = page; - int len; - - switch ((long)data) + switch ((long)m->private) { case LED_NOLCD: - out += sprintf(out, "Heartbeat: %d\n", led_heartbeat); - out += sprintf(out, "Disk IO: %d\n", led_diskio); - out += sprintf(out, "LAN Rx/Tx: %d\n", led_lanrxtx); + seq_printf(m, "Heartbeat: %d\n", led_heartbeat); + seq_printf(m, "Disk IO: %d\n", led_diskio); + seq_printf(m, "LAN Rx/Tx: %d\n", led_lanrxtx); break; case LED_HASLCD: - out += sprintf(out, "%s\n", lcd_text); + seq_printf(m, "%s\n", lcd_text); break; default: - *eof = 1; return 0; } - - len = out - page - off; - if (len < count) { - *eof = 1; - if (len <= 0) return 0; - } else { - len = count; - } - *start = page + off; - return len; + return 0; } -static int led_proc_write(struct file *file, const char *buf, - unsigned long count, void *data) +static int led_proc_open(struct inode *inode, struct file *file) { + return single_open(file, led_proc_show, PDE(inode)->data); +} + + +static ssize_t led_proc_write(struct file *file, const char *buf, + size_t count, loff_t *pos) +{ + void *data = PDE(file->f_path.dentry->d_inode)->data; char *cur, lbuf[count + 1]; int d; @@ -234,6 +228,15 @@ parse_error: return -EINVAL; } +static const struct file_operations led_proc_fops = { + .owner = THIS_MODULE, + .open = led_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + .write = led_proc_write, +}; + static int __init led_create_procfs(void) { struct proc_dir_entry *proc_pdc_root = NULL; @@ -243,19 +246,15 @@ static int __init led_create_procfs(void) proc_pdc_root = proc_mkdir("pdc", 0); if (!proc_pdc_root) return -1; - ent = create_proc_entry("led", S_IFREG|S_IRUGO|S_IWUSR, proc_pdc_root); + ent = proc_create_data("led", S_IRUGO|S_IWUSR, proc_pdc_root, + &led_proc_fops, (void *)LED_NOLCD); /* LED */ if (!ent) return -1; - ent->data = (void *)LED_NOLCD; /* LED */ - ent->read_proc = led_proc_read; - ent->write_proc = led_proc_write; if (led_type == LED_HASLCD) { - ent = create_proc_entry("lcd", S_IFREG|S_IRUGO|S_IWUSR, proc_pdc_root); + ent = proc_create_data("lcd", S_IRUGO|S_IWUSR, proc_pdc_root, + &led_proc_fops, (void *)LED_HASLCD); /* LCD */ if (!ent) return -1; - ent->data = (void *)LED_HASLCD; /* LCD */ - ent->read_proc = led_proc_read; - ent->write_proc = led_proc_write; } return 0; From d0608b54740c82b08056b7611e38a3fd73be3564 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 17 Nov 2009 22:50:59 +0000 Subject: [PATCH 8/8] parisc: Fixup last users of irq_chip->typename The typename member of struct irq_chip was kept for migration purposes and is obsolete since more than 2 years. Fix up the leftovers. Signed-off-by: Thomas Gleixner Signed-off-by: Kyle McMartin --- arch/parisc/kernel/irq.c | 4 ++-- drivers/parisc/dino.c | 2 +- drivers/parisc/eisa.c | 2 +- drivers/parisc/gsc.c | 2 +- drivers/parisc/iosapic.c | 2 +- drivers/parisc/superio.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c index f47465e8d04..efbcee5d222 100644 --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c @@ -145,7 +145,7 @@ static int cpu_set_affinity_irq(unsigned int irq, const struct cpumask *dest) #endif static struct irq_chip cpu_interrupt_type = { - .typename = "CPU", + .name = "CPU", .startup = cpu_startup_irq, .shutdown = cpu_disable_irq, .enable = cpu_enable_irq, @@ -192,7 +192,7 @@ int show_interrupts(struct seq_file *p, void *v) seq_printf(p, "%10u ", kstat_irqs(i)); #endif - seq_printf(p, " %14s", irq_desc[i].chip->typename); + seq_printf(p, " %14s", irq_desc[i].chip->name); #ifndef PARISC_IRQ_CR16_COUNTS seq_printf(p, " %s", action->name); diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index d69bde6a234..c542c7bb745 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c @@ -354,7 +354,7 @@ static unsigned int dino_startup_irq(unsigned int irq) } static struct irq_chip dino_interrupt_type = { - .typename = "GSC-PCI", + .name = "GSC-PCI", .startup = dino_startup_irq, .shutdown = dino_disable_irq, .enable = dino_enable_irq, diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c index 51220749cb6..46f503fb7fc 100644 --- a/drivers/parisc/eisa.c +++ b/drivers/parisc/eisa.c @@ -189,7 +189,7 @@ static unsigned int eisa_startup_irq(unsigned int irq) } static struct irq_chip eisa_interrupt_type = { - .typename = "EISA", + .name = "EISA", .startup = eisa_startup_irq, .shutdown = eisa_disable_irq, .enable = eisa_enable_irq, diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c index 647adc9f85a..c4e1f3c3c2f 100644 --- a/drivers/parisc/gsc.c +++ b/drivers/parisc/gsc.c @@ -149,7 +149,7 @@ static unsigned int gsc_asic_startup_irq(unsigned int irq) } static struct irq_chip gsc_asic_interrupt_type = { - .typename = "GSC-ASIC", + .name = "GSC-ASIC", .startup = gsc_asic_startup_irq, .shutdown = gsc_asic_disable_irq, .enable = gsc_asic_enable_irq, diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 88e33355321..c76836727ca 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -730,7 +730,7 @@ static int iosapic_set_affinity_irq(unsigned int irq, #endif static struct irq_chip iosapic_interrupt_type = { - .typename = "IO-SAPIC-level", + .name = "IO-SAPIC-level", .startup = iosapic_startup_irq, .shutdown = iosapic_disable_irq, .enable = iosapic_enable_irq, diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index 675f04e6597..a35c9c5b89e 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c @@ -326,7 +326,7 @@ static unsigned int superio_startup_irq(unsigned int irq) } static struct irq_chip superio_interrupt_type = { - .typename = SUPERIO, + .name = SUPERIO, .startup = superio_startup_irq, .shutdown = superio_disable_irq, .enable = superio_enable_irq,