From patchwork Tue Jun 4 17:18:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Ott X-Patchwork-Id: 248790 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 28FCC2C00A4 for ; Wed, 5 Jun 2013 03:18:57 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752953Ab3FDRS0 (ORCPT ); Tue, 4 Jun 2013 13:18:26 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:60676 "EHLO e06smtp11.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751503Ab3FDRSY (ORCPT ); Tue, 4 Jun 2013 13:18:24 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Jun 2013 18:13:37 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 4 Jun 2013 18:13:35 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id B6D0217D801A; Tue, 4 Jun 2013 18:19:36 +0100 (BST) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r54HI8oN51380370; Tue, 4 Jun 2013 17:18:08 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r54HIIYe003221; Tue, 4 Jun 2013 11:18:18 -0600 Received: from icon-9-167-201-64.megacenter.de.ibm.com (icon-9-167-201-64.megacenter.de.ibm.com [9.167.201.64]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r54HIFwu003151 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 4 Jun 2013 11:18:17 -0600 Date: Tue, 4 Jun 2013 19:18:14 +0200 (CEST) From: Sebastian Ott X-X-Sender: sebott@c4eb To: Bjorn Helgaas cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] pci: add pcibios_release_device Message-ID: User-Agent: Alpine 2.03 (LFD 1266 2009-07-14) Organization: =?ISO-8859-15?Q?=22IBM_Deutschland_Research_&_Development_GmbH_=2F_Vorsitzende_des_Aufsichtsrats=3A_Martina_Koederitz_Gesch=E4ftsf=FChrung=3A_Dirk_Wittkopp_Sitz_der_Gesellschaft=3A_B=F6blingen_=2F_Registergericht?= =?ISO-8859-15?Q?=3A_Amtsgericht_Stuttgart=2C_HRB_243294=22?= MIME-Version: 1.0 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13060417-5024-0000-0000-0000063C7A2D Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Hello Bjorn, part of your feedback to the PCI support on s390 was to put some smarts in the config space accessors and let the pci core do the scanning of pci functions. To get there I had to implement pcibios_add_device on s390 to do some arch specific device initialization. During removal of the pci function I would like to undo these steps. Would it be possible to have a couterpart of pcibios_add_device - like the patch below: pci: add pcibios_release_device Platforms may want to provide architecture-specific functionality when a pci device is released. Add a pcibios_release_device() call that architectures can override to do so. Signed-off-by: Sebastian Ott --- drivers/pci/pci.c | 10 ++++++++++ drivers/pci/probe.c | 1 + include/linux/pci.h | 1 + 3 files changed, 12 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1335,6 +1335,16 @@ int __weak pcibios_add_device (struct pc } /** + * pcibios_release_device - provide arch specific hooks when releasing device dev + * @dev: the PCI device being released + * + * Permits the platform to provide architecture specific functionality when + * devices are released. This is the default implementation. Architecture + * implementations can override this. + */ +void __weak pcibios_release_device(struct pci_dev *dev) {} + +/** * pcibios_disable_device - disable arch specific PCI resources for device dev * @dev: the PCI device to disable * --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1132,6 +1132,7 @@ static void pci_release_dev(struct devic pci_dev = to_pci_dev(dev); pci_release_capabilities(pci_dev); pci_release_of_node(pci_dev); + pcibios_release_device(pci_dev); kfree(pci_dev); } --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1643,6 +1643,7 @@ void pcibios_set_master(struct pci_dev * int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); int pcibios_add_device(struct pci_dev *dev); +void pcibios_release_device(struct pci_dev *dev); #ifdef CONFIG_PCI_MMCONFIG void __init pci_mmcfg_early_init(void);