linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC v1 10/25] sh: intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc
       [not found] <1432116013-25902-1-git-send-email-jiang.liu@linux.intel.com>
@ 2015-05-20  9:59 ` Jiang Liu
  2015-05-20 15:12   ` Thomas Gleixner
  2015-05-20 10:00 ` [RFC v1 19/25] genirq: Kill the first parameter 'irq' of irq_flow_handler_t Jiang Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Jiang Liu @ 2015-05-20  9:59 UTC (permalink / raw)
  To: Thomas Gleixner, Bjorn Helgaas, Benjamin Herrenschmidt,
	Ingo Molnar, H. Peter Anvin, Rafael J. Wysocki, Randy Dunlap,
	Yinghai Lu, Borislav Petkov, Simon Horman, Magnus Damm, Jiang Liu
  Cc: Konrad Rzeszutek Wilk, Tony Luck, x86, linux-kernel, linux-pci,
	linux-acpi, linux-sh

Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc while we
already have a pointer to corresponding irq_desc.

Also replace generic_handle_irq with generic_handle_irq_desc() to avoid
looking up irq_desc again.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
 drivers/sh/intc/core.c |    2 +-
 drivers/sh/intc/virq.c |   14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 81f22980b2de..e4ca964ca840 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -67,7 +67,7 @@ void intc_set_prio_level(unsigned int irq, unsigned int level)
 
 static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
 {
-	generic_handle_irq((unsigned int)irq_get_handler_data(irq));
+	generic_handle_irq_desc(irq, desc);
 }
 
 static void __init intc_register_irq(struct intc_desc *desc,
diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
index 3dbc21696924..8083882a91c0 100644
--- a/drivers/sh/intc/virq.c
+++ b/drivers/sh/intc/virq.c
@@ -109,7 +109,7 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
 
 static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	struct intc_virq_list *entry, *vlist = irq_data_get_irq_handler_data(data);
 	struct intc_desc_int *d = get_intc_desc(irq);
@@ -118,12 +118,14 @@ static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
 
 	for_each_virq(entry, vlist) {
 		unsigned long addr, handle;
+		struct irq_desc *vdesc = irq_to_desc(entry->irq);
 
-		handle = (unsigned long)irq_get_handler_data(entry->irq);
-		addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
-
-		if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
-			generic_handle_irq(entry->irq);
+		if (vdesc) {
+			handle = (unsigned long)irq_desc_get_handler_data(vdesc);
+			addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
+			if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
+				generic_handle_irq_desc(entry->irq, vdesc);
+		}
 	}
 
 	chip->irq_unmask(data);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC v1 19/25] genirq: Kill the first parameter 'irq' of irq_flow_handler_t
       [not found] <1432116013-25902-1-git-send-email-jiang.liu@linux.intel.com>
  2015-05-20  9:59 ` [RFC v1 10/25] sh: intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc Jiang Liu
@ 2015-05-20 10:00 ` Jiang Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Jiang Liu @ 2015-05-20 10:00 UTC (permalink / raw)
  To: Thomas Gleixner, Bjorn Helgaas, Benjamin Herrenschmidt,
	Ingo Molnar, H. Peter Anvin, Rafael J. Wysocki, Randy Dunlap,
	Yinghai Lu, Borislav Petkov, Simon Horman, Magnus Damm,
	Kevin Cernekee, abdoulaye berthe, Jiang Liu
  Cc: Konrad Rzeszutek Wilk, Tony Luck, x86, linux-kernel, linux-pci,
	linux-acpi, linux-sh

Now most IRQ flow handlers make no use of the first parameter 'irq'.
And for those who do make use of 'irq', we could easily get the irq
number through irq_desc->irq_data->irq. So kill the first parameter
'irq' of irq_flow_handler_t.

To ease review, I have split the changes into several parts, though
they should be merge as one to support bisecting.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
 arch/sh/boards/mach-se/7343/irq.c  |    4 ++--
 arch/sh/boards/mach-se/7722/irq.c  |    3 ++-
 arch/sh/boards/mach-se/7724/irq.c  |    3 ++-
 arch/sh/boards/mach-x3proto/gpio.c |    4 ++--
 arch/sh/cchips/hd6446x/hd64461.c   |    2 +-
 drivers/sh/intc/core.c             |    4 ++--
 drivers/sh/intc/virq.c             |    5 +++--
 7 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/arch/sh/boards/mach-se/7343/irq.c b/arch/sh/boards/mach-se/7343/irq.c
index 1087dba9b015..6129aef6db76 100644
--- a/arch/sh/boards/mach-se/7343/irq.c
+++ b/arch/sh/boards/mach-se/7343/irq.c
@@ -29,9 +29,9 @@
 static void __iomem *se7343_irq_regs;
 struct irq_domain *se7343_irq_domain;
 
-static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc)
+static void se7343_irq_demux(struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int bit;
diff --git a/arch/sh/boards/mach-se/7722/irq.c b/arch/sh/boards/mach-se/7722/irq.c
index 00e699232621..7200d595fe68 100644
--- a/arch/sh/boards/mach-se/7722/irq.c
+++ b/arch/sh/boards/mach-se/7722/irq.c
@@ -28,8 +28,9 @@
 static void __iomem *se7722_irq_regs;
 struct irq_domain *se7722_irq_domain;
 
-static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
+static void se7722_irq_demux(struct irq_desc *desc)
 {
+	unsigned int irq = irq_desc_get_irq(desc);
 	struct irq_data *data = irq_get_irq_data(irq);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
diff --git a/arch/sh/boards/mach-se/7724/irq.c b/arch/sh/boards/mach-se/7724/irq.c
index 5d1d3ec9a6cd..64e681e66c57 100644
--- a/arch/sh/boards/mach-se/7724/irq.c
+++ b/arch/sh/boards/mach-se/7724/irq.c
@@ -92,8 +92,9 @@ static struct irq_chip se7724_irq_chip __read_mostly = {
 	.irq_unmask	= enable_se7724_irq,
 };
 
-static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc)
+static void se7724_irq_demux(struct irq_desc *desc)
 {
+	unsigned int irq = irq_desc_get_irq(desc);
 	struct fpga_irq set = get_fpga_irq(irq);
 	unsigned short intv = __raw_readw(set.sraddr);
 	unsigned int ext_irq = set.base;
diff --git a/arch/sh/boards/mach-x3proto/gpio.c b/arch/sh/boards/mach-x3proto/gpio.c
index f035a7ac6456..1fb2cbee25f2 100644
--- a/arch/sh/boards/mach-x3proto/gpio.c
+++ b/arch/sh/boards/mach-x3proto/gpio.c
@@ -60,9 +60,9 @@ static int x3proto_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
 	return virq;
 }
 
-static void x3proto_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
+static void x3proto_gpio_irq_handler(struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int pin;
diff --git a/arch/sh/cchips/hd6446x/hd64461.c b/arch/sh/cchips/hd6446x/hd64461.c
index e9735616bdc8..8180092502f7 100644
--- a/arch/sh/cchips/hd6446x/hd64461.c
+++ b/arch/sh/cchips/hd6446x/hd64461.c
@@ -56,7 +56,7 @@ static struct irq_chip hd64461_irq_chip = {
 	.irq_unmask	= hd64461_unmask_irq,
 };
 
-static void hd64461_irq_demux(unsigned int irq, struct irq_desc *desc)
+static void hd64461_irq_demux(struct irq_desc *desc)
 {
 	unsigned short intv = __raw_readw(HD64461_NIRR);
 	unsigned int ext_irq = HD64461_IRQBASE;
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index e4ca964ca840..8c75e7c2c9b3 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -65,9 +65,9 @@ void intc_set_prio_level(unsigned int irq, unsigned int level)
 	raw_spin_unlock_irqrestore(&intc_big_lock, flags);
 }
 
-static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
+static void intc_redirect_irq(struct irq_desc *desc)
 {
-	generic_handle_irq_desc(irq, desc);
+	generic_handle_irq_desc(desc);
 }
 
 static void __init intc_register_irq(struct intc_desc *desc,
diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
index 8083882a91c0..49ffc8d5cb00 100644
--- a/drivers/sh/intc/virq.c
+++ b/drivers/sh/intc/virq.c
@@ -107,8 +107,9 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
 	return 0;
 }
 
-static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
+static void intc_virq_handler(struct irq_desc *desc)
 {
+	unsigned int irq = irq_desc_get_irq(desc);
 	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	struct intc_virq_list *entry, *vlist = irq_data_get_irq_handler_data(data);
@@ -124,7 +125,7 @@ static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
 			handle = (unsigned long)irq_desc_get_handler_data(vdesc);
 			addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
 			if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
-				generic_handle_irq_desc(entry->irq, vdesc);
+				generic_handle_irq_desc(vdesc);
 		}
 	}
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC v1 10/25] sh: intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc
  2015-05-20  9:59 ` [RFC v1 10/25] sh: intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc Jiang Liu
@ 2015-05-20 15:12   ` Thomas Gleixner
  2015-05-20 15:24     ` Jiang Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2015-05-20 15:12 UTC (permalink / raw)
  To: Jiang Liu
  Cc: Bjorn Helgaas, Benjamin Herrenschmidt, Ingo Molnar,
	H. Peter Anvin, Rafael J. Wysocki, Randy Dunlap, Yinghai Lu,
	Borislav Petkov, Simon Horman, Magnus Damm, Konrad Rzeszutek Wilk,
	Tony Luck, x86, linux-kernel, linux-pci, linux-acpi, linux-sh

On Wed, 20 May 2015, Jiang Liu wrote:

> Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc while we
> already have a pointer to corresponding irq_desc.
> 
> Also replace generic_handle_irq with generic_handle_irq_desc() to avoid
> looking up irq_desc again.
> 
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> ---
>  drivers/sh/intc/core.c |    2 +-
>  drivers/sh/intc/virq.c |   14 ++++++++------
>  2 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
> index 81f22980b2de..e4ca964ca840 100644
> --- a/drivers/sh/intc/core.c
> +++ b/drivers/sh/intc/core.c
> @@ -67,7 +67,7 @@ void intc_set_prio_level(unsigned int irq, unsigned int level)
>  
>  static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
>  {
> -	generic_handle_irq((unsigned int)irq_get_handler_data(irq));
> +	generic_handle_irq_desc(irq, desc);

This looks wrong. It's a redirector of irq to some other irq.

     	redir_irq = (unsigned int)irq_get_handler_data(irq);

which should be:

        redir_irq = (unsigned int)irq_desc_get_irq_handler_data(desc);

And redir_irq is certainly not the same as irq. So this wants a
conversion to irq_desc_get_irq_handler_data() first. That makes the
irq argument unused.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC v1 10/25] sh: intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc
  2015-05-20 15:12   ` Thomas Gleixner
@ 2015-05-20 15:24     ` Jiang Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Jiang Liu @ 2015-05-20 15:24 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Bjorn Helgaas, Benjamin Herrenschmidt, Ingo Molnar,
	H. Peter Anvin, Rafael J. Wysocki, Randy Dunlap, Yinghai Lu,
	Borislav Petkov, Simon Horman, Magnus Damm, Konrad Rzeszutek Wilk,
	Tony Luck, x86, linux-kernel, linux-pci, linux-acpi, linux-sh

On 2015/5/20 23:12, Thomas Gleixner wrote:
> On Wed, 20 May 2015, Jiang Liu wrote:
> 
>> Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc while we
>> already have a pointer to corresponding irq_desc.
>>
>> Also replace generic_handle_irq with generic_handle_irq_desc() to avoid
>> looking up irq_desc again.
>>
>> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
>> ---
>>  drivers/sh/intc/core.c |    2 +-
>>  drivers/sh/intc/virq.c |   14 ++++++++------
>>  2 files changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
>> index 81f22980b2de..e4ca964ca840 100644
>> --- a/drivers/sh/intc/core.c
>> +++ b/drivers/sh/intc/core.c
>> @@ -67,7 +67,7 @@ void intc_set_prio_level(unsigned int irq, unsigned int level)
>>  
>>  static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
>>  {
>> -	generic_handle_irq((unsigned int)irq_get_handler_data(irq));
>> +	generic_handle_irq_desc(irq, desc);
> 
> This looks wrong. It's a redirector of irq to some other irq.
> 
>      	redir_irq = (unsigned int)irq_get_handler_data(irq);
> 
> which should be:
> 
>         redir_irq = (unsigned int)irq_desc_get_irq_handler_data(desc);
> 
> And redir_irq is certainly not the same as irq. So this wants a
> conversion to irq_desc_get_irq_handler_data() first. That makes the
> irq argument unused.

Good catch, will fix it in next version.

> 
> Thanks,
> 
> 	tglx
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-20 15:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1432116013-25902-1-git-send-email-jiang.liu@linux.intel.com>
2015-05-20  9:59 ` [RFC v1 10/25] sh: intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc Jiang Liu
2015-05-20 15:12   ` Thomas Gleixner
2015-05-20 15:24     ` Jiang Liu
2015-05-20 10:00 ` [RFC v1 19/25] genirq: Kill the first parameter 'irq' of irq_flow_handler_t Jiang Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).