Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75492a5

Browse files
keesMartin Schwidefsky
authored andcommitted
s390/scsi: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Steffen Maier <[email protected]> Cc: Benjamin Block <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent 544e8dd commit 75492a5

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

drivers/s390/scsi/zfcp_erp.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ enum zfcp_erp_act_result {
5656
ZFCP_ERP_NOMEM = 5,
5757
};
5858

59+
static void zfcp_erp_memwait_handler(struct timer_list *t);
60+
5961
static void zfcp_erp_adapter_block(struct zfcp_adapter *adapter, int mask)
6062
{
6163
zfcp_erp_clear_adapter_status(adapter,
@@ -237,6 +239,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status,
237239
erp_action->fsf_req_id = 0;
238240
erp_action->action = need;
239241
erp_action->status = act_status;
242+
timer_setup(&erp_action->timer, zfcp_erp_memwait_handler, 0);
240243

241244
return erp_action;
242245
}
@@ -564,21 +567,22 @@ void zfcp_erp_notify(struct zfcp_erp_action *erp_action, unsigned long set_mask)
564567
* zfcp_erp_timeout_handler - Trigger ERP action from timed out ERP request
565568
* @data: ERP action (from timer data)
566569
*/
567-
void zfcp_erp_timeout_handler(unsigned long data)
570+
void zfcp_erp_timeout_handler(struct timer_list *t)
568571
{
569-
struct zfcp_erp_action *act = (struct zfcp_erp_action *) data;
572+
struct zfcp_fsf_req *fsf_req = from_timer(fsf_req, t, timer);
573+
struct zfcp_erp_action *act = fsf_req->erp_action;
570574
zfcp_erp_notify(act, ZFCP_STATUS_ERP_TIMEDOUT);
571575
}
572576

573-
static void zfcp_erp_memwait_handler(unsigned long data)
577+
static void zfcp_erp_memwait_handler(struct timer_list *t)
574578
{
575-
zfcp_erp_notify((struct zfcp_erp_action *)data, 0);
579+
struct zfcp_erp_action *act = from_timer(act, t, timer);
580+
581+
zfcp_erp_notify(act, 0);
576582
}
577583

578584
static void zfcp_erp_strategy_memwait(struct zfcp_erp_action *erp_action)
579585
{
580-
setup_timer(&erp_action->timer, zfcp_erp_memwait_handler,
581-
(unsigned long) erp_action);
582586
erp_action->timer.expires = jiffies + HZ;
583587
add_timer(&erp_action->timer);
584588
}

drivers/s390/scsi/zfcp_ext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extern int zfcp_erp_thread_setup(struct zfcp_adapter *);
6969
extern void zfcp_erp_thread_kill(struct zfcp_adapter *);
7070
extern void zfcp_erp_wait(struct zfcp_adapter *);
7171
extern void zfcp_erp_notify(struct zfcp_erp_action *, unsigned long);
72-
extern void zfcp_erp_timeout_handler(unsigned long);
72+
extern void zfcp_erp_timeout_handler(struct timer_list *);
7373

7474
/* zfcp_fc.c */
7575
extern struct kmem_cache *zfcp_fc_req_cache;

drivers/s390/scsi/zfcp_fsf.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121

2222
struct kmem_cache *zfcp_fsf_qtcb_cache;
2323

24-
static void zfcp_fsf_request_timeout_handler(unsigned long data)
24+
static void zfcp_fsf_request_timeout_handler(struct timer_list *t)
2525
{
26-
struct zfcp_adapter *adapter = (struct zfcp_adapter *) data;
26+
struct zfcp_fsf_req *fsf_req = from_timer(fsf_req, t, timer);
27+
struct zfcp_adapter *adapter = fsf_req->adapter;
2728
zfcp_qdio_siosl(adapter);
2829
zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
2930
"fsrth_1");
@@ -32,17 +33,15 @@ static void zfcp_fsf_request_timeout_handler(unsigned long data)
3233
static void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req,
3334
unsigned long timeout)
3435
{
35-
fsf_req->timer.function = zfcp_fsf_request_timeout_handler;
36-
fsf_req->timer.data = (unsigned long) fsf_req->adapter;
36+
fsf_req->timer.function = (TIMER_FUNC_TYPE)zfcp_fsf_request_timeout_handler;
3737
fsf_req->timer.expires = jiffies + timeout;
3838
add_timer(&fsf_req->timer);
3939
}
4040

4141
static void zfcp_fsf_start_erp_timer(struct zfcp_fsf_req *fsf_req)
4242
{
4343
BUG_ON(!fsf_req->erp_action);
44-
fsf_req->timer.function = zfcp_erp_timeout_handler;
45-
fsf_req->timer.data = (unsigned long) fsf_req->erp_action;
44+
fsf_req->timer.function = (TIMER_FUNC_TYPE)zfcp_erp_timeout_handler;
4645
fsf_req->timer.expires = jiffies + 30 * HZ;
4746
add_timer(&fsf_req->timer);
4847
}
@@ -692,7 +691,7 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
692691
adapter->req_no++;
693692

694693
INIT_LIST_HEAD(&req->list);
695-
init_timer(&req->timer);
694+
timer_setup(&req->timer, NULL, 0);
696695
init_completion(&req->completion);
697696

698697
req->adapter = adapter;

0 commit comments

Comments
 (0)