Re: [PATCH 3/4] usb: Bind devices to ACPI devices when possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 12 Mar 2012, Matthew Garrett wrote:

> > > +static struct acpi_bus_type usb_acpi_bus = {
> > > +	.bus = &usb_bus_type,
> > > +	.find_bridge = NULL,
> > > +	.find_device = usb_acpi_find_device,
> > > +};
> > 
> > I don't understand exactly how this is supposed to work.  Does this 
> > mean that the ACPI core will call usb_acpi_find_device() for every ACPI 
> > device whose underlying real device is registered on the usb_bus_type?  
> > If so, when does this call take place?
> 
> Kind of? platform_notify gets called whenever a device is registered, 
> and on ACPi systems that'll be acpi_platform_notify. It'll take the 
> registered device and, if there are glue functions for that bus type, 
> pass it to the callback functions. The idea is that we have two 
> disparate device trees, the Linux one and the ACPI one. This just gives 
> us an opportunity to glue some of the devices together.

Ah, okay.

> > Bear in mind that USB devices aren't the only things registered with 
> > usb_bus_type.  We also register device structures representing USB 
> > interfaces and endpoints.  Hence the to_usb_device() call above might 
> > not always do what you want.
> 
> Ugh. Is there any clean way to distinguish from the device structure? If 
> not, the easiest would seem to be to just add another bus type 
> structure, even if the members are identical.

Easy; just call is_usb_device() (defined in core/usb.h).

Alan Stern

--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux