Received: by 10.192.165.148 with SMTP id m20csp4793188imm; Tue, 24 Apr 2018 08:29:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx48uOhZy+cDgw8DCxvV9/IOeSk4qoXUOqvO0mbsMmldrOobLmzQ3jei9cUv3tGWX6oCdTYHE X-Received: by 10.101.82.194 with SMTP id z2mr21032093pgp.69.1524583799264; Tue, 24 Apr 2018 08:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524583799; cv=none; d=google.com; s=arc-20160816; b=GpLuQ6yqyYRv4zaTrm7FDHFBRf2DtsqVHZYnwdsUZrUq6PPkpIHvTt+1rhVMOhNHcL OdQWelXY4/dqMWWS25oBp5m6JTx77nNethTgHcZBbWMO2nrsFh7niF/g76GlvTlab+dP 2yJBg6wVBu9vAIZsgkSpg3XRDbZJSDJ2V15ll8Xk7hKjdZ4j/56xLdMyfhkRJCbsgjV5 8GBwj33N9QWH9QQ2NN0mkzME0dbZ3DQtHEckJw+gptas0rQrvKk1wII8OL9cFqSRMbpz 8sWEvTUtdX7uphtrN6/IEMOWcFeGP9KfdoV784K2+HEL7GFHgtv4GASsvv2tbQGHleq0 Nwfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Nkh3RyRiplFeXY51oXiwGOOuOd+SKObkBmXGu/nVBdc=; b=a4qoiQSw+bDyYMkQlI4u8ZbmQNcE84CZbRd4U3a59ya2rbHfD0xMPF15yJb5DdtNva tbwPDkBECX8PxFNJCeOWBTdku09PZzP61DmYk+ZSrHG298YHkF7nxqR8OQ460S8LYWy7 GjxcIV+UazBW6ODec1z2bCwAbM0Ye/U5wEKyEdJTtB0+Vt7tIZve5OAQCTFvCp7qRcuF pyidvSmMuQ4bubLoxZsGWglZ1D+uFKgiRhwOIhdCxEUKisvhL53oi61knWAK31ytE0iW 1PCJO2SdprTxHq+6wRdjNlaDESBbWp9VF8jf8re9UBweBcH95KLFUWEqaADahAal5hNm 73FA== ARC-Authentication-Results: i=1; mx.google.com; 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 66si13793044pfm.167.2018.04.24.08.29.44; Tue, 24 Apr 2018 08:29:59 -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; 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 S1751535AbeDXP2S (ORCPT + 99 others); Tue, 24 Apr 2018 11:28:18 -0400 Received: from david.siemens.de ([192.35.17.14]:41462 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751231AbeDXP2Q (ORCPT ); Tue, 24 Apr 2018 11:28:16 -0400 X-Greylist: delayed 409 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 Apr 2018 11:28:16 EDT Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id w3OFDijx023442 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Apr 2018 17:13:45 +0200 Received: from md1f2u6c.ad001.siemens.net (md1q0hnc.ad001.siemens.net [139.25.68.37] (may be forged)) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id w3OFDhen031216; Tue, 24 Apr 2018 17:13:44 +0200 From: Jan Kiszka To: Bjorn Helgaas , Linux Kernel Mailing List , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Will Deacon , Lorenzo Pieralisi Subject: [PATCH 5/6] PCI: Add support for unbinding the generic PCI host controller Date: Tue, 24 Apr 2018 17:13:41 +0200 Message-Id: X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kiszka Particularly useful when working in virtual environments where the controller may come and go, but possibly not only there. CC: Will Deacon CC: Lorenzo Pieralisi Signed-off-by: Jan Kiszka --- drivers/pci/host/pci-host-common.c | 13 +++++++++++++ drivers/pci/host/pci-host-generic.c | 1 + include/linux/pci-ecam.h | 1 + 3 files changed, 15 insertions(+) diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c index 5d028f53fdcd..d8f10451f273 100644 --- a/drivers/pci/host/pci-host-common.c +++ b/drivers/pci/host/pci-host-common.c @@ -101,5 +101,18 @@ int pci_host_common_probe(struct platform_device *pdev, return ret; } + platform_set_drvdata(pdev, bridge->bus); + return 0; +} + +int pci_host_common_remove(struct platform_device *pdev) +{ + struct pci_bus *bus = platform_get_drvdata(pdev); + + pci_lock_rescan_remove(); + pci_stop_root_bus(bus); + pci_remove_root_bus(bus); + pci_unlock_rescan_remove(); + return 0; } diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c index 45319ee3b484..dea3ec7592a2 100644 --- a/drivers/pci/host/pci-host-generic.c +++ b/drivers/pci/host/pci-host-generic.c @@ -95,5 +95,6 @@ static struct platform_driver gen_pci_driver = { .suppress_bind_attrs = true, }, .probe = gen_pci_probe, + .remove = pci_host_common_remove, }; builtin_platform_driver(gen_pci_driver); diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h index baadad1aabbc..29efa09d686b 100644 --- a/include/linux/pci-ecam.h +++ b/include/linux/pci-ecam.h @@ -62,5 +62,6 @@ extern struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */ /* for DT-based PCI controllers that support ECAM */ int pci_host_common_probe(struct platform_device *pdev, struct pci_ecam_ops *ops); +int pci_host_common_remove(struct platform_device *pdev); #endif #endif -- 2.13.6