All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] pwm: rcar: Drop useless call to pwm_get_state
@ 2019-10-24  7:14 Uwe Kleine-König
  2019-10-24  7:14 ` [PATCH 2/2] pwm: rcar: Document inability to set duty_cycle = 0 Uwe Kleine-König
  2019-10-24  7:20 ` [PATCH 1/2] pwm: rcar: Drop useless call to pwm_get_state Yoshihiro Shimoda
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2019-10-24  7:14 UTC (permalink / raw)
  To: Thierry Reding, Yoshihiro Shimoda; +Cc: linux-pwm, kernel

pwm_get_state has no side effects and the resulting pwm_state is unused.
So drop the call to pwm_get_state and the local variable from
rcar_pwm_apply().

The call was introduced in commit 7f68ce8287d3 ("pwm: rcar: Add support
"atomic" API") and already then was useless.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-rcar.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index 852eb2347954..6fac8eb98d54 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -161,11 +161,9 @@ static int rcar_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 			  const struct pwm_state *state)
 {
 	struct rcar_pwm_chip *rp = to_rcar_pwm_chip(chip);
-	struct pwm_state cur_state;
 	int div, ret;
 
 	/* This HW/driver only supports normal polarity */
-	pwm_get_state(pwm, &cur_state);
 	if (state->polarity != PWM_POLARITY_NORMAL)
 		return -ENOTSUPP;
 
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] pwm: rcar: Document inability to set duty_cycle = 0
  2019-10-24  7:14 [PATCH 1/2] pwm: rcar: Drop useless call to pwm_get_state Uwe Kleine-König
@ 2019-10-24  7:14 ` Uwe Kleine-König
  2019-10-24  7:20   ` Yoshihiro Shimoda
  2019-10-24  7:20 ` [PATCH 1/2] pwm: rcar: Drop useless call to pwm_get_state Yoshihiro Shimoda
  1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2019-10-24  7:14 UTC (permalink / raw)
  To: Thierry Reding, Yoshihiro Shimoda; +Cc: linux-pwm, kernel

When .apply is called with state->duty_cycle = 0 the duty_ns parameter
to rcar_pwm_set_counter() is 0 which results in ph being 0 and
rcar_pwm_set_counter() returning -EINVAL.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-rcar.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index 6fac8eb98d54..2685577b6dd4 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -3,6 +3,9 @@
  * R-Car PWM Timer driver
  *
  * Copyright (C) 2015 Renesas Electronics Corporation
+ *
+ * Limitations:
+ * - The hardware cannot generate a 0% duty cycle.
  */
 
 #include <linux/clk.h>
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH 1/2] pwm: rcar: Drop useless call to pwm_get_state
  2019-10-24  7:14 [PATCH 1/2] pwm: rcar: Drop useless call to pwm_get_state Uwe Kleine-König
  2019-10-24  7:14 ` [PATCH 2/2] pwm: rcar: Document inability to set duty_cycle = 0 Uwe Kleine-König
@ 2019-10-24  7:20 ` Yoshihiro Shimoda
  1 sibling, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2019-10-24  7:20 UTC (permalink / raw)
  To: Uwe Kleine-König, Thierry Reding; +Cc: linux-pwm, kernel

Hi Uwe,

> From: Uwe Kleine-Konig, Sent: Thursday, October 24, 2019 4:14 PM
> 
> pwm_get_state has no side effects and the resulting pwm_state is unused.
> So drop the call to pwm_get_state and the local variable from
> rcar_pwm_apply().
> 
> The call was introduced in commit 7f68ce8287d3 ("pwm: rcar: Add support
> "atomic" API") and already then was useless.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thank you for the patch!

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 2/2] pwm: rcar: Document inability to set duty_cycle = 0
  2019-10-24  7:14 ` [PATCH 2/2] pwm: rcar: Document inability to set duty_cycle = 0 Uwe Kleine-König
@ 2019-10-24  7:20   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2019-10-24  7:20 UTC (permalink / raw)
  To: Uwe Kleine-König, Thierry Reding; +Cc: linux-pwm, kernel

Hi Uwe,

> From: Uwe Kleine-Konig, Sent: Thursday, October 24, 2019 4:14 PM
> 
> When .apply is called with state->duty_cycle = 0 the duty_ns parameter
> to rcar_pwm_set_counter() is 0 which results in ph being 0 and
> rcar_pwm_set_counter() returning -EINVAL.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thank you for the patch!

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-24  7:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-24  7:14 [PATCH 1/2] pwm: rcar: Drop useless call to pwm_get_state Uwe Kleine-König
2019-10-24  7:14 ` [PATCH 2/2] pwm: rcar: Document inability to set duty_cycle = 0 Uwe Kleine-König
2019-10-24  7:20   ` Yoshihiro Shimoda
2019-10-24  7:20 ` [PATCH 1/2] pwm: rcar: Drop useless call to pwm_get_state Yoshihiro Shimoda

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.