linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: "Jerome Brunet" <jbrunet@baylibre.com>,
	"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
	"Neil Armstrong" <narmstrong@baylibre.com>,
	"Kevin Hilman" <khilman@baylibre.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"thierry.reding@gmail.com" <thierry.reding@gmail.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"open list:ARM/Amlogic Meson..."
	<linux-amlogic@lists.infradead.org>,
	linux-pwm@vger.kernel.org,
	Dmitry Rokosov <ddrokosov@sberdevices.ru>
Subject: [PATCH v5 RESEND 3/6] pwm: meson: remove not needed check in meson_pwm_calc
Date: Wed, 24 May 2023 21:49:56 +0200	[thread overview]
Message-ID: <c6d59480-df25-9244-82ec-fcd26dbe5022@gmail.com> (raw)
In-Reply-To: <aa498590-261c-4ada-63ff-8d7aaeec0932@gmail.com>

period >= duty implies that cnt >= duty_cnt. We verified before
that cnt <= 0xffff, therefore we can omit the check here.

Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/pwm/pwm-meson.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 33107204a..aad4a0ed3 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -204,12 +204,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm,
 		channel->hi = 0;
 		channel->lo = cnt;
 	} else {
-		/* Then check is we can have the duty with the same pre_div */
 		duty_cnt = div64_u64(fin_freq * duty, NSEC_PER_SEC * (pre_div + 1));
-		if (duty_cnt > 0xffff) {
-			dev_err(meson->chip.dev, "unable to get duty cycle\n");
-			return -EINVAL;
-		}
 
 		dev_dbg(meson->chip.dev, "duty=%llu pre_div=%u duty_cnt=%u\n",
 			duty, pre_div, duty_cnt);
-- 
2.40.1



  parent reply	other threads:[~2023-05-24 19:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 19:45 [PATCH v5 0/6] pwm: meson: make full use of common clock framework Heiner Kallweit
2023-05-24 19:47 ` [PATCH v5 RESEND 1/6] pwm: meson: modify and simplify calculation in meson_pwm_get_state Heiner Kallweit
2023-05-24 19:48 ` [PATCH v5 RESEND 2/6] pwm: meson: fix handling of period/duty if greater than UINT_MAX Heiner Kallweit
2023-05-24 19:49 ` Heiner Kallweit [this message]
2023-05-24 19:50 ` [PATCH v5 4/6] pwm: meson: switch to using struct clk_parent_data for mux parents Heiner Kallweit
2023-05-24 19:51 ` [PATCH v5 5/6] pwm: meson: don't use hdmi/video clock as mux parent Heiner Kallweit
2023-05-24 19:52 ` [PATCH v5 6/6] pwm: meson: make full use of common clock framework Heiner Kallweit
2023-06-23 14:51 ` [PATCH v5 0/6] " Thierry Reding

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=c6d59480-df25-9244-82ec-fcd26dbe5022@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=ddrokosov@sberdevices.ru \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=narmstrong@baylibre.com \
    --cc=thierry.reding@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).