From patchwork Wed Aug 28 17:43:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13781642 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95D351A254F for ; Wed, 28 Aug 2024 17:45:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724867122; cv=none; b=Zz8jt7xtn0XlufDKduEw+Ry9C0gktZO2WWWln9I0go0knXer3QNf5iGonVPLed2uBXYZAkLaK2grqudOtg5QyHvijR8f7HDEgYD8qS+vM4dynSdUqx4nAhRAAHfH2kjwIbtJxIrMvtRO6iGC7tbCrWlgyleIf1yglbFS8dLjRzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724867122; c=relaxed/simple; bh=xISFm7Swyov+VWmn5kO5OkMXBY69JoEFK3eIlzHNd1A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b5q2L8pC34mSPdigTdinzQNUlMoWDxvaXY5ccVI+RKBRxsTHpKPFVAip3jMewmIx4g2Cbr4Uki8gk8j7Y9LAJvZqo/SENhrQjLW3iZqGqFNWSlXzvCgHGi0TQT9PzU0gjJ8STyyu5R6FI7LVTROJ5MZCpDccfBv21mnZfLTpxsg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=kP6UTLX8; arc=none smtp.client-ip=199.89.1.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="kP6UTLX8" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4WvBdX0rRwzlgTGW; Wed, 28 Aug 2024 17:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1724867116; x=1727459117; bh=sCS5j gvUBL2CiNcfPh57wQWHu2vQJ5PVvJPno3ObagY=; b=kP6UTLX8fyRFHvGag57Q6 4acj/wSqXqWBUHTAOGksq9qCAzfOlsY19krsbnRNd2UFmkPOxMKwuZfsnPEFwhHV 5y6tvQ3Z6fM2jpsSO6cu6K/G0tOLqyb8obMeS/cJhPS8yJEHBH4HZskU0Yd81fZ2 cUw0MfNPRtPzduIpHqgT4A2qpjb99JK9pkFQKKgHGzJFlZVafDAVbfJRGYBdgh+X hGj9YusnDY19rZ7K2TZMXw0lvc/rU29NH/QEn/P1kOGCzpE0yTGw0eYcHMFMPYq4 3a0b2iUsmdYJGibXPbhhPPHsRcIx97HsFOkS++g8GXElNxJkNHeT91YWGSzAjPgh g== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id uWoqCEr6kCaS; Wed, 28 Aug 2024 17:45:16 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 009.lax.mailroute.net (Postfix) with ESMTPSA id 4WvBdR6dzjzlgVXv; Wed, 28 Aug 2024 17:45:15 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Manivannan Sadhasivam , "James E.J. Bottomley" , Peter Wang , Avri Altman , Bean Huo , Andrew Halaney Subject: [PATCH v3 4/9] ufs: core: Call ufshcd_add_scsi_host() later Date: Wed, 28 Aug 2024 10:43:56 -0700 Message-ID: <20240828174435.2469498-5-bvanassche@acm.org> X-Mailer: git-send-email 2.46.0.469.g59c65b2a67-goog In-Reply-To: <20240828174435.2469498-1-bvanassche@acm.org> References: <20240828174435.2469498-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Call ufshcd_add_scsi_host() after host controller initialization has completed. This is possible because no code between the old and new ufshcd_add_scsi_host() call site depends on the scsi_add_host() call. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Bart Van Assche Reviewed-by: Bean Huo --- drivers/ufs/core/ufshcd.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 1b69b370991d..20e00ec5fda8 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10576,10 +10576,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) hba->is_irq_enabled = true; } - err = ufshcd_add_scsi_host(hba); - if (err) - goto out_disable; - /* Reset the attached device */ ufshcd_device_reset(hba); @@ -10591,7 +10587,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) dev_err(hba->dev, "Host controller enable failed\n"); ufshcd_print_evt_hist(hba); ufshcd_print_host_state(hba); - goto free_tmf_queue; + goto out_disable; } /* @@ -10626,6 +10622,10 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) */ ufshcd_set_ufs_dev_active(hba); + err = ufshcd_add_scsi_host(hba); + if (err) + goto out_disable; + async_schedule(ufshcd_async_scan, hba); ufs_sysfs_add_nodes(hba->dev); @@ -10633,12 +10633,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) ufshcd_pm_qos_init(hba); return 0; -free_tmf_queue: - blk_mq_destroy_queue(hba->tmf_queue); - blk_put_queue(hba->tmf_queue); - blk_mq_free_tag_set(&hba->tmf_tag_set); - if (hba->scsi_host_added) - scsi_remove_host(hba->host); out_disable: hba->is_irq_enabled = false; ufshcd_hba_exit(hba);