Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2874643imc; Wed, 13 Mar 2019 03:35:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUReFUum7X1kdANBra1tlwpnnNxGxvMSli/smJgLAyvXFaaNv7fPRbxp4qzOphCID+HMiV X-Received: by 2002:a63:720f:: with SMTP id n15mr38526886pgc.216.1552473310371; Wed, 13 Mar 2019 03:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552473310; cv=none; d=google.com; s=arc-20160816; b=qUaeRzfa/K0pao0X9T6vX0Px2zHN37bOTxxJMGpquVeLD0feP1IoCCJL2I7Z9ciIzA worEKsb6s0dQ87mHnnVxDIzRbyR1eSCEKV8slIcS3YJcq6rxLM3xToRlzj2FdmeWuuWZ Wg8+yBUa1wRiXE6BjyRk4U9REHrYscZpt6jv6569BXZ90eQGmPSpxhJE27FNJ/sMW5VF 2kugDU5LleISxYTtCy8SNStMuEsf9eyKRRej22ZxBc6tOjitaXUpf6Avz5HCHPJQqxLN MTR3lDSVT5P62M8kr04mld/ehtAc7iWR/rISvoHUa5wsvmnqqNcZdnZNabgQZ/yAXWtH xCNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=pmXsP3+6D66jVVY6Tsu2xHDdAyPuADr3f4W1TlG/2EA=; b=JQYgORxiqY6T9p1cIeFnY1jqE7MNLjn8zk2d+dUO14KffAWgGkM6IsZusTunid9HQd yOAi7vsm7npuVca0w2w/IdD3QkDUC7ALWicmZpF4P0K7SFBV3F58uc/HFcfgZvDilUl7 ydBKw5PgUlbz18Ee/1I6G8el7ftoTLGzLIF8866ZHhhRUB27vnjcBzGGhTP9SB7WBMUY MR/lNU+YA84XpyYXTSyweMEQRRuDIvYsBVYE3XW50km7uzxC0QdGibhh59mDjAppMp3Y 5C71yq+qh2yYXBuQUBM4ScbgsBoBccbaHmWai/oBjBAC/JqLa7xbNup+ze9ln0uk1L9g rVFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=EWmTK3JK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si9426514pgs.432.2019.03.13.03.34.54; Wed, 13 Mar 2019 03:35:10 -0700 (PDT) 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=@synopsys.com header.s=mail header.b=EWmTK3JK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726218AbfCMKdX (ORCPT + 99 others); Wed, 13 Mar 2019 06:33:23 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:35946 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbfCMKdW (ORCPT ); Wed, 13 Mar 2019 06:33:22 -0400 Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 78D0910C25F8; Wed, 13 Mar 2019 03:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1552473202; bh=hZJ5siwkYRrtUpNGM0+G4sTCKZ5j4X5UCoWae5UxQSc=; h=Subject:To:CC:References:From:Date:In-Reply-To:From; b=EWmTK3JKGjwRNGp6X0Ds6sNMmZbR5RQDPGWm/eSKS4UJwjuL28hWnCQGg+d0hEEeF 5d0LBarwh/MJH0/NB18fhWjMtnV9xjvNSLLnUh6Q8zki2T/6RvBG8w7O8SYIX4ECc4 smZZogV20n3Oor+FR0nl5gvVfbRzyS5vWLGtaXzihEgseheY/j3MxctXjvvWoDtlFA ZZTcXhhc4Kd9UyD5zIolXuLiew3dQ4ab54jRhKuLy+GevLQTzRCqlXYC39XNqFoAgc 58xZWdaJjrqMYiyyPBvbPB4XZFGBikyD7PrpD9oIBEevtVWjmFuMpdz3M0z/ivat03 lTvb2AvRu7MHA== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 51451A0087; Wed, 13 Mar 2019 10:33:22 +0000 (UTC) Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 13 Mar 2019 03:33:17 -0700 Received: from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by DE02WEHTCB.internal.synopsys.com (10.225.19.94) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 13 Mar 2019 11:33:15 +0100 Received: from [10.107.19.55] (10.107.19.55) by DE02WEHTCA.internal.synopsys.com (10.225.19.80) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 13 Mar 2019 11:33:15 +0100 Subject: Re: [PATCH v2 5/5] PCI: dwc: Save root bus for driver remove To: Jisheng Zhang , Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas CC: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" References: <20190301125510.4e2ee985@xhacker.debian> <20190301125943.47adae82@xhacker.debian> From: Gustavo Pimentel Message-ID: <962065dc-6e9d-d481-ca56-a2045ca7fef0@synopsys.com> Date: Wed, 13 Mar 2019 10:33:13 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190301125943.47adae82@xhacker.debian> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.107.19.55] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 01/03/2019 05:06, Jisheng Zhang wrote: > Currently dwc host doesn't support the remove, but nothing prevent us > from supporting it. Save the root bus for clean up work in driver > remove code path. > > After this patch, the dwc host users could implement its remove as: > > static int foo_pcie_remove(struct platform_device *pdev) > { > ... > pci_stop_root_bus(pp->root_bus); > pci_remove_root_bus(pp->root_bus); > dw_pcie_free_msi(pp); > ... > } > > Signed-off-by: Jisheng Zhang > --- > drivers/pci/controller/dwc/pcie-designware-host.c | 1 + > drivers/pci/controller/dwc/pcie-designware.h | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > index 4831c12fee93..ca45a4471ca0 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > @@ -496,6 +496,7 @@ int dw_pcie_host_init(struct pcie_port *pp) > goto err_free_msi; > > bus = bridge->bus; > + pp->root_bus = bus; Why you don't use from the begging the pp->root_bus variable instead of bus variable? That way we can remove the bus variable. Regards, Gustavo > > if (pp->ops->scan_bus) > pp->ops->scan_bus(pp); > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h > index 3be7ca9f1fc3..cd92ded606c6 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.h > +++ b/drivers/pci/controller/dwc/pcie-designware.h > @@ -182,6 +182,7 @@ struct pcie_port { > struct page *msi_page; > u32 num_vectors; > u32 irq_mask[MAX_MSI_CTRLS]; > + struct pci_bus *root_bus; > raw_spinlock_t lock; > DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS); > }; >