linux/drivers/platform/x86
Lukas Wunner a7da21613c PCI: hotplug: Drop hotplug_slot_info
Ever since the PCI hotplug core was introduced in 2002, drivers had to
allocate and register a struct hotplug_slot_info for every slot:
https://git.kernel.org/tglx/history/c/a8a2069f432c

Apparently the idea was that drivers furnish the hotplug core with an
up-to-date card presence status, power status, latch status and
attention indicator status as well as notify the hotplug core of changes
thereof.  However only 4 out of 12 hotplug drivers bother to notify the
hotplug core with pci_hp_change_slot_info() and the hotplug core never
made any use of the information:  There is just a single macro in
pci_hotplug_core.c, GET_STATUS(), which uses the hotplug_slot_info if
the driver lacks the corresponding callback in hotplug_slot_ops.  The
macro is called when the user reads the attribute via sysfs.

Now, if the callback isn't defined, the attribute isn't exposed in sysfs
in the first place (see e.g. has_power_file()).  There are only two
situations when the hotplug_slot_info would actually be accessed:

* If the driver defines ->enable_slot or ->disable_slot but not
  ->get_power_status.

* If the driver defines ->set_attention_status but not
  ->get_attention_status.

There is no driver doing the former and just a single driver doing the
latter, namely pnv_php.c.  Amend it with a ->get_attention_status
callback.  With that, the hotplug_slot_info becomes completely unused by
the PCI hotplug core.  But a few drivers use it internally as a cache:

cpcihp uses it to cache the latch_status and adapter_status.
cpqhp uses it to cache the adapter_status.
pnv_php and rpaphp use it to cache the attention_status.
shpchp uses it to cache all four values.

Amend these drivers to cache the information in their private slot
struct.  shpchp's slot struct already contains members to cache the
power_status and adapter_status, so additional members are only needed
for the other two values.  In the case of cpqphp, the cached value is
only accessed in a single place, so instead of caching it, read the
current value from the hardware.

Caution:  acpiphp, cpci, cpqhp, shpchp, asus-wmi and eeepc-laptop
populate the hotplug_slot_info with initial values on probe.  That code
is herewith removed.  There is a theoretical chance that the code has
side effects without which the driver fails to function, e.g. if the
ACPI method to read the adapter status needs to be executed at least
once on probe.  That seems unlikely to me, still maintainers should
review the changes carefully for this possibility.

Rafael adds: "I'm not aware of any case in which it will break anything,
[...] but if that happens, it may be necessary to add the execution of
the control methods in question directly to the initialization part."

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>
2018-09-18 17:52:15 -05:00
..
acer-wireless.c
acer-wmi.c platform/x86: acer-wmi: Silence "unsupported" message a bit 2018-08-22 13:40:24 +03:00
acerhdf.c
alienware-wmi.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
amilo-rfkill.c
apple-gmux.c platform/x86: apple-gmux: fix gmux_get_client_id()'s return type 2018-04-24 19:55:33 +03:00
asus-laptop.c platform/x86: Simplify getting .drvdata 2018-04-23 08:52:59 -07:00
asus-nb-wmi.c platform/x86: asus-nb-wmi: Add keymap entry for lid flip action on UX360 2018-08-15 13:17:48 +03:00
asus-wireless.c platform/x86: asus-wireless: Fix uninitialized symbol usage 2018-07-02 16:48:22 +03:00
asus-wmi.c PCI: hotplug: Drop hotplug_slot_info 2018-09-18 17:52:15 -05:00
asus-wmi.h
classmate-laptop.c
compal-laptop.c
dell-laptop.c platform/x86: dell-laptop: Fix backlight detection 2018-07-31 17:40:36 +03:00
dell-rbtn.c
dell-rbtn.h
dell-smbios-base.c platform/x86: dell-smbios-base: Support systems without tokens 2018-06-26 15:01:52 -07:00
dell-smbios-smm.c platform/x86: dell-smbios: make a function and a pointer static 2018-06-26 15:12:20 -07:00
dell-smbios-wmi.c platform/x86: dell-smbios-wmi: make function dell_smbios_wmi_call static 2018-07-02 16:48:22 +03:00
dell-smbios.h platform/x86: dell-smbios: Link all dell-smbios-* modules together 2018-03-09 09:35:42 -08:00
dell-smo8800.c
dell-wmi-aio.c
dell-wmi-descriptor.c
dell-wmi-descriptor.h
dell-wmi-led.c
dell-wmi.c platform/x86: dell-wmi: Ignore new rfkill and fn-lock events 2018-06-04 12:20:22 +03:00
eeepc-laptop.c PCI: hotplug: Drop hotplug_slot_info 2018-09-18 17:52:15 -05:00
eeepc-wmi.c
fujitsu-laptop.c platform/x86: fujitsu-laptop: Simplify soft key handling 2018-04-19 16:25:54 -07:00
fujitsu-tablet.c
gpd-pocket-fan.c
hdaps.c
hp-wireless.c
hp-wmi.c
hp_accel.c
i2c-multi-instantiate.c platform/x86: Add ACPI i2c-multi-instantiate pseudo driver 2018-08-09 13:58:21 +02:00
ibm_rtl.c
ideapad-laptop.c platform/x86: ideapad: Add Y520-15IKBM and Y720-15IKBM to no_hw_rfkill 2018-08-15 13:17:48 +03:00
intel-hid.c platform/x86: intel-hid: Add support for Device Specific Methods 2018-07-02 16:48:22 +03:00
intel-rst.c
intel-smartconnect.c
intel-vbtn.c platform/x86: intel-vbtn: Add support for dock mode detection 2018-07-02 16:48:22 +03:00
intel-wmi-thunderbolt.c
intel_bxtwc_tmu.c headers: separate linux/mod_devicetable.h from linux/platform_device.h 2018-07-07 17:52:26 +02:00
intel_cht_int33fe.c platform/x86: intel_cht_int33fe: Add device connections for the Type-C port 2018-03-22 13:49:28 +01:00
intel_chtdc_ti_pwrbtn.c
intel_int0002_vgpio.c
intel_ips.c platform/x86: intel_ips: remove redundant variables slope and offset 2018-07-18 13:29:11 +03:00
intel_ips.h
intel_menlow.c
intel_mid_powerbtn.c
intel_mid_thermal.c
intel_oaktrail.c
intel_pmc_core.c platform/x86: intel_pmc_core: Add CNP SLPS0 debug registers 2018-07-02 15:00:30 +03:00
intel_pmc_core.h platform/x86: intel_pmc_core: Add CNP SLPS0 debug registers 2018-07-02 15:00:30 +03:00
intel_pmc_ipc.c
intel_punit_ipc.c platform-drivers-x86 for v4.19-1 2018-08-22 14:14:15 -07:00
intel_scu_ipc.c platform: x86: intel_scu_ipc: Replace mdelay with usleep_range in intel_scu_ipc_i2c_cntrl 2018-04-23 17:24:23 +03:00
intel_scu_ipcutil.c
intel_telemetry_core.c
intel_telemetry_debugfs.c
intel_telemetry_pltdrv.c
intel_turbo_max_3.c
Kconfig platform-drivers-x86 for v4.19-1 2018-08-22 14:14:15 -07:00
Makefile platform-drivers-x86 for v4.19-1 2018-08-22 14:14:15 -07:00
mlx-platform.c platform/x86: mlx-platform: Fix copy-paste error in mlxplat_init() 2018-08-15 12:55:32 +03:00
msi-laptop.c
msi-wmi.c
mxm-wmi.c
panasonic-laptop.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
peaq-wmi.c
pmc_atom.c
pvpanic.c
samsung-laptop.c platform/x86: Simplify getting .drvdata 2018-04-23 08:52:59 -07:00
samsung-q10.c
sony-laptop.c
surface3-wmi.c
surface3_button.c
surfacepro3_button.c
tc1100-wmi.c
thinkpad_acpi.c platform-drivers-x86 for v4.19-1 2018-08-22 14:14:15 -07:00
topstar-laptop.c
toshiba-wmi.c
toshiba_acpi.c platform/x86: toshiba_acpi: Fix defined but not used build warnings 2018-07-21 09:26:45 -07:00
toshiba_bluetooth.c
toshiba_haps.c
touchscreen_dmi.c platform/x86: touchscreen_dmi: Add info for the Cube KNote i1101 tablet 2018-08-15 12:55:32 +03:00
wmi-bmof.c
wmi.c platform/x86: wmi: Do not mix pages and kmalloc 2018-06-22 16:24:40 -07:00
xo1-rfkill.c
xo15-ebook.c