Re: [patch V2 04/46] genirq/chip: Use the first chip in irq_chip_compose_msi_msg()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 26 Aug 2020 22:19:56 +0100,
Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> 
> On Wed, Aug 26 2020 at 20:50, Marc Zyngier wrote:
> > On Wed, 26 Aug 2020 12:16:32 +0100,
> > Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> >> ---
> >> V2: New patch. Note, that this might break other stuff which relies on the
> >>     current behaviour, but the hierarchy composition of DT based chips is
> >>     really hard to follow.
> >

[...]

> What about the below?
> 
> Thanks,
> 
>         tglx
> ---
> --- a/kernel/irq/internals.h
> +++ b/kernel/irq/internals.h
> @@ -473,6 +473,15 @@ static inline void irq_domain_deactivate
>  }
>  #endif
>  
> +static inline struct irq_data *irqd_get_parent_data(struct irq_data *irqd)
> +{
> +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
> +	return irqd->parent_data;
> +#else
> +	return NULL;
> +#endif
> +}
> +

We obviously should have had this forever.

>  #ifdef CONFIG_GENERIC_IRQ_DEBUGFS
>  #include <linux/debugfs.h>
>  
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -1541,18 +1541,17 @@ EXPORT_SYMBOL_GPL(irq_chip_release_resou
>   */
>  int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
>  {
> -	struct irq_data *pos = NULL;
> +	struct irq_data *pos;
>  
> -#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
> -	for (; data; data = data->parent_data)
> -#endif
> +	for (pos = NULL; !pos && data; data = irqd_get_parent_data(data)) {
>  		if (data->chip && data->chip->irq_compose_msi_msg)
>  			pos = data;
> +	}
> +
>  	if (!pos)
>  		return -ENOSYS;
>  
>  	pos->chip->irq_compose_msi_msg(pos, msg);
> -
>  	return 0;
>  }

Perfect, ship it! ;-)

	M.

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



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux