[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160307190705.GA27101@svinekod>
Date: Mon, 7 Mar 2016 19:07:06 +0000
From: Mark Rutland <mark.rutland@....com>
To: Iyappan Subramanian <isubramanian@....com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, toanle@....com,
patches@....com, linux-arm-kernel@...ts.infradead.org,
marc.zyngier@....com
Subject: Re: [PATCH 1/2] drivers: net: xgene: fix: Derive prefetch number
from irq
On Tue, Mar 08, 2016 at 09:49:36PM -0800, Iyappan Subramanian wrote:
> Prefetch buffer numbers are mapped to hardware irqs. Currently
> they are statically assigned to match with firmware irqs.
>
> If the irq on firmware changes, prefetch buffer number on the driver
> also needs to be updated to match with the firmware.
>
> This patch removes this static association between firmware and the
> driver by deriving the prefetch buffer number from the Linux irq.
This driver should neither care about the Linux IRQ number nor the interrupt
controller's physical IRQ number. Neither of the two are properties of the
device.
What you actually care about is the index of the interrupt pin _out_ of the
device, not _into_ the interrupt controller. As with other drivers, that should
described explicitly in the device binding. Either the interrupts should be
listed in a fixed order, or they should be given names.
> +static u8 xgene_start_cpu_bufnum(struct xgene_enet_pdata *pdata)
> +{
> + struct irq_desc *desc;
> + int hwirq;
> +
> + desc = irq_to_desc(pdata->irqs[0]);
> + hwirq = desc->irq_data.hwirq;
> +
> + return hwirq - XGENE2_RM0_START_IRQ;
> +}
No device driver should be doing this.
Mark.
Powered by blists - more mailing lists