mirror of
https://github.com/torvalds/linux.git
synced 2024-12-24 20:01:55 +00:00
125450f814
When the PCI hotplug core and its first user, cpqphp, were introduced in February 2002 with historic commit a8a2069f432c, cpqphp allocated a slot struct for its internal use plus a hotplug_slot struct to be registered with the hotplug core and linked the two with pointers: https://git.kernel.org/tglx/history/c/a8a2069f432c Nowadays, the predominant pattern in the tree is to embed ("subclass") such structures in one another and cast to the containing struct with container_of(). But it wasn't until July 2002 that container_of() was introduced with historic commit ec4f214232cf: https://git.kernel.org/tglx/history/c/ec4f214232cf pnv_php, introduced in 2016, did the right thing and embedded struct hotplug_slot in its internal struct pnv_php_slot, but all other drivers cargo-culted cpqphp's design and linked separate structs with pointers. Embedding structs is preferrable to linking them with pointers because it requires fewer allocations, thereby reducing overhead and simplifying error paths. Casting an embedded struct to the containing struct becomes a cheap subtraction rather than a dereference. And having fewer pointers reduces the risk of them pointing nowhere either accidentally or due to an attack. Convert all drivers to embed struct hotplug_slot in their internal slot struct. The "private" pointer in struct hotplug_slot thereby becomes unused, so drop it. Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> # drivers/pci/hotplug/rpa* Acked-by: Sebastian Ott <sebott@linux.ibm.com> # drivers/pci/hotplug/s390* Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com> # drivers/platform/x86 Cc: Len Brown <lenb@kernel.org> Cc: Scott Murray <scott@spiteful.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Oliver OHalloran <oliveroh@au1.ibm.com> Cc: Gavin Shan <gwshan@linux.vnet.ibm.com> Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com> Cc: Corentin Chary <corentin.chary@gmail.com> Cc: Darren Hart <dvhart@infradead.org> |
||
---|---|---|
.. | ||
acer-wireless.c | ||
acer-wmi.c | ||
acerhdf.c | ||
alienware-wmi.c | ||
amilo-rfkill.c | ||
apple-gmux.c | ||
asus-laptop.c | ||
asus-nb-wmi.c | ||
asus-wireless.c | ||
asus-wmi.c | ||
asus-wmi.h | ||
classmate-laptop.c | ||
compal-laptop.c | ||
dell-laptop.c | ||
dell-rbtn.c | ||
dell-rbtn.h | ||
dell-smbios-base.c | ||
dell-smbios-smm.c | ||
dell-smbios-wmi.c | ||
dell-smbios.h | ||
dell-smo8800.c | ||
dell-wmi-aio.c | ||
dell-wmi-descriptor.c | ||
dell-wmi-descriptor.h | ||
dell-wmi-led.c | ||
dell-wmi.c | ||
eeepc-laptop.c | ||
eeepc-wmi.c | ||
fujitsu-laptop.c | ||
fujitsu-tablet.c | ||
gpd-pocket-fan.c | ||
hdaps.c | ||
hp_accel.c | ||
hp-wireless.c | ||
hp-wmi.c | ||
i2c-multi-instantiate.c | ||
ibm_rtl.c | ||
ideapad-laptop.c | ||
intel_bxtwc_tmu.c | ||
intel_cht_int33fe.c | ||
intel_chtdc_ti_pwrbtn.c | ||
intel_int0002_vgpio.c | ||
intel_ips.c | ||
intel_ips.h | ||
intel_menlow.c | ||
intel_mid_powerbtn.c | ||
intel_mid_thermal.c | ||
intel_oaktrail.c | ||
intel_pmc_core.c | ||
intel_pmc_core.h | ||
intel_pmc_ipc.c | ||
intel_punit_ipc.c | ||
intel_scu_ipc.c | ||
intel_scu_ipcutil.c | ||
intel_telemetry_core.c | ||
intel_telemetry_debugfs.c | ||
intel_telemetry_pltdrv.c | ||
intel_turbo_max_3.c | ||
intel-hid.c | ||
intel-rst.c | ||
intel-smartconnect.c | ||
intel-vbtn.c | ||
intel-wmi-thunderbolt.c | ||
Kconfig | ||
Makefile | ||
mlx-platform.c | ||
msi-laptop.c | ||
msi-wmi.c | ||
mxm-wmi.c | ||
panasonic-laptop.c | ||
peaq-wmi.c | ||
pmc_atom.c | ||
pvpanic.c | ||
samsung-laptop.c | ||
samsung-q10.c | ||
sony-laptop.c | ||
surface3_button.c | ||
surface3-wmi.c | ||
surfacepro3_button.c | ||
tc1100-wmi.c | ||
thinkpad_acpi.c | ||
topstar-laptop.c | ||
toshiba_acpi.c | ||
toshiba_bluetooth.c | ||
toshiba_haps.c | ||
toshiba-wmi.c | ||
touchscreen_dmi.c | ||
wmi-bmof.c | ||
wmi.c | ||
xo1-rfkill.c | ||
xo15-ebook.c |