Re: [PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Mon, Jan 24, 2005 at 12:10:25PM -0800, long wrote: > On Tuesday, January 18, 2005 5:03 PM Greg KH wrote: > >> > > >> >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? > > Before changes: > > The patch makes the parent of the device pointing to the pci_dev > structure. The parents portX devices are in /sys/devices which > should be removed based on your suggestions. Below is /sys/devices > before any changes made. > > /sys/devices > | > __ ide0 > | > __ pci:00 > | > __ pnp0 > | > __ port1 > | | > | __ port1.00 > | | > | __ port1.01 > | . > | . > | . > | > __ port2 > | > __ port3 > | > __ system > > After changes: > > The parents portX devices are no longer necessary because port1.00 > and port1.01 devices shoud have the parent of the pci_dev structure > (based on your suggestion). The patch does the following changes: > > - remove code creating and handling the parent portX devices. > - rename portX.YZ to pcieYZ (for example port1.00 renamed to pcie00) > since portX is no longer needed. > - make pcieYZ have the parent of the pci_dev structure. > > Below is /sys/devices after changes made to the patch. > > /sys/devices > | > __ ide0 > | > __ pci:00 > | | > | __ :00:00.0 > | | > | __ :00:04.0 > | | | > | . __ class > | . | > | . __ pcie00 > | | > | __ pcie01 > | . > | . > | . > | > __ platform > | > __ pnp0 > | > __ system > > > Please let me know what you think of the changes. Ok, that makes more sense now. I've applied your patch, thanks. greg k-h - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Mon, Jan 24, 2005 at 12:10:25PM -0800, long wrote: On Tuesday, January 18, 2005 5:03 PM Greg KH wrote: 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? Before changes: The patch makes the parent of the device pointing to the pci_dev structure. The parents portX devices are in /sys/devices which should be removed based on your suggestions. Below is /sys/devices before any changes made. /sys/devices | __ ide0 | __ pci:00 | __ pnp0 | __ port1 | | | __ port1.00 | | | __ port1.01 | . | . | . | __ port2 | __ port3 | __ system After changes: The parents portX devices are no longer necessary because port1.00 and port1.01 devices shoud have the parent of the pci_dev structure (based on your suggestion). The patch does the following changes: - remove code creating and handling the parent portX devices. - rename portX.YZ to pcieYZ (for example port1.00 renamed to pcie00) since portX is no longer needed. - make pcieYZ have the parent of the pci_dev structure. Below is /sys/devices after changes made to the patch. /sys/devices | __ ide0 | __ pci:00 | | | __ :00:00.0 | | | __ :00:04.0 | | | | . __ class | . | | . __ pcie00 | | | __ pcie01 | . | . | . | __ platform | __ pnp0 | __ system Please let me know what you think of the changes. Ok, that makes more sense now. I've applied your patch, thanks. greg k-h - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re:[PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Tuesday, January 18, 2005 5:03 PM Greg KH wrote: >> > >> >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? Before changes: The patch makes the parent of the device pointing to the pci_dev structure. The parents portX devices are in /sys/devices which should be removed based on your suggestions. Below is /sys/devices before any changes made. /sys/devices | __ ide0 | __ pci:00 | __ pnp0 | __ port1 | | | __ port1.00 | | | __ port1.01 | . | . | . | __ port2 | __ port3 | __ system After changes: The parents portX devices are no longer necessary because port1.00 and port1.01 devices shoud have the parent of the pci_dev structure (based on your suggestion). The patch does the following changes: - remove code creating and handling the parent portX devices. - rename portX.YZ to pcieYZ (for example port1.00 renamed to pcie00) since portX is no longer needed. - make pcieYZ have the parent of the pci_dev structure. Below is /sys/devices after changes made to the patch. /sys/devices | __ ide0 | __ pci:00 | | | __ :00:00.0 | | | __ :00:04.0 | | | | . __ class | . | | . __ pcie00 | | | __ pcie01 | . | . | . | __ platform | __ pnp0 | __ system Please let me know what you think of the changes. Thanks, Long - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re:[PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Tuesday, January 18, 2005 5:03 PM Greg KH wrote: 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? Before changes: The patch makes the parent of the device pointing to the pci_dev structure. The parents portX devices are in /sys/devices which should be removed based on your suggestions. Below is /sys/devices before any changes made. /sys/devices | __ ide0 | __ pci:00 | __ pnp0 | __ port1 | | | __ port1.00 | | | __ port1.01 | . | . | . | __ port2 | __ port3 | __ system After changes: The parents portX devices are no longer necessary because port1.00 and port1.01 devices shoud have the parent of the pci_dev structure (based on your suggestion). The patch does the following changes: - remove code creating and handling the parent portX devices. - rename portX.YZ to pcieYZ (for example port1.00 renamed to pcie00) since portX is no longer needed. - make pcieYZ have the parent of the pci_dev structure. Below is /sys/devices after changes made to the patch. /sys/devices | __ ide0 | __ pci:00 | | | __ :00:00.0 | | | __ :00:04.0 | | | | . __ class | . | | . __ pcie00 | | | __ pcie01 | . | . | . | __ platform | __ pnp0 | __ system Please let me know what you think of the changes. Thanks, Long - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Tue, Jan 18, 2005 at 05:59:44PM -0800, long wrote: > On Tue Jan 18 11:41:01 2005 Greg KH wrote: > >> > > >> > > >> > 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. > > > >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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re:[PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Tue Jan 18 11:41:01 2005 Greg KH wrote: >> > >> > >> > 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. > >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. Signed-off-by: T. Long Nguyen <[EMAIL PROTECTED]> - diff -urpN greg-patch/drivers/pci/pcie/portdrv_bus.c greg-patch-update/drivers/pci/pcie/portdrv_bus.c --- greg-patch/drivers/pci/pcie/portdrv_bus.c 2005-01-18 15:59:38.0 -0500 +++ greg-patch-update/drivers/pci/pcie/portdrv_bus.c2005-01-18 16:03:47.0 -0500 @@ -14,8 +14,6 @@ #include -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 = _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 != _port_bus_type || - dev->bus != _port_bus_type || - drv == _generic_driver) { + if (drv->bus != _port_bus_type || dev->bus != _port_bus_type) return 0; - } + pciedev = to_pcie_device(dev); driver = to_service_driver(drv); if ( (driver->id_table->vendor != PCI_ANY_ID && diff -urpN greg-patch/drivers/pci/pcie/portdrv_core.c greg-patch-update/drivers/pci/pcie/portdrv_core.c --- greg-patch/drivers/pci/pcie/portdrv_core.c 2005-01-18 15:59:38.0 -0500 +++ greg-patch-update/drivers/pci/pcie/portdrv_core.c 2005-01-18 16:06:51.0 -0500 @@ -17,8 +17,6 @@ extern int pcie_mch_quirk; /* MSI-quirk Indicator */ -extern struct device_driver pcieport_generic_driver; - static int pcie_port_probe_service(struct device *dev) { struct pcie_device *pciedev; @@ -103,6 +101,7 @@ static int pcie_port_resume_service(stru */ static void release_pcie_device(struct device *dev) { + printk(KERN_DEBUG "Free Port Service[%s]\n", dev->bus_id); kfree(to_pcie_device(dev)); } @@ -217,18 +216,18 @@ static int get_port_device_capability(st return services; } -static void pcie_device_init(struct pcie_device *parent, - struct pcie_device *dev, - int port_type, int service_type) +static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev, + int port_type, int service_type, int irq, int irq_mode) { struct device *device; - if (parent) { - dev->id.vendor = parent->port->vendor; - dev->id.device = parent->port->device; - dev->id.port_type = port_type; - dev->id.service_type = (1 << service_type); - } + dev->port = parent; + dev->interrupt_mode = irq_mode; + dev->irq = irq; + dev->id.vendor = parent->vendor; + dev->id.device = parent->device; + dev->id.port_type = port_type; + dev->id.service_type = (1 << service_type); /* Initialize generic device interface */ device = >device; @@ -240,35 +239,23 @@ static void pcie_device_init(struct pcie device->driver = NULL; device->driver_data = NULL; device->release = release_pcie_device; /* callback to free pcie dev */ - sprintf(>bus_id[0], "%s.%02x", parent->device.bus_id, - get_descriptor_id(port_type, service_type)); - device->parent = ((parent == NULL) ? NULL : >device); + sprintf(>bus_id[0], "pcie%02x", + get_descriptor_id(port_type, service_type)); + device->parent = >dev; } -static struct pcie_device* alloc_pcie_device( - struct pcie_device *parent, struct pci_dev *bridge, +static struct pcie_device* alloc_pcie_device(struct pci_dev *parent,
Re: [PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Tue, Jan 18, 2005 at 11:28:57AM -0800, long wrote: > On Mon, 17 Jan 2005 15:49:08 -0800 Greg KH wrote: > > > +int pcie_port_device_register(struct pci_dev *dev) > > > +{ > > > + struct pcie_device *parent; > > > + int status, type, capabilities, irq_mode, i; > > > + int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; > > > + u16 reg16; > > > + > > > + /* Get port type */ > > > + pci_read_config_word(dev, > > > + pci_find_capability(dev, PCI_CAP_ID_EXP) + > > > + PCIE_CAPABILITIES_REG, ); > > > + type = (reg16 >> 4) & PORT_TYPE_MASK; > > > + > > > + /* Now get port services */ > > > + capabilities = get_port_device_capability(dev); > > > + irq_mode = assign_interrupt_mode(dev, vectors, capabilities); > > > + > > > + /* Allocate parent */ > > > + parent = alloc_pcie_device(NULL, dev, type, 0, dev->irq, irq_mode); > > > + if (!parent) > > > + return -ENOMEM; > > > + > > > + status = device_register(>device); > > > + if (status) { > > > + kfree(parent); > > > + return status; > > > + } > > > > > > 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. 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 :) thanks, greg k-h - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re:[PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Mon, 17 Jan 2005 15:49:08 -0800 Greg KH wrote: > > +int pcie_port_device_register(struct pci_dev *dev) > > +{ > > + struct pcie_device *parent; > > + int status, type, capabilities, irq_mode, i; > > + int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; > > + u16 reg16; > > + > > + /* Get port type */ > > + pci_read_config_word(dev, > > + pci_find_capability(dev, PCI_CAP_ID_EXP) + > > + PCIE_CAPABILITIES_REG, ); > > + type = (reg16 >> 4) & PORT_TYPE_MASK; > > + > > + /* Now get port services */ > > + capabilities = get_port_device_capability(dev); > > + irq_mode = assign_interrupt_mode(dev, vectors, capabilities); > > + > > + /* Allocate parent */ > > + parent = alloc_pcie_device(NULL, dev, type, 0, dev->irq, irq_mode); > > + if (!parent) > > + return -ENOMEM; > > + > > + status = device_register(>device); > > + if (status) { > > + kfree(parent); > > + return status; > > + } > > > 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. Thanks, Long - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re:[PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Mon, 17 Jan 2005 15:49:08 -0800 Greg KH wrote: +int pcie_port_device_register(struct pci_dev *dev) +{ + struct pcie_device *parent; + int status, type, capabilities, irq_mode, i; + int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; + u16 reg16; + + /* Get port type */ + pci_read_config_word(dev, + pci_find_capability(dev, PCI_CAP_ID_EXP) + + PCIE_CAPABILITIES_REG, reg16); + type = (reg16 4) PORT_TYPE_MASK; + + /* Now get port services */ + capabilities = get_port_device_capability(dev); + irq_mode = assign_interrupt_mode(dev, vectors, capabilities); + + /* Allocate parent */ + parent = alloc_pcie_device(NULL, dev, type, 0, dev-irq, irq_mode); + if (!parent) + return -ENOMEM; + + status = device_register(parent-device); + if (status) { + kfree(parent); + return status; + } 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. Thanks, Long - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Tue, Jan 18, 2005 at 11:28:57AM -0800, long wrote: On Mon, 17 Jan 2005 15:49:08 -0800 Greg KH wrote: +int pcie_port_device_register(struct pci_dev *dev) +{ + struct pcie_device *parent; + int status, type, capabilities, irq_mode, i; + int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; + u16 reg16; + + /* Get port type */ + pci_read_config_word(dev, + pci_find_capability(dev, PCI_CAP_ID_EXP) + + PCIE_CAPABILITIES_REG, reg16); + type = (reg16 4) PORT_TYPE_MASK; + + /* Now get port services */ + capabilities = get_port_device_capability(dev); + irq_mode = assign_interrupt_mode(dev, vectors, capabilities); + + /* Allocate parent */ + parent = alloc_pcie_device(NULL, dev, type, 0, dev-irq, irq_mode); + if (!parent) + return -ENOMEM; + + status = device_register(parent-device); + if (status) { + kfree(parent); + return status; + } 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. 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 :) thanks, greg k-h - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re:[PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Tue Jan 18 11:41:01 2005 Greg KH wrote: 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. 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. Signed-off-by: T. Long Nguyen [EMAIL PROTECTED] - diff -urpN greg-patch/drivers/pci/pcie/portdrv_bus.c greg-patch-update/drivers/pci/pcie/portdrv_bus.c --- greg-patch/drivers/pci/pcie/portdrv_bus.c 2005-01-18 15:59:38.0 -0500 +++ greg-patch-update/drivers/pci/pcie/portdrv_bus.c2005-01-18 16:03:47.0 -0500 @@ -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 diff -urpN greg-patch/drivers/pci/pcie/portdrv_core.c greg-patch-update/drivers/pci/pcie/portdrv_core.c --- greg-patch/drivers/pci/pcie/portdrv_core.c 2005-01-18 15:59:38.0 -0500 +++ greg-patch-update/drivers/pci/pcie/portdrv_core.c 2005-01-18 16:06:51.0 -0500 @@ -17,8 +17,6 @@ extern int pcie_mch_quirk; /* MSI-quirk Indicator */ -extern struct device_driver pcieport_generic_driver; - static int pcie_port_probe_service(struct device *dev) { struct pcie_device *pciedev; @@ -103,6 +101,7 @@ static int pcie_port_resume_service(stru */ static void release_pcie_device(struct device *dev) { + printk(KERN_DEBUG Free Port Service[%s]\n, dev-bus_id); kfree(to_pcie_device(dev)); } @@ -217,18 +216,18 @@ static int get_port_device_capability(st return services; } -static void pcie_device_init(struct pcie_device *parent, - struct pcie_device *dev, - int port_type, int service_type) +static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev, + int port_type, int service_type, int irq, int irq_mode) { struct device *device; - if (parent) { - dev-id.vendor = parent-port-vendor; - dev-id.device = parent-port-device; - dev-id.port_type = port_type; - dev-id.service_type = (1 service_type); - } + dev-port = parent; + dev-interrupt_mode = irq_mode; + dev-irq = irq; + dev-id.vendor = parent-vendor; + dev-id.device = parent-device; + dev-id.port_type = port_type; + dev-id.service_type = (1 service_type); /* Initialize generic device interface */ device = dev-device; @@ -240,35 +239,23 @@ static void pcie_device_init(struct pcie device-driver = NULL; device-driver_data = NULL; device-release = release_pcie_device; /* callback to free pcie dev */ - sprintf(device-bus_id[0], %s.%02x, parent-device.bus_id, - get_descriptor_id(port_type, service_type)); - device-parent = ((parent == NULL) ? NULL : parent-device); + sprintf(device-bus_id[0], pcie%02x, + get_descriptor_id(port_type, service_type)); + device-parent = parent-dev; } -static struct pcie_device* alloc_pcie_device( - struct pcie_device *parent, struct pci_dev *bridge, +static struct pcie_device* alloc_pcie_device(struct pci_dev *parent, int
Re: [PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Tue, Jan 18, 2005 at 05:59:44PM -0800, long wrote: On Tue Jan 18 11:41:01 2005 Greg KH wrote: 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. 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 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Mon, Jan 17, 2005 at 02:01:52PM -0800, Greg KH wrote: > +int pcie_port_device_register(struct pci_dev *dev) > +{ > + struct pcie_device *parent; > + int status, type, capabilities, irq_mode, i; > + int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; > + u16 reg16; > + > + /* Get port type */ > + pci_read_config_word(dev, > + pci_find_capability(dev, PCI_CAP_ID_EXP) + > + PCIE_CAPABILITIES_REG, ); > + type = (reg16 >> 4) & PORT_TYPE_MASK; > + > + /* Now get port services */ > + capabilities = get_port_device_capability(dev); > + irq_mode = assign_interrupt_mode(dev, vectors, capabilities); > + > + /* Allocate parent */ > + parent = alloc_pcie_device(NULL, dev, type, 0, dev->irq, irq_mode); > + if (!parent) > + return -ENOMEM; > + > + status = device_register(>device); > + if (status) { > + kfree(parent); > + return status; > + } 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. thanks, greg k-h - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] PCI: add PCI Express Port Bus Driver subsystem
On Mon, Jan 17, 2005 at 02:01:52PM -0800, Greg KH wrote: +int pcie_port_device_register(struct pci_dev *dev) +{ + struct pcie_device *parent; + int status, type, capabilities, irq_mode, i; + int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; + u16 reg16; + + /* Get port type */ + pci_read_config_word(dev, + pci_find_capability(dev, PCI_CAP_ID_EXP) + + PCIE_CAPABILITIES_REG, reg16); + type = (reg16 4) PORT_TYPE_MASK; + + /* Now get port services */ + capabilities = get_port_device_capability(dev); + irq_mode = assign_interrupt_mode(dev, vectors, capabilities); + + /* Allocate parent */ + parent = alloc_pcie_device(NULL, dev, type, 0, dev-irq, irq_mode); + if (!parent) + return -ENOMEM; + + status = device_register(parent-device); + if (status) { + kfree(parent); + return status; + } 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. thanks, greg k-h - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/