[PATCH] drivers: pwm: remove redundant check in pwm_ops_check()

Ben Zong-You Xie via B4 Relay posted 1 patch 1 week, 3 days ago
drivers/pwm/core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] drivers: pwm: remove redundant check in pwm_ops_check()
Posted by Ben Zong-You Xie via B4 Relay 1 week, 3 days ago
From: Ben Zong-You Xie <ben717@andestech.com>

Drop the redundant check for the existence of 'ops->write_waveform'.

Fixes: 17e40c25158f ("pwm: New abstraction for PWM waveforms")
Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>
---
 drivers/pwm/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index ec8731515333..450aedd32c81 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -1699,8 +1699,7 @@ static bool pwm_ops_check(const struct pwm_chip *chip)
 
 	if (ops->write_waveform) {
 		if (!ops->round_waveform_tohw ||
-		    !ops->round_waveform_fromhw ||
-		    !ops->write_waveform)
+		    !ops->round_waveform_fromhw)
 			return false;
 
 		if (PWM_WFHWSIZE < ops->sizeof_wfhw) {

---
base-commit: 63faf32666e03a78cc985bcbae196418cf7d7938
change-id: 20260129-fix-pwm-ops-check-6e36ce09d75a

Best regards,
--  
Ben Zong-You Xie <ben717@andestech.com>
Re: [PATCH] drivers: pwm: remove redundant check in pwm_ops_check()
Posted by Uwe Kleine-König 1 week, 3 days ago
Hello Ben,

thanks for your patch.

On Thu, Jan 29, 2026 at 02:43:34PM +0800, Ben Zong-You Xie via B4 Relay wrote:
> From: Ben Zong-You Xie <ben717@andestech.com>
> 
> Drop the redundant check for the existence of 'ops->write_waveform'.
> 
> Fixes: 17e40c25158f ("pwm: New abstraction for PWM waveforms")
> Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>

I would rewrite the commit log to:

	pwm: Remove redundant check in pwm_ops_check()

	ops->write_waveform is already known to be non-NULL so there is
	no need to check it a second time.

	The superflous check was introduced in commit 17e40c25158f
	("pwm: New abstraction for PWM waveforms").

	Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>

to make the change more clear and also to not bother the stable team
with backporting the commit to stable.

Please confirm if you're ok with this change, then I cope for the update
while applying your change.

Best regards
Uwe
Re: [PATCH] drivers: pwm: remove redundant check in pwm_ops_check()
Posted by Ben Zong-You Xie 1 week, 2 days ago
On Thu, Jan 29, 2026 at 08:19:00AM +0100, Uwe Kleine-König wrote:
> I would rewrite the commit log to:
> 
> 	pwm: Remove redundant check in pwm_ops_check()
> 
> 	ops->write_waveform is already known to be non-NULL so there is
> 	no need to check it a second time.
> 
> 	The superflous check was introduced in commit 17e40c25158f
> 	("pwm: New abstraction for PWM waveforms").
> 
> 	Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>
> 
> to make the change more clear and also to not bother the stable team
> with backporting the commit to stable.
> 
> Please confirm if you're ok with this change, then I cope for the update
> while applying your change.
> 
> Best regards
> Uwe

Hi Uwe,

I'm ok with the change, and thank you for the review.

Best regards,
Ben

Re: [PATCH] drivers: pwm: remove redundant check in pwm_ops_check()
Posted by Uwe Kleine-König 1 week, 2 days ago
hello Ben,

On Fri, Jan 30, 2026 at 01:11:41PM +0800, Ben Zong-You Xie wrote:
> On Thu, Jan 29, 2026 at 08:19:00AM +0100, Uwe Kleine-König wrote:
> > I would rewrite the commit log to:
> > 
> > [...]
> > 
> > to make the change more clear and also to not bother the stable team
> > with backporting the commit to stable.
> > 
> > Please confirm if you're ok with this change, then I cope for the update
> > while applying your change.
>
> I'm ok with the change, and thank you for the review.

Thanks for confirming, I applied to

	https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next

. With the merge window opening in more than a week from now I will
include it in my MR for 6.20-rc1.

Best regards
Uwe