layerscape: add patches-5.4
[openwrt/staging/mkresin.git] / target / linux / layerscape / patches-5.4 / 701-net-0085-staging-fsl_qbman-stop-using-current_kernel_time.patch
1 From 91c2f372e3f70ab5b5afff5af60348fd5656d739 Mon Sep 17 00:00:00 2001
2 From: Camelia Groza <camelia.groza@nxp.com>
3 Date: Wed, 10 Oct 2018 17:30:18 +0300
4 Subject: [PATCH] staging/fsl_qbman: stop using current_kernel_time()
5
6 The current_kernel_time() call was removed in [1] in order to avoid
7 overflows in 2038. Use ktime_get_coarse_real_ts64() instead.
8
9 [1] 9765164 ("y2038: remove unused time interfaces")
10
11 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
12 ---
13 drivers/staging/fsl_qbman/qbman_driver.c | 9 ++++++---
14 1 file changed, 6 insertions(+), 3 deletions(-)
15
16 --- a/drivers/staging/fsl_qbman/qbman_driver.c
17 +++ b/drivers/staging/fsl_qbman/qbman_driver.c
18 @@ -57,7 +57,10 @@ static __init int qbman_init(void)
19 };
20 struct qm_mcr_queryfq_np np;
21 int err, retry = CONFIG_FSL_QMAN_INIT_TIMEOUT;
22 - struct timespec nowts, diffts, startts = current_kernel_time();
23 + struct timespec64 nowts, diffts, startts;
24 +
25 + ktime_get_coarse_real_ts64(&startts);
26 +
27 /* Loop while querying given fqid succeeds or time out */
28 while (1) {
29 err = qman_query_fq_np(&fq, &np);
30 @@ -68,8 +71,8 @@ static __init int qbman_init(void)
31 pr_err("QMan: I/O error, continuing anyway\n");
32 break;
33 }
34 - nowts = current_kernel_time();
35 - diffts = timespec_sub(nowts, startts);
36 + ktime_get_coarse_real_ts64(&nowts);
37 + diffts = timespec64_sub(nowts, startts);
38 if (diffts.tv_sec > 0) {
39 if (!retry--) {
40 pr_err("QMan: time out, control-plane"