Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3106273pxb; Fri, 5 Nov 2021 09:51:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPcWO7wssqEWd/p7+QpmnNKHjqku7NesXOjCkL5HdvPp5Vk//eFspGB7CEOFlCIbEjZLFm X-Received: by 2002:a05:6638:204b:: with SMTP id t11mr9938654jaj.40.1636131084223; Fri, 05 Nov 2021 09:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636131084; cv=none; d=google.com; s=arc-20160816; b=HSi79DZI4nNtkh3V5MfNJVGjmmuseJwyhyEI7bHVJMwo1Jzq0NW4PCZ4PgCvO3sqGL nrCusy1L5HpU5x1ONmFAfAQ7VG3kTCrcOC/McAfotgC70rjMM6p3yBttghkLhnZrr3Ut O/+RlLQwP1ZtS6KnfIEE40uaQV6tT2jnL9fYI/xT9CjCfnnokHOJVxDWmI9pB/Hid/Q7 tZTBwr1Ltenf5DNLH4e7qw9LELCmHMUm5fiycGIlrZff+cdoeEBAKeiCgIJK1tpT3QkR jj313obgU1dhcBgT3Eo6d3eGMFqG77w+F5ybx2fuU7+EczGJqVuuy2Tzfa1eRLPV3Nzh loEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bdb80uo18gVQMcTTaY0uQ+4GvowseRiUtBf6LCCGsxM=; b=N7TLPFUS3EVse6uO5omnbXPSCsdmai5w/g8peYceXcKs5zsw8c0qKAMUPrvYurHy5M KMTtADmiiivezRtqB+ZsZrQ3bLC4K1SBYIoJrhSyXNa8lS9C2RfnJBxdeRMb0xC1deWw xsIo2sGQ1QSoj3FtF8vsDufNFeWubLQEiy1qJuRqLD8BFybxbijDPwGOZXnuLlWkhB2X 6mkrYyc4mi6z2QzsUJgePrcN3u3VKabulMxbJAarFrFa/CPE/p9de7xZ33frxZm8PeFn QyxRq2b9Q2kqavc8UuapnSEAdZtFRMpKP3o57BiM6Y/+i5pFv5TrQ+MsK6M+M5V346l8 l0TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jxtxGOL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si8253815jak.88.2021.11.05.09.51.08; Fri, 05 Nov 2021 09:51:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jxtxGOL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233407AbhKEPZm (ORCPT + 99 others); Fri, 5 Nov 2021 11:25:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:34306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233330AbhKEPZl (ORCPT ); Fri, 5 Nov 2021 11:25:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1A21161037; Fri, 5 Nov 2021 15:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636125782; bh=SqXbChSnDaXFGPgVQdxjFDEugSBYCURJsa2sAqkFNNg=; h=From:To:Cc:Subject:Date:From; b=jxtxGOL2YoxoT2/yKMVeR/jc+bUWPN9bDY/yhZPCw3fokccuzCgByw15Nzx2ZlxJo wjGopXljGijo9X9oF2ir5yVpZpboc3d9uwnIT3nt6n+3g8ZfVU5YbkWkd+obhlo3lf JKqyePC61iydtXBx9ZzcapqcaduQdRO6mFeoDM9JzMT9RJTvVu3fTn01f2HpovBlpn rZdYu3DBY3SlVkCpL/2DIbgjAVs3RSbYfh/qL+DQiDu1WH4nh2r8eD3vO7VkywnmpH OIUCLWPepMNoEdIRM4yFUvnTMM+3r8Zf7za9EosQrNmzqRXZCwxGbXNJQYuv5NVgeI lknJBerkJl5yA== From: Nathan Chancellor To: Sebastian Reichel Cc: Nick Desaulniers , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor Subject: [PATCH v2] power: reset: ltc2952: Fix use of floating point literals Date: Fri, 5 Nov 2021 08:20:50 -0700 Message-Id: <20211105152049.2522250-1-nathan@kernel.org> X-Mailer: git-send-email 2.34.0.rc0 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A new commit in LLVM causes an error on the use of 'long double' when '-mno-x87' is used, which the kernel does through an alias, '-mno-80387' (see the LLVM commit below for more details around why it does this). drivers/power/reset/ltc2952-poweroff.c:162:28: error: expression requires 'long double' type support, but target 'x86_64-unknown-linux-gnu' does not support it data->wde_interval = 300L * 1E6L; ^ drivers/power/reset/ltc2952-poweroff.c:162:21: error: expression requires 'long double' type support, but target 'x86_64-unknown-linux-gnu' does not support it data->wde_interval = 300L * 1E6L; ^ drivers/power/reset/ltc2952-poweroff.c:163:41: error: expression requires 'long double' type support, but target 'x86_64-unknown-linux-gnu' does not support it data->trigger_delay = ktime_set(2, 500L*1E6L); ^ 3 errors generated. This happens due to the use of a 'long double' literal. The 'E6' part of '1E6L' causes the literal to be a 'double' then the 'L' suffix promotes it to 'long double'. There is no visible reason for floating point values in this driver, as the values are only assigned to integer types. Use NSEC_PER_MSEC, which is the same integer value as '1E6L', to avoid changing functionality but fix the error. Fixes: 6647156c00cc ("power: reset: add LTC2952 poweroff driver") Link: https://github.com/ClangBuiltLinux/linux/issues/1497 Link: https://github.com/llvm/llvm-project/commit/a8083d42b1c346e21623a1d36d1f0cadd7801d83 Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers --- v1 -> v2: https://lore.kernel.org/r/20211104215047.663411-1-nathan@kernel.org/ * A separate review pointed out that NSEC_PER_MSEC is a better choice than USEC_PER_SEC because ktime_t is nanoseconds and the few functions that take these values work in nanoseconds. The value is the same but the documentation is better. * Pick up Nick's review tag. 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..65d9528cc989 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 = 300L * NSEC_PER_MSEC; + data->trigger_delay = ktime_set(2, 500L * NSEC_PER_MSEC); hrtimer_init(&data->timer_trigger, CLOCK_MONOTONIC, HRTIMER_MODE_REL); data->timer_trigger.function = ltc2952_poweroff_timer_trigger; base-commit: d4439a1189f93d0ac1eaf0197db8e6b3e197d5c7 -- 2.34.0.rc0