Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] usb: core: Add ACPI support for USB interface devices
@ 2020-03-24 10:09 Andy Shevchenko
  2020-03-24 11:45 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2020-03-24 10:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-usb, Rafael J. Wysocki, linux-acpi
  Cc: Andy Shevchenko

Currently on ACPI-enabled systems the USB interface device has no link to
the actual firmware node and thus drivers may not parse additional information
given in the table. The new feature, proposed here, allows to pass properties
or other information to the drivers.

The ACPI companion of the device has to be set for USB interface devices
to achieve above. Use ACPI_COMPANION_SET macro to set this.

Note, OF already does link of_node and this is the same for ACPI case.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: rewrite commit message to emphasize that it is a new feature (Greg)
 drivers/usb/core/message.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 5adf489428aa..d5f834f16993 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -5,6 +5,7 @@
  * Released under the GPLv2 only.
  */
 
+#include <linux/acpi.h>
 #include <linux/pci.h>	/* for scatterlist macros */
 #include <linux/usb.h>
 #include <linux/module.h>
@@ -1941,6 +1942,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
 			intf->dev.of_node = usb_of_get_interface_node(dev,
 					configuration, ifnum);
 		}
+		ACPI_COMPANION_SET(&intf->dev, ACPI_COMPANION(&dev->dev));
 		intf->dev.driver = NULL;
 		intf->dev.bus = &usb_bus_type;
 		intf->dev.type = &usb_if_device_type;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] usb: core: Add ACPI support for USB interface devices
  2020-03-24 10:09 [PATCH v2] usb: core: Add ACPI support for USB interface devices Andy Shevchenko
@ 2020-03-24 11:45 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2020-03-24 11:45 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:,
	Rafael J. Wysocki, ACPI Devel Maling List

On Tue, Mar 24, 2020 at 11:09 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Currently on ACPI-enabled systems the USB interface device has no link to
> the actual firmware node and thus drivers may not parse additional information
> given in the table. The new feature, proposed here, allows to pass properties
> or other information to the drivers.
>
> The ACPI companion of the device has to be set for USB interface devices
> to achieve above. Use ACPI_COMPANION_SET macro to set this.
>
> Note, OF already does link of_node and this is the same for ACPI case.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
> v2: rewrite commit message to emphasize that it is a new feature (Greg)
>  drivers/usb/core/message.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
> index 5adf489428aa..d5f834f16993 100644
> --- a/drivers/usb/core/message.c
> +++ b/drivers/usb/core/message.c
> @@ -5,6 +5,7 @@
>   * Released under the GPLv2 only.
>   */
>
> +#include <linux/acpi.h>
>  #include <linux/pci.h> /* for scatterlist macros */
>  #include <linux/usb.h>
>  #include <linux/module.h>
> @@ -1941,6 +1942,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
>                         intf->dev.of_node = usb_of_get_interface_node(dev,
>                                         configuration, ifnum);
>                 }
> +               ACPI_COMPANION_SET(&intf->dev, ACPI_COMPANION(&dev->dev));
>                 intf->dev.driver = NULL;
>                 intf->dev.bus = &usb_bus_type;
>                 intf->dev.type = &usb_if_device_type;
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 10:09 [PATCH v2] usb: core: Add ACPI support for USB interface devices Andy Shevchenko
2020-03-24 11:45 ` Rafael J. Wysocki

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git