Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: msi-laptop: Add msi_scm_disable_hw_fn_handling() helper

Add a msi_scm_disable_hw_fn_handling() to remove the duplicate code
for this in the resume and init paths.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220826111453.178962-2-hdegoede@redhat.com

+8 -9
+8 -9
drivers/platform/x86/msi-laptop.c
··· 913 913 return retval; 914 914 } 915 915 916 - #ifdef CONFIG_PM_SLEEP 917 - static int msi_laptop_resume(struct device *device) 916 + static int msi_scm_disable_hw_fn_handling(void) 918 917 { 919 918 u8 data; 920 919 int result; ··· 932 933 return result; 933 934 934 935 return 0; 936 + } 937 + 938 + #ifdef CONFIG_PM_SLEEP 939 + static int msi_laptop_resume(struct device *device) 940 + { 941 + return msi_scm_disable_hw_fn_handling(); 935 942 } 936 943 #endif 937 944 ··· 971 966 972 967 static int __init load_scm_model_init(struct platform_device *sdev) 973 968 { 974 - u8 data; 975 969 int result; 976 970 977 971 if (!quirks->ec_read_only) { ··· 984 980 } 985 981 986 982 /* disable hardware control by fn key */ 987 - result = ec_read(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, &data); 988 - if (result < 0) 989 - return result; 990 - 991 - result = ec_write(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, 992 - data | MSI_STANDARD_EC_SCM_LOAD_MASK); 983 + result = msi_scm_disable_hw_fn_handling(); 993 984 if (result < 0) 994 985 return result; 995 986