From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Bresticker Subject: Re: [PATCH v2 14/16] irqchip: mips-gic: Support local interrupts Date: Fri, 5 Sep 2014 14:50:02 -0700 Message-ID: References: <1409938218-9026-1-git-send-email-abrestic@chromium.org> <1409938218-9026-15-git-send-email-abrestic@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Thomas Gleixner Cc: Ralf Baechle , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Jason Cooper , Jeffrey Deans , Markos Chandras , Paul Burton , Arnd Bergmann , John Crispin , David Daney , Linux-MIPS , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" List-Id: devicetree@vger.kernel.org On Fri, Sep 5, 2014 at 12:05 PM, Thomas Gleixner wrote: > On Fri, 5 Sep 2014, Andrew Bresticker wrote: >> static void gic_mask_irq(struct irq_data *d) >> { >> - GIC_CLR_INTR_MASK(d->irq - gic_irq_base); >> + unsigned int irq = d->irq - gic_irq_base; >> + >> + if (gic_is_local_irq(irq)) { >> + GICWRITE(GIC_REG(VPE_LOCAL, GIC_VPE_RMASK), >> + 1 << GIC_INTR_BIT(gic_hw_to_local_irq(irq))); >> + } else { >> + GIC_CLR_INTR_MASK(irq); >> + } >> } >> >> static void gic_unmask_irq(struct irq_data *d) >> { >> - GIC_SET_INTR_MASK(d->irq - gic_irq_base); >> + unsigned int irq = d->irq - gic_irq_base; >> + >> + if (gic_is_local_irq(irq)) { >> + GICWRITE(GIC_REG(VPE_LOCAL, GIC_VPE_SMASK), >> + 1 << GIC_INTR_BIT(gic_hw_to_local_irq(irq))); >> + } else { >> + GIC_SET_INTR_MASK(irq); >> + } > > Why are you adding a conditional in all these functions instead of > having two interrupt chips with separate callbacks and irqdata? Ok, I'll use a separate irqchip. > And looking at GIC_SET_INTR_MASK(irq) makes me shudder even more. The > whole thing can be replaced with the generic interrupt chip functions. > > If you set it up proper, then there is not a single conditional or > runtime calculation of bitmasks, address offsets etc. Yes, I'd like to use the generic irqchip library here, but Malta and SEAD-3 will need to be converted over to using irq domains. Perhaps I'll do that first - it should get rid of a lot of the other ugliness here as well. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html