[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200524185628.bfx4qefdr3eet22r@pengutronix.de>
Date: Sun, 24 May 2020 20:56:28 +0200
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Paul Cercueil <paul@...pouillou.net>
Cc: Thierry Reding <thierry.reding@...il.com>, od@...c.me,
linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] pwm: jz4740: Add support for the JZ4725B
Hello Paul,
On Sun, May 24, 2020 at 07:51:23PM +0200, Paul Cercueil wrote:
> Le dim. 24 mai 2020 à 19:37, Uwe Kleine-König
> <u.kleine-koenig@...gutronix.de> a écrit :
> > On Mon, Apr 13, 2020 at 02:14:45PM +0200, Paul Cercueil wrote:
> > > @@ -214,6 +218,7 @@ static int jz4740_pwm_probe(struct
> > > platform_device *pdev)
> > > {
> > > struct device *dev = &pdev->dev;
> > > struct jz4740_pwm_chip *jz4740;
> > > + const struct soc_info *info = device_get_match_data(dev);
> > >
> > > jz4740 = devm_kzalloc(dev, sizeof(*jz4740), GFP_KERNEL);
> > > if (!jz4740)
> > > @@ -227,8 +232,8 @@ static int jz4740_pwm_probe(struct
> > > platform_device *pdev)
> > >
> > > jz4740->chip.dev = dev;
> > > jz4740->chip.ops = &jz4740_pwm_ops;
> > > - jz4740->chip.npwm = NUM_PWM;
> > > jz4740->chip.base = -1;
> > > + jz4740->chip.npwm = info ? info->num_pwms : NUM_PWM;
> >
> > Can info be actually NULL? I don't think so, so you can just use
> > info->num_pwms here and drop the definition of NUM_PWM.
>
> In *theory* it can be NULL if the kernel is configured without CONFIG_OF,
> which will never happen on any board supported by this driver. I can add a
> dependency on CONFIG_OF in V2, then use info->num_pwms there.
I'd prefer just something like:
if (!info)
return -EINVAL;
instead of a dependency on CONFIG_OF.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
Powered by blists - more mailing lists