From: Atish Patra <atish.patra@wdc.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: "mark.rutland@arm.com" <mark.rutland@arm.com>,
"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Wesley Terpstra <wesley@sifive.com>,
"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
"palmer@sifive.com" <palmer@sifive.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
"thierry.reding@gmail.com" <thierry.reding@gmail.com>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>
Subject: Re: [RFC 2/4] pwm: sifive: Add a driver for SiFive SoC PWM
Date: Mon, 15 Oct 2018 23:28:04 -0700 [thread overview]
Message-ID: <39685c1b-46cf-9e78-c9aa-46168627053f@wdc.com> (raw)
Message-ID: <20181016062804.F8RYeSveWtrMhbh07EGtD8UoKtxExUkBVzn4vRP6xcg@z> (raw)
In-Reply-To: <20181010131128.GA29142@infradead.org>
On 10/10/18 6:11 AM, Christoph Hellwig wrote:
> Thanks for getting these drivers submitted upstream!
>
> I don't really know anything about PWM, so just some random nitpicking
> below..
>
>> + iowrite32(frac, pwm->regs + REG_PWMCMP0 + (dev->hwpwm * SIZE_PWMCMP));
>
> * already has a higher precedence than +, so no need for the inner
> braces.
>
>> + duty = ioread32(pwm->regs + REG_PWMCMP0 + (dev->hwpwm * SIZE_PWMCMP));
>
> Same here.
Will remove the braces in both places.
>
>> + /* (1 << (16+scale)) * 10^9/rate = real_period */
> unsigned long scalePow = (pwm->approx_period * (u64)rate) / 1000000000;
>
> no camcel case, please.
My bad. I will fix that.
>
>> + int scale = ilog2(scalePow) - 16;
>> +
>> + scale = clamp(scale, 0, 0xf);
>
> Why not:
>
> int scale = clamp(ilog2(scale_pow) - 16, 0, 0xf);
>
Sure.
>> +static int sifive_pwm_clock_notifier(struct notifier_block *nb,
>> + unsigned long event, void *data)
>> +{
>> + struct clk_notifier_data *ndata = data;
>> + struct sifive_pwm_device *pwm = container_of(nb,
>> + struct sifive_pwm_device,
>> + notifier);
>
> I don't think there are any guidlines, but I always prefer to just move
> the whole container_of onto a new line:
>
> struct sifive_pwm_device *pwm =
> container_of(nb, struct sifive_pwm_device, notifier);
Done.
Regards,
Atish
>
>> +static struct platform_driver sifive_pwm_driver = {
>> + .probe = sifive_pwm_probe,
>> + .remove = sifive_pwm_remove,
>> + .driver = {
>> + .name = "pwm-sifivem",
>> + .of_match_table = of_match_ptr(sifive_pwm_of_match),
>> + },
>> +};
>
> What about using tabs to align this a little more nicely?
>
> static struct platform_driver sifive_pwm_driver = {
> .probe = sifive_pwm_probe,
> .remove = sifive_pwm_remove,
> .driver = {
> .name = "pwm-sifivem",
> .of_match_table = of_match_ptr(sifive_pwm_of_match),
> },
> };
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2018-10-16 6:28 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 18:51 [RFC 0/4] GPIO & PWM support for HiFive Unleashed Atish Patra
2018-10-09 18:51 ` Atish Patra
2018-10-09 18:51 ` [RFC 1/4] pwm: sifive: Add DT documentation for SiFive PWM Controller Atish Patra
2018-10-09 18:51 ` Atish Patra
2018-10-10 13:49 ` Thierry Reding
2018-10-10 13:49 ` Thierry Reding
2018-10-15 22:57 ` Atish Patra
2018-10-15 22:57 ` Atish Patra
2018-10-15 23:19 ` Wesley Terpstra
2018-10-15 23:19 ` Wesley Terpstra
2018-10-16 11:13 ` Thierry Reding
2018-10-16 11:13 ` Thierry Reding
2018-10-16 11:01 ` Thierry Reding
2018-10-16 11:01 ` Thierry Reding
2018-10-16 17:31 ` Paul Walmsley
2018-10-16 17:31 ` Paul Walmsley
2018-10-16 22:04 ` Thierry Reding
2018-10-16 22:04 ` Thierry Reding
2018-10-16 22:20 ` Atish Patra
2018-10-16 22:20 ` Atish Patra
2018-10-17 15:58 ` Rob Herring
2018-10-17 15:58 ` Rob Herring
2018-10-17 21:45 ` Atish Patra
2018-10-17 21:45 ` Atish Patra
2018-11-10 5:38 ` Paul Walmsley
2018-11-10 5:38 ` Paul Walmsley
2018-10-10 13:51 ` Thierry Reding
2018-10-10 13:51 ` Thierry Reding
2018-10-15 22:45 ` Atish Patra
2018-10-15 22:45 ` Atish Patra
2018-10-16 10:51 ` Thierry Reding
2018-10-16 10:51 ` Thierry Reding
2018-10-16 22:42 ` Atish Patra
2018-10-16 22:42 ` Atish Patra
2018-10-09 18:51 ` [RFC 2/4] pwm: sifive: Add a driver for SiFive SoC PWM Atish Patra
2018-10-09 18:51 ` Atish Patra
2018-10-10 13:11 ` Christoph Hellwig
2018-10-10 13:11 ` Christoph Hellwig
2018-10-10 13:44 ` Thierry Reding
2018-10-10 13:44 ` Thierry Reding
2018-10-16 6:28 ` Atish Patra [this message]
2018-10-16 6:28 ` Atish Patra
2018-10-10 14:13 ` Thierry Reding
2018-10-10 14:13 ` Thierry Reding
2018-10-16 6:24 ` Atish Patra
2018-10-16 6:24 ` Atish Patra
2018-10-09 18:51 ` [RFC 3/4] gpio: sifive: Add DT documentation for SiFive GPIO Atish Patra
2018-10-09 18:51 ` Atish Patra
2018-10-09 18:51 ` [RFC 4/4] gpio: sifive: Add GPIO driver for SiFive SoCs Atish Patra
2018-10-09 18:51 ` Atish Patra
2018-10-10 12:35 ` Linus Walleij
2018-10-10 12:35 ` Linus Walleij
2018-10-17 1:01 ` Atish Patra
2018-10-17 1:01 ` Atish Patra
2019-09-18 7:32 ` Bin Meng
2018-10-10 13:01 ` Andreas Schwab
2018-10-10 13:01 ` Andreas Schwab
2018-10-10 13:12 ` Christoph Hellwig
2018-10-10 13:12 ` Christoph Hellwig
2018-10-10 13:28 ` Andreas Schwab
2018-10-10 13:28 ` Andreas Schwab
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=39685c1b-46cf-9e78-c9aa-46168627053f@wdc.com \
--to=atish.patra@wdc.com \
--cc=devicetree@vger.kernel.org \
--cc=hch@infradead.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=palmer@sifive.com \
--cc=robh+dt@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=wesley@sifive.com \
/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;
as well as URLs for NNTP newsgroup(s).