Skip to content

Commit 8d73b2a

Browse files
arndbcminyard
authored andcommitted
ipmi: kill off 'timespec' usage again
'struct timespec' is getting removed from the kernel. The usage in ipmi was fixed before in commit 48862ea ("ipmi: Update timespec usage to timespec64"), but unfortunately it crept back in. The busy looping code can better use ktime_t anyway, so use that there to simplify the implementation. Fixes: cbb19cb ("ipmi_si: Convert timespec64 to timespec") Signed-off-by: Arnd Bergmann <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
1 parent 0d8633b commit 8d73b2a

File tree

1 file changed

+13
-27
lines changed

1 file changed

+13
-27
lines changed

drivers/char/ipmi/ipmi_si_intf.c

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,10 @@ static void cleanup_ipmi_si(void);
265265
#ifdef DEBUG_TIMING
266266
void debug_timestamp(char *msg)
267267
{
268-
struct timespec t;
268+
struct timespec64 t;
269269

270-
ktime_get_ts(&t);
271-
pr_debug("**%s: %ld.%9.9ld\n", msg, (long) t.tv_sec, t.tv_nsec);
270+
ktime_get_ts64(&t);
271+
pr_debug("**%s: %lld.%9.9ld\n", msg, t.tv_sec, t.tv_nsec);
272272
}
273273
#else
274274
#define debug_timestamp(x)
@@ -935,38 +935,25 @@ static void set_run_to_completion(void *send_info, bool i_run_to_completion)
935935
}
936936

937937
/*
938-
* Use -1 in the nsec value of the busy waiting timespec to tell that
939-
* we are spinning in kipmid looking for something and not delaying
940-
* between checks
938+
* Use -1 as a special constant to tell that we are spinning in kipmid
939+
* looking for something and not delaying between checks
941940
*/
942-
static inline void ipmi_si_set_not_busy(struct timespec *ts)
943-
{
944-
ts->tv_nsec = -1;
945-
}
946-
static inline int ipmi_si_is_busy(struct timespec *ts)
947-
{
948-
return ts->tv_nsec != -1;
949-
}
950-
941+
#define IPMI_TIME_NOT_BUSY ns_to_ktime(-1ull)
951942
static inline bool ipmi_thread_busy_wait(enum si_sm_result smi_result,
952943
const struct smi_info *smi_info,
953-
struct timespec *busy_until)
944+
ktime_t *busy_until)
954945
{
955946
unsigned int max_busy_us = 0;
956947

957948
if (smi_info->si_num < num_max_busy_us)
958949
max_busy_us = kipmid_max_busy_us[smi_info->si_num];
959950
if (max_busy_us == 0 || smi_result != SI_SM_CALL_WITH_DELAY)
960-
ipmi_si_set_not_busy(busy_until);
961-
else if (!ipmi_si_is_busy(busy_until)) {
962-
ktime_get_ts(busy_until);
963-
timespec_add_ns(busy_until, max_busy_us * NSEC_PER_USEC);
951+
*busy_until = IPMI_TIME_NOT_BUSY;
952+
else if (*busy_until == IPMI_TIME_NOT_BUSY) {
953+
*busy_until = ktime_get() + max_busy_us * NSEC_PER_USEC;
964954
} else {
965-
struct timespec now;
966-
967-
ktime_get_ts(&now);
968-
if (unlikely(timespec_compare(&now, busy_until) > 0)) {
969-
ipmi_si_set_not_busy(busy_until);
955+
if (unlikely(ktime_get() > *busy_until)) {
956+
*busy_until = IPMI_TIME_NOT_BUSY;
970957
return false;
971958
}
972959
}
@@ -988,9 +975,8 @@ static int ipmi_thread(void *data)
988975
struct smi_info *smi_info = data;
989976
unsigned long flags;
990977
enum si_sm_result smi_result;
991-
struct timespec busy_until = { 0, 0 };
978+
ktime_t busy_until = IPMI_TIME_NOT_BUSY;
992979

993-
ipmi_si_set_not_busy(&busy_until);
994980
set_user_nice(current, MAX_NICE);
995981
while (!kthread_should_stop()) {
996982
int busy_wait;

0 commit comments

Comments
 (0)