Skip to content

Commit 4f45c37

Browse files
yuliao0214Vasily Gorbik
authored andcommitted
s390: cleanup timer API use
cleanup the s390's use of the timer API - del_timer() contains timer_pending() condition - mod_timer(timer, expires) is equivalent to: del_timer(timer); timer->expires = expires; add_timer(timer); If the timer is inactive it will be activated, using add_timer() on condition !timer_pending(&private->timer) is redundant. Just cleanup, no logic change. Signed-off-by: Yu Liao <liaoyu15@huawei.com> Link: https://lore.kernel.org/r/20220322030057.1243196-1-liaoyu15@huawei.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent 97f32e1 commit 4f45c37

5 files changed

Lines changed: 10 additions & 27 deletions

File tree

drivers/s390/char/sclp.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -745,9 +745,7 @@ sclp_sync_wait(void)
745745
/* Loop until driver state indicates finished request */
746746
while (sclp_running_state != sclp_running_state_idle) {
747747
/* Check for expired request timer */
748-
if (timer_pending(&sclp_request_timer) &&
749-
get_tod_clock_fast() > timeout &&
750-
del_timer(&sclp_request_timer))
748+
if (get_tod_clock_fast() > timeout && del_timer(&sclp_request_timer))
751749
sclp_request_timer.function(&sclp_request_timer);
752750
cpu_relax();
753751
}

drivers/s390/char/sclp_con.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ static void sclp_console_sync_queue(void)
109109
unsigned long flags;
110110

111111
spin_lock_irqsave(&sclp_con_lock, flags);
112-
if (timer_pending(&sclp_con_timer))
113-
del_timer(&sclp_con_timer);
112+
del_timer(&sclp_con_timer);
114113
while (sclp_con_queue_running) {
115114
spin_unlock_irqrestore(&sclp_con_lock, flags);
116115
sclp_sync_wait();

drivers/s390/char/sclp_vt220.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ sclp_vt220_emit_current(void)
231231
list_add_tail(&sclp_vt220_current_request->list,
232232
&sclp_vt220_outqueue);
233233
sclp_vt220_current_request = NULL;
234-
if (timer_pending(&sclp_vt220_timer))
235-
del_timer(&sclp_vt220_timer);
234+
del_timer(&sclp_vt220_timer);
236235
}
237236
sclp_vt220_flush_later = 0;
238237
}
@@ -776,8 +775,7 @@ static void __sclp_vt220_flush_buffer(void)
776775

777776
sclp_vt220_emit_current();
778777
spin_lock_irqsave(&sclp_vt220_lock, flags);
779-
if (timer_pending(&sclp_vt220_timer))
780-
del_timer(&sclp_vt220_timer);
778+
del_timer(&sclp_vt220_timer);
781779
while (sclp_vt220_queue_running) {
782780
spin_unlock_irqrestore(&sclp_vt220_lock, flags);
783781
sclp_sync_wait();

drivers/s390/cio/device_fsm.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,10 @@ ccw_device_timeout(struct timer_list *t)
113113
void
114114
ccw_device_set_timeout(struct ccw_device *cdev, int expires)
115115
{
116-
if (expires == 0) {
116+
if (expires == 0)
117117
del_timer(&cdev->private->timer);
118-
return;
119-
}
120-
if (timer_pending(&cdev->private->timer)) {
121-
if (mod_timer(&cdev->private->timer, jiffies + expires))
122-
return;
123-
}
124-
cdev->private->timer.expires = jiffies + expires;
125-
add_timer(&cdev->private->timer);
118+
else
119+
mod_timer(&cdev->private->timer, jiffies + expires);
126120
}
127121

128122
int

drivers/s390/cio/eadm_sch.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,10 @@ static void eadm_subchannel_set_timeout(struct subchannel *sch, int expires)
112112
{
113113
struct eadm_private *private = get_eadm_private(sch);
114114

115-
if (expires == 0) {
115+
if (expires == 0)
116116
del_timer(&private->timer);
117-
return;
118-
}
119-
if (timer_pending(&private->timer)) {
120-
if (mod_timer(&private->timer, jiffies + expires))
121-
return;
122-
}
123-
private->timer.expires = jiffies + expires;
124-
add_timer(&private->timer);
117+
else
118+
mod_timer(&private->timer, jiffies + expires);
125119
}
126120

127121
static void eadm_subchannel_irq(struct subchannel *sch)

0 commit comments

Comments
 (0)