Skip to contentSkip to conversation

usb: ulpi: Make container_of() no-op in to_ulpi_dev()

PATCH In review Andy Shevchenko 2 participants 2 messages Jun 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: ulpi: Make container_of() no-op in to_ulpi_dev()

Move embedded struct device member to make container_of() noop

---
 include/linux/ulpi/driver.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/ulpi/driver.h +1 -1
index c7a1810373e3..a8cb617a3028 100644
@@ -15,9 +15,9 @@ struct ulpi_ops;
  * @dev: device interface
  */
 struct ulpi {
+	struct device dev;
 	struct ulpi_device_id id;
 	const struct ulpi_ops *ops;
-	struct device dev;
 };
 
 #define to_ulpi_dev(d) container_of(d, struct ulpi, dev)
Signature · 1 line
2.40.0.1.gaa8946217a0b
#1 lore raw
Quoted 12 lines · Andy Shevchenko

Move embedded struct device member to make container_of() noop

---
 include/linux/ulpi/driver.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/ulpi/driver.h +0 -0
index c7a1810373e3..a8cb617a3028 100644

include/linux/ulpi/driver.h struct ulpi_ops; · line 20

Quoted 7 lines
include/linux/ulpi/driver.h +1 -1
@@ -15,9 +15,9 @@ struct ulpi_ops;
  * @dev: device interface
  */
 struct ulpi {
+	struct device dev;
 	struct ulpi_device_id id;
 	const struct ulpi_ops *ops;
-	struct device dev;

CPUs don't like doing pointer math anymore? :)

I'll go queue this up, thanks for the micro-optimization.

greg k-h