Skip to content

Commit 87e5890

Browse files
sumachidanandnchatrad
authored andcommitted
amd_hsmp: Conditionally call device_add_groups or devm_device_add_groups
In linux 6.10.rc3, devm_device_add_groups is removed and device_add_groups should be used in that place. Add a check to call one of them based on the linux version.
1 parent f7feffe commit 87e5890

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

amd_hsmp.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <linux/acpi.h>
2121
#include "amd_hsmp.h" /* this will come from linux kernel as UAPI header */
2222

23+
#include <generated/uapi/linux/version.h>
24+
2325
#define DRIVER_NAME "amd_hsmp"
2426
#define DRIVER_VERSION "2.4"
2527
#define ACPI_HSMP_DEVICE_HID "AMDI0097"
@@ -728,8 +730,12 @@ static int hsmp_create_non_acpi_sysfs_if(struct device *dev)
728730

729731
hsmp_create_attr_list(attr_grp, dev, i);
730732
}
731-
733+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,10,0)
734+
return device_add_groups(dev, hsmp_attr_grps);
735+
#else
732736
return devm_device_add_groups(dev, hsmp_attr_grps);
737+
#endif
738+
733739
}
734740

735741
static int hsmp_create_acpi_sysfs_if(struct device *dev)

0 commit comments

Comments
 (0)