From mboxrd@z Thu Jan 1 00:00:00 1970 From: Honghui Zhang Subject: Re: [PATCH 4/4] PCI: mediatek: Add loadable kernel module support Date: Thu, 28 Jun 2018 09:17:32 +0800 Message-ID: <1530148652.28284.4.camel@mhfsdcap03> References: <1530091298-28120-1-git-send-email-honghui.zhang@mediatek.com> <1530091298-28120-5-git-send-email-honghui.zhang@mediatek.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Andy Shevchenko Cc: Lorenzo Pieralisi , Marc Zyngier , Bjorn Helgaas , Matthias Brugger , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , linux-pci@vger.kernel.org, Linux Kernel Mailing List , devicetree , yingjoe.chen@mediatek.com, Eddie Huang , ryder.lee@mediatek.com, hongkun.cao@mediatek.com, youlin.pei@mediatek.com, yong.wu@mediatek.com, YT Shen , sean.wang@mediatek.com List-Id: devicetree@vger.kernel.org On Wed, 2018-06-27 at 19:39 +0300, Andy Shevchenko wrote: > On Wed, Jun 27, 2018 at 12:21 PM, wrote: > > From: Honghui Zhang > > > > Implement remove callback function for Mediatek PCIe driver to add > > loadable kernel module support. > > > +static void mtk_pcie_irq_teardown(struct mtk_pcie *pcie) > > +{ > > + struct mtk_pcie_port *port, *tmp; > > + > > > + if (list_empty(&pcie->ports)) > > + return; > > This is redundant. Yeah, you are right, I will remove it. > > > + > > + list_for_each_entry_safe(port, tmp, &pcie->ports, list) { > > + irq_set_chained_handler_and_data(port->irq, NULL, NULL); > > + > > + if (port->irq_domain) > > + irq_domain_remove(port->irq_domain); > > + > > + if (IS_ENABLED(CONFIG_PCI_MSI)) { > > + if (port->msi_domain) > > + irq_domain_remove(port->msi_domain); > > + if (port->inner_domain) > > + irq_domain_remove(port->inner_domain); > > + } > > + > > + irq_dispose_mapping(port->irq); > > + } > > +} > > > +static void mtk_pcie_free_resources(struct mtk_pcie *pcie) > > +{ > > + struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie); > > + struct list_head *windows = &host->windows; > > + > > + pci_unmap_iospace(&pcie->pio); > > + pci_free_resource_list(windows); > > +} > > + > > +static int mtk_pcie_remove(struct platform_device *pdev) > > +{ > > + struct mtk_pcie *pcie = platform_get_drvdata(pdev); > > + struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie); > > + > > + pci_stop_root_bus(host->bus); > > + pci_remove_root_bus(host->bus); > > + mtk_pcie_free_resources(pcie); > > + > > + mtk_pcie_irq_teardown(pcie); > > + > > > + if (!list_empty(&pcie->ports)) > > I think this is also not needed. Do you put runtime PM by the way? Yes, it's could be removed. the pm was putted in mtk_pcie_put_resources which will call mtk_pcie_subsys_powerdown, and the pm was putted in that function. thanks. > > > + mtk_pcie_put_resources(pcie); > > + > > + return 0; > > +} >