All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: debug: remove jiffies_to_timespec
@ 2017-11-27 11:36 Arnd Bergmann
  2017-11-27 12:18 ` Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arnd Bergmann @ 2017-11-27 11:36 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: y2038, Arnd Bergmann, Bart Van Assche, Douglas Gilbert,
	Hannes Reinecke, Johannes Thumshirn, linux-scsi, linux-kernel

There is no need to go through an intermediate timespec to convert
to ktime_t when we just want a simple multiplication. This gets
rid of one of the few users of jiffies_to_timespec, which I
hope to remove as part of the y2038 cleanup.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/scsi_debug.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index e4f037f0f38b..df7e9db44d44 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -4085,10 +4085,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
 		ktime_t kt;
 
 		if (delta_jiff > 0) {
-			struct timespec ts;
-
-			jiffies_to_timespec(delta_jiff, &ts);
-			kt = ktime_set(ts.tv_sec, ts.tv_nsec);
+			kt = ns_to_ktime((u64)delta_jiff * (NSEC_PER_SEC / HZ));
 		} else
 			kt = sdebug_ndelay;
 		if (NULL == sd_dp) {
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: debug: remove jiffies_to_timespec
  2017-11-27 11:36 [PATCH] scsi: debug: remove jiffies_to_timespec Arnd Bergmann
@ 2017-11-27 12:18 ` Johannes Thumshirn
  2017-11-27 13:29 ` Douglas Gilbert
  2017-11-29  5:01 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2017-11-27 12:18 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: James E.J. Bottomley, Martin K. Petersen, y2038, Bart Van Assche,
	Douglas Gilbert, Hannes Reinecke, linux-scsi, linux-kernel

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: debug: remove jiffies_to_timespec
  2017-11-27 11:36 [PATCH] scsi: debug: remove jiffies_to_timespec Arnd Bergmann
  2017-11-27 12:18 ` Johannes Thumshirn
@ 2017-11-27 13:29 ` Douglas Gilbert
  2017-11-29  5:01 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Douglas Gilbert @ 2017-11-27 13:29 UTC (permalink / raw)
  To: Arnd Bergmann, James E.J. Bottomley, Martin K. Petersen
  Cc: y2038, Bart Van Assche, Hannes Reinecke, Johannes Thumshirn,
	linux-scsi, linux-kernel

On 2017-11-27 12:36 PM, Arnd Bergmann wrote:
> There is no need to go through an intermediate timespec to convert
> to ktime_t when we just want a simple multiplication. This gets
> rid of one of the few users of jiffies_to_timespec, which I
> hope to remove as part of the y2038 cleanup.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>

> ---
>   drivers/scsi/scsi_debug.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index e4f037f0f38b..df7e9db44d44 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -4085,10 +4085,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
>   		ktime_t kt;
>   
>   		if (delta_jiff > 0) {
> -			struct timespec ts;
> -
> -			jiffies_to_timespec(delta_jiff, &ts);
> -			kt = ktime_set(ts.tv_sec, ts.tv_nsec);
> +			kt = ns_to_ktime((u64)delta_jiff * (NSEC_PER_SEC / HZ));
>   		} else
>   			kt = sdebug_ndelay;
>   		if (NULL == sd_dp) {
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: debug: remove jiffies_to_timespec
  2017-11-27 11:36 [PATCH] scsi: debug: remove jiffies_to_timespec Arnd Bergmann
  2017-11-27 12:18 ` Johannes Thumshirn
  2017-11-27 13:29 ` Douglas Gilbert
@ 2017-11-29  5:01 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2017-11-29  5:01 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: James E.J. Bottomley, Martin K. Petersen, y2038, Bart Van Assche,
	Douglas Gilbert, Hannes Reinecke, Johannes Thumshirn, linux-scsi,
	linux-kernel


Arnd,

> There is no need to go through an intermediate timespec to convert to
> ktime_t when we just want a simple multiplication. This gets rid of
> one of the few users of jiffies_to_timespec, which I hope to remove as
> part of the y2038 cleanup.

Applied to 4.16/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-29  5:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27 11:36 [PATCH] scsi: debug: remove jiffies_to_timespec Arnd Bergmann
2017-11-27 12:18 ` Johannes Thumshirn
2017-11-27 13:29 ` Douglas Gilbert
2017-11-29  5:01 ` Martin K. Petersen

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.