Skip to content

Commit 32666d9

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: bus: Make container_of() no-op where it makes sense
Move list head node to be the first member in a few data structures in order to make container_of() no-op at compile time. On x86_64 with a custom (default + a few dozens of drivers enabled) configuration: add/remove: 0/0 grow/shrink: 5/12 up/down: 21/-124 (-103) ... Total: Before=39924675, After=39924572, chg -0.00% Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 39cd87c commit 32666d9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

include/acpi/acpi_bus.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile(
124124
}
125125

126126
struct acpi_scan_handler {
127-
const struct acpi_device_id *ids;
128127
struct list_head list_node;
128+
const struct acpi_device_id *ids;
129129
bool (*match)(const char *idstr, const struct acpi_device_id **matchid);
130130
int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
131131
void (*detach)(struct acpi_device *dev);
@@ -269,14 +269,14 @@ struct acpi_device_power_flags {
269269
};
270270

271271
struct acpi_device_power_state {
272+
struct list_head resources; /* Power resources referenced */
272273
struct {
273274
u8 valid:1;
274275
u8 explicit_set:1; /* _PSx present? */
275276
u8 reserved:6;
276277
} flags;
277278
int power; /* % Power (compared to D0) */
278279
int latency; /* Dx->D0 time (microseconds) */
279-
struct list_head resources; /* Power resources referenced */
280280
};
281281

282282
struct acpi_device_power {
@@ -342,16 +342,16 @@ struct acpi_device_wakeup {
342342
};
343343

344344
struct acpi_device_physical_node {
345-
unsigned int node_id;
346345
struct list_head node;
347346
struct device *dev;
347+
unsigned int node_id;
348348
bool put_online:1;
349349
};
350350

351351
struct acpi_device_properties {
352+
struct list_head list;
352353
const guid_t *guid;
353354
union acpi_object *properties;
354-
struct list_head list;
355355
void **bufs;
356356
};
357357

@@ -488,12 +488,12 @@ struct acpi_device {
488488

489489
/* Non-device subnode */
490490
struct acpi_data_node {
491+
struct list_head sibling;
491492
const char *name;
492493
acpi_handle handle;
493494
struct fwnode_handle fwnode;
494495
struct fwnode_handle *parent;
495496
struct acpi_device_data data;
496-
struct list_head sibling;
497497
struct kobject kobj;
498498
struct completion kobj_done;
499499
};

0 commit comments

Comments
 (0)