[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL_JsqKi8PXVqHgVxqMN+mbX8U-ZGsCMUFqbxmjeFmj1xKTrjw@mail.gmail.com>
Date: Mon, 9 Oct 2023 15:07:14 -0500
From: Rob Herring <robh@...nel.org>
To: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
Cc: Thierry Reding <thierry.reding@...il.com>,
Heiko Stuebner <heiko@...ech.de>, linux-pwm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org
Subject: Re: [PATCH] pwm: Use device_get_match_data()
On Mon, Oct 9, 2023 at 2:30 PM Uwe Kleine-König
<u.kleine-koenig@...gutronix.de> wrote:
>
> On Mon, Oct 09, 2023 at 12:29:16PM -0500, 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>
> > ---
> > drivers/pwm/pwm-img.c | 8 ++------
> > drivers/pwm/pwm-rockchip.c | 9 ++-------
> > 2 files changed, 4 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c
> > index 326af85888e7..e32b5e8c203d 100644
> > --- a/drivers/pwm/pwm-img.c
> > +++ b/drivers/pwm/pwm-img.c
> > @@ -13,9 +13,9 @@
> > #include <linux/mfd/syscon.h>
> > #include <linux/module.h>
> > #include <linux/of.h>
> > -#include <linux/of_device.h>
> > #include <linux/platform_device.h>
> > #include <linux/pm_runtime.h>
> > +#include <linux/property.h>
> > #include <linux/pwm.h>
> > #include <linux/regmap.h>
> > #include <linux/slab.h>
> > @@ -261,7 +261,6 @@ static int img_pwm_probe(struct platform_device *pdev)
> > u64 val;
> > unsigned long clk_rate;
> > struct img_pwm_chip *imgchip;
> > - const struct of_device_id *of_dev_id;
> >
> > imgchip = devm_kzalloc(&pdev->dev, sizeof(*imgchip), GFP_KERNEL);
> > if (!imgchip)
> > @@ -273,10 +272,7 @@ static int img_pwm_probe(struct platform_device *pdev)
> > if (IS_ERR(imgchip->base))
> > return PTR_ERR(imgchip->base);
> >
> > - of_dev_id = of_match_device(img_pwm_of_match, &pdev->dev);
> > - if (!of_dev_id)
> > - return -ENODEV;
> > - imgchip->data = of_dev_id->data;
> > + imgchip->data = device_get_match_data(&pdev->dev);
>
> Is this a semantical change? If there is a match, the code is
> equivalent. Otherwise it was:
>
> return -ENODEV;
>
> before and now it's
>
> imgchip->data = NULL;
>
> isn't it?
As this driver only does DT matching, then of_match_device will never
return NULL if we've gotten to probe().
Will update the commit log.
Rob
Powered by blists - more mailing lists