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 > > --- > > 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/ |