From patchwork Wed Mar 14 11:48:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10281929 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 E83AB6038F for ; Wed, 14 Mar 2018 11:49:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9AB42866C for ; Wed, 14 Mar 2018 11:49:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE7FB28852; Wed, 14 Mar 2018 11:49:03 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham 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 5B5862866C for ; Wed, 14 Mar 2018 11:49:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751556AbeCNLtC (ORCPT ); Wed, 14 Mar 2018 07:49:02 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44758 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbeCNLtB (ORCPT ); Wed, 14 Mar 2018 07:49:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PJeC8FJ1T1GStsU5SiEP/rB35C7gW7r8v6GY3QPWf5s=; b=JIKoEFo3+kl+5LoT/y2gBKu8R fuevH49EXvIzLf+ZsAAqc6T6nwsSsN0ql70SvPt65uRlCljMID6m4BRucIYorXT36PtQzJ2AD0JfF hpH7SVqB5Ec7iNaX5cs9gQz+np9Un4aiXMte1lnCJQ38NdZDnJbDnK4tBvfhGeASToWIEehchMcu4 BnYyXwAhBxwNnnfZsnE3EXawlf6LJxLxFsskm99HFGJ1o9p+nbDWqqo0z46kT7LzGaX58zx27eNAo PnXnHSt1AcxqGEN9jNhQM2QFXlkNrOl5DWbgOEJAOh/z9Fvvd5vpInxigxdkDF4kUEMSVKEImr9/j 0tQreQYDA==; Received: from 77.117.139.172.wireless.dyn.drei.com ([77.117.139.172] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ew4tr-0007Fq-Hm; Wed, 14 Mar 2018 11:48:56 +0000 From: Christoph Hellwig To: "Martin K. Petersen" Cc: aacraid@adaptec.com, linuxdrivers@attotech.com, linux-m68k@lists.linux-m68k.org, linux-scsi@vger.kernel.org Subject: [PATCH 04/12] esas2r: remove initialization / cleanup dead wood Date: Wed, 14 Mar 2018 12:48:26 +0100 Message-Id: <20180314114834.17380-5-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180314114834.17380-1-hch@lst.de> References: <20180314114834.17380-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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 esas2r has been converted to hotplug style initialization long ago, but kept various remant of the old-style scsi_module.c initialization around. Remove those. Signed-off-by: Christoph Hellwig --- drivers/scsi/esas2r/esas2r.h | 2 -- drivers/scsi/esas2r/esas2r_init.c | 21 ------------ drivers/scsi/esas2r/esas2r_main.c | 72 +++------------------------------------ 3 files changed, 4 insertions(+), 91 deletions(-) diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h index 1da6407ee142..858c3b33db78 100644 --- a/drivers/scsi/esas2r/esas2r.h +++ b/drivers/scsi/esas2r/esas2r.h @@ -962,7 +962,6 @@ struct esas2r_adapter { * Function Declarations * SCSI functions */ -int esas2r_release(struct Scsi_Host *); const char *esas2r_info(struct Scsi_Host *); int esas2r_write_params(struct esas2r_adapter *a, struct esas2r_request *rq, struct esas2r_sas_nvram *data); @@ -984,7 +983,6 @@ int esas2r_target_reset(struct scsi_cmnd *cmd); /* Internal functions */ int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid, int index); -int esas2r_cleanup(struct Scsi_Host *host); int esas2r_read_fw(struct esas2r_adapter *a, char *buf, long off, int count); int esas2r_write_fw(struct esas2r_adapter *a, const char *buf, long off, int count); diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c index 5b14dd29b764..9dffcb28c9b7 100644 --- a/drivers/scsi/esas2r/esas2r_init.c +++ b/drivers/scsi/esas2r/esas2r_init.c @@ -661,27 +661,6 @@ void esas2r_kill_adapter(int i) } } -int esas2r_cleanup(struct Scsi_Host *host) -{ - struct esas2r_adapter *a; - int index; - - if (host == NULL) { - int i; - - esas2r_debug("esas2r_cleanup everything"); - for (i = 0; i < MAX_ADAPTERS; i++) - esas2r_kill_adapter(i); - return -1; - } - - esas2r_debug("esas2r_cleanup called for host %p", host); - a = (struct esas2r_adapter *)host->hostdata; - index = a->index; - esas2r_kill_adapter(index); - return index; -} - int esas2r_suspend(struct pci_dev *pdev, pm_message_t state) { struct Scsi_Host *host = pci_get_drvdata(pdev); diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c index 4eb14301a497..e07eac5be087 100644 --- a/drivers/scsi/esas2r/esas2r_main.c +++ b/drivers/scsi/esas2r/esas2r_main.c @@ -235,7 +235,6 @@ static struct scsi_host_template driver_template = { .module = THIS_MODULE, .show_info = esas2r_show_info, .name = ESAS2R_LONGNAME, - .release = esas2r_release, .info = esas2r_info, .ioctl = esas2r_ioctl, .queuecommand = esas2r_queuecommand, @@ -520,44 +519,16 @@ static int esas2r_probe(struct pci_dev *pcid, static void esas2r_remove(struct pci_dev *pdev) { - struct Scsi_Host *host; - int index; - - if (pdev == NULL) { - esas2r_log(ESAS2R_LOG_WARN, "esas2r_remove pdev==NULL"); - return; - } - - host = pci_get_drvdata(pdev); - - if (host == NULL) { - /* - * this can happen if pci_set_drvdata was already called - * to clear the host pointer. if this is the case, we - * are okay; this channel has already been cleaned up. - */ - - return; - } + struct Scsi_Host *host = pci_get_drvdata(pdev); + struct esas2r_adapter *a = (struct esas2r_adapter *)host->hostdata; esas2r_log_dev(ESAS2R_LOG_INFO, &(pdev->dev), "esas2r_remove(%p) called; " "host:%p", pdev, host); - index = esas2r_cleanup(host); - - if (index < 0) - esas2r_log_dev(ESAS2R_LOG_WARN, &(pdev->dev), - "unknown host in %s", - __func__); - + esas2r_kill_adapter(a->index); found_adapters--; - - /* if this was the last adapter, clean up the rest of the driver */ - - if (found_adapters == 0) - esas2r_cleanup(NULL); } static int __init esas2r_init(void) @@ -638,30 +609,7 @@ static int __init esas2r_init(void) for (i = 0; i < MAX_ADAPTERS; i++) esas2r_adapters[i] = NULL; - /* initialize */ - - driver_template.module = THIS_MODULE; - - if (pci_register_driver(&esas2r_pci_driver) != 0) - esas2r_log(ESAS2R_LOG_CRIT, "pci_register_driver FAILED"); - else - esas2r_log(ESAS2R_LOG_INFO, "pci_register_driver() OK"); - - if (!found_adapters) { - pci_unregister_driver(&esas2r_pci_driver); - esas2r_cleanup(NULL); - - esas2r_log(ESAS2R_LOG_CRIT, - "driver will not be loaded because no ATTO " - "%s devices were found", - ESAS2R_DRVR_NAME); - return -1; - } else { - esas2r_log(ESAS2R_LOG_INFO, "found %d adapters", - found_adapters); - } - - return 0; + return pci_register_driver(&esas2r_pci_driver); } /* Handle ioctl calls to "/proc/scsi/esas2r/ATTOnode" */ @@ -753,18 +701,6 @@ int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh) } -int esas2r_release(struct Scsi_Host *sh) -{ - esas2r_log_dev(ESAS2R_LOG_INFO, &(sh->shost_gendev), - "esas2r_release() called"); - - esas2r_cleanup(sh); - if (sh->irq) - free_irq(sh->irq, NULL); - scsi_unregister(sh); - return 0; -} - const char *esas2r_info(struct Scsi_Host *sh) { struct esas2r_adapter *a = (struct esas2r_adapter *)sh->hostdata;