All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shiraz Hashim <shiraz.hashim@st.com>
To: Thierry Reding <thierry.reding@avionic-design.de>
Cc: <linux-kernel@vger.kernel.org>, <spear-devel@list.st.com>,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
Date: Thu, 25 Oct 2012 09:39:09 +0530	[thread overview]
Message-ID: <20121025040909.GE3900@localhost.localdomain> (raw)
In-Reply-To: <20121024055137.GC9787@avionic-0098.mockup.avionic-design.de>

On Wed, Oct 24, 2012 at 07:51:37AM +0200, Thierry Reding wrote:
> On Mon, Oct 22, 2012 at 04:36:41PM +0530, Shiraz Hashim wrote:
> [...]
> > +struct spear_pwm_chip {
> > +	void __iomem *mmio_base;
> > +	struct clk *clk;
> > +	struct pwm_chip	chip;
> 
> My editor shows a tab between pwm_chip and chip. This should really be a
> space.
> 
> > +	ret = pwmchip_add(&pc->chip);
> > +	if (ret < 0) {
> > +		dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
> > +		return ret;
> > +	}
> > +
> > +	ret = clk_prepare_enable(pc->clk);
> > +	if (ret < 0)
> > +		return pwmchip_remove(&pc->chip);
> 
> I think in order to fix the potential race condition that Viresh
> mentioned we should move the clk_prepare_enable() before the
> pwmchip_add(), but don't forget to disable and unprepare the clock if
> pwmchip_add() fails.
> 
> Actually, can't we make it a clk_prepare() only at this point and move
> the clk_enable() and clk_disable() into the if block below? In case the
> compatible value is not "st,spear1340-pwm" we don't need the clock
> enabled.
> 
> > +
> > +	if (of_device_is_compatible(np, "st,spear1340-pwm")) {
> > +		/*
> > +		 * 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);
> > +
> 
> Oh, and a spurious newline here... =)
> 
> > +	}
> > +
> > +	/* only disable the clk and leave it prepared */
> > +	clk_disable(pc->clk);
> 
> This can go into the if block to match the clk_enable().

All suggestions would be included in V5. I hope this would be the
last one :).

--
regards
Shiraz

      parent reply	other threads:[~2012-10-25  4:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 11:06 [PATCH V4] PWM: Add SPEAr PWM chip driver support Shiraz Hashim
2012-10-22 13:55 ` Viresh Kumar
2012-10-24  5:43   ` Thierry Reding
2012-10-24  5:51 ` Thierry Reding
2012-10-24  6:37   ` Viresh Kumar
2012-10-25  4:09   ` Shiraz Hashim [this message]

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=20121025040909.GE3900@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.