Re: [PATCH v4 03/10] irqchip/sun6i-r: Use a stacked irqchip driver

From: Marc Zyngier
Date: Thu Jan 14 2021 - 16:06:46 EST


Hi Samuel,

On 2021-01-12 05:59, Samuel Holland wrote:

[...]

> +static void sun6i_r_intc_ack_nmi(void)
> +{
> + writel(SUN6I_NMI_BIT, base + SUN6I_IRQ_PENDING(0));

writel_relaxed()

> +}
> +
> +static void sun6i_r_intc_nmi_ack(struct irq_data *data)
> +{
> + if (irqd_get_trigger_type(data) & IRQ_TYPE_EDGE_BOTH)
> + sun6i_r_intc_ack_nmi();
> + else
> + data->chip_data = SUN6I_NMI_NEEDS_ACK;
> +}
> +
> +static void sun6i_r_intc_nmi_eoi(struct irq_data *data)
> +{
> + /* For oneshot IRQs, delay the ack until the IRQ is unmasked. */
> + if (data->chip_data == SUN6I_NMI_NEEDS_ACK && !irqd_irq_masked(data))
> {
> + sun6i_r_intc_ack_nmi();
> + data->chip_data = 0;

nit: NULL rather than 0?

[...]

> +static struct irq_chip sun6i_r_intc_nmi_chip = {
> + .name = "sun6i-r-intc",
> + .irq_ack = sun6i_r_intc_nmi_ack,
> + .irq_mask = irq_chip_mask_parent,
> + .irq_unmask = sun6i_r_intc_nmi_unmask,
> + .irq_eoi = sun6i_r_intc_nmi_eoi,
> + .irq_set_affinity = irq_chip_set_affinity_parent,
> + .irq_set_type = sun6i_r_intc_nmi_set_type,
> + .irq_set_irqchip_state = sun6i_r_intc_nmi_set_irqchip_state,

You probably also want to wire irq_get_irqchip_state(), while
you're at it.

Otherwise, looks pretty good now.

Thanks,

M.

--
Without deviation from the norm, progress is not possible.