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

Baolin Wang baolin.wang at linux.alibaba.com
Wed Nov 30 17:17:30 PST 2022



On 11/30/2022 11:21 PM, Uwe Kleine-König wrote:
> diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c
> index 7004f55bbf11..bda8bc5af976 100644
> --- a/drivers/pwm/pwm-sprd.c
> +++ b/drivers/pwm/pwm-sprd.c
> @@ -65,8 +65,8 @@ static void sprd_pwm_write(struct sprd_pwm_chip *spc, u32 hwid,
>   	writel_relaxed(val, spc->base + offset);
>   }
>   
> -static void sprd_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
> -			       struct pwm_state *state)
> +static int sprd_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
> +			      struct pwm_state *state)
>   {
>   	struct sprd_pwm_chip *spc =
>   		container_of(chip, struct sprd_pwm_chip, chip);
> @@ -83,7 +83,7 @@ static void sprd_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
>   	if (ret) {
>   		dev_err(spc->dev, "failed to enable pwm%u clocks\n",
>   			pwm->hwpwm);
> -		return;
> +		return 0;
>   	}
>   
>   	val = sprd_pwm_read(spc, pwm->hwpwm, SPRD_PWM_ENABLE);
> @@ -113,6 +113,8 @@ static void sprd_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
>   	/* Disable PWM clocks if the PWM channel is not in enable state. */
>   	if (!state->enabled)
>   		clk_bulk_disable_unprepare(SPRD_PWM_CHN_CLKS_NUM, chn->clks);
> +
> +	return 0;
>   }
>   
>   static int sprd_pwm_config(struct sprd_pwm_chip *spc, struct pwm_device *pwm,

For sprd pwm parts:
Reviewed-by: Baolin Wang <baolin.wang at linux.alibaba.com>



More information about the Linux-mediatek mailing list