Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp882567ybi; Thu, 30 May 2019 08:10:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxO+MLJsc3wG3zvmfzM9oRw2AM5kaJKsz7hAyqVtTkrsKsnsZZsH4/JSQN/rxnVZ2ZMhya8 X-Received: by 2002:a62:ae05:: with SMTP id q5mr4048036pff.13.1559229052344; Thu, 30 May 2019 08:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559229052; cv=none; d=google.com; s=arc-20160816; b=uNnUeXVdguWOGBzkvRBahgOu+TQ1A7//pLCw4/MXPDq5lauxyK8hmYrSPZ++WFkDVn qR7LdYNVpJHFfneBRWqBeemIpYiA/fR+jpVv3ubC2nImhI0U53psS4iRllcIADyI4UB6 m/sPMDAiV/dhE+Vg16KEEmXcWId8UEdVTPGQ8XyChWTvsV6fLDYeanF6q5RbeptzwM/h y9z+FI01xnyaTmWh8rdGBic9rOWMTzJqw3ybSTaUvF0DCn4U6K3U0kvD4cBf6bFJsmki 3wGcsz/i9lgXwP63Ez2/LPZUStEhSnWCd71qV62byAxTKdFt4HbLY1dFOQ8HBO2czvef DjSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=z/kZStR16GAc8TywQmoK2TRSs2ZPEo25y4bfTxz1rt8=; b=ZJ39wJLIKvWD8gALLXBHOfP+8y54h87EhhsTvVJJTgiUykVOy+sezGVhuVV6iAupQO EcNFsemnLebEWQcMS6olu+uq5muw9aaw608rZo7xP/zgAHhoY1qd1EkhWNPcQVPNO7jH dUkonJlgw9cVXJz+J5QiHf+CXIhM6dIx2/uVHXIrZXem4k+wWI7RR3MxJLWqQNGkkn7X mWFYwcwZZ0meHm/4nZKM8bSr/8vOSXbdAJL87Jock/MKq0s3lA8C1m6LRNH9KVNAfX64 ar0kSP77W2kD4HhjQObQ1AxXX9lRlLuPf+fGDF5fEedz3GUzIeXrtjvcxbUIxyDenxtw HCuQ== 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 c6si3541103pfc.235.2019.05.30.08.10.34; Thu, 30 May 2019 08:10:52 -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 S1726609AbfE3PH4 (ORCPT + 99 others); Thu, 30 May 2019 11:07:56 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38124 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725440AbfE3PHz (ORCPT ); Thu, 30 May 2019 11:07:55 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 31A7D341; Thu, 30 May 2019 08:07:55 -0700 (PDT) Received: from redmoon (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F1AD23F59C; Thu, 30 May 2019 08:07:53 -0700 (PDT) Date: Thu, 30 May 2019 16:07:51 +0100 From: Lorenzo Pieralisi To: Ley Foon Tan Cc: Ley Foon Tan , Bjorn Helgaas , linux-kernel@vger.kernel.org, linux-pci , devicetree@vger.kernel.org Subject: Re: [PATCH] PCI: altera: Allow building as module Message-ID: <20190530150751.GB13993@redmoon> References: <1556081835-12921-1-git-send-email-ley.foon.tan@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 14, 2019 at 01:35:05PM +0800, Ley Foon Tan wrote: > On Wed, Apr 24, 2019 at 12:57 PM Ley Foon Tan wrote: > > > > Altera PCIe Rootport IP is a soft IP and is only available after > > FPGA image is programmed. > > > > Make driver modulable to support use case FPGA image is programmed > > after kernel is booted. User proram FPGA image in kernel then only load > > PCIe driver module. > > > > Signed-off-by: Ley Foon Tan > > --- > > drivers/pci/controller/Kconfig | 2 +- > > drivers/pci/controller/pcie-altera.c | 28 ++++++++++++++++++++++++++-- > > 2 files changed, 27 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig > > index 6012f3059acd..4b550f9cdd56 100644 > > --- a/drivers/pci/controller/Kconfig > > +++ b/drivers/pci/controller/Kconfig > > @@ -174,7 +174,7 @@ config PCIE_IPROC_MSI > > PCIe controller > > > > config PCIE_ALTERA > > - bool "Altera PCIe controller" > > + tristate "Altera PCIe controller" > > depends on ARM || NIOS2 || ARM64 || COMPILE_TEST > > help > > Say Y here if you want to enable PCIe controller support on Altera > > diff --git a/drivers/pci/controller/pcie-altera.c b/drivers/pci/controller/pcie-altera.c > > index 27edcebd1726..6c86bc69ace8 100644 > > --- a/drivers/pci/controller/pcie-altera.c > > +++ b/drivers/pci/controller/pcie-altera.c > > @@ -10,6 +10,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -705,6 +706,13 @@ static int altera_pcie_init_irq_domain(struct altera_pcie *pcie) > > return 0; > > } > > > > +static int altera_pcie_irq_teardown(struct altera_pcie *pcie) > > +{ > > + irq_set_chained_handler_and_data(pcie->irq, NULL, NULL); > > + irq_domain_remove(pcie->irq_domain); > > + irq_dispose_mapping(pcie->irq); > > +} > > + > > static int altera_pcie_parse_dt(struct altera_pcie *pcie) > > { > > struct device *dev = &pcie->pdev->dev; > > @@ -798,6 +806,7 @@ static int altera_pcie_probe(struct platform_device *pdev) > > > > pcie = pci_host_bridge_priv(bridge); > > pcie->pdev = pdev; > > + platform_set_drvdata(pdev, pcie); > > > > match = of_match_device(altera_pcie_of_match, &pdev->dev); > > if (!match) > > @@ -855,13 +864,28 @@ static int altera_pcie_probe(struct platform_device *pdev) > > return ret; > > } > > > > +static int altera_pcie_remove(struct platform_device *pdev) > > +{ > > + struct altera_pcie *pcie = platform_get_drvdata(pdev); > > + struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); > > + > > + pci_stop_root_bus(bridge->bus); > > + pci_remove_root_bus(bridge->bus); > > + pci_free_resource_list(&pcie->resources); > > + altera_pcie_irq_teardown(pcie); > > + > > + return 0; > > +} > > + > > static struct platform_driver altera_pcie_driver = { > > .probe = altera_pcie_probe, > > + .remove = altera_pcie_remove, > > .driver = { > > .name = "altera-pcie", > > .of_match_table = altera_pcie_of_match, > > - .suppress_bind_attrs = true, > > }, > > }; > > > > -builtin_platform_driver(altera_pcie_driver); > > +MODULE_DEVICE_TABLE(of, altera_pcie_of_match); > > +module_platform_driver(altera_pcie_driver); > > +MODULE_LICENSE("GPL v2"); > > -- > > 2.19.0 > > > Hi > > Any comment for this patch? Applied to pci/altera for v5.3, thanks. Lorenzo