[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ll3i664yuojtueo5c5uzclduylbrjxf3r672jjb5hgtbslx6jj@fvcefnjftqmq>
Date: Mon, 4 Nov 2024 10:08:02 +0100
From: Uwe Kleine-König <u.kleine-koenig@...libre.com>
To: George Stark <gnstark@...utedevices.com>
Cc: neil.armstrong@...aro.org, khilman@...libre.com, jbrunet@...libre.com,
martin.blumenstingl@...glemail.com, linux-pwm@...r.kernel.org, linux-amlogic@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org, kernel@...utedevices.com
Subject: Re: [PATCH v2 1/4] pwm: meson: Simplify get_state() callback
On Wed, Oct 16, 2024 at 06:25:50PM +0300, George Stark wrote:
> In .get_state() callback meson_pwm_channel struct are used to store
> lo and hi reg values but they are never reused after that so
> for clearness use local variable instead.
>
> Signed-off-by: George Stark <gnstark@...utedevices.com>
> ---
> drivers/pwm/pwm-meson.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
> index 98e6c1533312..2ef632caebcc 100644
> --- a/drivers/pwm/pwm-meson.c
> +++ b/drivers/pwm/pwm-meson.c
> @@ -310,6 +310,7 @@ static int meson_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
> struct meson_pwm *meson = to_meson_pwm(chip);
> struct meson_pwm_channel_data *channel_data;
> struct meson_pwm_channel *channel;
> + unsigned int hi, lo;
> u32 value;
>
> channel = &meson->channels[pwm->hwpwm];
> @@ -319,11 +320,11 @@ static int meson_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
> state->enabled = value & channel_data->pwm_en_mask;
>
> value = readl(meson->base + channel_data->reg_offset);
> - channel->lo = FIELD_GET(PWM_LOW_MASK, value);
> - channel->hi = FIELD_GET(PWM_HIGH_MASK, value);
> + lo = FIELD_GET(PWM_LOW_MASK, value);
> + hi = FIELD_GET(PWM_HIGH_MASK, value);
>
> - state->period = meson_pwm_cnt_to_ns(chip, pwm, channel->lo + channel->hi);
> - state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, channel->hi);
> + state->period = meson_pwm_cnt_to_ns(chip, pwm, lo + hi);
> + state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, hi);
>
> state->polarity = PWM_POLARITY_NORMAL;
Fine for me if you drop the local variable channel as found by the build
bot.
Best regards
Uwe
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists