From patchwork Thu Sep 28 20:15:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 9976735 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CA18760365 for ; Thu, 28 Sep 2017 20:15:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC1CA29735 for ; Thu, 28 Sep 2017 20:15:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B08EB29737; Thu, 28 Sep 2017 20:15:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_HI, RCVD_IN_SBL_CSS, RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFCF829735 for ; Thu, 28 Sep 2017 20:15:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751464AbdI1UPl (ORCPT ); Thu, 28 Sep 2017 16:15:41 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35685 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751126AbdI1UPk (ORCPT ); Thu, 28 Sep 2017 16:15:40 -0400 Received: by mail-pf0-f193.google.com with SMTP id i23so2362270pfi.2; Thu, 28 Sep 2017 13:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=iiSHx1S1UKMFIXA2sA1vh0bNZJpdYszEDk6YQA7UMXg=; b=JhGmOlhdfjc7xkGZ2/gNB8RUXCQVfXcpbD+cJgzuWlXfOxN43rRwfdJwJU9D6AR+hE yamUf25WGatkvRiIWAFzI13udqCjYqeDyDO8UqQtx+4shdYyj1T0F4AOhlzAwM4wBB/E dfOb0r4WegRQRhbE6aDyET5EfO83H7xC7BJIlNJEZ/fIY+aY3d2wBio9St3YHHx7CkjB x2xh4KTDUm30UaJFalsFHscOkbuWwaap2lPeQ+PPgDh141YR0F6r9WuhJC1KEaTEdPmw uikQjko0NTE93kwrmYpntzW9dMbdmYfwK4DP1blXQvLuJSS+pgINtWAVeTHLU+7HUNcV Xm1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iiSHx1S1UKMFIXA2sA1vh0bNZJpdYszEDk6YQA7UMXg=; b=QBueRxNKsY283kMi8iroteBdgiTalScPxoC6EDFnYjcyo4yJuNLSKYKoMvLE8EvD+u p5FZn/3yvRtomUgrw1sxLeHQc3862xhPgUENZgZUa/QqFGXg4va6ecEqdWwdY492c5N6 zs97btZks/SF9uUf806tICFCgz21+/sMLm3fPG4oyG6xWHGjiJKYVR1vHSlxlqzI26wg Dk9ogApKZvV1RB1zjFvKZLFPTaD2V1HbFGXhXNsVelSUSauuHOZxcn1b+Dn/3UGIidcx v5z2ga3qg2k5165cafvSt3vKnB+//IDnUNTcupFUYZgBVD+pC1LRPYbVLOlLPrfaaaA8 S5Tg== X-Gm-Message-State: AHPjjUhLFAHt/knellvF8Z9D4jV6naHkQwcK67gh/sPiR2tfuB3mQNAH SrJYQIfwEeYbTRd++TL8SjU= X-Google-Smtp-Source: AOwi7QBseNGR2h3xSzi4xOoNHVZp0yK7kcNunmERV3WSrS+b/x7Em4rHGyMjbhzD+nIbufenZYhFDw== X-Received: by 10.84.160.204 with SMTP id v12mr4778230plg.382.1506629740365; Thu, 28 Sep 2017 13:15:40 -0700 (PDT) Received: from localhost.localdomain ([103.254.204.108]) by smtp.gmail.com with ESMTPSA id 23sm3715281pge.44.2017.09.28.13.15.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Sep 2017 13:15:39 -0700 (PDT) From: Himanshu Jha To: martin.petersen@oracle.com Cc: jejb@linux.vnet.ibm.com, linuxdrivers@attotech.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Himanshu Jha Subject: [PATCH] scsi: esas2r: Use setup_timer and mod_timer Date: Fri, 29 Sep 2017 01:45:25 +0530 Message-Id: <1506629725-11620-1-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use setup_timer and mod_timer API instead of structure assignments. This is done using Coccinelle and semantic patch used for this as follows: @@ expression x,y,z,a,b; @@ -init_timer (&x); +setup_timer (&x, y, z); +mod_timer (&a, b); -x.function = y; -x.data = z; -x.expires = b; -add_timer(&a); Signed-off-by: Himanshu Jha --- drivers/scsi/esas2r/esas2r_main.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c index 81f226b..1866ba0 100644 --- a/drivers/scsi/esas2r/esas2r_main.c +++ b/drivers/scsi/esas2r/esas2r_main.c @@ -1635,14 +1635,8 @@ static void esas2r_timer_callback(unsigned long context); void esas2r_kickoff_timer(struct esas2r_adapter *a) { - init_timer(&a->timer); - - a->timer.function = esas2r_timer_callback; - a->timer.data = (unsigned long)a; - a->timer.expires = jiffies + - msecs_to_jiffies(100); - - add_timer(&a->timer); + setup_timer(&a->timer, esas2r_timer_callback, (unsigned long)a); + mod_timer(&a->timer, jiffies + msecs_to_jiffies(100)); } static void esas2r_timer_callback(unsigned long context)