mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Rose <johnrose@austin.ibm.com>
To: Greg KH <greg@kroah.com>
Cc: Jesse Barnes <jbarnes@engr.sgi.com>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] release_pcibus_dev() crash
Date: Thu, 13 Jan 2005 14:12:15 -0600	[thread overview]
Message-ID: <1105647135.30960.22.camel@sinatra.austin.ibm.com> (raw)
In-Reply-To: <20050113183729.GA25049@kroah.com>

> So, does the patch below fix the problem for you?
> (warning, not even compile tested)

Unfortunately, the class device attribute and pci_remove_legacy_files()
are statically defined in probe.c.  The patch below augments yours to account
for this.

This set of changes also fixes the crash.  I'll let you decide if explicitly
cleaning up these files is worth exporting this stuff outside of probe.c.  
Also, suggestions are welcome for a cleaner way to do this, I'm not totally
comfortable with the ifdef's and inlines :)

Thanks-
John

Signed-off-by: John Rose <johnrose@austin.ibm.com>

diff -puN drivers/pci/probe.c~01_release_pcibus_dev drivers/pci/probe.c
--- 2_6_linus_2/drivers/pci/probe.c~01_release_pcibus_dev	2005-01-13 13:41:08.000000000 -0600
+++ 2_6_linus_2-johnrose/drivers/pci/probe.c	2005-01-13 13:57:27.000000000 -0600
@@ -70,7 +70,7 @@ static void pci_remove_legacy_files(stru
 }
 #else /* !HAVE_PCI_LEGACY */
 static inline void pci_create_legacy_files(struct pci_bus *bus) { return; }
-static inline void pci_remove_legacy_files(struct pci_bus *bus) { return; }
+inline void pci_remove_legacy_files(struct pci_bus *bus) { return; }
 #endif /* HAVE_PCI_LEGACY */
 
 /*
@@ -86,7 +86,7 @@ static ssize_t pci_bus_show_cpuaffinity(
 		buf[ret++] = '\n';
 	return ret;
 }
-static CLASS_DEVICE_ATTR(cpuaffinity, S_IRUGO, pci_bus_show_cpuaffinity, NULL);
+CLASS_DEVICE_ATTR(cpuaffinity, S_IRUGO, pci_bus_show_cpuaffinity, NULL);
 
 /*
  * PCI Bus Class
@@ -95,10 +95,6 @@ static void release_pcibus_dev(struct cl
 {
 	struct pci_bus *pci_bus = to_pci_bus(class_dev);
 
-	pci_remove_legacy_files(pci_bus);
-	class_device_remove_file(&pci_bus->class_dev,
-				 &class_device_attr_cpuaffinity);
-	sysfs_remove_link(&pci_bus->class_dev.kobj, "bridge");
 	if (pci_bus->bridge)
 		put_device(pci_bus->bridge);
 	kfree(pci_bus);
diff -puN drivers/pci/remove.c~01_release_pcibus_dev drivers/pci/remove.c
--- 2_6_linus_2/drivers/pci/remove.c~01_release_pcibus_dev	2005-01-13 13:42:39.000000000 -0600
+++ 2_6_linus_2-johnrose/drivers/pci/remove.c	2005-01-13 13:47:18.000000000 -0600
@@ -61,15 +61,18 @@ int pci_remove_device_safe(struct pci_de
 }
 EXPORT_SYMBOL(pci_remove_device_safe);
 
-void pci_remove_bus(struct pci_bus *b)
+void pci_remove_bus(struct pci_bus *pci_bus)
 {
-	pci_proc_detach_bus(b);
+	pci_proc_detach_bus(pci_bus);
 
 	spin_lock(&pci_bus_lock);
-	list_del(&b->node);
+	list_del(&pci_bus->node);
 	spin_unlock(&pci_bus_lock);
-
-	class_device_unregister(&b->class_dev);
+	pci_remove_legacy_files(pci_bus);
+	class_device_remove_file(&pci_bus->class_dev,
+		&class_device_attr_cpuaffinity);
+	sysfs_remove_link(&pci_bus->class_dev.kobj, "bridge");
+	class_device_unregister(&pci_bus->class_dev);
 }
 EXPORT_SYMBOL(pci_remove_bus);
 
diff -puN include/linux/pci.h~01_release_pcibus_dev include/linux/pci.h
--- 2_6_linus_2/include/linux/pci.h~01_release_pcibus_dev	2005-01-13 13:53:28.000000000 -0600
+++ 2_6_linus_2-johnrose/include/linux/pci.h	2005-01-13 13:58:06.000000000 -0600
@@ -1055,8 +1055,10 @@ enum pci_fixup_pass {
 
 
 void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
+void pci_remove_legacy_files(struct pci_bus *bus);
 
 extern int pci_pci_problems;
+extern struct class_device_attribute class_device_attr_cpuaffinity;
 #define PCIPCI_FAIL		1
 #define PCIPCI_TRITON		2
 #define PCIPCI_NATOMA		4

_


  reply	other threads:[~2005-01-13 20:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-13  0:39 John Rose
2005-01-13  0:55 ` Jesse Barnes
2005-01-13 17:11   ` John Rose
2005-01-13 17:33     ` Jesse Barnes
2005-01-13 17:49       ` John Rose
2005-01-13 18:18         ` Greg KH
2005-01-13 18:21           ` Jesse Barnes
2005-01-13 18:37             ` Greg KH
2005-01-13 20:12               ` John Rose [this message]
2005-01-13 20:25                 ` Greg KH
2005-01-13 20:54                   ` John Rose
2005-01-13 21:05                     ` Greg KH
2005-01-13 21:17                       ` John Rose
2005-01-13 21:55                         ` John Rose
2005-01-13 23:41                         ` Greg KH

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=1105647135.30960.22.camel@sinatra.austin.ibm.com \
    --to=johnrose@austin.ibm.com \
    --cc=greg@kroah.com \
    --cc=jbarnes@engr.sgi.com \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome