Skip to contentSkip to conversation

PCI: add PCI Express Port Bus Driver subsystem

PATCH long 2 participants 2 messages Jan 19, 2005 PCI

lore
Share & tools
lore

long

author
#0 lore raw
Quoted 7 lines · On Tue Jan 18 11:41:01 2005 Greg KH wrote:
Quoted 7 lines
Quoted 6 lines

This puts all of the pcie "port" structures in /sys/devices/ Shouldn't you make the parent of the device you create point to the pci_dev structure that's passed into this function? That would make the sysfs tree a lot saner I think.

Quoted 8 lines
Quoted 3 lines

The patch makes the parent of the device point to the pci_dev structure that is passed into this function. If you think it is cleaner that the patch should not, I will update the patch to reflect your input.

That would be great, but it doesn't show up that way on my box. All of the portX devices are in /sys/devices/ which is what I don't think you want. I would love for them to have the parent of the pci_dev structure :)

Agree. Thanks for your inputs. The patch below include the changes based on your previous post.

---------------------------------------------------------------------

drivers/pci/pcie/portdrv_bus.c +2 -13
diff -urpN greg-patch/drivers/pci/pcie/portdrv_bus.c greg-patch-update/drivers/pci/pcie/portdrv_bus.c
@@ -14,8 +14,6 @@
 
 #include <linux/pcieport_if.h>
 
-static int generic_probe (struct device *dev) {	return 0;}
-static int generic_remove (struct device *dev) { return 0;}
 static int pcie_port_bus_match(struct device *dev, struct device_driver *drv);
 static int pcie_port_bus_suspend(struct device *dev, u32 state);
 static int pcie_port_bus_resume(struct device *dev);
@@ -27,23 +25,14 @@ struct bus_type pcie_port_bus_type = {
 	.resume		= pcie_port_bus_resume, 
 };
 
-struct device_driver pcieport_generic_driver = {
-	.name =	"pcieport",
-	.bus = &pcie_port_bus_type,
-	.probe = generic_probe,
-	.remove = generic_remove,
-};
-
 static int pcie_port_bus_match(struct device *dev, struct device_driver *drv)
 {
 	struct pcie_device *pciedev;
 	struct pcie_port_service_driver *driver;
 
-	if (	drv->bus != &pcie_port_bus_type || 
-		dev->bus != &pcie_port_bus_type	||
-		drv == &pcieport_generic_driver) {
+	if (drv->bus != &pcie_port_bus_type || dev->bus != &pcie_port_bus_type)
 		return 0;
-	}
+	
 	pciedev = to_pcie_device(dev);
 	driver = to_service_driver(drv);
 	if (   (driver->id_table->vendor != PCI_ANY_ID && 
drivers/pci/pcie/portdrv_core.c +50 -69

230 lines not on this page · raw message

drivers/pci/pcie/portdrv.h +3 -4
diff -urpN greg-patch/drivers/pci/pcie/portdrv.h greg-patch-update/drivers/pci/pcie/portdrv.h
@@ -28,14 +28,13 @@
 #define get_descriptor_id(type, service) (((type - 4) << 4) | service)
 
 extern struct bus_type pcie_port_bus_type;
-extern struct device_driver pcieport_generic_driver;
 extern int pcie_port_device_probe(struct pci_dev *dev);
 extern int pcie_port_device_register(struct pci_dev *dev);
 #ifdef CONFIG_PM
-extern int pcie_port_device_suspend(struct pcie_device *dev, u32 state);
-extern int pcie_port_device_resume(struct pcie_device *dev);
+extern int pcie_port_device_suspend(struct pci_dev *dev, u32 state);
+extern int pcie_port_device_resume(struct pci_dev *dev);
 #endif
-extern void pcie_port_device_remove(struct pcie_device *dev);
+extern void pcie_port_device_remove(struct pci_dev *dev);
 extern void pcie_port_bus_register(void);
 extern void pcie_port_bus_unregister(void);
 
drivers/pci/pcie/portdrv_pci.c +3 -19
diff -urpN greg-patch/drivers/pci/pcie/portdrv_pci.c greg-patch-update/drivers/pci/pcie/portdrv_pci.c
@@ -63,34 +63,18 @@ static int __devinit pcie_portdrv_probe 
 
 static void pcie_portdrv_remove (struct pci_dev *dev)
 {
-	struct pcie_device *pciedev;
-
-      	pciedev = (struct pcie_device *)pci_get_drvdata(dev);
-	if (pciedev) {
-		pcie_port_device_remove(pciedev);
-		pci_set_drvdata(dev, NULL); 
-	}
+	pcie_port_device_remove(dev);
 }
 
 #ifdef CONFIG_PM
 static int pcie_portdrv_suspend (struct pci_dev *dev, u32 state)
 {
-	struct pcie_device *pciedev;
-	
-      	pciedev = (struct pcie_device *)pci_get_drvdata(dev);
-	if (pciedev) 
-		pcie_port_device_suspend(pciedev, state);
-	return 0;
+	return pcie_port_device_suspend(dev, state);
 }
 
 static int pcie_portdrv_resume (struct pci_dev *dev)
 {
-	struct pcie_device *pciedev;
-	
-      	pciedev = (struct pcie_device *)pci_get_drvdata(dev);
-	if (pciedev) 
-		pcie_port_device_resume(pciedev);
-	return 0;
+	return pcie_port_device_resume(dev);
 }
 #endif
 
#1 lore raw
Quoted 12 lines · long
Quoted 11 lines · On Tue Jan 18 11:41:01 2005 Greg KH wrote:
Quoted 10 lines
Quoted 6 lines

This puts all of the pcie "port" structures in /sys/devices/ Shouldn't you make the parent of the device you create point to the pci_dev structure that's passed into this function? That would make the sysfs tree a lot saner I think.

The patch makes the parent of the device point to the pci_dev structure that is passed into this function. If you think it is cleaner that the patch should not, I will update the patch to reflect your input.

Quoted 7 lines
Quoted 4 lines

That would be great, but it doesn't show up that way on my box. All of the portX devices are in /sys/devices/ which is what I don't think you want. I would love for them to have the parent of the pci_dev structure :)

Agree. Thanks for your inputs. The patch below include the changes based on your previous post.

Hm, that seems like a pretty big patch just to add a pointer to a parent device :)

What really does this patch do? What does the sysfs tree now look like?

thanks,

greg k-h