[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191216180502.GA2404915@kroah.com>
Date: Mon, 16 Dec 2019 19:05:02 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: cang@...eaurora.org
Cc: Bart Van Assche <bvanassche@....org>, asutoshd@...eaurora.org,
nguyenb@...eaurora.org, rnayak@...eaurora.org,
linux-scsi@...r.kernel.org, kernel-team@...roid.com,
saravanak@...gle.com, salyzyn@...gle.com,
Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
Pedro Sousa <pedrom.sousa@...opsys.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Stanley Chu <stanley.chu@...iatek.com>,
Bean Huo <beanhuo@...ron.com>,
Venkat Gopalakrishnan <venkatg@...eaurora.org>,
Tomas Winkler <tomas.winkler@...el.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] scsi: ufs: Put SCSI host after remove it
On Mon, Dec 16, 2019 at 10:31:29PM +0800, cang@...eaurora.org wrote:
> On 2019-12-15 02:32, Bart Van Assche wrote:
> > On 12/14/19 8:03 AM, Can Guo wrote:
> > > In ufshcd_remove(), after SCSI host is removed, put it once so that
> > > its
> > > resources can be released.
> > >
> > > Signed-off-by: Can Guo <cang@...eaurora.org>
> > >
> > > 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);
> >
> > Hi Can,
> >
> > The UFS driver may queue work asynchronously and that asynchronous
> > work may refer to the SCSI host, e.g. ufshcd_err_handler(). Is it
> > guaranteed that all that asynchronous work has finished before
> > scsi_host_put() is called?
> >
> > Thanks,
> >
> > Bart.
>
> Hi Bart,
>
> As SCSI host is allocated in ufshcd_platform_init() during platform
> drive probe, it is much more appropriate if platform driver calls
> ufshcd_dealloc_host() in their own drv->remove() path. How do you
> think if I change it as below? If it is OK to you, please ignore my
> previous mails.
>
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index 3d4582e..ea45756 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c
> @@ -3239,6 +3239,7 @@ static int ufs_qcom_remove(struct platform_device
> *pdev)
>
> pm_runtime_get_sync(&(pdev)->dev);
> ufshcd_remove(hba);
> + ufshcd_dealloc_host(hba);
> return 0;
> }
Wait, why is this a platform device? Don't you hang off of a pci
device? Or am I missing something earlier in this patchset?
thanks,
greg k-h
Powered by blists - more mailing lists