linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Lennert Buytenhek <buytenh@wantstofly.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Thomas Gleixner <tglx@linutronix.de>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 01/28] powerpc: mpic irq_data conversion.
Date: Wed, 9 Mar 2011 08:33:09 +0100	[thread overview]
Message-ID: <20110309073309.GL16649@mail.wantstofly.org> (raw)
In-Reply-To: <1299640975.22236.263.camel@pasglop>

On Wed, Mar 09, 2011 at 02:22:55PM +1100, Benjamin Herrenschmidt wrote:

> > -static void mpic_unmask_ht_irq(unsigned int irq)
> > +static void mpic_unmask_ht_irq(struct irq_data *d)
> >  {
> > -	struct mpic *mpic = mpic_from_irq(irq);
> > -	unsigned int src = mpic_irq_to_hw(irq);
> > +	struct mpic *mpic = mpic_from_irq(d->irq);
> > +	unsigned int src = mpic_irq_to_hw(d->irq);
> 
> It's a bit sad to have a pointerm turn it back to a irq number,
> look it up just to get back the chip data in there :-)

ACK, how about the below?


> Either we should create an mpic_from_irqdata() which itself uses
> irq_data_get_irq_chip_data() or just change mpic_from_irq() if we
> decide we can always call it with "data" instead of "irq"

There's one site left that needs to go from virq to mpic, so I've
done the former.


> > -	mpic_unmask_irq(irq);
> > +	mpic_unmask_irq(d);
> >  
> > -	if (irq_to_desc(irq)->status & IRQ_LEVEL)
> > +	if (irq_to_desc(d->irq)->status & IRQ_LEVEL)
> >  		mpic_ht_end_irq(mpic, src);
> >  }
> 
> Do we really need that gymnastic to get to desc->status from irq_data ?
> 
> Again, we're going back to a number and then looking it up again... bad.
> 
> I don't see off hand a data -> desc accessor, but it also looks like it
> should be trivial to add. Thomas, what do you reckon ?

It really shouldn't be looking at the desc at all.

This should help, as we only look at IRQ_LEVEL here:

	http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-tip.git;a=commitdiff;h=876dbd4cc1b35c1a4cb96a2be1d43ea0eabce3b4


cheers,
Lennert


diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 95712f6..eb70218 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -648,6 +648,12 @@ static inline struct mpic * mpic_from_irq(unsigned int irq)
 	return get_irq_chip_data(irq);
 }
 
+/* Get the mpic structure from the irq data */
+static inline struct mpic * mpic_from_irq_data(struct irq_data *d)
+{
+	return irq_data_get_irq_chip_data(d);
+}
+
 /* Send an EOI */
 static inline void mpic_eoi(struct mpic *mpic)
 {
@@ -663,7 +669,7 @@ static inline void mpic_eoi(struct mpic *mpic)
 void mpic_unmask_irq(struct irq_data *d)
 {
 	unsigned int loops = 100000;
-	struct mpic *mpic = mpic_from_irq(d->irq);
+	struct mpic *mpic = mpic_from_irq_data(d);
 	unsigned int src = mpic_irq_to_hw(d->irq);
 
 	DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, d->irq, src);
@@ -684,7 +690,7 @@ void mpic_unmask_irq(struct irq_data *d)
 void mpic_mask_irq(struct irq_data *d)
 {
 	unsigned int loops = 100000;
-	struct mpic *mpic = mpic_from_irq(d->irq);
+	struct mpic *mpic = mpic_from_irq_data(d);
 	unsigned int src = mpic_irq_to_hw(d->irq);
 
 	DBG("%s: disable_irq: %d (src %d)\n", mpic->name, d->irq, src);
@@ -705,7 +711,7 @@ void mpic_mask_irq(struct irq_data *d)
 
 void mpic_end_irq(struct irq_data *d)
 {
-	struct mpic *mpic = mpic_from_irq(d->irq);
+	struct mpic *mpic = mpic_from_irq_data(d);
 
 #ifdef DEBUG_IRQ
 	DBG("%s: end_irq: %d\n", mpic->name, d->irq);
@@ -722,7 +728,7 @@ void mpic_end_irq(struct irq_data *d)
 
 static void mpic_unmask_ht_irq(struct irq_data *d)
 {
-	struct mpic *mpic = mpic_from_irq(d->irq);
+	struct mpic *mpic = mpic_from_irq_data(d);
 	unsigned int src = mpic_irq_to_hw(d->irq);
 
 	mpic_unmask_irq(d);
@@ -733,7 +739,7 @@ static void mpic_unmask_ht_irq(struct irq_data *d)
 
 static unsigned int mpic_startup_ht_irq(struct irq_data *d)
 {
-	struct mpic *mpic = mpic_from_irq(d->irq);
+	struct mpic *mpic = mpic_from_irq_data(d);
 	unsigned int src = mpic_irq_to_hw(d->irq);
 
 	mpic_unmask_irq(d);
@@ -744,7 +750,7 @@ static unsigned int mpic_startup_ht_irq(struct irq_data *d)
 
 static void mpic_shutdown_ht_irq(struct irq_data *d)
 {
-	struct mpic *mpic = mpic_from_irq(d->irq);
+	struct mpic *mpic = mpic_from_irq_data(d);
 	unsigned int src = mpic_irq_to_hw(d->irq);
 
 	mpic_shutdown_ht_interrupt(mpic, src, irq_to_desc(d->irq)->status);
@@ -753,7 +759,7 @@ static void mpic_shutdown_ht_irq(struct irq_data *d)
 
 static void mpic_end_ht_irq(struct irq_data *d)
 {
-	struct mpic *mpic = mpic_from_irq(d->irq);
+	struct mpic *mpic = mpic_from_irq_data(d);
 	unsigned int src = mpic_irq_to_hw(d->irq);
 
 #ifdef DEBUG_IRQ
@@ -805,7 +811,7 @@ static void mpic_end_ipi(struct irq_data *d)
 int mpic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,
 		      bool force)
 {
-	struct mpic *mpic = mpic_from_irq(d->irq);
+	struct mpic *mpic = mpic_from_irq_data(d);
 	unsigned int src = mpic_irq_to_hw(d->irq);
 
 	if (mpic->flags & MPIC_SINGLE_DEST_CPU) {
@@ -851,7 +857,7 @@ static unsigned int mpic_type_to_vecpri(struct mpic *mpic, unsigned int type)
 
 int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type)
 {
-	struct mpic *mpic = mpic_from_irq(d->irq);
+	struct mpic *mpic = mpic_from_irq_data(d);
 	unsigned int src = mpic_irq_to_hw(d->irq);
 	struct irq_desc *desc = irq_to_desc(d->irq);
 	unsigned int vecpri, vold, vnew;

  reply	other threads:[~2011-03-09  7:33 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1299541392.git.buytenh@wantstofly.org>
2011-03-07 23:59 ` [PATCH 01/28] powerpc: mpic irq_data conversion Lennert Buytenhek
2011-03-08  4:13   ` Grant Likely
2011-03-08  4:51     ` Benjamin Herrenschmidt
2011-03-09  3:22   ` Benjamin Herrenschmidt
2011-03-09  7:33     ` Lennert Buytenhek [this message]
2011-03-09  7:51       ` Benjamin Herrenschmidt
2011-03-09  8:26         ` Lennert Buytenhek
2011-03-09  8:26   ` [PATCH v2 " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 02/28] powerpc: platforms/512x " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 03/28] powerpc: platforms/52xx " Lennert Buytenhek
2011-03-09  8:26   ` [PATCH v2 " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 04/28] powerpc: platforms/82xx " Lennert Buytenhek
2011-03-09  8:26   ` [PATCH v2 " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 05/28] powerpc: platforms/85xx " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 06/28] powerpc: platforms/86xx " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 07/28] powerpc: platforms/8xx " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 08/28] powerpc: platforms/cell " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 09/28] powerpc: platforms/chrp " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 10/28] powerpc: platforms/embedded6xx " Lennert Buytenhek
2011-03-09  8:26   ` [PATCH v2 " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 11/28] powerpc: platforms/iseries " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 12/28] powerpc: platforms/powermac " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 13/28] powerpc: platforms/ps3 " Lennert Buytenhek
2011-03-09  8:26   ` [PATCH v2 " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 14/28] powerpc: platforms/pseries " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 15/28] powerpc: sysdev/cpm1 " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 16/28] powerpc: sysdev/cpm2_pic " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 17/28] powerpc: sysdev/fsl_msi " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 18/28] powerpc: sysdev/i8259 " Lennert Buytenhek
2011-03-07 23:59 ` [PATCH 19/28] powerpc: sysdev/ipic " Lennert Buytenhek
2011-03-08  0:00 ` [PATCH 20/28] powerpc: sysdev/mpc8xx_pic " Lennert Buytenhek
2011-03-08  0:00 ` [PATCH 21/28] powerpc: sysdev/mpc8xxx_gpio " Lennert Buytenhek
2011-03-09  8:26   ` [PATCH v2 " Lennert Buytenhek
2011-03-16 21:25     ` Peter Korsgaard
2011-03-08  0:00 ` [PATCH 22/28] powerpc: sysdev/mv64x60_pic " Lennert Buytenhek
2011-03-08  0:00 ` [PATCH 23/28] powerpc: sysdev/qe_lib/qe_ic " Lennert Buytenhek
2011-03-09  8:27   ` [PATCH v2 " Lennert Buytenhek
2011-03-08  0:00 ` [PATCH 24/28] powerpc: sysdev/tsi108_pci " Lennert Buytenhek
2011-03-08  0:00 ` [PATCH 25/28] powerpc: sysdev/uic " Lennert Buytenhek
2011-03-09  8:27   ` [PATCH v2 " Lennert Buytenhek
2011-03-08  0:00 ` [PATCH 26/28] powerpc: sysdev/xilinx_intc " Lennert Buytenhek
2011-03-09  8:27   ` [PATCH v2 " Lennert Buytenhek
2011-03-08  0:00 ` [PATCH 27/28] powerpc: core " Lennert Buytenhek
2011-03-08  0:00 ` [PATCH 28/28] powerpc: Enable GENERIC_HARDIRQS_NO_DEPRECATED Lennert Buytenhek
2011-03-08  4:38   ` Grant Likely
2011-03-08  4:48     ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110309073309.GL16649@mail.wantstofly.org \
    --to=buytenh@wantstofly.org \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).