* [PATCH v2 07/11] pwm: imx27: Propagate errors in .get_state() to the caller
[not found] <20221130152148.2769768-1-u.kleine-koenig@pengutronix.de>
@ 2022-11-30 15:21 ` Uwe Kleine-König
2022-11-30 15:21 ` [PATCH v2 08/11] pwm: mtk-disp: " Uwe Kleine-König
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2022-11-30 15:21 UTC (permalink / raw)
To: Thierry Reding
Cc: Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, NXP Linux Team, linux-pwm, linux-arm-kernel
.get_state() can return an error indication. Make use of it to propagate
failing hardware accesses.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/pwm/pwm-imx27.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c
index 3a22c2fddc45..29a3089c534c 100644
--- a/drivers/pwm/pwm-imx27.c
+++ b/drivers/pwm/pwm-imx27.c
@@ -128,7 +128,7 @@ static int pwm_imx27_get_state(struct pwm_chip *chip,
ret = pwm_imx27_clk_prepare_enable(imx);
if (ret < 0)
- return 0;
+ return ret;
val = readl(imx->mmio_base + MX3_PWMCR);
--
2.38.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 08/11] pwm: mtk-disp: Propagate errors in .get_state() to the caller
[not found] <20221130152148.2769768-1-u.kleine-koenig@pengutronix.de>
2022-11-30 15:21 ` [PATCH v2 07/11] pwm: imx27: Propagate errors in .get_state() to the caller Uwe Kleine-König
@ 2022-11-30 15:21 ` Uwe Kleine-König
2022-12-01 13:11 ` AngeloGioacchino Del Regno
2022-11-30 15:21 ` [PATCH v2 09/11] pwm: rockchip: " Uwe Kleine-König
2022-12-09 21:47 ` [PATCH v2 00/11] pwm: Allow .get_state to fail Andy Shevchenko
3 siblings, 1 reply; 10+ messages in thread
From: Uwe Kleine-König @ 2022-11-30 15:21 UTC (permalink / raw)
To: Thierry Reding
Cc: Conor Dooley, Matthias Brugger, linux-pwm, linux-arm-kernel,
linux-mediatek
.get_state() can return an error indication. Make use of it to propagate
failing hardware accesses.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/pwm/pwm-mtk-disp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
index 9a6bb334a31b..67e5799dd157 100644
--- a/drivers/pwm/pwm-mtk-disp.c
+++ b/drivers/pwm/pwm-mtk-disp.c
@@ -184,14 +184,14 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip,
err = clk_prepare_enable(mdp->clk_main);
if (err < 0) {
dev_err(chip->dev, "Can't enable mdp->clk_main: %pe\n", ERR_PTR(err));
- return 0;
+ return err;
}
err = clk_prepare_enable(mdp->clk_mm);
if (err < 0) {
dev_err(chip->dev, "Can't enable mdp->clk_mm: %pe\n", ERR_PTR(err));
clk_disable_unprepare(mdp->clk_main);
- return 0;
+ return err;
}
rate = clk_get_rate(mdp->clk_main);
--
2.38.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 09/11] pwm: rockchip: Propagate errors in .get_state() to the caller
[not found] <20221130152148.2769768-1-u.kleine-koenig@pengutronix.de>
2022-11-30 15:21 ` [PATCH v2 07/11] pwm: imx27: Propagate errors in .get_state() to the caller Uwe Kleine-König
2022-11-30 15:21 ` [PATCH v2 08/11] pwm: mtk-disp: " Uwe Kleine-König
@ 2022-11-30 15:21 ` Uwe Kleine-König
2022-11-30 18:37 ` Heiko Stübner
2022-12-09 21:47 ` [PATCH v2 00/11] pwm: Allow .get_state to fail Andy Shevchenko
3 siblings, 1 reply; 10+ messages in thread
From: Uwe Kleine-König @ 2022-11-30 15:21 UTC (permalink / raw)
To: Thierry Reding
Cc: Conor Dooley, Heiko Stuebner, linux-pwm, linux-arm-kernel,
linux-rockchip
.get_state() can return an error indication. Make use of it to propagate
failing hardware accesses.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/pwm/pwm-rockchip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
index 3ec7d1756903..7f084eb34092 100644
--- a/drivers/pwm/pwm-rockchip.c
+++ b/drivers/pwm/pwm-rockchip.c
@@ -70,11 +70,11 @@ static int rockchip_pwm_get_state(struct pwm_chip *chip,
ret = clk_enable(pc->pclk);
if (ret)
- return 0;
+ return ret;
ret = clk_enable(pc->clk);
if (ret)
- return 0;
+ return ret;
clk_rate = clk_get_rate(pc->clk);
--
2.38.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 09/11] pwm: rockchip: Propagate errors in .get_state() to the caller
2022-11-30 15:21 ` [PATCH v2 09/11] pwm: rockchip: " Uwe Kleine-König
@ 2022-11-30 18:37 ` Heiko Stübner
0 siblings, 0 replies; 10+ messages in thread
From: Heiko Stübner @ 2022-11-30 18:37 UTC (permalink / raw)
To: Thierry Reding, Uwe Kleine-König
Cc: Conor Dooley, linux-pwm, linux-arm-kernel, linux-rockchip
Am Mittwoch, 30. November 2022, 16:21:46 CET schrieb Uwe Kleine-König:
> .get_state() can return an error indication. Make use of it to propagate
> failing hardware accesses.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 08/11] pwm: mtk-disp: Propagate errors in .get_state() to the caller
2022-11-30 15:21 ` [PATCH v2 08/11] pwm: mtk-disp: " Uwe Kleine-König
@ 2022-12-01 13:11 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 10+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-12-01 13:11 UTC (permalink / raw)
To: Uwe Kleine-König, Thierry Reding
Cc: Conor Dooley, Matthias Brugger, linux-pwm, linux-arm-kernel,
linux-mediatek
Il 30/11/22 16:21, Uwe Kleine-König ha scritto:
> .get_state() can return an error indication. Make use of it to propagate
> failing hardware accesses.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 00/11] pwm: Allow .get_state to fail
[not found] <20221130152148.2769768-1-u.kleine-koenig@pengutronix.de>
` (2 preceding siblings ...)
2022-11-30 15:21 ` [PATCH v2 09/11] pwm: rockchip: " Uwe Kleine-König
@ 2022-12-09 21:47 ` Andy Shevchenko
2022-12-10 9:18 ` Uwe Kleine-König
3 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2022-12-09 21:47 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Thierry Reding, linux-pwm, linux-gpio, dri-devel, linux-leds,
linux-arm-kernel, chrome-platform, linux-amlogic, linux-mediatek,
linux-rpi-kernel, linux-rockchip, linux-riscv, linux-stm32,
linux-sunxi
On Wed, Nov 30, 2022 at 04:21:37PM +0100, Uwe Kleine-König wrote:
> Hello,
>
> I forgot about this series and was remembered when I talked to Conor
> Dooley about how .get_state() should behave in an error case.
>
> Compared to (implicit) v1, sent with Message-Id: 20220916151506.298488-1-u.kleine-koenig@pengutronix.de
> I changed:
>
> - Patch #1 which does the prototype change now just adds "return 0" to
> all implementations and so gets simpler and doesn't change behaviour.
> The adaptions to the different .get_state() implementations are split
> out into individual patches to ease review.
> - One minor inconsistency fixed in "pwm: Handle .get_state() failures"
> that I noticed while looking into this patch.
> - I skipped changing sun4i.c as I don't know how to handle the error
> there. Someone might want to have a look. (That's not ideal, but it's
> not worse than the same issue before this series.)
>
> In v1 Thierry had the concern:
>
> | That raises the question about what to do in these cases. If we return
> | an error, that could potentially throw off consumers. So perhaps the
> | closest would be to return a disabled PWM? Or perhaps it'd be up to the
> | consumer to provide some fallback configuration for invalidly configured
> | or unconfigured PWMs.
>
> .get_state() is only called in pwm_device_request on a pwm_state that a
> consumer might see. Before my series a consumer might have seen a
> partial modified pwm_state (because .get_state() might have modified
> .period, then stumbled and returned silently). The last patch ensures
> that this partial modification isn't given out to the consumer. Instead
> they now see the same as if .get_state wasn't implemented at all.
I'm wondering why we didn't see a compiler warning about mistyped function
prototypes in some drivers.
P.S. The series is good thing to do, thank you.
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 00/11] pwm: Allow .get_state to fail
2022-12-09 21:47 ` [PATCH v2 00/11] pwm: Allow .get_state to fail Andy Shevchenko
@ 2022-12-10 9:18 ` Uwe Kleine-König
2022-12-10 20:57 ` Andy Shevchenko
0 siblings, 1 reply; 10+ messages in thread
From: Uwe Kleine-König @ 2022-12-10 9:18 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Thierry Reding, linux-pwm, linux-gpio, dri-devel, linux-leds,
linux-arm-kernel, chrome-platform, linux-amlogic, linux-mediatek,
linux-rpi-kernel, linux-rockchip, linux-riscv, linux-stm32,
linux-sunxi
[-- Attachment #1.1: Type: text/plain, Size: 1482 bytes --]
Hello Andy,
On Fri, Dec 09, 2022 at 11:47:54PM +0200, Andy Shevchenko wrote:
> On Wed, Nov 30, 2022 at 04:21:37PM +0100, Uwe Kleine-König wrote:
> > In v1 Thierry had the concern:
> >
> > | That raises the question about what to do in these cases. If we return
> > | an error, that could potentially throw off consumers. So perhaps the
> > | closest would be to return a disabled PWM? Or perhaps it'd be up to the
> > | consumer to provide some fallback configuration for invalidly configured
> > | or unconfigured PWMs.
> >
> > .get_state() is only called in pwm_device_request on a pwm_state that a
> > consumer might see. Before my series a consumer might have seen a
> > partial modified pwm_state (because .get_state() might have modified
> > .period, then stumbled and returned silently). The last patch ensures
> > that this partial modification isn't given out to the consumer. Instead
> > they now see the same as if .get_state wasn't implemented at all.
>
> I'm wondering why we didn't see a compiler warning about mistyped function
> prototypes in some drivers.
I don't understand where you expected a warning. Care to elaborate?
> P.S. The series is good thing to do, thank you.
It's already too late for an ack, the series is already in Thierry's
tree.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 00/11] pwm: Allow .get_state to fail
2022-12-10 9:18 ` Uwe Kleine-König
@ 2022-12-10 20:57 ` Andy Shevchenko
2022-12-10 22:41 ` Uwe Kleine-König
0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2022-12-10 20:57 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Thierry Reding, linux-pwm, linux-gpio, dri-devel, linux-leds,
linux-arm-kernel, chrome-platform, linux-amlogic, linux-mediatek,
linux-rpi-kernel, linux-rockchip, linux-riscv, linux-stm32,
linux-sunxi
On Sat, Dec 10, 2022 at 10:18:33AM +0100, Uwe Kleine-König wrote:
> On Fri, Dec 09, 2022 at 11:47:54PM +0200, Andy Shevchenko wrote:
> > On Wed, Nov 30, 2022 at 04:21:37PM +0100, Uwe Kleine-König wrote:
...
> > I'm wondering why we didn't see a compiler warning about mistyped function
> > prototypes in some drivers.
>
> I don't understand where you expected a warning. Care to elaborate?
intel-lpss.c has the prototype that returns an int. IIRC it was like this
before your patches. Now the above wondering passage...
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 00/11] pwm: Allow .get_state to fail
2022-12-10 20:57 ` Andy Shevchenko
@ 2022-12-10 22:41 ` Uwe Kleine-König
2022-12-11 13:31 ` Andy Shevchenko
0 siblings, 1 reply; 10+ messages in thread
From: Uwe Kleine-König @ 2022-12-10 22:41 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Thierry Reding, linux-pwm, linux-gpio, dri-devel, linux-leds,
linux-arm-kernel, chrome-platform, linux-amlogic, linux-mediatek,
linux-rpi-kernel, linux-rockchip, linux-riscv, linux-stm32,
linux-sunxi
[-- Attachment #1.1: Type: text/plain, Size: 927 bytes --]
Hello Andy,
On Sat, Dec 10, 2022 at 10:57:16PM +0200, Andy Shevchenko wrote:
> On Sat, Dec 10, 2022 at 10:18:33AM +0100, Uwe Kleine-König wrote:
> > On Fri, Dec 09, 2022 at 11:47:54PM +0200, Andy Shevchenko wrote:
> > > On Wed, Nov 30, 2022 at 04:21:37PM +0100, Uwe Kleine-König wrote:
>
> ...
>
> > > I'm wondering why we didn't see a compiler warning about mistyped function
> > > prototypes in some drivers.
> >
> > I don't understand where you expected a warning. Care to elaborate?
>
> intel-lpss.c has the prototype that returns an int. IIRC it was like this
Do you mean drivers/mfd/intel-lpss.c? That one doesn't implement a PWM?!
And drivers/pwm/pwm-lpss.c is adapted by this series.
One of us is confused ...
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 00/11] pwm: Allow .get_state to fail
2022-12-10 22:41 ` Uwe Kleine-König
@ 2022-12-11 13:31 ` Andy Shevchenko
0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2022-12-11 13:31 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Thierry Reding, linux-pwm, linux-gpio, dri-devel, linux-leds,
linux-arm-kernel, chrome-platform, linux-amlogic, linux-mediatek,
linux-rpi-kernel, linux-rockchip, linux-riscv, linux-stm32,
linux-sunxi
On Sat, Dec 10, 2022 at 11:41:54PM +0100, Uwe Kleine-König wrote:
> On Sat, Dec 10, 2022 at 10:57:16PM +0200, Andy Shevchenko wrote:
> > On Sat, Dec 10, 2022 at 10:18:33AM +0100, Uwe Kleine-König wrote:
> > > On Fri, Dec 09, 2022 at 11:47:54PM +0200, Andy Shevchenko wrote:
> > > > On Wed, Nov 30, 2022 at 04:21:37PM +0100, Uwe Kleine-König wrote:
...
> > > > I'm wondering why we didn't see a compiler warning about mistyped function
> > > > prototypes in some drivers.
> > >
> > > I don't understand where you expected a warning. Care to elaborate?
> >
> > intel-lpss.c has the prototype that returns an int. IIRC it was like this
>
> Do you mean drivers/mfd/intel-lpss.c? That one doesn't implement a PWM?!
Nope, I meant pwm-lpss.c.
> And drivers/pwm/pwm-lpss.c is adapted by this series.
That's what I didn't see how.
> One of us is confused ...
Yes, because when I have checked the branch based on Linux Next I already saw
that get_state() returns a code and I wasn't aware that the series is already
there.
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-12-11 13:33 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20221130152148.2769768-1-u.kleine-koenig@pengutronix.de>
2022-11-30 15:21 ` [PATCH v2 07/11] pwm: imx27: Propagate errors in .get_state() to the caller Uwe Kleine-König
2022-11-30 15:21 ` [PATCH v2 08/11] pwm: mtk-disp: " Uwe Kleine-König
2022-12-01 13:11 ` AngeloGioacchino Del Regno
2022-11-30 15:21 ` [PATCH v2 09/11] pwm: rockchip: " Uwe Kleine-König
2022-11-30 18:37 ` Heiko Stübner
2022-12-09 21:47 ` [PATCH v2 00/11] pwm: Allow .get_state to fail Andy Shevchenko
2022-12-10 9:18 ` Uwe Kleine-König
2022-12-10 20:57 ` Andy Shevchenko
2022-12-10 22:41 ` Uwe Kleine-König
2022-12-11 13:31 ` Andy Shevchenko
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 NNTP newsgroup(s).