Skip to contentSkip to conversation

: Suppress PCI bridge sysfs error messages.

PATCH New Linas Vepstas 1 participant 1 message Apr 2, 2007 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Suppress PCI bridge sysfs error messages.

Greg,

A non-urgent and somwhat ugly patch; please review, and if it seems correct, please apply.

--linas

While fiddling with PCI hotplugging, I noticed the messages

pci 0001:00:02.4: Error creating sysfs bridge symlink, continuing... pci 0001:00:02.2: Error creating sysfs bridge symlink, continuing... pci 0001:00:02.6: Error creating sysfs bridge symlink, continuing... pci 0001:00:02.0: Error creating sysfs bridge symlink, continuing...

These are printed by pci_bus_add_devices(); the reason for the error is that these are all other bridges that are already in sysfs. For a while, I assumed that pci_bus_add_devices() was being called with the wrong argument, but this seems not to be the case. Thus, I simply added a flag to make these prints go quiet.

This patch also cleans up some crazy whitespace indentation.

This patch seems inelegant, but I'm not sure what else to do.

----

 drivers/pci/bus.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/pci/bus.c +12 -8
Index: linux-2.6.21-rc4-git4/drivers/pci/bus.c
===================================================================
@@ -131,18 +131,22 @@ void __devinit pci_bus_add_devices(struc
 		 * it and then scan for unattached PCI devices.
 		 */
 		if (dev->subordinate) {
-		       if (list_empty(&dev->subordinate->node)) {
-			       down_write(&pci_bus_sem);
-			       list_add_tail(&dev->subordinate->node,
+			int make_link = 0;
+			if (list_empty(&dev->subordinate->node)) {
+				make_link = 1;
+				down_write(&pci_bus_sem);
+				list_add_tail(&dev->subordinate->node,
 					       &dev->bus->children);
-			       up_write(&pci_bus_sem);
+				up_write(&pci_bus_sem);
 			}
 			pci_bus_add_devices(dev->subordinate);
-			retval = sysfs_create_link(&dev->subordinate->class_dev.kobj,
+			if (make_link) {
+				retval = sysfs_create_link(&dev->subordinate->class_dev.kobj,
 						   &dev->dev.kobj, "bridge");
-			if (retval)
-				dev_err(&dev->dev, "Error creating sysfs "
-					"bridge symlink, continuing...\n");
+				if (retval)
+					dev_err(&dev->dev, "Error creating sysfs "
+						"bridge symlink, continuing...\n");
+			}
 		}
 	}
 }