From: Paul Cercueil <paul@crapouillou.net>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-pwm@vger.kernel.org, kernel@pengutronix.de,
Thierry Reding <thierry.reding@gmail.com>,
linux-mips@vger.kernel.org
Subject: Re: [PATCH 3/8] pwm: jz4740: Put per-channel clk into driver data
Date: Fri, 30 Jun 2023 00:55:29 +0200 [thread overview]
Message-ID: <HCE1XR.D74206DFB5G5@crapouillou.net> (raw)
In-Reply-To: <20230629140745.fknzjerunbl2wr3k@pengutronix.de>
Le jeu. 29 juin 2023 à 16:07:45 +0200, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> a écrit :
> Hello Paul,
>
> first of all, your mail is strange. I think the problem is that it
> doesn't contain a Message-Id. The result is that I got it twice and in
> return vger.kernel.org seems to have refused to take it. At least it's
> neither in lore.kernel.org nor in
> https://patchwork.ozlabs.org/project/linux-pwm/patch/20230629094839.757092-4-u.kleine-koenig@pengutronix.de/
> .
Sorry about that, I'm at the Embedded Linux conference in Prague
without my computer, so I just answered from my Android phone. I didn't
know it would cause problems, I guess I'll refrain from doing that from
now on.
Cheers,
-Paul
>
> On Thu, Jun 29, 2023 at 01:12:25PM +0200, Paul Cercueil wrote:
>> Le 29 juin 2023 11:48, Uwe Kleine-König
>> <u.kleine-koenig@pengutronix.de> a écrit :
>> >
>> > Stop using chip_data which is about to go away. Instead track the
>> > per-channel clk in struct jz4740_pwm_chip.
>> >
>> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>> > ---
>> > drivers/pwm/pwm-jz4740.c | 11 +++++++----
>> > 1 file changed, 7 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
>> > index 3b7067f6cd0d..e0a57d71a60c 100644
>> > --- a/drivers/pwm/pwm-jz4740.c
>> > +++ b/drivers/pwm/pwm-jz4740.c
>> > @@ -27,6 +27,7 @@ struct soc_info {
>> > struct jz4740_pwm_chip {
>> > struct pwm_chip chip;
>> > struct regmap *map;
>> > + struct clk *clk[];
>> > };
>> >
>> > static inline struct jz4740_pwm_chip *to_jz4740(struct pwm_chip
>> *chip)
>> > @@ -70,14 +71,15 @@ static int jz4740_pwm_request(struct pwm_chip
>> *chip, struct pwm_device *pwm)
>> > return err;
>> > }
>> >
>> > - pwm_set_chip_data(pwm, clk);
>> > + jz->clk[pwm->hwpwm] = clk;
>> >
>> > return 0;
>> > }
>> >
>> > static void jz4740_pwm_free(struct pwm_chip *chip, struct
>> pwm_device *pwm)
>> > {
>> > - struct clk *clk = pwm_get_chip_data(pwm);
>> > + struct jz4740_pwm_chip *jz = to_jz4740(chip);
>> > + struct clk *clk = jz->clk[pwm->hwpwm];
>> >
>> > clk_disable_unprepare(clk);
>> > clk_put(clk);
>> > @@ -123,7 +125,7 @@ static int jz4740_pwm_apply(struct pwm_chip
>> *chip, struct pwm_device *pwm,
>> > {
>> > struct jz4740_pwm_chip *jz4740 = to_jz4740(pwm->chip);
>> > unsigned long long tmp = 0xffffull * NSEC_PER_SEC;
>> > - struct clk *clk = pwm_get_chip_data(pwm);
>> > + struct clk *clk = jz4740->clk[pwm->hwpwm];
>> > unsigned long period, duty;
>> > long rate;
>> > int err;
>> > @@ -229,7 +231,8 @@ static int jz4740_pwm_probe(struct
>> platform_device *pdev)
>> > if (!info)
>> > return -EINVAL;
>> >
>> > - jz4740 = devm_kzalloc(dev, sizeof(*jz4740), GFP_KERNEL);
>> > + jz4740 = devm_kzalloc(dev, sizeof(*jz4740) + info->num_pwms *
>> sizeof(jz4740->clk[0]),
>> > + GFP_KERNEL);
>>
>> LGTM, but please use struct_size() from <linux/overflow.h>.
>
> Ah, I thought there is such a macro, but I didn't find it neither by
> grepping nor by asking in #kernelnewbies. Thanks, will respin the
> series
> in a few days.
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-König
> |
> Industrial Linux Solutions |
> https://www.pengutronix.de/ |
next prev parent reply other threads:[~2023-06-29 22:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <notmuch-sha1-d2bb15a9dcb5470a6eebca0b1a01c57918a22695>
2023-06-29 14:07 ` [PATCH 3/8] pwm: jz4740: Put per-channel clk into driver data Uwe Kleine-König
2023-06-29 22:55 ` Paul Cercueil [this message]
2023-06-30 10:28 ` Philippe Mathieu-Daudé
2023-06-29 9:48 [PATCH 0/8] pwm: Get rid of pwm_[sg]et_chip_data() Uwe Kleine-König
2023-06-29 9:48 ` [PATCH 3/8] pwm: jz4740: Put per-channel clk into driver data Uwe Kleine-König
2023-06-30 10:25 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=HCE1XR.D74206DFB5G5@crapouillou.net \
--to=paul@crapouillou.net \
--cc=kernel@pengutronix.de \
--cc=linux-mips@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox