From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64598C433FE for ; Thu, 25 Nov 2021 15:15:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350377AbhKYPSR (ORCPT ); Thu, 25 Nov 2021 10:18:17 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:35786 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355935AbhKYPQP (ORCPT ); Thu, 25 Nov 2021 10:16:15 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 5097021B39; Thu, 25 Nov 2021 15:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1637853062; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LJZGiGysEvwnS4VJ2OrmYVNPAakVnkw0aD/YkspHkGc=; b=r/I72grkEVhzdlNXu1mhg9S5H3kMpmSFJCRBBW1UM1khAl3MCQZpKq7n1i75yzdI7WpBLt yvjhoTwZyV59r7PNbxS0cCk92ACjyzFMFMVgGfQBLo+q0f3+9IYJLYz4Tves/iV+Vn3YPg hf9hsz3/PkyZmx+Zm4zalyYoabqZ6a8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1637853062; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LJZGiGysEvwnS4VJ2OrmYVNPAakVnkw0aD/YkspHkGc=; b=RHqZ8Z5LalbpIFOBGkjn6Ud/C+mo1bECawOL1gyVU33y0CeK9yOCkSbk6APvc/3VlhXjjR zoo7zTKSZemd8AAA== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id B4B7CA3B8B; Thu, 25 Nov 2021 15:11:01 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id A136951919F4; Thu, 25 Nov 2021 16:11:01 +0100 (CET) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , linux-scsi@vger.kernel.org, John Garry , Bart van Assche , Hannes Reinecke , Don Brace Subject: [PATCH 04/15] hpsa: move hpsa_hba_inquiry after scsi_add_host() Date: Thu, 25 Nov 2021 16:10:37 +0100 Message-Id: <20211125151048.103910-5-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211125151048.103910-1-hare@suse.de> References: <20211125151048.103910-1-hare@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move hpsa_hba_inquiry to after scsi_add_host() so that the host is fully initialized. Signed-off-by: Hannes Reinecke Tested-by: Don Brace --- drivers/scsi/hpsa.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index cdf3328cc065..d0a7d1086c74 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -5877,6 +5877,22 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h) return 0; } +static void hpsa_hba_inquiry(struct ctlr_info *h) +{ + int rc; + +#define HBA_INQUIRY_BYTE_COUNT 64 + h->hba_inquiry_data = kmalloc(HBA_INQUIRY_BYTE_COUNT, GFP_KERNEL); + if (!h->hba_inquiry_data) + return; + rc = hpsa_scsi_do_inquiry(h, RAID_CTLR_LUNID, 0, + h->hba_inquiry_data, HBA_INQUIRY_BYTE_COUNT); + if (rc != 0) { + kfree(h->hba_inquiry_data); + h->hba_inquiry_data = NULL; + } +} + static int hpsa_scsi_add_host(struct ctlr_info *h) { int rv; @@ -5886,6 +5902,9 @@ static int hpsa_scsi_add_host(struct ctlr_info *h) dev_err(&h->pdev->dev, "scsi_add_host failed\n"); return rv; } + + hpsa_hba_inquiry(h); + scsi_scan_host(h->scsi_host); return 0; } @@ -7952,22 +7971,6 @@ static int hpsa_pci_init(struct ctlr_info *h) return err; } -static void hpsa_hba_inquiry(struct ctlr_info *h) -{ - int rc; - -#define HBA_INQUIRY_BYTE_COUNT 64 - h->hba_inquiry_data = kmalloc(HBA_INQUIRY_BYTE_COUNT, GFP_KERNEL); - if (!h->hba_inquiry_data) - return; - rc = hpsa_scsi_do_inquiry(h, RAID_CTLR_LUNID, 0, - h->hba_inquiry_data, HBA_INQUIRY_BYTE_COUNT); - if (rc != 0) { - kfree(h->hba_inquiry_data); - h->hba_inquiry_data = NULL; - } -} - static int hpsa_init_reset_devices(struct pci_dev *pdev, u32 board_id) { int rc, i; @@ -8872,8 +8875,6 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) /* Turn the interrupts on so we can service requests */ h->access.set_intr_mask(h, HPSA_INTR_ON); - hpsa_hba_inquiry(h); - h->lastlogicals = kzalloc(sizeof(*(h->lastlogicals)), GFP_KERNEL); if (!h->lastlogicals) dev_info(&h->pdev->dev, -- 2.29.2