Commit 706a527c authored by Tina Ruchandani's avatar Tina Ruchandani Committed by Kalle Valo

prism54: isl_38xx: Replace 'struct timeval'

'struct timeval' uses a 32-bit seconds field which will overflow in
year 2038 and beyond. This patch is part of a larger effort to remove
all instances of 'struct timeval' from the kernel and replace them
with 64-bit timekeeping variables.
The patch also fixes the debug printf specifier to avoid the
seconds value being truncated.
The patch was build-tested / debugged by removing the
"if VERBOSE > SHOW_ERROR_MESSAGES" guards.
Signed-off-by: default avatarTina Ruchandani <ruchandani.tina@gmail.com>
Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent e4c8b456
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ktime.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -113,7 +114,7 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) ...@@ -113,7 +114,7 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base)
#if VERBOSE > SHOW_ERROR_MESSAGES #if VERBOSE > SHOW_ERROR_MESSAGES
u32 counter = 0; u32 counter = 0;
struct timeval current_time; struct timespec64 current_ts64;
DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n"); DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n");
#endif #endif
...@@ -121,22 +122,22 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) ...@@ -121,22 +122,22 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base)
if (asleep) { if (asleep) {
/* device is in powersave, trigger the device for wakeup */ /* device is in powersave, trigger the device for wakeup */
#if VERBOSE > SHOW_ERROR_MESSAGES #if VERBOSE > SHOW_ERROR_MESSAGES
do_gettimeofday(&current_time); ktime_get_real_ts64(&current_ts64);
DEBUG(SHOW_TRACING, "%08li.%08li Device wakeup triggered\n", DEBUG(SHOW_TRACING, "%lld.%09ld Device wakeup triggered\n",
current_time.tv_sec, (long)current_time.tv_usec); (s64)current_ts64.tv_sec, current_ts64.tv_nsec);
DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n", DEBUG(SHOW_TRACING, "%lld.%09ld Device register read %08x\n",
current_time.tv_sec, (long)current_time.tv_usec, (s64)current_ts64.tv_sec, current_ts64.tv_nsec,
readl(device_base + ISL38XX_CTRL_STAT_REG)); readl(device_base + ISL38XX_CTRL_STAT_REG));
#endif #endif
reg = readl(device_base + ISL38XX_INT_IDENT_REG); reg = readl(device_base + ISL38XX_INT_IDENT_REG);
if (reg == 0xabadface) { if (reg == 0xabadface) {
#if VERBOSE > SHOW_ERROR_MESSAGES #if VERBOSE > SHOW_ERROR_MESSAGES
do_gettimeofday(&current_time); ktime_get_real_ts64(&current_ts64);
DEBUG(SHOW_TRACING, DEBUG(SHOW_TRACING,
"%08li.%08li Device register abadface\n", "%lld.%09ld Device register abadface\n",
current_time.tv_sec, (long)current_time.tv_usec); (s64)current_ts64.tv_sec, current_ts64.tv_nsec);
#endif #endif
/* read the Device Status Register until Sleepmode bit is set */ /* read the Device Status Register until Sleepmode bit is set */
while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG), while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG),
...@@ -149,13 +150,13 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) ...@@ -149,13 +150,13 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base)
#if VERBOSE > SHOW_ERROR_MESSAGES #if VERBOSE > SHOW_ERROR_MESSAGES
DEBUG(SHOW_TRACING, DEBUG(SHOW_TRACING,
"%08li.%08li Device register read %08x\n", "%lld.%09ld Device register read %08x\n",
current_time.tv_sec, (long)current_time.tv_usec, (s64)current_ts64.tv_sec, current_ts64.tv_nsec,
readl(device_base + ISL38XX_CTRL_STAT_REG)); readl(device_base + ISL38XX_CTRL_STAT_REG));
do_gettimeofday(&current_time); ktime_get_real_ts64(&current_ts64);
DEBUG(SHOW_TRACING, DEBUG(SHOW_TRACING,
"%08li.%08li Device asleep counter %i\n", "%lld.%09ld Device asleep counter %i\n",
current_time.tv_sec, (long)current_time.tv_usec, (s64)current_ts64.tv_sec, current_ts64.tv_nsec,
counter); counter);
#endif #endif
} }
...@@ -168,9 +169,9 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) ...@@ -168,9 +169,9 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base)
/* perform another read on the Device Status Register */ /* perform another read on the Device Status Register */
reg = readl(device_base + ISL38XX_CTRL_STAT_REG); reg = readl(device_base + ISL38XX_CTRL_STAT_REG);
do_gettimeofday(&current_time); ktime_get_real_ts64(&current_ts64);
DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n", DEBUG(SHOW_TRACING, "%lld.%00ld Device register read %08x\n",
current_time.tv_sec, (long)current_time.tv_usec, reg); (s64)current_ts64.tv_sec, current_ts64.tv_nsec, reg);
#endif #endif
} else { } else {
/* device is (still) awake */ /* device is (still) awake */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment