[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_JsqK_69+4ZXrg78xf2apvvt_VRHquR2ThjOGkyQZKz655gg@mail.gmail.com>
Date: Mon, 9 Oct 2023 07:10:54 -0500
From: Rob Herring <robh@...nel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc: Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Claudiu Beznea <claudiu.beznea@...on.dev>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] memory: Use device_get_match_data()
On Sun, Oct 8, 2023 at 6:33 AM Krzysztof Kozlowski
<krzysztof.kozlowski@...aro.org> wrote:
>
> On 07/10/2023 00:44, Rob Herring wrote:
> > Use preferred device_get_match_data() instead of of_match_device() to
> > get the driver match data. With this, adjust the includes to explicitly
> > include the correct headers.
> >
> > Signed-off-by: Rob Herring <robh@...nel.org>
> > ---
>
> ...
>
> > enum ccf_version {
> > CCF1,
> > @@ -172,14 +170,9 @@ static irqreturn_t ccf_irq(int irq, void *dev_id)
> > static int ccf_probe(struct platform_device *pdev)
> > {
> > struct ccf_private *ccf;
> > - const struct of_device_id *match;
> > u32 errinten;
> > int ret, irq;
> >
> > - match = of_match_device(ccf_matches, &pdev->dev);
> > - if (WARN_ON(!match))
> > - return -ENODEV;
> > -
> > ccf = devm_kzalloc(&pdev->dev, sizeof(*ccf), GFP_KERNEL);
> > if (!ccf)
> > return -ENOMEM;
> > @@ -189,7 +182,7 @@ static int ccf_probe(struct platform_device *pdev)
> > return PTR_ERR(ccf->regs);
> >
> > ccf->dev = &pdev->dev;
> > - ccf->info = match->data;
> > + ccf->info = device_get_match_data(&pdev->dev);
>
> This part is no equivalent. You miss here if (WARN_ON(!ccf->info)).
Checking for match failed was pointless. We already matched in order
to probe and DT is the only way we match.
Rob
Powered by blists - more mailing lists