Skip to contentSkip to conversation

usb: core: Add ACPI support for USB interfaces

PATCH Superseded Andy Shevchenko 2 participants 4 messages Mar 23, 2020 – Mar 24, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: core: Add ACPI support for USB interfaces

The ACPI companion of the device has to be set for USB interfaces in order to read and attach the properties described in the ACPI table. Use ACPI_COMPANION_SET macro to set this.

---
 drivers/usb/core/message.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/core/message.c +2 -0
index 5adf489428aa..d5f834f16993 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 22 lines · Andy Shevchenko

The ACPI companion of the device has to be set for USB interfaces in order to read and attach the properties described in the ACPI table. Use ACPI_COMPANION_SET macro to set this.

---
 drivers/usb/core/message.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/core/message.c +1 -0
index 5adf489428aa..d5f834f16993 100644
@@ -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>

drivers/usb/core/message.c int usb_set_configuration(struct usb_device *dev, int configuration) · line 1948

Quoted 7 lines
drivers/usb/core/message.c +1 -0
@@ -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;

And what does this "fix"?

Is this a new feature, what isn't working today without this change?

And if it is a fix, should it be backported to older kernels, how far?

greg k-h

#2 lore raw
Quoted 18 lines · Greg Kroah-Hartman
Quoted 17 lines · Andy Shevchenko

The ACPI companion of the device has to be set for USB interfaces in order to read and attach the properties described in the ACPI table. Use ACPI_COMPANION_SET macro to set this.

---
 drivers/usb/core/message.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/core/message.c +0 -0
index 5adf489428aa..d5f834f16993 100644
@@ -5,6 +5,7 @@
  * Released under the GPLv2 only.
  */
 
Quoted 15 lines

drivers/usb/core/message.c int usb_set_configuration(struct usb_device *dev, int configuration) · line 1948

Quoted 12 lines
drivers/usb/core/message.c +2 -0
+#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;

And what does this "fix"?

It links the firmware node of physical USB device to USB interface. Otherwise it will be no firmware nodes under a corresponding folder.

It mimics what is done for OF in couple of lines above.

Quoted 1 line

Is this a new feature, what isn't working today without this change?

Yes, it is a new feature. I can't tell it fixes anything, because no complains so far. I doubt it previously works.

Quoted 1 line

And if it is a fix, should it be backported to older kernels, how far?

No, no need for that. Usually I put Fixes tag when I would like change to be considered for backporting.

I'll probably update the commit message to clarify all this. Would it be enough?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 45 lines · Andy Shevchenko
Quoted 18 lines · Greg Kroah-Hartman
Quoted 17 lines · Andy Shevchenko

The ACPI companion of the device has to be set for USB interfaces in order to read and attach the properties described in the ACPI table. Use ACPI_COMPANION_SET macro to set this.

---
 drivers/usb/core/message.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/core/message.c +0 -0
index 5adf489428aa..d5f834f16993 100644
@@ -5,6 +5,7 @@
  * Released under the GPLv2 only.
  */
 
Quoted 15 lines

drivers/usb/core/message.c int usb_set_configuration(struct usb_device *dev, int configuration) · line 1948

Quoted 12 lines
drivers/usb/core/message.c +2 -0
+#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;

And what does this "fix"?

It links the firmware node of physical USB device to USB interface. Otherwise it will be no firmware nodes under a corresponding folder.

It mimics what is done for OF in couple of lines above.

Quoted 1 line

Is this a new feature, what isn't working today without this change?

Yes, it is a new feature. I can't tell it fixes anything, because no complains so far. I doubt it previously works.

Quoted 6 lines
Quoted 1 line

And if it is a fix, should it be backported to older kernels, how far?

No, no need for that. Usually I put Fixes tag when I would like change to be considered for backporting.

I'll probably update the commit message to clarify all this. Would it be enough?

Please do so, what you have now is insufficient :)

thanks,

greg k-h