linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci: add pcibios_release_device
@ 2013-06-04 17:18 Sebastian Ott
  2013-06-04 23:29 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Ott @ 2013-06-04 17:18 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel

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 <sebott@linux.vnet.ibm.com>
---
 drivers/pci/pci.c   |   10 ++++++++++
 drivers/pci/probe.c |    1 +
 include/linux/pci.h |    1 +
 3 files changed, 12 insertions(+)

--- 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);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] pci: add pcibios_release_device
  2013-06-04 17:18 [PATCH] pci: add pcibios_release_device Sebastian Ott
@ 2013-06-04 23:29 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2013-06-04 23:29 UTC (permalink / raw)
  To: Sebastian Ott; +Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org

On Tue, Jun 4, 2013 at 11:18 AM, Sebastian Ott
<sebott@linux.vnet.ibm.com> wrote:
> 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 <sebott@linux.vnet.ibm.com>

Applied to pci/misc for v3.11.  Thanks!

> ---
>  drivers/pci/pci.c   |   10 ++++++++++
>  drivers/pci/probe.c |    1 +
>  include/linux/pci.h |    1 +
>  3 files changed, 12 insertions(+)
>
> --- 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);
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-04 23:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-04 17:18 [PATCH] pci: add pcibios_release_device Sebastian Ott
2013-06-04 23:29 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).