Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7019209imm; Wed, 27 Jun 2018 18:21:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKq3YghEqRJ2/m062j+530pehKQbLMObgMaRasW6cQIStjnFJj/Umo+BnKC4lJkuH1Sldp4 X-Received: by 2002:a63:2d45:: with SMTP id t66-v6mr6914682pgt.381.1530148872876; Wed, 27 Jun 2018 18:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530148872; cv=none; d=google.com; s=arc-20160816; b=DxAiYonslsBR2Kp8aZuOCdbprISJzct+vzq6PzsMg4wu8yQU/SkMdqThZrdNA7dw4V tVD+s41SlyoEOwmMnrpNxbGQfyDe73+W7UhSBWfvaPB7lGRTOMqnioU+03rEUeHf2q9V MzlblRBVgFPUnZkng3u3VP65TGJ5thjBj0gcs9DNT4Jw1S4BMHy7ldSRbpPHTL78JRjG cOC6xoTn0iymINlaXhmewpw/pvJVH4aCYkKb6mkH22CmKfxVqunRJjerOEUOn/WmD6ai mX3LszjnAKZJlqAX/AeUXS0JThX8DJmqvW7KnpEwb7p4rKbisos9YW+7rIyM73FBujTN aPBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=S+eyaMMMpaKU6GJWCbKk6QYBvLo7664JRvy9T72Xzz8=; b=t/fajjrtlokhOnnsbc/MKMFJU2s7vYXywAtFNNw8AE0UGohpHmSqIYB2BrVmaxBS8z 1QcsxHXD2CONvvBRoSqtlw2ftEDXW9ffYvrIissdTdkw2+H1mHHeBh0aBiUATbyfLWu5 Vhw1x07PCXkKVV6hGmbzXT8y8BuiUh6dAC0ZjaqG3ScWG+/vmrCzJyWiBEjw894vkls1 xVoUoQR8fvguk60B1YOEQ+66tcXeS7SyCSynj6RT7KTsrOuF2L8RrXIBjlbQXTsYiQrw ybgKPpBTB88rah+XeeFG2EZjMd2f/pZjewv772m0l9THXLGJ7avLItnMzoty+S1SYBsh OY2Q== 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 j10-v6si4562287pgq.503.2018.06.27.18.20.58; Wed, 27 Jun 2018 18:21:12 -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 S1752625AbeF1BRk (ORCPT + 99 others); Wed, 27 Jun 2018 21:17:40 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:56283 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751114AbeF1BRi (ORCPT ); Wed, 27 Jun 2018 21:17:38 -0400 X-UUID: 2c77f741283b4d6d870f353a6a835d63-20180628 Received: from mtkcas35.mediatek.inc [(172.27.4.250)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1293185427; Thu, 28 Jun 2018 09:17:34 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Thu, 28 Jun 2018 09:17:33 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Thu, 28 Jun 2018 09:17:32 +0800 Message-ID: <1530148652.28284.4.camel@mhfsdcap03> Subject: Re: [PATCH 4/4] PCI: mediatek: Add loadable kernel module support From: Honghui Zhang To: Andy Shevchenko CC: Lorenzo Pieralisi , Marc Zyngier , Bjorn Helgaas , "Matthias Brugger" , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , , Linux Kernel Mailing List , devicetree , , Eddie Huang , , , , , YT Shen , Date: Thu, 28 Jun 2018 09:17:32 +0800 In-Reply-To: References: <1530091298-28120-1-git-send-email-honghui.zhang@mediatek.com> <1530091298-28120-5-git-send-email-honghui.zhang@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; > > +} >