Skip to content

Commit 644106c

Browse files
nathanchancesre
authored andcommitted
power: reset: ltc2952: Fix use of floating point literals
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: 6647156 ("power: reset: add LTC2952 poweroff driver") Link: ClangBuiltLinux#1497 Link: llvm/llvm-project@a8083d4 Signed-off-by: Nathan Chancellor <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 80211be commit 644106c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/power/reset/ltc2952-poweroff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ static void ltc2952_poweroff_kill(void)
159159

160160
static void ltc2952_poweroff_default(struct ltc2952_poweroff *data)
161161
{
162-
data->wde_interval = 300L * 1E6L;
163-
data->trigger_delay = ktime_set(2, 500L*1E6L);
162+
data->wde_interval = 300L * NSEC_PER_MSEC;
163+
data->trigger_delay = ktime_set(2, 500L * NSEC_PER_MSEC);
164164

165165
hrtimer_init(&data->timer_trigger, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
166166
data->timer_trigger.function = ltc2952_poweroff_timer_trigger;

0 commit comments

Comments
 (0)