[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y24ykug8.wl-maz@kernel.org>
Date: Mon, 06 Dec 2021 08:29:11 +0000
From: Marc Zyngier <maz@...nel.org>
To: Shawn Guo <shawn.guo@...aro.org>
Cc: Florian Fainelli <f.fainelli@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Maulik Shah <quic_mkshah@...cinc.com>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Loic Poulain <loic.poulain@...aro.org>,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
Claudiu Beznea <claudiu.beznea@...rochip.com>,
Neil Armstrong <narmstrong@...libre.com>
Subject: Re: [PATCH v3 1/3] irqchip: Pass platform_device pointer to init_cb
On Mon, 06 Dec 2021 06:40:05 +0000,
Shawn Guo <shawn.guo@...aro.org> wrote:
>
> On Thu, Dec 02, 2021 at 07:10:04PM +0000, Marc Zyngier wrote:
> > On 2021-12-02 17:52, Florian Fainelli wrote:
> > > On 12/2/21 4:21 AM, Shawn Guo wrote:
> > > > It makes sense to just pass device_node for callback in
> > > > IRQCHIP_DECLARE
> > > > case, but not so much for IRQCHIP_PLATFORM_DRIVER one, because
> > > > platform_driver probe/init usually needs device pointer for various
> > > > purposes, e.g. resource allocation, service request, device prefixed
> > > > message output, etc. Create a new callback type irqchip_init_cb_t
> > > > which
> > > > takes platform_device pointer as parameter, and update the existing
> > > > IRQCHIP_PLATFORM_DRIVER users accordingly.
> > > >
> > > > Cc: Florian Fainelli <f.fainelli@...il.com>
> > > > Cc: Claudiu Beznea <claudiu.beznea@...rochip.com>
> > > > Cc: Neil Armstrong <narmstrong@...libre.com>
> > > > Signed-off-by: Shawn Guo <shawn.guo@...aro.org>
> > >
> > > Could you copy all recipients on all 3 patches plus your cover letter
> > > next time so we have the full context? Thanks!
> > >
> > > [snip]
> > >
> > > >
> > > > -static int __init bcm7120_l2_intc_probe_7120(struct device_node *dn,
> > > > +static int __init bcm7120_l2_intc_probe_7120(struct platform_device
> > > > *pdev,
> > > > struct device_node *parent)
> > > > {
> > > > - return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_7120,
> > > > + return bcm7120_l2_intc_probe(pdev->dev.of_node, parent,
> > > > + bcm7120_l2_intc_iomap_7120,
> > > > "BCM7120 L2");
> > >
> > > If you look further into that driver, you will see that we do something
> > > like this in bcm7120_l2_intc_probe:
> > >
> > > pdev = of_find_device_by_node(dn);
> > > if (!pdev) {
> > > ret = -ENODEV;
> > > goto out_free_data;
> > > }
> > >
> > > which would be completely superfluous now that we pass a platform_device
> > > directly. Can you rework your patch so as to eliminate that
> > > of_find_device_by_ndoe() (and the companion put_device call)?
> >
> > Or just adopt the same construct in the MPM driver. At this stage, drivers
> > requiring a platform_device are the minority.
>
> Marc,
>
> I need to ensure I understand you comment. Are you suggesting that I
> keep IRQCHIP_MATCH() unchanged, and go back to the MPM driver
> construction I used in v2?
No. I suggest that you leave the irqchip API as is (i.e. drop this
patch) and use of_find_device_by_node() in the MPM driver, just like
the Broadcom driver does. This should be enough for your use case.
M.
--
Without deviation from the norm, progress is not possible.
Powered by blists - more mailing lists