linux-stable/drivers/platform/x86
Shyam Sundar S K 146b6f6855 platform/x86/amd/pmf: Register notify handler only if SPS is enabled
Power source notify handler is getting registered even when none of the
PMF feature in enabled leading to a crash.

...
[   22.592162] Call Trace:
[   22.592164]  <TASK>
[   22.592164]  ? rcu_note_context_switch+0x5e0/0x660
[   22.592166]  ? __warn+0x81/0x130
[   22.592171]  ? rcu_note_context_switch+0x5e0/0x660
[   22.592172]  ? report_bug+0x171/0x1a0
[   22.592175]  ? prb_read_valid+0x1b/0x30
[   22.592177]  ? handle_bug+0x3c/0x80
[   22.592178]  ? exc_invalid_op+0x17/0x70
[   22.592179]  ? asm_exc_invalid_op+0x1a/0x20
[   22.592182]  ? rcu_note_context_switch+0x5e0/0x660
[   22.592183]  ? acpi_ut_delete_object_desc+0x86/0xb0
[   22.592186]  ? acpi_ut_update_ref_count.part.0+0x22d/0x930
[   22.592187]  __schedule+0xc0/0x1410
[   22.592189]  ? ktime_get+0x3c/0xa0
[   22.592191]  ? lapic_next_event+0x1d/0x30
[   22.592193]  ? hrtimer_start_range_ns+0x25b/0x350
[   22.592196]  schedule+0x5e/0xd0
[   22.592197]  schedule_hrtimeout_range_clock+0xbe/0x140
[   22.592199]  ? __pfx_hrtimer_wakeup+0x10/0x10
[   22.592200]  usleep_range_state+0x64/0x90
[   22.592203]  amd_pmf_send_cmd+0x106/0x2a0 [amd_pmf bddfe0fe3712aaa99acce3d5487405c5213c6616]
[   22.592207]  amd_pmf_update_slider+0x56/0x1b0 [amd_pmf bddfe0fe3712aaa99acce3d5487405c5213c6616]
[   22.592210]  amd_pmf_set_sps_power_limits+0x72/0x80 [amd_pmf bddfe0fe3712aaa99acce3d5487405c5213c6616]
[   22.592213]  amd_pmf_pwr_src_notify_call+0x49/0x90 [amd_pmf bddfe0fe3712aaa99acce3d5487405c5213c6616]
[   22.592216]  notifier_call_chain+0x5a/0xd0
[   22.592218]  atomic_notifier_call_chain+0x32/0x50
...

Fix this by moving the registration of source change notify handler only
when SPS(Static Slider) is advertised as supported.

Reported-by: Allen Zhong <allen@atr.me>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217571
Fixes: 4c71ae4144 ("platform/x86/amd/pmf: Add support SPS PMF feature")
Tested-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20230622060309.310001-1-Shyam-sundar.S-k@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2023-06-22 10:20:00 +02:00
..
amd platform/x86/amd/pmf: Register notify handler only if SPS is enabled 2023-06-22 10:20:00 +02:00
dell platform/x86: dell-laptop: Register ctl-led for speaker-mute 2023-03-16 14:51:07 +01:00
hp platform/x86: hp-wmi: add micmute to hp_wmi_keymap struct 2023-05-09 10:54:33 +02:00
intel platform/x86: int3472: Avoid crash in unregistering regulator gpio 2023-05-30 12:10:22 +02:00
x86-android-tablets platform/x86: x86-android-tablets: Add accelerometer support for Yoga Tablet 2 1050/830 series 2023-04-17 12:23:26 +02:00
acer-wireless.c acer-wireless: send an EV_SYN/SYN_REPORT between state changes 2020-12-07 16:10:11 +01:00
acer-wmi.c platform/x86: acer-wmi: Convert to platform remove callback returning void 2023-03-07 12:19:13 +01:00
acerhdf.c Thermal control updates for 6.4-rc1 2023-04-25 18:32:43 -07:00
adv_swbutton.c platform/x86: adv_swbutton: Convert to platform remove callback returning void 2023-03-07 12:19:26 +01:00
amilo-rfkill.c platform/x86: amilo-rfkill: Convert to platform remove callback returning void 2023-03-07 12:19:43 +01:00
apple-gmux.c platform/x86: apple-gmux: Fix iomem_base __iomem annotation 2023-04-06 14:24:04 +02:00
asus-laptop.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
asus-nb-wmi.c platform/x86: asus-wmi: Ignore WMI events with codes 0x7B, 0xC0 2023-05-15 14:55:57 +02:00
asus-tf103c-dock.c platform/x86: asus-tf103c-dock: Constify toprow keymap 2023-02-06 15:08:45 +01:00
asus-wireless.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
asus-wmi.c platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting 2023-01-24 13:41:13 +01:00
asus-wmi.h platform/x86: asus-wmi: Add quirk wmi_ignore_fan 2023-01-12 19:35:51 +01:00
barco-p50-gpio.c platform/x86: barco-p50-gpio: Convert to platform remove callback returning void 2023-03-07 12:19:45 +01:00
classmate-laptop.c platform/x86: classmate: mark SPI related data as maybe unused 2023-03-16 16:10:54 +01:00
compal-laptop.c platform/x86: compal-laptop: Convert to platform remove callback returning void 2023-03-07 12:19:47 +01:00
dual_accel_detect.h platform/x86: dual_accel_detect: Use the new i2c_acpi_client_count() helper 2021-08-12 17:26:36 +02:00
eeepc-laptop.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
eeepc-wmi.c platform/x86: asus-wmi: Move acpi_backlight=vendor quirks to ACPI video_detect.c 2022-09-03 12:17:27 +02:00
firmware_attributes_class.c platform/x86: dell-wmi-sysman: fw_attr_inuse can be static 2021-06-16 17:47:52 +02:00
firmware_attributes_class.h platform/x86: firmware_attributes_class: Create helper file for handling firmware-attributes class registration events 2021-06-16 17:47:51 +02:00
fujitsu-laptop.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
fujitsu-tablet.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
gigabyte-wmi.c platform/x86: gigabyte-wmi: add support for X570S AORUS ELITE 2023-03-31 19:31:48 +02:00
gpd-pocket-fan.c platform/x86: gpd pocket fan: Clean-up by using managed work init 2021-03-23 15:22:40 +01:00
hdaps.c platform/x86: use PLATFORM_DEVID_NONE instead of -1 2022-10-03 09:40:04 +02:00
huawei-wmi.c platform/x86: huawei-wmi: Convert to platform remove callback returning void 2023-03-07 12:20:17 +01:00
ibm_rtl.c platform/x86: ibm_rtl: move to use bus_get_dev_root() 2023-03-17 15:29:06 +01:00
ideapad-laptop.c platform-drivers-x86 for v6.4-1 2023-04-25 16:59:48 -07:00
ideapad-laptop.h platform/x86: Add driver for Yoga Tablet Mode switch 2023-04-06 12:33:34 +02:00
intel_ips.c platform/x86: intel_ips: fix set but unused warning in read_mgtv 2021-06-16 17:47:55 +02:00
intel_ips.h platform/x86: intel-ips: Use the correct style for SPDX License Identifier 2020-01-10 11:57:21 +02:00
intel_scu_ipc.c drivers: remove struct module * setting from struct class 2023-03-17 15:16:27 +01:00
intel_scu_ipcutil.c platform/x86: intel_scu_ipcutil: Convert to use new SCU IPC API 2020-04-24 11:17:41 +01:00
intel_scu_pcidrv.c platform/x86: intel_scu_pcidrv: Add back PCI ID for Medfield 2023-05-08 17:35:08 +02:00
intel_scu_pltdrv.c platform/x86: Add Elkhart Lake SCU/PMC support 2020-05-05 20:26:16 +03:00
intel_scu_wdt.c platform/x86: intel_scu_wdt: Drop mistakenly added const 2021-02-05 12:54:27 +02:00
Kconfig platform/x86: Add driver for Yoga Tablet Mode switch 2023-04-06 12:33:34 +02:00
lenovo-ymc.c platform/x86: Add driver for Yoga Tablet Mode switch 2023-04-06 12:33:34 +02:00
lenovo-yogabook-wmi.c platform/x86: lenovo-yogabook-wmi: Add support for hall sensor on the back 2021-12-07 12:21:01 +01:00
lg-laptop.c ACPI updates for 6.2-rc1 2022-12-12 13:38:17 -08:00
Makefile platform/x86: Add driver for Yoga Tablet Mode switch 2023-04-06 12:33:34 +02:00
meraki-mx100.c platform/x86: add meraki-mx100 platform driver 2021-08-12 09:26:28 +02:00
mlx-platform.c platform: mellanox: mlx-platform: Initialize shift variable to 0 2023-03-07 12:08:30 +01:00
msi-ec.c platform/x86: Add new msi-ec driver 2023-03-27 16:10:20 +02:00
msi-ec.h platform/x86: Add new msi-ec driver 2023-03-27 16:10:20 +02:00
msi-laptop.c platform/x86: use PLATFORM_DEVID_NONE instead of -1 2022-10-03 09:40:04 +02:00
msi-wmi.c platform/x86: msi-wmi: Fix variable 'status' set but not used compiler warning 2021-02-04 13:35:20 +01:00
mxm-wmi.c platform/x86: mxm-wmi: fix memleak in mxm_wmi_call_mx[ds|mx]() 2022-12-08 16:32:12 +01:00
nvidia-wmi-ec-backlight.c platform/x86: nvidia-wmi-ec-backlight: Add force module parameter 2023-02-18 11:45:52 +01:00
p2sb.c platform/x86: p2sb: Don't fail if unknown CPU is found 2022-11-07 12:33:49 +01:00
panasonic-laptop.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
pcengines-apuv2.c platform/x86: pcengines-apuv2: Drop platform:pcengines-apuv2 module-alias 2023-03-16 16:14:52 +01:00
pmc_atom.c platform/x86: pmc_atom: Amend comment style and grammar 2022-08-25 16:23:52 +02:00
samsung-laptop.c platform/x86: use PLATFORM_DEVID_NONE instead of -1 2022-10-03 09:40:04 +02:00
samsung-q10.c platform/x86: samsung-q10: Convert to platform remove callback returning void 2023-03-07 12:20:44 +01:00
serial-multi-instantiate.c spi: Updates for v6.4 2023-04-27 11:02:26 -07:00
simatic-ipc.c platform/x86: simatic-ipc: add another model 2023-01-12 19:42:53 +01:00
sony-laptop.c platform/x86: sony: mark SPI related data as maybe unused 2023-03-16 16:11:03 +01:00
system76_acpi.c ACPI updates for 6.2-rc1 2022-12-12 13:38:17 -08:00
think-lmi.c platform-drivers-x86 for v6.4-1 2023-04-25 16:59:48 -07:00
think-lmi.h platform/x86: think-lmi: certificate support clean ups 2022-04-04 15:20:53 +02:00
thinkpad_acpi.c platform/x86: thinkpad_acpi: Add profile force ability 2023-05-09 10:54:45 +02:00
topstar-laptop.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
toshiba_acpi.c ACPI updates for 6.2-rc1 2022-12-12 13:38:17 -08:00
toshiba_bluetooth.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
toshiba_haps.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
toshiba-wmi.c
touchscreen_dmi.c platform/x86: touchscreen_dmi: Add info for the Dexp Ursus KX210i 2023-05-09 10:54:58 +02:00
uv_sysfs.c x86/platform/uv: Make kobj_type structure constant 2023-02-10 17:24:37 +01:00
winmate-fm07-keys.c platform/x86: use PLATFORM_DEVID_NONE instead of -1 2022-10-03 09:40:04 +02:00
wireless-hotkey.c ACPI updates for 6.2-rc1 2022-12-12 13:38:17 -08:00
wmi-bmof.c platform/x86: wmi: Make remove callback return void 2021-03-08 11:33:39 +01:00
wmi.c platform/x86: wmi: Convert to platform remove callback returning void 2023-03-07 12:20:47 +01:00
xiaomi-wmi.c platform/x86: wmi: Make two functions static 2020-04-17 16:47:26 +03:00
xo1-rfkill.c platform/x86: xo1-rfkill: Convert to platform remove callback returning void 2023-03-07 12:20:50 +01:00
xo15-ebook.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00