From: Shiraz Hashim <shiraz.hashim@st.com>
To: viresh kumar <viresh.kumar@linaro.org>
Cc: <thierry.reding@avionic-design.de>,
<linux-kernel@vger.kernel.org>, <spear-devel@list.st.com>
Subject: Re: [PATCH V3] PWM: Add SPEAr PWM chip driver support
Date: Mon, 22 Oct 2012 11:36:41 +0530 [thread overview]
Message-ID: <20121022060641.GB3900@localhost.localdomain> (raw)
In-Reply-To: <CAOh2x=mNWNtwcWB3a=mCsfwC8WqXiisW8zeg9amsXy7b2nLCkA@mail.gmail.com>
Hi Viresh,
On Mon, Oct 22, 2012 at 09:39:21AM +0530, viresh kumar wrote:
> Every time you read a code, you figure out new things about it.
> Sorry for these comments Now :(
No problem, it is important to fix now than catch them later.
> On Mon, Oct 22, 2012 at 9:21 AM, Shiraz Hashim <shiraz.hashim@st.com> wrote:
> > diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
> > index acfe482..6512786 100644
> > --- a/drivers/pwm/Makefile
> > +++ b/drivers/pwm/Makefile
> > @@ -9,6 +9,7 @@ obj-$(CONFIG_PWM_PUV3) += pwm-puv3.o
> > obj-$(CONFIG_PWM_PXA) += pwm-pxa.o
> > obj-$(CONFIG_PWM_SAMSUNG) += pwm-samsung.o
> > obj-$(CONFIG_PWM_TEGRA) += pwm-tegra.o
> > +obj-$(CONFIG_PWM_SPEAR) += pwm-spear.o
>
> I have gone through this on every version of this patch, but couldn't figure
> out that you were trying to add it in alphabetical order, but you couldn't.
>
Would fix this.
> > diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
>
> > +static int spear_pwm_probe(struct platform_device *pdev)
> > +{
> > + pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
> > + if (!pc) {
> > + dev_err(&pdev->dev, "failed to allocate memory\n");
> > + return -ENOMEM;
> > + }
> > +
> > + pc->dev = &pdev->dev;
>
> If you are going to send another version, then please move this
>
> > + pc->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
> > + if (!pc->mmio_base)
> > + return -EADDRNOTAVAIL;
> > +
> > + platform_set_drvdata(pdev, pc);
>
> and this
>
> > + pc->clk = devm_clk_get(&pdev->dev, NULL);
> > + if (IS_ERR(pc->clk))
> > + return PTR_ERR(pc->clk);
>
> to this place :)
> So, that we don't do these for failure cases.
>
Okay.
> > + pc->chip.dev = &pdev->dev;
> > + pc->chip.ops = &spear_pwm_ops;
> > + pc->chip.base = -1;
> > + pc->chip.npwm = NUM_PWM;
> > +
>
> > + if (np && of_device_is_compatible(np, "st,spear1340-pwm")) {
>
> I have noticed it earlier, but don't know why didn't i gave a comment here?
> you don't need to check for np here. It can't be NULL as you depend on
> CONFIG_OF.
Okay, would remove this.
> > + /*
> > + * Following enables PWM chip, channels would still be
> > + * enabled individually through their control register
> > + */
> > + val = readl_relaxed(pc->mmio_base + PWMMCR);
> > + val |= PWMMCR_PWM_ENABLE;
> > + writel_relaxed(val, pc->mmio_base + PWMMCR);
> > +
> > + }
> > +
> > + /* only disable the clk and leave it prepared */
> > + clk_disable(pc->clk);
> > +
> > + return 0;
> > +}
> > +
> > +static int spear_pwm_remove(struct platform_device *pdev)
> > +{
> > + struct spear_pwm_chip *pc = platform_get_drvdata(pdev);
> > + int i;
> > +
> > + for (i = 0; i < NUM_PWM; i++) {
> > + struct pwm_device *pwm = &pc->chip.pwms[i];
> > +
> > + if (test_bit(PWMF_ENABLED, &pwm->flags)) {
> > + spear_pwm_writel(pc, i, PWMCR, 0);
> > + clk_disable(pc->clk);
> > + }
> > + }
> > +
> > + /* clk was prepared in probe, hence unprepare it here */
> > + clk_unprepare(pc->clk);
>
> I believe you need to remove the chip first and then do above to
> avoid any race conditions, that might occur.
>
I am afraid, I would loose all chips and their related information
(PWMF_ENABLED) then.
> > + return pwmchip_remove(&pc->chip);
> > +}
> > +
>
> After all this please add my:
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
I had already added your sob as you were the original author,
should I add a separate acked-by also ?
> Sorry Shiraz for so late comments, i can understand your
> frustration :(
No issues, review is higienic :)
--
regards
Shiraz
next prev parent reply other threads:[~2012-10-22 6:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-22 3:51 Shiraz Hashim
2012-10-22 4:09 ` viresh kumar
2012-10-22 6:06 ` Shiraz Hashim [this message]
2012-10-22 6:21 ` Viresh Kumar
2012-10-22 7:55 ` Thierry Reding
2012-10-22 8:25 ` Viresh Kumar
2012-10-22 8:30 ` Thierry Reding
2012-10-22 12:20 ` Lars-Peter Clausen
2012-10-24 5:54 ` Thierry Reding
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=20121022060641.GB3900@localhost.localdomain \
--to=shiraz.hashim@st.com \
--cc=linux-kernel@vger.kernel.org \
--cc=spear-devel@list.st.com \
--cc=thierry.reding@avionic-design.de \
--cc=viresh.kumar@linaro.org \
/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
Powered by JetHome