linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: "Sebastian Reichel" <sre@kernel.org>, "René Moll" <Rene.Moll@xsens.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: [PATCH] power: reset: ltc2952: fix float conversion error
Date: Sat,  4 Dec 2021 23:01:49 +0100	[thread overview]
Message-ID: <20211204220249.591482-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

clang-14 does not like the way this driver converts a 'long double'
to an integer when the target architecture disables floating point
support:

drivers/power/reset/ltc2952-poweroff.c:162:28: error: expression requires  'long double' type support, but target 'x86_64-unknown-linux' does not support it
        data->wde_interval = 300L * 1E6L;
                                  ^

Turn this into pure integer math and make it more readable at the
same time using the NSEC_PER_MSEC macro instead.

Fixes: 6647156c00cc ("power: reset: add LTC2952 poweroff driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/power/reset/ltc2952-poweroff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/reset/ltc2952-poweroff.c b/drivers/power/reset/ltc2952-poweroff.c
index fbb344353fe4..9fc88a9f244c 100644
--- a/drivers/power/reset/ltc2952-poweroff.c
+++ b/drivers/power/reset/ltc2952-poweroff.c
@@ -159,8 +159,8 @@ static void ltc2952_poweroff_kill(void)
 
 static void ltc2952_poweroff_default(struct ltc2952_poweroff *data)
 {
-	data->wde_interval = 300L * 1E6L;
-	data->trigger_delay = ktime_set(2, 500L*1E6L);
+	data->wde_interval = 300 * NSEC_PER_MSEC;
+	data->trigger_delay = ktime_set(2, 500 * NSEC_PER_MSEC);
 
 	hrtimer_init(&data->timer_trigger, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	data->timer_trigger.function = ltc2952_poweroff_timer_trigger;
-- 
2.29.2


             reply	other threads:[~2021-12-04 22:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04 22:01 Arnd Bergmann [this message]
2021-12-07 18:41 ` [PATCH] power: reset: ltc2952: fix float conversion error Nick Desaulniers
2021-12-07 19:00   ` Nick Desaulniers
2021-12-07 19:05   ` Nathan Chancellor

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=20211204220249.591482-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=Rene.Moll@xsens.com \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=sre@kernel.org \
    /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).