scsi: debug: remove jiffies_to_timespec
PATCH 1/1 scsi: debug: remove jiffies_to_timespec
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.
--- drivers/scsi/scsi_debug.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/scsi_debug.c +1 -4
@@ -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) {
Signature · 1 line
2.9.0
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +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
Quoted 6 lines · Arnd Bergmann
There is no need to go through an intermediate timespec to convert to
ktime_twhen we just want a simple multiplication. This gets rid of one of the few users ofjiffies_to_timespec, which I hope to remove as part of the y2038 cleanup.Signed-off-by Arnd Bergmann <[email protected]>
Quoted 21 lines
--- drivers/scsi/scsi_debug.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/scsi/scsi_debug.c +1
-4@@ -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) {
Martin K. Petersen
AppliedArnd,
Quoted 4 lines
There is no need to go through an intermediate timespec to convert to
ktime_twhen we just want a simple multiplication. This gets rid of one of the few users ofjiffies_to_timespec, which I hope to remove as part of the y2038 cleanup.
Applied to 4.16/scsi-queue. Thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering