From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754388AbdJSPvN (ORCPT ); Thu, 19 Oct 2017 11:51:13 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:48191 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751417AbdJSPvL (ORCPT ); Thu, 19 Oct 2017 11:51:11 -0400 X-Google-Smtp-Source: ABhQp+TqF9wxFApfIVb91rPlYltodSqhg20YWySA/+nQW3WB0ZKdDjmFCRCmu70/h69HEaKputuNLw== Date: Thu, 19 Oct 2017 08:51:10 -0700 From: Guenter Roeck To: Arnd Bergmann Cc: Wim Van Sebroeck , y2038@lists.linaro.org, xen-devel@lists.xenproject.org, Jan Beulich , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] watchdog: xen: use time64_t for timeouts Message-ID: <20171019155110.GB2962@roeck-us.net> References: <20171019150558.3202408-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171019150558.3202408-1-arnd@arndb.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 19, 2017 at 05:05:48PM +0200, Arnd Bergmann wrote: > The Xen watchdog driver uses __kernel_time_t and ktime_to_timespec() > internally for managing its timeouts. Both are deprecated because of > y2038 problems. The driver itself is fine, since it only uses monotonic > times, but converting it to use ktime_get_seconds() avoids the deprecated > interfaces and is slightly simpler. > > Signed-off-by: Arnd Bergmann Reviewed-by: Guenter Roeck > --- > drivers/watchdog/xen_wdt.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/watchdog/xen_wdt.c b/drivers/watchdog/xen_wdt.c > index cf0e650c2015..5dd5c3494d55 100644 > --- a/drivers/watchdog/xen_wdt.c > +++ b/drivers/watchdog/xen_wdt.c > @@ -35,7 +35,7 @@ > static struct platform_device *platform_device; > static DEFINE_SPINLOCK(wdt_lock); > static struct sched_watchdog wdt; > -static __kernel_time_t wdt_expires; > +static time64_t wdt_expires; > static bool is_active, expect_release; > > #define WATCHDOG_TIMEOUT 60 /* in seconds */ > @@ -49,15 +49,15 @@ module_param(nowayout, bool, S_IRUGO); > MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " > "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); > > -static inline __kernel_time_t set_timeout(void) > +static inline time64_t set_timeout(void) > { > wdt.timeout = timeout; > - return ktime_to_timespec(ktime_get()).tv_sec + timeout; > + return ktime_get_seconds() + timeout; > } > > static int xen_wdt_start(void) > { > - __kernel_time_t expires; > + time64_t expires; > int err; > > spin_lock(&wdt_lock); > @@ -98,7 +98,7 @@ static int xen_wdt_stop(void) > > static int xen_wdt_kick(void) > { > - __kernel_time_t expires; > + time64_t expires; > int err; > > spin_lock(&wdt_lock); > @@ -222,7 +222,7 @@ static long xen_wdt_ioctl(struct file *file, unsigned int cmd, > return put_user(timeout, argp); > > case WDIOC_GETTIMELEFT: > - retval = wdt_expires - ktime_to_timespec(ktime_get()).tv_sec; > + retval = wdt_expires - ktime_get_seconds(); > return put_user(retval, argp); > } > > -- > 2.9.0 >