From: George Stark <gnstark@salutedevices.com>
To: <u.kleine-koenig@pengutronix.de>, <neil.armstrong@linaro.org>,
<khilman@baylibre.com>, <jbrunet@baylibre.com>,
<martin.blumenstingl@googlemail.com>
Cc: <linux-pwm@vger.kernel.org>, <linux-amlogic@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <kernel@salutedevices.com>,
George Stark <gnstark@salutedevices.com>
Subject: [PATCH v2 1/4] pwm: meson: Simplify get_state() callback
Date: Wed, 16 Oct 2024 18:25:50 +0300 [thread overview]
Message-ID: <20241016152553.2321992-2-gnstark@salutedevices.com> (raw)
In-Reply-To: <20241016152553.2321992-1-gnstark@salutedevices.com>
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>
---
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;
--
2.25.1
next prev parent reply other threads:[~2024-10-16 15:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 15:25 [PATCH v2 0/4] pwm: meson: Support constant and polarity bits George Stark
2024-10-16 15:25 ` George Stark [this message]
2024-10-20 10:44 ` [PATCH v2 1/4] pwm: meson: Simplify get_state() callback kernel test robot
2024-11-04 9:08 ` Uwe Kleine-König
2024-10-16 15:25 ` [PATCH v2 2/4] pwm: meson: Support constant and polarity bits George Stark
2024-11-04 9:32 ` Uwe Kleine-König
2024-11-06 13:54 ` George Stark
2024-11-07 8:41 ` Uwe Kleine-König
2024-11-19 12:51 ` George Stark
2024-11-19 15:19 ` Uwe Kleine-König
2024-10-16 15:25 ` [PATCH v2 3/4] pwm: meson: Use separate device id data for axg and g12 George Stark
2024-10-16 15:25 ` [PATCH v2 4/4] pwm: meson: Enable constant and polarity features for g12, axg, s4 George Stark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241016152553.2321992-2-gnstark@salutedevices.com \
--to=gnstark@salutedevices.com \
--cc=jbrunet@baylibre.com \
--cc=kernel@salutedevices.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=neil.armstrong@linaro.org \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox