linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/16] irqchip: Add RDA8810PL interrupt driver
Date: Tue, 20 Nov 2018 08:10:27 +0000	[thread overview]
Message-ID: <86r2fgrwy4.wl-marc.zyngier@arm.com> (raw)
In-Reply-To: <20181120031958.GB5885@Mani-XPS-13-9360>

[dropping the @rdamicro.com addresses, as they bounce...]

On Tue, 20 Nov 2018 03:19:58 +0000,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> wrote:
> 
> Hi Marc,
> 
> Thanks for the quick review!
> 
> On Mon, Nov 19, 2018 at 05:36:49PM +0000, Marc Zyngier wrote:
> > Manivannan,
> > 
> > On 19/11/2018 17:09, Manivannan Sadhasivam wrote:

> > > +static int rda_intc_set_type(struct irq_data *data, unsigned int flow_type)
> > > +{
> > > +	if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))
> > > +		irq_set_handler(data->irq, handle_edge_irq);
> > > +	if (flow_type & (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW))
> > > +		irq_set_handler(data->irq, handle_level_irq);
> > 
> > So you don't need to set anything in your interrupt controller for this
> > to switch between level and edge? That'd be a first...
> >
> 
> Interrupt controller can only handle level triggered interrupts. Should
> I just remove irq_set_type callback itself?

No, keep it, but return -EINVAL on anything that doesn't match what
the controller actually supports.

> 
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +struct irq_domain *rda_irq_domain;
> > 
> > static?
> > 
> 
> Ack.
> 
> > > +
> > > +static void __exception_irq_entry rda_handle_irq(struct pt_regs *regs)
> > > +{
> > > +	u32 stat = readl(base + RDA_INTC_FINALSTATUS);
> > > +	u32 hwirq;
> > > +
> > > +	while (stat) {
> > > +		hwirq = __fls(stat);
> > > +		handle_domain_irq(rda_irq_domain, hwirq, regs);
> > > +		stat &= ~(1 << hwirq);
> > > +	}
> > > +}
> > > +
> > > +static struct irq_chip rda_irq_chip = {
> > > +	.name		= "rda-intc",
> > > +	.irq_ack	= rda_intc_mask_irq,
> > 
> > You're joking, right? What does it mean to implement both ack as mask
> > when you already have mask?
> > 
> 
> Right, but I just followed what other drivers were doing (irq-sa11x0). Will
> remove it.

As usual, seeing something in another driver doesn't mean it is
right. Also, StrongARM is an interesting piece of history, and taking
inspiration from it is mostly a bad idea.

[...]

> > > +static int __init rda8810_intc_init(struct device_node *node,
> > > +				    struct device_node *parent)
> > > +{
> > > +	base = of_io_request_and_map(node, 0, "rda-intc");
> > > +	if (!base)
> > > +		return -ENXIO;
> > > +	/*
> > > +	 * Mask, and invalid all interrupt sources
> > > +	 */
> > > +	writel(RDA_IRQ_MASK_ALL, base + RDA_INTC_MASK_CLR);
> > > +
> > > +	rda_irq_domain = irq_domain_create_linear(&node->fwnode, RDA_NR_IRQS,
> > > +						  &rda_irq_domain_ops, base);
> > > +	WARN_ON(!rda_irq_domain);
> > 
> > Just WARN_ON(), and carry on? Please implement some error handling.
> > 
> 
> Sure. Which one would you recommend? Panic or returning -ENXIO?

Don't leak the IO space, return -ENOMEM.

Thanks,

	M.

-- 
Jazz is not dead, it just smell funny.

  reply	other threads:[~2018-11-20  8:10 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19 17:09 [PATCH 00/16] Add initial RDA8810PL SoC and Orange Pi boards support Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 01/16] dt-bindings: Add RDA Micro vendor prefix Manivannan Sadhasivam
2018-11-19 17:22   ` Andreas Färber
2018-11-19 17:29     ` Manivannan Sadhasivam
2018-11-20  2:51       ` Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 02/16] dt-bindings: arm: Document RDA8810PL and reference boards Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 03/16] ARM: Prepare RDA8810PL SoC Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 04/16] arm: dts: Add devicetree for " Manivannan Sadhasivam
2018-11-19 18:25   ` Rob Herring
2018-11-20 19:31     ` Manivannan Sadhasivam
2018-11-19 19:37   ` Arnd Bergmann
2018-11-20 19:32     ` Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 05/16] arm: dts: Add devicetree for OrangePi 2G IoT board Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 06/16] arm: dts: Add devicetree for OrangePi i96 board Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 07/16] dt-bindings: interrupt-controller: Document RDA8810PL intc Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 08/16] arm: dts: rda8810pl: Add interrupt controller support Manivannan Sadhasivam
2018-11-19 18:29   ` Rob Herring
2018-11-20 19:28     ` Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 09/16] irqchip: Add RDA8810PL interrupt driver Manivannan Sadhasivam
2018-11-19 17:36   ` Marc Zyngier
2018-11-20  3:19     ` Manivannan Sadhasivam
2018-11-20  8:10       ` Marc Zyngier [this message]
2018-11-19 17:09 ` [PATCH 10/16] dt-bindings: timer: Document RDA8810PL SoC timer Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 11/16] arm: dts: rda8810pl: Add timer support Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 12/16] clocksource: Add clock driver for RDA8810PL SoC Manivannan Sadhasivam
2018-11-19 17:57   ` Marc Zyngier
2018-11-20  5:06     ` Manivannan Sadhasivam
2018-11-20  8:16       ` Marc Zyngier
2018-11-20  8:56         ` Linus Walleij
2018-11-20 11:05           ` Marc Zyngier
2018-11-20 12:09             ` Manivannan Sadhasivam
2018-11-20 10:32   ` Daniel Lezcano
2018-11-20 12:11     ` Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 13/16] dt-bindings: serial: Document RDA Micro UART Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 14/16] arm: dts: rda8810pl: Add interrupt support for UART Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 15/16] tty: serial: Add RDA8810PL UART driver Manivannan Sadhasivam
2018-11-19 17:09 ` [PATCH 16/16] MAINTAINERS: Add entry for RDA Micro SoC architecture Manivannan Sadhasivam

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=86r2fgrwy4.wl-marc.zyngier@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).