scsi: cxgbi: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Mon, 28 Aug 2017 17:13:50 +0000 (10:13 -0700)
committerKees Cook <keescook@chromium.org>
Wed, 1 Nov 2017 18:27:05 +0000 (11:27 -0700)
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: Karen Xie <kxie@chelsio.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
drivers/scsi/cxgbi/libcxgbi.c

index 7b09e7ddf35e7b99c2c87a64e42b369ebd7dbed1..babd79361a461097f93dedba4fb400d8caecf390 100644 (file)
@@ -545,10 +545,10 @@ static int act_open_rpl_status_to_errno(int status)
        }
 }
 
-static void act_open_retry_timer(unsigned long data)
+static void act_open_retry_timer(struct timer_list *t)
 {
+       struct cxgbi_sock *csk = from_timer(csk, t, retry_timer);
        struct sk_buff *skb;
-       struct cxgbi_sock *csk = (struct cxgbi_sock *)data;
 
        log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
                "csk 0x%p,%u,0x%lx,%u.\n",
@@ -586,8 +586,8 @@ static int do_act_open_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
        cxgbi_sock_get(csk);
        spin_lock_bh(&csk->lock);
        if (rpl->status == CPL_ERR_CONN_EXIST &&
-           csk->retry_timer.function != act_open_retry_timer) {
-               csk->retry_timer.function = act_open_retry_timer;
+           csk->retry_timer.function != (TIMER_FUNC_TYPE)act_open_retry_timer) {
+               csk->retry_timer.function = (TIMER_FUNC_TYPE)act_open_retry_timer;
                mod_timer(&csk->retry_timer, jiffies + HZ / 2);
        } else
                cxgbi_sock_fail_act_open(csk,
index 1d02cf9fe06c5e941e5d1a76254f86ce658fc04b..1bef2724eb783d7441b98e224eea3668f0792f28 100644 (file)
@@ -872,10 +872,10 @@ static int act_open_rpl_status_to_errno(int status)
        }
 }
 
-static void csk_act_open_retry_timer(unsigned long data)
+static void csk_act_open_retry_timer(struct timer_list *t)
 {
        struct sk_buff *skb = NULL;
-       struct cxgbi_sock *csk = (struct cxgbi_sock *)data;
+       struct cxgbi_sock *csk = from_timer(csk, t, retry_timer);
        struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(csk->cdev);
        void (*send_act_open_func)(struct cxgbi_sock *, struct sk_buff *,
                                   struct l2t_entry *);
@@ -963,8 +963,8 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb)
        spin_lock_bh(&csk->lock);
 
        if (status == CPL_ERR_CONN_EXIST &&
-           csk->retry_timer.function != csk_act_open_retry_timer) {
-               csk->retry_timer.function = csk_act_open_retry_timer;
+           csk->retry_timer.function != (TIMER_FUNC_TYPE)csk_act_open_retry_timer) {
+               csk->retry_timer.function = (TIMER_FUNC_TYPE)csk_act_open_retry_timer;
                mod_timer(&csk->retry_timer, jiffies + HZ / 2);
        } else
                cxgbi_sock_fail_act_open(csk,
index 512c8f1ea5b06efd4d42c2eed805be9e6a23d533..a61a152136a3c3dd9716157131d057245a62f887 100644 (file)
@@ -572,7 +572,7 @@ static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev)
        kref_init(&csk->refcnt);
        skb_queue_head_init(&csk->receive_queue);
        skb_queue_head_init(&csk->write_queue);
-       setup_timer(&csk->retry_timer, NULL, (unsigned long)csk);
+       timer_setup(&csk->retry_timer, NULL, 0);
        rwlock_init(&csk->callback_lock);
        csk->cdev = cdev;
        csk->flags = 0;