diff options
Diffstat (limited to 'drivers/s390/char/sclp.c')
-rw-r--r-- | drivers/s390/char/sclp.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c index 41d8aa96801f..9b4c61c1e309 100644 --- a/drivers/s390/char/sclp.c +++ b/drivers/s390/char/sclp.c @@ -136,6 +136,7 @@ static enum sclp_suspend_state_t { #define SCLP_BUSY_INTERVAL 10 #define SCLP_RETRY_INTERVAL 30 +static void sclp_request_timeout(bool force_restart); static void sclp_process_queue(void); static void __sclp_make_read_req(void); static int sclp_init_mask(int calculate); @@ -154,25 +155,32 @@ __sclp_queue_read_req(void) /* Set up request retry timer. Called while sclp_lock is locked. */ static inline void -__sclp_set_request_timer(unsigned long time, void (*function)(unsigned long), - unsigned long data) +__sclp_set_request_timer(unsigned long time, void (*cb)(struct timer_list *)) { del_timer(&sclp_request_timer); - sclp_request_timer.function = function; - sclp_request_timer.data = data; + sclp_request_timer.function = (TIMER_FUNC_TYPE)cb; sclp_request_timer.expires = jiffies + time; add_timer(&sclp_request_timer); } -/* Request timeout handler. Restart the request queue. If DATA is non-zero, +static void sclp_request_timeout_restart(struct timer_list *unused) +{ + sclp_request_timeout(true); +} + +static void sclp_request_timeout_normal(struct timer_list *unused) +{ + sclp_request_timeout(false); +} + +/* Request timeout handler. Restart the request queue. If force_restart, * force restart of running request. */ -static void -sclp_request_timeout(unsigned long data) +static void sclp_request_timeout(bool force_restart) { unsigned long flags; spin_lock_irqsave(&sclp_lock, flags); - if (data) { + if (force_restart) { if (sclp_running_state == sclp_running_state_running) { /* Break running state and queue NOP read event request * to get a defined interface state. */ @@ -181,7 +189,7 @@ sclp_request_timeout(unsigned long data) } } else { __sclp_set_request_timer(SCLP_BUSY_INTERVAL * HZ, - sclp_request_timeout, 0); + sclp_request_timeout_normal); } spin_unlock_irqrestore(&sclp_lock, flags); sclp_process_queue(); @@ -239,7 +247,7 @@ out: * invokes callback. This timer can be set per request in situations where * waiting too long would be harmful to the system, e.g. during SE reboot. */ -static void sclp_req_queue_timeout(unsigned long data) +static void sclp_req_queue_timeout(struct timer_list *unused) { unsigned long flags, expires_next; struct sclp_req *req; @@ -276,12 +284,12 @@ __sclp_start_request(struct sclp_req *req) req->status = SCLP_REQ_RUNNING; sclp_running_state = sclp_running_state_running; __sclp_set_request_timer(SCLP_RETRY_INTERVAL * HZ, - sclp_request_timeout, 1); + sclp_request_timeout_restart); return 0; } else if (rc == -EBUSY) { /* Try again later */ __sclp_set_request_timer(SCLP_BUSY_INTERVAL * HZ, - sclp_request_timeout, 0); + sclp_request_timeout_normal); return 0; } /* Request failed */ @@ -315,7 +323,7 @@ sclp_process_queue(void) /* Cannot abort already submitted request - could still * be active at the SCLP */ __sclp_set_request_timer(SCLP_BUSY_INTERVAL * HZ, - sclp_request_timeout, 0); + sclp_request_timeout_normal); break; } do_post: @@ -558,7 +566,7 @@ sclp_sync_wait(void) if (timer_pending(&sclp_request_timer) && get_tod_clock_fast() > timeout && del_timer(&sclp_request_timer)) - sclp_request_timer.function(sclp_request_timer.data); + sclp_request_timer.function((TIMER_DATA_TYPE)&sclp_request_timer); cpu_relax(); } local_irq_disable(); @@ -915,7 +923,7 @@ static void sclp_check_handler(struct ext_code ext_code, /* Initial init mask request timed out. Modify request state to failed. */ static void -sclp_check_timeout(unsigned long data) +sclp_check_timeout(struct timer_list *unused) { unsigned long flags; @@ -954,7 +962,7 @@ sclp_check_interface(void) sclp_init_req.status = SCLP_REQ_RUNNING; sclp_running_state = sclp_running_state_running; __sclp_set_request_timer(SCLP_RETRY_INTERVAL * HZ, - sclp_check_timeout, 0); + sclp_check_timeout); spin_unlock_irqrestore(&sclp_lock, flags); /* Enable service-signal interruption - needs to happen * with IRQs enabled. */ @@ -1159,9 +1167,8 @@ sclp_init(void) INIT_LIST_HEAD(&sclp_req_queue); INIT_LIST_HEAD(&sclp_reg_list); list_add(&sclp_state_change_event.list, &sclp_reg_list); - init_timer(&sclp_request_timer); - init_timer(&sclp_queue_timer); - sclp_queue_timer.function = sclp_req_queue_timeout; + timer_setup(&sclp_request_timer, NULL, 0); + timer_setup(&sclp_queue_timer, sclp_req_queue_timeout, 0); /* Check interface */ spin_unlock_irqrestore(&sclp_lock, flags); rc = sclp_check_interface(); |