On Sun, May 13, 2012 at 12:00:06AM +0800, Lan Tianyu wrote: > On 2012/5/12 8:15, Greg KH wrote: > >On Fri, May 11, 2012 at 04:08:31PM +0800, Lan Tianyu wrote: > >>The usb port is a device in the acpi table but it's not in the linux > >>usb subsystem. USB hub port doesn't have struct device. So the acpi > >>glue framework only can cover the usb port connected with usb device > >>and store the acpi handle to struct device.archdata.acpi_handle. This > >>patch adds the member platform_data in the struct usb_hub_port and > >>gets the hub port's acpi_handle and store it in the port's platform_data > >>to resolve no attached device no binding problem. The acpi method "_UPC" > >>and "_PLD" can be accessed without attached device. > >No, that's a hack. Please do this correctly and use the real structures > >here, not an unsigned long. > > > >Why not make the hub a real struct device? That would solve this > >problem, right? > You mean make the hub ports a real struct device. Yeah. But that may be > a little complex. The device tree and sys fs hierarchy will be changed. heiarchy's can always be changed, nothing should rely on a specific location in a tree as things can move around, right? But be careful about udev, it might have some "what is the parent" rules about usb devices that think that usb devices are always in a tree. Actually, a USB hub is a device, why not just put the port information on them, as sub devices. You don't have to hang the children USB devices off of those port devices, unless you test to find that everything works properly. That would not change any hiearchy in sysfs at all, right? > > struct usb_hub_port { > > void *port_owner; > > struct usb_device *child; > >+ unsigned long platform_data; > How about this? > > struct usb_hub_port { > void *port_owner; > struct usb_device *child; > + #ifdef CONFIG_ACPI > + acpi_handle port_acpi_handle; > + #endif Ok, that's better, don't you agree? It shows exactly what you are trying to do here, and should ensure type safety. greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html