From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: linuxppc-dev list <linuxppc-dev@ozlabs.org>
Subject: [PATCH/RFC] powerpc: make pci use device notifier
Date: Sat, 04 Nov 2006 08:22:48 +1100 [thread overview]
Message-ID: <1162588969.10630.115.camel@localhost.localdomain> (raw)
This is just an add-on to my previous patch to make it use the new
device notifier thingy that I added to gregkh tree instead of the old
style function pointer hooks
Index: linux-cell/arch/powerpc/kernel/setup_64.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/setup_64.c 2006-10-26 16:43:32.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/setup_64.c 2006-10-26 16:44:09.000000000 +1000
@@ -531,10 +531,6 @@ void __init setup_arch(char **cmdline_p)
conswitchp = &dummy_con;
#endif
-#ifdef CONFIG_PCI
- platform_notify = pci_platform_notify;
- platform_notify_remove = pci_platform_notify_remove;
-#endif
ppc_md.setup_arch();
paging_init();
Index: linux-cell/arch/powerpc/kernel/pci_64.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/pci_64.c 2006-10-26 16:43:32.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/pci_64.c 2006-10-26 16:44:09.000000000 +1000
@@ -22,6 +22,7 @@
#include <linux/list.h>
#include <linux/syscalls.h>
#include <linux/irq.h>
+#include <linux/notifier.h>
#include <asm/processor.h>
#include <asm/io.h>
@@ -554,6 +555,29 @@ void __devinit scan_phb(struct pci_contr
hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);
}
+static int ppc_pci_dev_notify(struct notifier_block *nb, unsigned long action,
+ void *data)
+{
+ struct device *dev = data;
+ struct device_ext *dext;
+
+ if (action == BUS_NOTIFY_DEL_DEVICE) {
+ dext = device_get_ext(dev);
+
+ DBG("%s:%s platform notify remove !\n",
+ dev_driver_string(dev), dev->bus_id);
+
+ device_set_ext(dev, NULL);
+ kfree(dext);
+ }
+
+ return 0;
+}
+
+static struct notifier_block ppc_pci_dev_notifier = {
+ .notifier_call = ppc_pci_dev_notify
+};
+
static int __init pcibios_init(void)
{
struct pci_controller *hose, *tmp;
@@ -566,6 +590,8 @@ static int __init pcibios_init(void)
if (firmware_has_feature(FW_FEATURE_ISERIES))
iSeries_pcibios_init();
+ register_bus_notifier(&pci_bus_type, &ppc_pci_dev_notifier);
+
printk(KERN_DEBUG "PCI: Probing PCI hardware\n");
/* Scan all of the recorded PCI controllers. */
@@ -1458,24 +1484,3 @@ int pcibus_to_node(struct pci_bus *bus)
EXPORT_SYMBOL(pcibus_to_node);
#endif
-int pci_platform_notify(struct device * dev)
-{
- return 0;
-}
-
-int pci_platform_notify_remove(struct device * dev)
-{
- struct device_ext *dext = device_get_ext(dev);
-
- DBG("%s:%s platform notify remove !\n",
- dev_driver_string(dev), dev->bus_id);
-
- if (dev->bus != &pci_bus_type)
- return 0;
-
- device_set_ext(dev, NULL);
- mb();
- kfree(dext);
-
- return 0;
-}
reply other threads:[~2006-11-03 21:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1162588969.10630.115.camel@localhost.localdomain \
--to=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).