RE: [PATCH v2 01/11] pwm: Make .get_state() callback return an error code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> Sent: Thursday, December 1, 2022 12:22 AM
> To: Thierry Reding <thierry.reding@xxxxxxxxx>
> Cc: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>; Linus Walleij
> <linus.walleij@xxxxxxxxxx>; Bartosz Golaszewski <brgl@xxxxxxxx>; Douglas
> Anderson <dianders@xxxxxxxxxxxx>; Pavel Machek <pavel@xxxxxx>;
> Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>; Nicolas Ferre
> <nicolas.ferre@xxxxxxxxxxxxx>; Alexandre Belloni
> <alexandre.belloni@xxxxxxxxxxx>; Ray Jui <rjui@xxxxxxxxxxxx>; Scott
> Branden <sbranden@xxxxxxxxxxxx>; Broadcom internal kernel review list
> <bcm-kernel-feedback-list@xxxxxxxxxxxx>; Benson Leung
> <bleung@xxxxxxxxxxxx>; Guenter Roeck <groeck@xxxxxxxxxxxx>; Shawn
> Guo <shawnguo@xxxxxxxxxx>; Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>;
> Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>; Fabio Estevam
> <festevam@xxxxxxxxx>; NXP Linux Team <linux-imx@xxxxxxx>; Kevin
> Hilman <khilman@xxxxxxxxxxxx>; Jerome Brunet <jbrunet@xxxxxxxxxxxx>;
> Martin Blumenstingl <martin.blumenstingl@xxxxxxxxxxxxxx>; Matthias
> Brugger <matthias.bgg@xxxxxxxxx>; Florian Fainelli <f.fainelli@xxxxxxxxx>;
> Heiko Stuebner <heiko@xxxxxxxxx>; Palmer Dabbelt
> <palmer@xxxxxxxxxxx>; Paul Walmsley <paul.walmsley@xxxxxxxxxx>;
> Michael Walle <michael@xxxxxxxx>; Orson Zhai <orsonzhai@xxxxxxxxx>;
> Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>; Chunyan Zhang
> <zhang.lyra@xxxxxxxxx>; Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx>;
> Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>; Alexandre Torgue
> <alexandre.torgue@xxxxxxxxxxx>; Chen-Yu Tsai <wens@xxxxxxxx>; Samuel
> Holland <samuel@xxxxxxxxxxxx>; Hammer Hsieh
> <hammerh0314@xxxxxxxxx>; iwamatsu nobuhiro(岩松 信洋 □SWC◯AC
> T) <nobuhiro1.iwamatsu@xxxxxxxxxxxxx>; Sean Anderson
> <sean.anderson@xxxxxxxx>; Michal Simek <michal.simek@xxxxxxxxxx>;
> Bjorn Andersson <andersson@xxxxxxxxxx>; Stephen Boyd
> <swboyd@xxxxxxxxxxxx>; Matthias Kaehlcke <mka@xxxxxxxxxxxx>; Satya
> Priya <quic_c_skakit@xxxxxxxxxxx>; linux-pwm@xxxxxxxxxxxxxxx;
> linux-gpio@xxxxxxxxxxxxxxx; dri-devel@xxxxxxxxxxxxxxxxxxxxx;
> linux-leds@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx;
> chrome-platform@xxxxxxxxxxxxxxx; linux-amlogic@xxxxxxxxxxxxxxxxxxx;
> linux-mediatek@xxxxxxxxxxxxxxxxxxx; linux-rpi-kernel@xxxxxxxxxxxxxxxxxxx;
> linux-rockchip@xxxxxxxxxxxxxxxxxxx; linux-riscv@xxxxxxxxxxxxxxxxxxx;
> linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx; linux-sunxi@xxxxxxxxxxxxxxx
> Subject: [PATCH v2 01/11] pwm: Make .get_state() callback return an error
> code
> 
> .get_state() might fail in some cases. To make it possible that a driver signals
> such a failure change the prototype of .get_state() to return an error code.
> 
> This patch was created using coccinelle and the following semantic patch:
> 
> @p1@
> identifier getstatefunc;
> identifier driver;
> @@
>  struct pwm_ops driver = {
>         ...,
>         .get_state = getstatefunc
>         ,...
>  };
> 
> @p2@
> identifier p1.getstatefunc;
> identifier chip, pwm, state;
> @@
> -void
> +int
>  getstatefunc(struct pwm_chip *chip, struct pwm_device *pwm, struct
> pwm_state *state)  {
>    ...
> -  return;
> +  return 0;
>    ...
>  }
> 
> plus the actual change of the prototype in include/linux/pwm.h (plus some
> manual fixing of indentions and empty lines).
> 
> So for now all drivers return success unconditionally. They are adapted in the
> following patches to make the changes easier reviewable.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>

<snip>

> a/drivers/pwm/pwm-visconti.c b/drivers/pwm/pwm-visconti.c index
> 927c4cbb1daf..e3fb79b3e2a7 100644
> --- a/drivers/pwm/pwm-visconti.c
> +++ b/drivers/pwm/pwm-visconti.c
> @@ -103,8 +103,8 @@ static int visconti_pwm_apply(struct pwm_chip *chip,
> struct pwm_device *pwm,
>  	return 0;
>  }
> 
> -static void visconti_pwm_get_state(struct pwm_chip *chip, struct
> pwm_device *pwm,
> -				   struct pwm_state *state)
> +static int visconti_pwm_get_state(struct pwm_chip *chip, struct
> pwm_device *pwm,
> +				  struct pwm_state *state)
>  {
>  	struct visconti_pwm_chip *priv = visconti_pwm_from_chip(chip);
>  	u32 period, duty, pwmc0, pwmc0_clk;
> @@ -122,6 +122,8 @@ static void visconti_pwm_get_state(struct pwm_chip
> *chip, struct pwm_device *pwm
>  		state->polarity = PWM_POLARITY_NORMAL;
> 
>  	state->enabled = true;
> +
> +	return 0;
>  }
> 
>  static const struct pwm_ops visconti_pwm_ops = { diff --git

<snip>

for the Visconti pwd:
Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@xxxxxxxxxxxxx>





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux