Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pwm: meson: Simplify get_state() callback

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@salutedevices.com>
Link: https://lore.kernel.org/r/20241119125318.3492261-2-gnstark@salutedevices.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

authored by

George Stark and committed by
Uwe Kleine-König
8c22e890 8ffd015d

+5 -6
+5 -6
drivers/pwm/pwm-meson.c
··· 309 309 { 310 310 struct meson_pwm *meson = to_meson_pwm(chip); 311 311 struct meson_pwm_channel_data *channel_data; 312 - struct meson_pwm_channel *channel; 312 + unsigned int hi, lo; 313 313 u32 value; 314 314 315 - channel = &meson->channels[pwm->hwpwm]; 316 315 channel_data = &meson_pwm_per_channel_data[pwm->hwpwm]; 317 316 318 317 value = readl(meson->base + REG_MISC_AB); 319 318 state->enabled = value & channel_data->pwm_en_mask; 320 319 321 320 value = readl(meson->base + channel_data->reg_offset); 322 - channel->lo = FIELD_GET(PWM_LOW_MASK, value); 323 - channel->hi = FIELD_GET(PWM_HIGH_MASK, value); 321 + lo = FIELD_GET(PWM_LOW_MASK, value); 322 + hi = FIELD_GET(PWM_HIGH_MASK, value); 324 323 325 - state->period = meson_pwm_cnt_to_ns(chip, pwm, channel->lo + channel->hi); 326 - state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, channel->hi); 324 + state->period = meson_pwm_cnt_to_ns(chip, pwm, lo + hi); 325 + state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, hi); 327 326 328 327 state->polarity = PWM_POLARITY_NORMAL; 329 328