From 5fbebcbdb3730666c0d1d22021a90d8483fc8e02 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 24 Jan 2012 14:07:18 +0900 Subject: sh: intc: Make global intc controller counter static. No need to expose this globally since it's only used for core accounting. Signed-off-by: Paul Mundt --- drivers/sh/intc/core.c | 2 +- drivers/sh/intc/internals.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/sh/intc') diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c index e53e449b4eca..c64690dda4a0 100644 --- a/drivers/sh/intc/core.c +++ b/drivers/sh/intc/core.c @@ -35,7 +35,7 @@ LIST_HEAD(intc_list); DEFINE_RAW_SPINLOCK(intc_big_lock); -unsigned int nr_intc_controllers; +static unsigned int nr_intc_controllers; /* * Default priority level diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h index b0e9155ff739..422b72df089e 100644 --- a/drivers/sh/intc/internals.h +++ b/drivers/sh/intc/internals.h @@ -157,7 +157,6 @@ void _intc_enable(struct irq_data *data, unsigned long handle); /* core.c */ extern struct list_head intc_list; extern raw_spinlock_t intc_big_lock; -extern unsigned int nr_intc_controllers; extern struct bus_type intc_subsys; unsigned int intc_get_dfl_prio_level(void); -- cgit v1.2.3 From 5bbda4e4aca4591c85ee53dea157ca5fc9a23306 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 24 Jan 2012 14:54:10 +0900 Subject: sh: intc: Prefer IRQCHIP_SKIP_SET_WAKE over a dummy set_wake callback. It's possible to use IRQCHIP_SKIP_SET_WAKE to get the behaviour that we're after, without having to bother with a dummy ->set_wake() callback for the IRQ chip. Signed-off-by: Paul Mundt --- drivers/sh/intc/chip.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'drivers/sh/intc') diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c index 7b246efa94ea..3679645427c1 100644 --- a/drivers/sh/intc/chip.c +++ b/drivers/sh/intc/chip.c @@ -58,11 +58,6 @@ static void intc_disable(struct irq_data *data) } } -static int intc_set_wake(struct irq_data *data, unsigned int on) -{ - return 0; /* allow wakeup, but setup hardware in intc_suspend() */ -} - #ifdef CONFIG_SMP /* * This is held with the irq desc lock held, so we don't require any @@ -225,8 +220,8 @@ struct irq_chip intc_irq_chip = { .irq_disable = intc_disable, .irq_shutdown = intc_disable, .irq_set_type = intc_set_type, - .irq_set_wake = intc_set_wake, #ifdef CONFIG_SMP .irq_set_affinity = intc_set_affinity, #endif + .flags = IRQCHIP_SKIP_SET_WAKE, }; -- cgit v1.2.3 From 29775df10f02f614db870ff4acaf0b07dbed1547 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 24 Jan 2012 15:38:57 +0900 Subject: sh: intc: Kill off superfluous irq_shutdown hooking. This already gets handled via disable, as per the notes in linux/irq.h. Signed-off-by: Paul Mundt --- drivers/sh/intc/chip.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/sh/intc') diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c index 3679645427c1..d90cb7e43920 100644 --- a/drivers/sh/intc/chip.c +++ b/drivers/sh/intc/chip.c @@ -218,7 +218,6 @@ struct irq_chip intc_irq_chip = { .irq_mask_ack = intc_mask_ack, .irq_enable = intc_enable, .irq_disable = intc_disable, - .irq_shutdown = intc_disable, .irq_set_type = intc_set_type, #ifdef CONFIG_SMP .irq_set_affinity = intc_set_affinity, -- cgit v1.2.3 From 30377642138aadeef35a31c2f90dba0b6fa7b91a Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 24 Jan 2012 16:55:57 +0900 Subject: sh: intc: Use IRQ_SET_MASK_OK_NOCOPY for intc_set_affinity. intc_set_affinity() updates the cpumask in place, so there's no need for the upper layer to do this itself. Signed-off-by: Paul Mundt --- drivers/sh/intc/chip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/sh/intc') diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c index d90cb7e43920..db10adf63dd7 100644 --- a/drivers/sh/intc/chip.c +++ b/drivers/sh/intc/chip.c @@ -73,7 +73,7 @@ static int intc_set_affinity(struct irq_data *data, cpumask_copy(data->affinity, cpumask); - return 0; + return IRQ_SET_MASK_OK_NOCOPY; } #endif -- cgit v1.2.3 From b59f9f9775e643435bba76e30e59e47c19c56dee Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 24 Jan 2012 17:41:55 +0900 Subject: sh: intc: optimize intc IRQ lookup This ensures that the sense/prio lists are sorted at registration time, enabling us to use a simple binary search for an optimized lookup (something that had been on the TODO for some time). Signed-off-by: Paul Mundt --- drivers/sh/intc/chip.c | 27 ++++++--------------------- drivers/sh/intc/core.c | 9 ++++++++- drivers/sh/intc/internals.h | 8 ++++++++ 3 files changed, 22 insertions(+), 22 deletions(-) (limited to 'drivers/sh/intc') diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c index db10adf63dd7..012df2676a26 100644 --- a/drivers/sh/intc/chip.c +++ b/drivers/sh/intc/chip.c @@ -2,13 +2,14 @@ * IRQ chip definitions for INTC IRQs. * * Copyright (C) 2007, 2008 Magnus Damm - * Copyright (C) 2009, 2010 Paul Mundt + * Copyright (C) 2009 - 2012 Paul Mundt * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. */ #include +#include #include #include "internals.h" @@ -117,28 +118,12 @@ static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp, unsigned int nr_hp, unsigned int irq) { - int i; - - /* - * this doesn't scale well, but... - * - * this function should only be used for cerain uncommon - * operations such as intc_set_priority() and intc_set_type() - * and in those rare cases performance doesn't matter that much. - * keeping the memory footprint low is more important. - * - * one rather simple way to speed this up and still keep the - * memory footprint down is to make sure the array is sorted - * and then perform a bisect to lookup the irq. - */ - for (i = 0; i < nr_hp; i++) { - if ((hp + i)->irq != irq) - continue; + struct intc_handle_int key; - return hp + i; - } + key.irq = irq; + key.handle = 0; - return NULL; + return bsearch(&key, hp, nr_hp, sizeof(*hp), intc_handle_int_cmp); } int intc_set_priority(unsigned int irq, unsigned int prio) diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c index c64690dda4a0..8e1fcd5e5f0d 100644 --- a/drivers/sh/intc/core.c +++ b/drivers/sh/intc/core.c @@ -2,7 +2,7 @@ * Shared interrupt handling code for IPR and INTC2 types of IRQs. * * Copyright (C) 2007, 2008 Magnus Damm - * Copyright (C) 2009, 2010 Paul Mundt + * Copyright (C) 2009 - 2012 Paul Mundt * * Based on intc2.c and ipr.c * @@ -31,6 +31,7 @@ #include #include #include +#include #include "internals.h" LIST_HEAD(intc_list); @@ -267,6 +268,9 @@ int __init register_intc_controller(struct intc_desc *desc) k += save_reg(d, k, hw->prio_regs[i].set_reg, smp); k += save_reg(d, k, hw->prio_regs[i].clr_reg, smp); } + + sort(d->prio, hw->nr_prio_regs, sizeof(*d->prio), + intc_handle_int_cmp, NULL); } if (hw->sense_regs) { @@ -277,6 +281,9 @@ int __init register_intc_controller(struct intc_desc *desc) for (i = 0; i < hw->nr_sense_regs; i++) k += save_reg(d, k, hw->sense_regs[i].reg, 0); + + sort(d->sense, hw->nr_sense_regs, sizeof(*d->sense), + intc_handle_int_cmp, NULL); } if (hw->subgroups) diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h index 422b72df089e..f034a979a16f 100644 --- a/drivers/sh/intc/internals.h +++ b/drivers/sh/intc/internals.h @@ -108,6 +108,14 @@ static inline void activate_irq(int irq) #endif } +static inline int intc_handle_int_cmp(const void *a, const void *b) +{ + const struct intc_handle_int *_a = a; + const struct intc_handle_int *_b = b; + + return _a->irq - _b->irq; +} + /* access.c */ extern unsigned long (*intc_reg_fns[])(unsigned long addr, unsigned long h, unsigned long data); -- cgit v1.2.3 From b448d6adf733cc130339685531940f28902f2b75 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Thu, 29 Mar 2012 00:28:19 +0900 Subject: sh: intc: Fix up section mismatch for intc_ack_data intc_ack_data is flagged as __init when it shouldn't be, causing section mismatches in non-init paths like intc_set_ack_handle(): WARNING: drivers/built-in.o(.text+0x5d760): Section mismatch in reference from the function intc_set_ack_handle() to the function .init.text:intc_ack_data() The function intc_set_ack_handle() references the function __init intc_ack_data(). This is often because intc_set_ack_handle lacks a __init annotation or the annotation of intc_ack_data is wrong. Reported-by: Kuninori Morimoto Signed-off-by: Paul Mundt --- drivers/sh/intc/handle.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/sh/intc') diff --git a/drivers/sh/intc/handle.c b/drivers/sh/intc/handle.c index 057ce56829bf..d80799f111df 100644 --- a/drivers/sh/intc/handle.c +++ b/drivers/sh/intc/handle.c @@ -172,9 +172,8 @@ intc_get_prio_handle(struct intc_desc *desc, struct intc_desc_int *d, return 0; } -static unsigned int __init intc_ack_data(struct intc_desc *desc, - struct intc_desc_int *d, - intc_enum enum_id) +static unsigned int intc_ack_data(struct intc_desc *desc, + struct intc_desc_int *d, intc_enum enum_id) { struct intc_mask_reg *mr = desc->hw.ack_regs; unsigned int i, j, fn, mode; -- cgit v1.2.3