* [PATCH v2] staging: gdm72xx: gdm_sdio: Replace timeval with ktime_t
@ 2016-02-10 5:52 Amitoj Kaur Chawla
2016-02-10 6:29 ` [Outreachy kernel] " Sudip Mukherjee
0 siblings, 1 reply; 3+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-10 5:52 UTC (permalink / raw)
To: y2038, outreachy-kernel
This driver uses 'struct timeval' which we are trying to remove since
32 bit time types will break in the year 2038. So replace it with
'ktime_t'.
Replaced do_gettimeofday() with ktime_get() because ktime_get() returns
a 'ktime_t' while do_gettimeofday() returns a 'struct timeval'.
This patch also uses ktime_us_delta() to get the elapsed time.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
Changes in v2:
-Removed the build error ktime_us_delta() was giving.
drivers/staging/gdm72xx/gdm_sdio.c | 10 +++++-----
drivers/staging/gdm72xx/gdm_sdio.h | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/gdm72xx/gdm_sdio.c b/drivers/staging/gdm72xx/gdm_sdio.c
index b0521da..247168f 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.c
+++ b/drivers/staging/gdm72xx/gdm_sdio.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/ktime.h>
#include <linux/mmc/core.h>
#include <linux/mmc/card.h>
@@ -303,7 +304,7 @@ static void send_sdu(struct sdio_func *func, struct tx_cxt *tx)
put_tx_struct(t->tx_cxt, t);
}
- do_gettimeofday(&tx->sdu_stamp);
+ tx->sdu_stamp = ktime_get();
spin_unlock_irqrestore(&tx->lock, flags);
}
@@ -330,7 +331,7 @@ static void do_tx(struct work_struct *work)
struct sdio_func *func = sdev->func;
struct tx_cxt *tx = &sdev->tx;
struct sdio_tx *t = NULL;
- struct timeval now, *before;
+ ktime_t now, *before;
int is_sdu = 0;
long diff;
unsigned long flags;
@@ -346,11 +347,10 @@ static void do_tx(struct work_struct *work)
list_del(&t->list);
is_sdu = 0;
} else if (!tx->stop_sdu_tx && !list_empty(&tx->sdu_list)) {
- do_gettimeofday(&now);
+ now = ktime_get();
before = &tx->sdu_stamp;
- diff = (now.tv_sec - before->tv_sec) * 1000000 +
- (now.tv_usec - before->tv_usec);
+ diff = ktime_us_delta(now, *before);
if (diff >= 0 && diff < TX_INTERVAL) {
schedule_work(&sdev->ws);
spin_unlock_irqrestore(&tx->lock, flags);
diff --git a/drivers/staging/gdm72xx/gdm_sdio.h b/drivers/staging/gdm72xx/gdm_sdio.h
index 77ad9d6..aa7dad2 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.h
+++ b/drivers/staging/gdm72xx/gdm_sdio.h
@@ -15,7 +15,7 @@
#define __GDM72XX_GDM_SDIO_H__
#include <linux/types.h>
-#include <linux/time.h>
+#include <linux/ktime.h>
#define MAX_NR_SDU_BUF 64
@@ -32,7 +32,7 @@ struct tx_cxt {
struct list_head free_list;
struct list_head sdu_list;
struct list_head hci_list;
- struct timeval sdu_stamp;
+ ktime_t sdu_stamp;
u8 *sdu_buf;
spinlock_t lock;
int can_send;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH v2] staging: gdm72xx: gdm_sdio: Replace timeval with ktime_t
2016-02-10 5:52 [PATCH v2] staging: gdm72xx: gdm_sdio: Replace timeval with ktime_t Amitoj Kaur Chawla
@ 2016-02-10 6:29 ` Sudip Mukherjee
2016-02-10 7:51 ` Amitoj Kaur Chawla
0 siblings, 1 reply; 3+ messages in thread
From: Sudip Mukherjee @ 2016-02-10 6:29 UTC (permalink / raw)
To: Amitoj Kaur Chawla; +Cc: y2038, outreachy-kernel
On Wed, Feb 10, 2016 at 11:22:17AM +0530, Amitoj Kaur Chawla wrote:
> This driver uses 'struct timeval' which we are trying to remove since
> 32 bit time types will break in the year 2038. So replace it with
> 'ktime_t'.
>
> Replaced do_gettimeofday() with ktime_get() because ktime_get() returns
> a 'ktime_t' while do_gettimeofday() returns a 'struct timeval'.
>
> This patch also uses ktime_us_delta() to get the elapsed time.
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
This will not apply as almost similar change has already been done by:
2bc29a1abc5c ("staging: gdm72xx: Replace timeval with ktime_t")
which tree are you using?
regards
sudip
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH v2] staging: gdm72xx: gdm_sdio: Replace timeval with ktime_t
2016-02-10 6:29 ` [Outreachy kernel] " Sudip Mukherjee
@ 2016-02-10 7:51 ` Amitoj Kaur Chawla
0 siblings, 0 replies; 3+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-10 7:51 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: y2038, outreachy-kernel
On Wed, Feb 10, 2016 at 11:59 AM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
>
> This will not apply as almost similar change has already been done by:
> 2bc29a1abc5c ("staging: gdm72xx: Replace timeval with ktime_t")
>
> which tree are you using?
>
> regards
> sudip
Sorry about this, I didn't rebase my tree. Done now.
Thanks,
Amitoj
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-10 7:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-10 5:52 [PATCH v2] staging: gdm72xx: gdm_sdio: Replace timeval with ktime_t Amitoj Kaur Chawla
2016-02-10 6:29 ` [Outreachy kernel] " Sudip Mukherjee
2016-02-10 7:51 ` Amitoj Kaur Chawla
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.