Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp503807ybl; Wed, 11 Dec 2019 03:09:03 -0800 (PST) X-Google-Smtp-Source: APXvYqygwc+8+1c3mnJ3Ink7GO1NSt3ktr2/7sCNeo14qhGWJsUkudAvIM8NsE+M1DsSMp46epJo X-Received: by 2002:aca:6544:: with SMTP id j4mr2320862oiw.61.1576062543492; Wed, 11 Dec 2019 03:09:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576062543; cv=none; d=google.com; s=arc-20160816; b=i3i14Eh6mkDL8f7n96k42DEPoVJpt9ViaTY7Il8evu5K3jU50wTaikFVhSJJunfdPk OgWKGgSSzXVaXvhOmfIa/lu/eZevBhD7aVHN38g2BOy73uRgkN0IwCo+D4zRTdV29HfC 3ChGsleL/Ji0mohq3YLL6LzkCakChbI9mQmm3IKScdhQEGtd5vwmQFoRihdLEXZTxj2O sxQjxmf4j2cUZZHLZo6lQ9Yl9314/FqsZ/rKiJdIkK+REQ04UGmtmowVeZ/Ruky0heFo b/RiOSjtr9YvpcB1kJ90tmzvglxloJZmGbXMJbJsY3XFM04o7vJs9PLabz7vvg9FxEBb oWDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:user-agent:message-id :references:in-reply-to:subject:cc:to:from:date :content-transfer-encoding:mime-version:dkim-signature :dkim-signature; bh=jX0KGXRHeP8DlfOT82Uf2GnxXa3u2O6NsJpa7uhIF50=; b=iIuq4yLW/WzPRS+YtrAx9kHpokOI15VIPXRV5Ut3Auo8v0bcL00dDmgpSd959AtSlA GE5xWBNAl+O2dWJQ+bNAg8YyMLSc8LaZaV1EPW6GWylfVRKgD1I4HUEYb4kzkJo6E1KM bJdABkxjuZMw4pNGorNBaw2BvRjaeXX6J6OKkvNznfTJx05gkfonek+21z2t51mVYIaq bo6FJlrXZMYt0IMkmpnwCQ9ZH03Or10RzzBgksHsOFw5zJQ0fjF06flZU2NpqPP5AGpJ eZvcFYXfFiqHQWMpzcpD4t/gDcV3uVr5F1SlaMq+ek1oOc9nqibgJIuhdNN4mnDPbFdU yG7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=zsmsymrwgfyinv5wlfyidntwsjeeldzt header.b=DudPVQJT; dkim=pass header.i=@amazonses.com header.s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx header.b=H0wnkqP9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si901148otk.80.2019.12.11.03.08.49; Wed, 11 Dec 2019 03:09:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=zsmsymrwgfyinv5wlfyidntwsjeeldzt header.b=DudPVQJT; dkim=pass header.i=@amazonses.com header.s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx header.b=H0wnkqP9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728857AbfLKLGy (ORCPT + 99 others); Wed, 11 Dec 2019 06:06:54 -0500 Received: from a27-56.smtp-out.us-west-2.amazonses.com ([54.240.27.56]:52296 "EHLO a27-56.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbfLKLGy (ORCPT ); Wed, 11 Dec 2019 06:06:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1576062413; h=MIME-Version:Content-Type:Content-Transfer-Encoding:Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID; bh=NgIYHPd10S/eLyWy6p1qiGPyW4E4NjhmYdPAmXSEoPY=; b=DudPVQJTmcv9zNCGJm1PTVONkMuA33uwA5wSCDhy3hn9ROAB1Gu4Ge62k1MPmDhF kf732JF16LpJvjoXbhGl6s97rhaMWVlY1oKCC1NLF8uf7jWp1rMRdiXaSXKwdRkoyzN Po/cXfOCIJQDm+kPkNOiR1WOpDnAKLyXNcwm9GoM= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1576062412; h=MIME-Version:Content-Type:Content-Transfer-Encoding:Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID:Feedback-ID; bh=NgIYHPd10S/eLyWy6p1qiGPyW4E4NjhmYdPAmXSEoPY=; b=H0wnkqP9csXa53iJQOPT/dj4xh51nfT0ghZK70hO3Zrc65lsoTQbtz729+JsW96j E1Z8LAwFg9X2w64GHae+uoEft97Aib4ZAuMS9busU3Fdjv3qhaDzbyNebT6gNEzV6Pu HUM0fIjkkURmjC9zN1DE7AY3fjqkXa/dKriDT3/w= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 11 Dec 2019 11:06:52 +0000 From: cang@codeaurora.org To: Avri Altman Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, Alim Akhtar , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Venkat Gopalakrishnan , Tomas Winkler , open list Subject: Re: [PATCH v2 1/3] scsi: ufs: Put SCSI host after remove it In-Reply-To: References: <1576054123-16417-1-git-send-email-cang@codeaurora.org> <0101016ef4259a7c-76bdf010-88b1-4309-ba24-8c874734184e-000000@us-west-2.amazonses.com> Message-ID: <0101016ef4a3e824-6386cb10-c53c-4f2e-bc07-82f4f4986020-000000@us-west-2.amazonses.com> X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 X-SES-Outgoing: 2019.12.11-54.240.27.56 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-12-11 18:37, Avri Altman wrote: >> >> In ufshcd_remove(), after SCSI host is removed, put it once so that >> its resources >> can be released. >> >> Signed-off-by: Can Guo > > This is not really part of this patchset, is it? > Hi Avri, I put this change in the same patchset due to #1. The main patch has dependency on it #2. Consider a scenario where platform driver is also compiled as a module, say ufs_qcom.ko. In this case, we have two modules, ufs-qcom.ko and ufs-bsg.ko. If do insmod ufs-qcom.ko then rmmod ufs-qcom.ko and do insmod ufs-qcom.ko again, without this change, because scsi host was not release, the new scsi host will have a different host number, meaning hba->host->host_no will be 1, but not 0. Now if do insmod ufs-bsg.ko now, the ufs-bsg dev created in /dev/bsg/ will be ufs-bsg1, but not ufs-bsg0. If keep trying these operations, the ufs-bsg device's name will be messed up. This change make sure after ufs-qcom.ko is removed and installed back, its hba->host->host_no stays 0, so that ufs-bsg device name stays same. Thanks, Can Guo. >> --- >> drivers/scsi/ufs/ufshcd.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c >> index >> b5966fa..a86b0fd 100644 >> --- a/drivers/scsi/ufs/ufshcd.c >> +++ b/drivers/scsi/ufs/ufshcd.c >> @@ -8251,6 +8251,7 @@ void ufshcd_remove(struct ufs_hba *hba) >> ufs_bsg_remove(hba); >> ufs_sysfs_remove_nodes(hba->dev); >> scsi_remove_host(hba->host); >> + scsi_host_put(hba->host); >> /* disable interrupts */ >> ufshcd_disable_intr(hba, hba->intr_mask); >> ufshcd_hba_stop(hba, true); >> -- >> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora >> Forum, >> a Linux Foundation Collaborative Project