Linux-PWM Archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-pwm@vger.kernel.org, Lee Jones <lee.jones@linaro.org>,
	kernel@pengutronix.de
Subject: Re: [PATCH v2] pwm: Ensure for legacy drivers that pwm->state stays consistent
Date: Mon, 28 Jun 2021 19:24:11 +0200	[thread overview]
Message-ID: <20210628172411.6nfiiwc75x6mutcr@pengutronix.de> (raw)
In-Reply-To: <YNm2ftmwN2Nsgy0I@orome.fritz.box>

[-- Attachment #1: Type: text/plain, Size: 1557 bytes --]

On Mon, Jun 28, 2021 at 01:46:06PM +0200, Thierry Reding wrote:
> On Sat, May 01, 2021 at 06:09:43PM +0200, Uwe Kleine-König wrote:
> > Without this change it can happen that if changing the polarity succeeded
> > but changing duty_cycle and period failed pwm->state contains a mixture
> > between the old and the requested state.
> > 
> > So remember the initial state before starting to modify the configuration
> > and restore it when one of the required callback fails.
> > 
> > Compared to the previous implementation .disable() (if necessary) is called
> > earlier to prevent a glitch.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> > Hello,
> > 
> > just a small optimisation: At the end of pwm_apply_legacy()
> > state->enabled is known to be true, so simplify
> > 
> > 	if (state->enabled && !pwm->state.enabled) {
> > 
> > to
> > 	if (!pwm->state.enabled) {
> > 
> > Best regards
> > Uwe
> > 
> >  drivers/pwm/core.c | 139 +++++++++++++++++++++++++--------------------
> >  1 file changed, 78 insertions(+), 61 deletions(-)
> 
> Applied, thanks. I made a few tiny changes such as dropping the apply
> function pointer, which didn't seem very useful.

I just checked what you did and I can live with your changes. However I
think you should point out in the commit log what you actually changed.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-06-28 17:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-11 16:04 [PATCH] pwm: Ensure for legacy drivers that pwm->state stays consistent Uwe Kleine-König
2021-05-01 16:09 ` [PATCH v2] " Uwe Kleine-König
2021-06-28 11:46   ` Thierry Reding
2021-06-28 17:24     ` Uwe Kleine-König [this message]
2021-06-29 19:44   ` Geert Uytterhoeven
2021-06-30  6:48     ` Uwe Kleine-König
2021-06-30 10:22       ` Geert Uytterhoeven
2021-06-30 16:21         ` Uwe Kleine-König
2021-06-30 17:08           ` Geert Uytterhoeven
2021-06-30 17:18           ` Thierry Reding
2021-06-29 19:52   ` Geert Uytterhoeven

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=20210628172411.6nfiiwc75x6mutcr@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).