Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6625784imm; Wed, 27 Jun 2018 10:28:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc5/+WSyHe7GvE8S6MJXt4FOzoXXC27xmcZDwB+rxyXbyDBvit32OjNhlMqzc3/+DtouNDi X-Received: by 2002:a62:830e:: with SMTP id h14-v6mr6935686pfe.64.1530120527416; Wed, 27 Jun 2018 10:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530120527; cv=none; d=google.com; s=arc-20160816; b=aTcIgHCE/WYuIxkv0mlgzq0TtqV0+TXCjBWn412migWEKKWn5xNWNoDzV7ZsLjfvQ9 NEOBNYLVlRY0ECUulH6PBXmtYDMkLJaHoITjCT2wlkZOHUBXZyhYYWtp8JX+PrTam4eM VVlK4zXghb6dN+oYbQomx8TP6cRgCbDJ1EMTEkSqEpQ7W0Z1NO+BRJLx6IOoNJKOR1JX OXy/MJlhm5T2y34cOUlxPyvoCiKvnMqZOaEMxqaTB8yob9gcQ6OqnIgYlZzhb9jL4Tzq EdFIgjBNwJdk2m0nXupLqW2ZD8nRJPtCV1wTtIrGVJppfrDBSeOAicVJ/eiFIhhg0lvg MtIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=gjI3Ne/ln21BdK+QUDq4mpxavjfPCFRmsNpo76PxHPo=; b=ZMwZTYUlILlUU8HA0c3f5jUR0yeIxtSBk6iyDd9hxtbLHqgtBeERcmy1PaLCZocpBn o8HTzHGLsNyVTOG4u4Ok0IWsOZtBU6QdS9Css/KFcLaet142DAPj58vh1zy7D4KDHWDy ZwLxRpJbafR7Ls1rLurp83F1Bdaq3eCRYlVy3lAoRJnRW2HvmSzgIzt3i0Q3tFXdagVa oUlLhf7PySoICeActMhBk86L5MTPRwLnI7EcSrN3J1g7QtDopsLw+E2rfAlZQ+fjcPZZ X7Y7vdgGDRM+dIM+LIxQ2h1LiZi1vn/DWPcsjc9nIGbfIAlsTpdKju2jc9dcBOHqWEk3 0YgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pmuQCuN2; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4-v6si3761534pgy.251.2018.06.27.10.28.32; Wed, 27 Jun 2018 10:28:47 -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=@gmail.com header.s=20161025 header.b=pmuQCuN2; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965154AbeF0QjK (ORCPT + 99 others); Wed, 27 Jun 2018 12:39:10 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:33431 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752267AbeF0QjI (ORCPT ); Wed, 27 Jun 2018 12:39:08 -0400 Received: by mail-ua0-f196.google.com with SMTP id u21-v6so1682762uao.0; Wed, 27 Jun 2018 09:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gjI3Ne/ln21BdK+QUDq4mpxavjfPCFRmsNpo76PxHPo=; b=pmuQCuN2Apa/CdvY1aK5L2UcE6y03WV6XW+jJkhc3uTgCjqfL98rxN9ZEexLeIXELE VtgdFspD4gn3RIsKVnXexetW1+7yTLZ2iRt1L2aIJYEBNVzITPoqhfzu9shRUSbZshzu cmMA6ooqaYejvP1NizKQ/Epwn2gnarLCAnCc6ki//YFCTGT+DNAkSTx4OIB4Gp5J8i1i OC5wv4Q5w6GpMgYt3KbAuWMokkCNtAWpKfXLAtYV5lj3d3BjslyGo06hD4mtJW/x2kyi 6XrG7vebmkEGf6kyPdhgDkwGFuns+p/HSlQDK2ccQchvZz9WK5Xdim2G44zzR1458Q2s IJEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gjI3Ne/ln21BdK+QUDq4mpxavjfPCFRmsNpo76PxHPo=; b=G8JQupIrdOQOApyBOYW6tnRLiFAli538Ie8LSZM77i1Uipj0PKvQ6xStcDFhu2UbLp 7D75QwO3I/KMGmKbaTuTIo0GNtROaW5uyVdKExq2uu06JN9VrGXQ+xPxM7FHaJgsdhvM 9bWEmwL9gw2CTg5LZmNBZ5Wef5bNQQi1TlBspeBVjnFoYvn/AXNFpP03Sq6ld0mzhyua bBh9hqeRVdksp2i7x3fbVcVPxD821XwDDLTQFmO1wbMg6Q3BN6EvM8NGniZcv6RQjo29 nDDvvDtVe5JRvvqnViznXE65Nq+6xnVppRF7Ml7fJK/C9mWv++0P3pbCqhFd8NIR4DAm PjJA== X-Gm-Message-State: APt69E082pONdCWI+lmC9edkL51KC2609iQ0wgK0J9Q3iM/j7yxzje/i v0BZ5FLbpT4fkxr+olb3NE2/sc0ZX9rvb/y+MJk= X-Received: by 2002:ab0:1a23:: with SMTP id a35-v6mr4199375uai.47.1530117547254; Wed, 27 Jun 2018 09:39:07 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:8b02:0:0:0:0:0 with HTTP; Wed, 27 Jun 2018 09:39:06 -0700 (PDT) In-Reply-To: <1530091298-28120-5-git-send-email-honghui.zhang@mediatek.com> References: <1530091298-28120-1-git-send-email-honghui.zhang@mediatek.com> <1530091298-28120-5-git-send-email-honghui.zhang@mediatek.com> From: Andy Shevchenko Date: Wed, 27 Jun 2018 19:39:06 +0300 Message-ID: Subject: Re: [PATCH 4/4] PCI: mediatek: Add loadable kernel module support To: Honghui Zhang 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > + > + 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? > + mtk_pcie_put_resources(pcie); > + > + return 0; > +} -- With Best Regards, Andy Shevchenko