* [PATCH 1/3] pwm: bcm-kona: Use pwmchip_add() instead of pwmchip_add_with_polarity()
@ 2020-12-05 16:51 Uwe Kleine-König
2020-12-05 16:51 ` [PATCH 2/3] pwm: atmel-hlcdc: " Uwe Kleine-König
2020-12-05 16:51 ` [PATCH 3/3] pwm: Drop function pwmchip_add_with_polarity() Uwe Kleine-König
0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2020-12-05 16:51 UTC (permalink / raw)
To: Thierry Reding, Lee Jones; +Cc: linux-pwm
The only side effect of this change is that pwm->state.polarity is
initialized to PWM_POLARITY_NORMAL instead of PWM_POLARITY_INVERSED.
However all other members of pwm->state are uninitialized and consumers
are expected to provide the right polarity (either by setting it explicitly
or by using a helper like pwm_init_state() that overwrites .polarity
anyhow with a value independent of the initial value).
The eventual goal is to remove pwmchip_add_with_polarity() and so simplify
the data flow in the PWM core.
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
drivers/pwm/pwm-bcm-kona.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c
index 16c5898b934a..40ecfb2bb632 100644
--- a/drivers/pwm/pwm-bcm-kona.c
+++ b/drivers/pwm/pwm-bcm-kona.c
@@ -303,7 +303,7 @@ static int kona_pwmc_probe(struct platform_device *pdev)
clk_disable_unprepare(kp->clk);
- ret = pwmchip_add_with_polarity(&kp->chip, PWM_POLARITY_INVERSED);
+ ret = pwmchip_add(&kp->chip);
if (ret < 0)
dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret);
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] pwm: atmel-hlcdc: Use pwmchip_add() instead of pwmchip_add_with_polarity()
2020-12-05 16:51 [PATCH 1/3] pwm: bcm-kona: Use pwmchip_add() instead of pwmchip_add_with_polarity() Uwe Kleine-König
@ 2020-12-05 16:51 ` Uwe Kleine-König
2020-12-05 16:51 ` [PATCH 3/3] pwm: Drop function pwmchip_add_with_polarity() Uwe Kleine-König
1 sibling, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2020-12-05 16:51 UTC (permalink / raw)
To: Thierry Reding, Lee Jones; +Cc: linux-pwm
The only side effect of this change is that pwm->state.polarity is
initialized to PWM_POLARITY_NORMAL instead of PWM_POLARITY_INVERSED.
However all other members of pwm->state are uninitialized and consumers
are expected to provide the right polarity (either by setting it explicitly
or by using a helper like pwm_init_state() that overwrites .polarity
anyhow with a value independent of the initial value).
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
drivers/pwm/pwm-atmel-hlcdc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
index dcbc0489dfd4..4551aa2c484c 100644
--- a/drivers/pwm/pwm-atmel-hlcdc.c
+++ b/drivers/pwm/pwm-atmel-hlcdc.c
@@ -270,7 +270,7 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
chip->chip.of_xlate = of_pwm_xlate_with_flags;
chip->chip.of_pwm_n_cells = 3;
- ret = pwmchip_add_with_polarity(&chip->chip, PWM_POLARITY_INVERSED);
+ ret = pwmchip_add(&chip->chip);
if (ret) {
clk_disable_unprepare(hlcdc->periph_clk);
return ret;
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] pwm: Drop function pwmchip_add_with_polarity()
2020-12-05 16:51 [PATCH 1/3] pwm: bcm-kona: Use pwmchip_add() instead of pwmchip_add_with_polarity() Uwe Kleine-König
2020-12-05 16:51 ` [PATCH 2/3] pwm: atmel-hlcdc: " Uwe Kleine-König
@ 2020-12-05 16:51 ` Uwe Kleine-König
2020-12-07 13:38 ` Uwe Kleine-König
1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2020-12-05 16:51 UTC (permalink / raw)
To: Thierry Reding, Lee Jones; +Cc: linux-pwm
pwmchip_add() only calls pwmchip_add_with_polarity() and nothing else. All
other users of pwmchip_add_with_polarity() are gone. So drop
pwmchip_add_with_polarity() and move the code instead to pwmchip_add().
The initial assignment to pwm->state.polarity is dropped. In every correct
usage of the PWM API this value is overwritten later anyhow.
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
include/linux/pwm.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index e4d84d4db293..8f4eefd129aa 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -392,8 +392,6 @@ int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result,
int pwm_set_chip_data(struct pwm_device *pwm, void *data);
void *pwm_get_chip_data(struct pwm_device *pwm);
-int pwmchip_add_with_polarity(struct pwm_chip *chip,
- enum pwm_polarity polarity);
int pwmchip_add(struct pwm_chip *chip);
int pwmchip_remove(struct pwm_chip *chip);
struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] pwm: Drop function pwmchip_add_with_polarity()
2020-12-05 16:51 ` [PATCH 3/3] pwm: Drop function pwmchip_add_with_polarity() Uwe Kleine-König
@ 2020-12-07 13:38 ` Uwe Kleine-König
0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2020-12-07 13:38 UTC (permalink / raw)
To: Thierry Reding, Lee Jones; +Cc: linux-pwm
[-- Attachment #1: Type: text/plain, Size: 1290 bytes --]
On Sat, Dec 05, 2020 at 05:51:46PM +0100, Uwe Kleine-König wrote:
> pwmchip_add() only calls pwmchip_add_with_polarity() and nothing else. All
> other users of pwmchip_add_with_polarity() are gone. So drop
> pwmchip_add_with_polarity() and move the code instead to pwmchip_add().
>
> The initial assignment to pwm->state.polarity is dropped. In every correct
> usage of the PWM API this value is overwritten later anyhow.
>
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> ---
> include/linux/pwm.h | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/include/linux/pwm.h b/include/linux/pwm.h
> index e4d84d4db293..8f4eefd129aa 100644
> --- a/include/linux/pwm.h
> +++ b/include/linux/pwm.h
> @@ -392,8 +392,6 @@ int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result,
> int pwm_set_chip_data(struct pwm_device *pwm, void *data);
> void *pwm_get_chip_data(struct pwm_device *pwm);
>
> -int pwmchip_add_with_polarity(struct pwm_chip *chip,
> - enum pwm_polarity polarity);
I forgot the relevant change in drivers/pwm/core.c. I will resend.
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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-07 13:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-05 16:51 [PATCH 1/3] pwm: bcm-kona: Use pwmchip_add() instead of pwmchip_add_with_polarity() Uwe Kleine-König
2020-12-05 16:51 ` [PATCH 2/3] pwm: atmel-hlcdc: " Uwe Kleine-König
2020-12-05 16:51 ` [PATCH 3/3] pwm: Drop function pwmchip_add_with_polarity() Uwe Kleine-König
2020-12-07 13:38 ` Uwe Kleine-König
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.