Skip to content

Commit 64226fc

Browse files
authored
Merge pull request #504 from flying-elephant/replace-PM_COMFIG
Replace pm comfig
2 parents 08f9075 + bc40723 commit 64226fc

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

4.18/wacom_sys.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,7 +2942,9 @@ static void wacom_remove(struct hid_device *hdev)
29422942
wacom_release_resources(wacom);
29432943
}
29442944

2945+
#ifndef HAVE_PM_PTR
29452946
#ifdef CONFIG_PM
2947+
#endif
29462948
static int wacom_resume(struct hid_device *hdev)
29472949
{
29482950
struct wacom *wacom = hid_get_drvdata(hdev);
@@ -2962,17 +2964,24 @@ static int wacom_reset_resume(struct hid_device *hdev)
29622964
{
29632965
return wacom_resume(hdev);
29642966
}
2967+
#ifndef HAVE_PM_PTR
29652968
#endif /* CONFIG_PM */
2969+
#endif
29662970

29672971
static struct hid_driver wacom_driver = {
29682972
.name = "wacom",
29692973
.id_table = wacom_ids,
29702974
.probe = wacom_probe,
29712975
.remove = wacom_remove,
29722976
.report = wacom_wac_report,
2977+
#ifdef HAVE_PM_PTR
2978+
.resume = pm_ptr(wacom_resume),
2979+
.reset_resume = pm_ptr(wacom_reset_resume),
2980+
#else
29732981
#ifdef CONFIG_PM
29742982
.resume = wacom_resume,
29752983
.reset_resume = wacom_reset_resume,
2984+
#endif
29762985
#endif
29772986
.raw_event = wacom_raw_event,
29782987
};

configure.ac

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,24 @@ WACOM_LINUX_TRY_COMPILE([
321321
AC_MSG_RESULT([no])
322322
])
323323

324+
dnl Check if pm_ptr has been added to pm.h or
325+
dnl not. This is the case in Linux 5.9 and later.
326+
AC_MSG_CHECKING(pm_ptr)
327+
WACOM_LINUX_TRY_COMPILE([
328+
#include <linux/pm.h>
329+
#ifndef pm_ptr
330+
#error "pm_ptr is not defined"
331+
#endif
332+
],[
333+
],[
334+
HAVE_PM_PTR=yes
335+
AC_MSG_RESULT([yes])
336+
AC_DEFINE([WACOM_PM_PTR], [], [kernel defines pm_ptr from v5.9])
337+
],[
338+
HAVE_PM_PTR=no
339+
AC_MSG_RESULT([no])
340+
])
341+
324342
dnl Check which version of the driver we should compile
325343
AC_DEFUN([WCM_EXPLODE], [$(echo "$1" | awk '{split($[0],x,"[[^0-9]]"); printf("%03d%03d%03d\n",x[[1]],x[[2]],x[[3]]);}')])
326344
EXPLODED_VER="WCM_EXPLODE($MODUTS)"

0 commit comments

Comments
 (0)