> -----Original Message-----
> From: Uwe Kleine-König <u.kleine-koe...@pengutronix.de>
> Sent: Thursday, December 1, 2022 12:22 AM
> To: Thierry Reding <thierry.red...@gmail.com>
> Cc: Conor Dooley <conor.doo...@microchip.com>; Linus Walleij
> <linus.wall...@linaro.org>; Bartosz Golaszewski <b...@bgdev.pl>; Douglas
> Anderson <diand...@chromium.org>; Pavel Machek <pa...@ucw.cz>;
> Claudiu Beznea <claudiu.bez...@microchip.com>; Nicolas Ferre
> <nicolas.fe...@microchip.com>; Alexandre Belloni
> <alexandre.bell...@bootlin.com>; Ray Jui <r...@broadcom.com>; Scott
> Branden <sbran...@broadcom.com>; Broadcom internal kernel review list
> <bcm-kernel-feedback-l...@broadcom.com>; Benson Leung
> <ble...@chromium.org>; Guenter Roeck <gro...@chromium.org>; Shawn
> Guo <shawn...@kernel.org>; Sascha Hauer <s.ha...@pengutronix.de>;
> Pengutronix Kernel Team <ker...@pengutronix.de>; Fabio Estevam
> <feste...@gmail.com>; NXP Linux Team <linux-...@nxp.com>; Kevin
> Hilman <khil...@baylibre.com>; Jerome Brunet <jbru...@baylibre.com>;
> Martin Blumenstingl <martin.blumensti...@googlemail.com>; Matthias
> Brugger <matthias....@gmail.com>; Florian Fainelli <f.faine...@gmail.com>;
> Heiko Stuebner <he...@sntech.de>; Palmer Dabbelt
> <pal...@dabbelt.com>; Paul Walmsley <paul.walms...@sifive.com>;
> Michael Walle <mich...@walle.cc>; Orson Zhai <orsonz...@gmail.com>;
> Baolin Wang <baolin.w...@linux.alibaba.com>; Chunyan Zhang
> <zhang.l...@gmail.com>; Fabrice Gasnier <fabrice.gasn...@foss.st.com>;
> Maxime Coquelin <mcoquelin.st...@gmail.com>; Alexandre Torgue
> <alexandre.tor...@foss.st.com>; Chen-Yu Tsai <w...@csie.org>; Samuel
> Holland <sam...@sholland.org>; Hammer Hsieh
> <hammerh0...@gmail.com>; iwamatsu nobuhiro(岩松 信洋 □SWC◯AC
> T) <nobuhiro1.iwama...@toshiba.co.jp>; Sean Anderson
> <sean.ander...@seco.com>; Michal Simek <michal.si...@xilinx.com>;
> Bjorn Andersson <anders...@kernel.org>; Stephen Boyd
> <swb...@chromium.org>; Matthias Kaehlcke <m...@chromium.org>; Satya
> Priya <quic_c_ska...@quicinc.com>; linux-...@vger.kernel.org;
> linux-g...@vger.kernel.org; dri-devel@lists.freedesktop.org;
> linux-l...@vger.kernel.org; linux-arm-ker...@lists.infradead.org;
> chrome-platf...@lists.linux.dev; linux-amlo...@lists.infradead.org;
> linux-media...@lists.infradead.org; linux-rpi-ker...@lists.infradead.org;
> linux-rockc...@lists.infradead.org; linux-ri...@lists.infradead.org;
> linux-st...@st-md-mailman.stormreply.com; linux-su...@lists.linux.dev
> 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-koe...@pengutronix.de>

<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.iwama...@toshiba.co.jp>

Reply via email to