From patchwork Thu Nov 9 00:27:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ching Huang X-Patchwork-Id: 10050461 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 1DB1D601EA for ; Thu, 9 Nov 2017 08:28:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D2322AB68 for ; Thu, 9 Nov 2017 08:28:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01F562AB92; Thu, 9 Nov 2017 08:28:11 +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=-5.4 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI autolearn=unavailable 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 ACE8C2AB68 for ; Thu, 9 Nov 2017 08:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753395AbdKII14 (ORCPT ); Thu, 9 Nov 2017 03:27:56 -0500 Received: from mail-it0-f48.google.com ([209.85.214.48]:49327 "EHLO mail-it0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753363AbdKII1z (ORCPT ); Thu, 9 Nov 2017 03:27:55 -0500 Received: by mail-it0-f48.google.com with SMTP id y15so10245991ita.4 for ; Thu, 09 Nov 2017 00:27:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=areca-com-tw.20150623.gappssmtp.com; s=20150623; h=subject:from:to:date:message-id:mime-version :content-transfer-encoding; bh=OmBvQynVQxNfE7HEnnfqCnCaaRlTt8Cra63IoizfZyc=; b=zxUPSBnSSVAmEfrzVuA2FeKqWxn8H0Eme6hERTqMR+a+te8qdEqlM2XN9D2esCnmpp uG0G3nlZOh1KKDYG7ELM1Gblrp4Zpxj/9zI2ffBwQgURGO1F6lMPi1/OrRtSZ561flVd IGy6qUWLsbm2Oxc7jQAhzE0b+krtj8us++Jvgx5Yf/nH+F517hmF4pE++nYE8gt5Z1R7 pDwoS1yMj/l14H3bSM6PxVeRfqgfltzxBsWdGsah6JMZvGM0jldE1V9LxC8qBYOZslum E/5RJABwlPZqryHYTgbVeKzcQurZV4KIhaY+W9VkTLPfb2mBvjy4fvHJXgOI5wb5qAZ6 f7Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:date:message-id:mime-version :content-transfer-encoding; bh=OmBvQynVQxNfE7HEnnfqCnCaaRlTt8Cra63IoizfZyc=; b=PFdM7lMPuX8hCR3sgMGUq4EIn8lvnDNP1xN9BYFPyZtjQPuUlvRn+JULBz+bEm4w95 5H9LfEMyp7arba+5Cj4SIqnZDN7YLnMXVVqYxL32vjhSpqMxkMpAVjN/AMSazJdHu0s9 F5sReHzCuUwiTpRMD7B+EcjmmCn6vvG2Lz77tBzCj5SSYQHknKstjoEfUl9iaGUtKcFy CC/Rd9EC7Bos6BGUwR+9KJM9Jq0AIxf0JarzQADOAhEuW3n/lKjUaqvm1G7gmJ5ti2TY x4ikDTMFMXAQqz+KICYXXNX93o8A/ecuRvRRSofNrKFHBsA1BS3tMqStSJGgzgPx+Jft dWlA== X-Gm-Message-State: AJaThX7LJcmmztOXcovmR0K/+KqbwlZUwH12GBcwqvC4UbuviI32/mO1 7w5Kz7KGsoIIHw4l6ImZwzg8ZA== X-Google-Smtp-Source: ABhQp+S1rpkTDObA2K6XCU3TxkbYCBd9k9mAl7SkY+Lt3BRH2FIA15d/4Wvz2SZIuI0RQeztJL4yaQ== X-Received: by 10.36.157.12 with SMTP id f12mr4102258itd.19.1510216074745; Thu, 09 Nov 2017 00:27:54 -0800 (PST) Received: from [192.168.0.106] (60-248-88-209.HINET-IP.hinet.net. [60.248.88.209]) by smtp.gmail.com with ESMTPSA id 79sm3473545itu.7.2017.11.09.00.27.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Nov 2017 00:27:53 -0800 (PST) Subject: [PATCH 11/13] scsi: arcmsr: spin off duplicate code of timer init for message isr BH in arcmsr_probe and arcmsr_resume as a function From: Ching Huang To: martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, jthumshirn@suse.de, hare@suse.de, dan.carpenter@oracle.com, hch@infradead.org Date: Thu, 09 Nov 2017 08:27:47 +0800 Message-ID: <1510187267.4523.94.camel@Centos6.3-64> Mime-Version: 1.0 X-Mailer: Evolution 2.32.3 (2.32.3-37.el6) 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 From: Ching Huang spin off duplicate code of timer init for message isr BH in arcmsr_probe and arcmsr_resume as a function arcmsr_init_get_devmap_timer Signed-off-by: Ching Huang diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c --- a/drivers/scsi/arcmsr/arcmsr_hba.c 2017-11-08 18:54:58.000000000 +0800 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2017-11-08 18:55:50.000000000 +0800 @@ -857,6 +857,19 @@ out_free_irq: return FAILED; } +static void arcmsr_init_get_devmap_timer(struct AdapterControlBlock *pacb) +{ + INIT_WORK(&pacb->arcmsr_do_message_isr_bh, arcmsr_message_isr_bh_fn); + atomic_set(&pacb->rq_map_token, 16); + atomic_set(&pacb->ante_token_value, 16); + pacb->fw_flag = FW_NORMAL; + init_timer(&pacb->eternal_timer); + pacb->eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ); + pacb->eternal_timer.data = (unsigned long)pacb; + pacb->eternal_timer.function = &arcmsr_request_device_map; + add_timer(&pacb->eternal_timer); +} + static void arcmsr_init_set_datetime_timer(struct AdapterControlBlock *pacb) { init_timer(&pacb->refresh_timer); @@ -948,15 +961,7 @@ static int arcmsr_probe(struct pci_dev * if (arcmsr_request_irq(pdev, acb) == FAILED) goto scsi_host_remove; arcmsr_iop_init(acb); - INIT_WORK(&acb->arcmsr_do_message_isr_bh, arcmsr_message_isr_bh_fn); - atomic_set(&acb->rq_map_token, 16); - atomic_set(&acb->ante_token_value, 16); - acb->fw_flag = FW_NORMAL; - init_timer(&acb->eternal_timer); - acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ); - acb->eternal_timer.data = (unsigned long) acb; - acb->eternal_timer.function = &arcmsr_request_device_map; - add_timer(&acb->eternal_timer); + arcmsr_init_get_devmap_timer(acb); if (set_date_time) arcmsr_init_set_datetime_timer(acb); if(arcmsr_alloc_sysfs_attr(acb)) @@ -1047,15 +1052,7 @@ static int arcmsr_resume(struct pci_dev if (arcmsr_request_irq(pdev, acb) == FAILED) goto controller_stop; arcmsr_iop_init(acb); - INIT_WORK(&acb->arcmsr_do_message_isr_bh, arcmsr_message_isr_bh_fn); - atomic_set(&acb->rq_map_token, 16); - atomic_set(&acb->ante_token_value, 16); - acb->fw_flag = FW_NORMAL; - init_timer(&acb->eternal_timer); - acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ); - acb->eternal_timer.data = (unsigned long) acb; - acb->eternal_timer.function = &arcmsr_request_device_map; - add_timer(&acb->eternal_timer); + arcmsr_init_get_devmap_timer(acb); if (set_date_time) arcmsr_init_set_datetime_timer(acb); return 0;