Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1283005imm; Fri, 8 Jun 2018 13:14:53 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLMpcoMHjmD6Aqjk3nAnR0DRQhxKQEkLTesGSf0tg2lryXbD+5/G0w7Ux7eMdBaLxQU8Hxy X-Received: by 2002:a17:902:981:: with SMTP id 1-v6mr8047310pln.11.1528488893442; Fri, 08 Jun 2018 13:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528488893; cv=none; d=google.com; s=arc-20160816; b=Ns4eHFB3G4REY0/0rLXQvPk60SgKahTHXvcHVYQMYxwAcuFES7RDEE7P/a1vbYtnGA kzbh3eBykEFvE7rtgUF+v0+IR7vQ+fJS6GK/pDsMfgS/NlvhducKbev1STRr6L5l0rs/ a/GDxDeudDcslGAwh+wFj+OodQ771iIYVUCOvhRF1EGAD+zmT80mkW1nltxfqK3TyMT2 aRGhmbjQuyjpbYqekMJWBWgMZbl+EncGfAt96QRjrZNQlyJHAMI5Fu9dvfC0rBYwG0ZI jaTmChpTVEHTZ3Xo4pWaxNT5a/5lgiFIgoyEi39phYaYy53m9Lic7qB7cl+g8w4KuuCw Ocyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature:arc-authentication-results; bh=VvoECr9BKbZPp+QUsAz4y39Lxdee3Q4Mouh3Vp4q0mE=; b=VpaJyTT5xTDKCG5cgrPRWQNhuJcjwZ9avOUMOdQW0Tp1dpqUDbgJXZ6D2W2Hon/7x6 Ktl6zKQGMVHawbkLbh9PisO64KLlatL6cn6CZ5udUONHOHElI1e8/ZZDb5MOndY7BNYO 1+0IXII82I5KwEyV83xThST5BOrMQXEC0ZQpGFcvmhXcGfkzpGPcyTCpbw6wdyTHh4Ep zDU+rCScRC6XkDyHWKCposgEuraU3oZAlkKc0ccLxOd79rw3doFkiCF0NA+hBHWpOFk6 fHjMqm2Dg1UePmgJEK3w9XuhfyzdLaUcf0q3AGLEKSYd+Wu2dn51pOdA7m5g2mGbx506 dofg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UdRWSkNL; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x65-v6si19371270pgb.598.2018.06.08.13.14.38; Fri, 08 Jun 2018 13:14:53 -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=@kernel.org header.s=default header.b=UdRWSkNL; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753107AbeFHUMa (ORCPT + 99 others); Fri, 8 Jun 2018 16:12:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:51466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753061AbeFHUM1 (ORCPT ); Fri, 8 Jun 2018 16:12:27 -0400 Received: from localhost (unknown [150.199.191.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 83109206B7; Fri, 8 Jun 2018 20:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528488746; bh=FKUd47oD/8ggZ9rec5l/rQEIGCIEXLBsnjPMZK98vic=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=UdRWSkNLyEOrE/qfDtXuypBMjFxf7yeZz40hRsCK544hBZTeMa+Ya7mYPdGfw5Ovb 8Kel9heTJnW0N9qIQUpQsIREgC97jqRCJHHpsX3m3NkMeDowN49NavGnIDVxCmDWYR FAzmY/k2R9oh2ABmqPFDRlNHL2AddCjC7lsNmZTY= Subject: [PATCH v1 4/9] PCI/portdrv: Squash device removal code into portdrv_pci.c From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: Oza Pawandeep , linux-kernel@vger.kernel.org Date: Fri, 08 Jun 2018 15:12:25 -0500 Message-ID: <152848874571.14051.17371000358965533938.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <152848853199.14051.12670957565366345798.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <152848853199.14051.12670957565366345798.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Helgaas Move device removal code next to its caller in portdrv_pci.c. No functional change intended. Signed-off-by: Bjorn Helgaas --- drivers/pci/pcie/portdrv.h | 1 - drivers/pci/pcie/portdrv_core.c | 21 --------------------- drivers/pci/pcie/portdrv_pci.c | 21 +++++++++++++++++++++ 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h index cb2a33ea68a5..ab3631a61347 100644 --- a/drivers/pci/pcie/portdrv.h +++ b/drivers/pci/pcie/portdrv.h @@ -79,7 +79,6 @@ void pcie_port_service_unregister(struct pcie_port_service_driver *new); #define get_descriptor_id(type, service) (((type - 4) << 8) | service) extern struct bus_type pcie_port_bus_type; -void pcie_port_device_remove(struct pci_dev *dev); int __must_check pcie_port_bus_register(void); void pcie_port_bus_unregister(void); diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 9bcc856738ff..2ef046af08d2 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -25,13 +25,6 @@ struct portdrv_service_data { u32 service; }; -static int remove_iter(struct device *dev, void *data) -{ - if (dev->bus == &pcie_port_bus_type) - device_unregister(dev); - return 0; -} - static int find_service_iter(struct device *device, void *data) { struct pcie_port_service_driver *service_driver; @@ -95,20 +88,6 @@ struct device *pcie_port_find_device(struct pci_dev *dev, return device; } -/** - * pcie_port_device_remove - unregister PCI Express port service devices - * @dev: PCI Express port the service devices to unregister are associated with - * - * Remove PCI Express port service devices associated with given port and - * disable MSI-X or MSI for the port. - */ -void pcie_port_device_remove(struct pci_dev *dev) -{ - device_for_each_child(&dev->dev, NULL, remove_iter); - pci_free_irq_vectors(dev); - pci_disable_device(dev); -} - /** * pcie_port_probe_service - probe driver for given PCI Express port service * @dev: PCI Express port service device to probe against diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 1b7855a062ff..ab5e3a63981b 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c @@ -506,6 +506,27 @@ static int pcie_portdrv_probe(struct pci_dev *dev, return 0; } +static int remove_iter(struct device *dev, void *data) +{ + if (dev->bus == &pcie_port_bus_type) + device_unregister(dev); + return 0; +} + +/** + * pcie_port_device_remove - unregister PCI Express port service devices + * @dev: PCI Express port the service devices to unregister are associated with + * + * Remove PCI Express port service devices associated with given port and + * disable MSI-X or MSI for the port. + */ +static void pcie_port_device_remove(struct pci_dev *dev) +{ + device_for_each_child(&dev->dev, NULL, remove_iter); + pci_free_irq_vectors(dev); + pci_disable_device(dev); +} + static void pcie_portdrv_remove(struct pci_dev *dev) { if (pci_bridge_d3_possible(dev)) {