Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-laptop/tp_smapi/files/, app-laptop/tp_smapi/
Date: Tue, 30 Jan 2018 04:01:59
Message-Id: 1517284771.a39ab58e766da4ad5021445cccf99b372b621a98.mjo@gentoo
1 commit: a39ab58e766da4ad5021445cccf99b372b621a98
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 30 03:56:53 2018 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 30 03:59:31 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a39ab58e
7
8 app-laptop/tp_smapi: new revision to fix the build with >= linux-4.15.
9
10 Closes: https://bugs.gentoo.org/646096
11 Package-Manager: Portage-2.3.19, Repoman-2.3.6
12
13 .../files/linux-4.15-timer_setup-fix.patch | 43 ++++++++++++
14 app-laptop/tp_smapi/tp_smapi-0.42-r2.ebuild | 76 ++++++++++++++++++++++
15 2 files changed, 119 insertions(+)
16
17 diff --git a/app-laptop/tp_smapi/files/linux-4.15-timer_setup-fix.patch b/app-laptop/tp_smapi/files/linux-4.15-timer_setup-fix.patch
18 new file mode 100644
19 index 00000000000..88c5580db18
20 --- /dev/null
21 +++ b/app-laptop/tp_smapi/files/linux-4.15-timer_setup-fix.patch
22 @@ -0,0 +1,43 @@
23 +From 76c5120f7be4880cf2c6801f872327e4e70c449f Mon Sep 17 00:00:00 2001
24 +From: Jan Nordholz <jnordholz@××××××××××××××××××××.de>
25 +Date: Mon, 4 Dec 2017 03:27:11 +0100
26 +Subject: [PATCH] Adapt HDAPS driver to use the new timer_setup() interface.
27 +
28 +Linux 4.15 removed the ancient init_timer() API and changed the signature
29 +of the timer handler function.
30 +
31 +Signed-off-by: Jan Nordholz <jnordholz@××××××××××××××××××××.de>
32 +Closes: #31
33 +---
34 + hdaps.c | 8 ++++++++
35 + 1 file changed, 8 insertions(+)
36 +
37 +diff --git a/hdaps.c b/hdaps.c
38 +index 0763c3a..76930a3 100644
39 +--- a/hdaps.c
40 ++++ b/hdaps.c
41 +@@ -469,7 +469,11 @@ static void hdaps_calibrate(void)
42 + /* Timer handler for updating the input device. Runs in softirq context,
43 + * so avoid lenghty or blocking operations.
44 + */
45 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
46 + static void hdaps_mousedev_poll(unsigned long unused)
47 ++#else
48 ++static void hdaps_mousedev_poll(struct timer_list *unused)
49 ++#endif
50 + {
51 + int ret;
52 +
53 +@@ -779,8 +783,12 @@ static int __init hdaps_init(void)
54 + hdaps_invert = 0; /* default */
55 +
56 + /* Init timer before platform_driver_register, in case of suspend */
57 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
58 + init_timer(&hdaps_timer);
59 + hdaps_timer.function = hdaps_mousedev_poll;
60 ++#else
61 ++ timer_setup(&hdaps_timer, hdaps_mousedev_poll, 0);
62 ++#endif
63 + ret = platform_driver_register(&hdaps_driver);
64 + if (ret)
65 + goto out;
66
67 diff --git a/app-laptop/tp_smapi/tp_smapi-0.42-r2.ebuild b/app-laptop/tp_smapi/tp_smapi-0.42-r2.ebuild
68 new file mode 100644
69 index 00000000000..e09bd1f674d
70 --- /dev/null
71 +++ b/app-laptop/tp_smapi/tp_smapi-0.42-r2.ebuild
72 @@ -0,0 +1,76 @@
73 +# Copyright 1999-2018 Gentoo Foundation
74 +# Distributed under the terms of the GNU General Public License v2
75 +
76 +EAPI=6
77 +
78 +inherit flag-o-matic linux-mod
79 +
80 +DESCRIPTION="IBM ThinkPad SMAPI BIOS driver"
81 +HOMEPAGE="https://github.com/evgeni/${PN}"
82 +SRC_URI="${HOMEPAGE}/releases/download/tp-smapi/${PV}/${P}.tgz"
83 +
84 +LICENSE="GPL-2"
85 +SLOT="0"
86 +KEYWORDS="~amd64 ~x86"
87 +
88 +IUSE="hdaps"
89 +
90 +# We need dmideode if the kernel does not support
91 +# DMI_DEV_TYPE_OEM_STRING in dmi.h.
92 +DEPEND="sys-apps/dmidecode"
93 +RDEPEND="${DEPEND}"
94 +
95 +PATCHES=( "${FILESDIR}/linux-4.15-timer_setup-fix.patch" )
96 +
97 +# This code is factored out of both pkg_pretend() and pkg_setup()
98 +# because the PMS states that ebuilds may not call phase functions
99 +# directly (see the "List of functions" section). This was bug #596616
100 +# and #596622.
101 +tp_smapi_pkg_pretend() {
102 + linux-mod_pkg_setup
103 +
104 + MODULE_NAMES="thinkpad_ec(extra:) tp_smapi(extra:)"
105 + BUILD_PARAMS="KSRC=${KV_DIR} KBUILD=${KV_OUT_DIR}"
106 + BUILD_TARGETS="default"
107 +
108 + if use hdaps; then
109 + CONFIG_CHECK="~INPUT_UINPUT"
110 + WARNING_INPUT_UINPUT="Your kernel needs uinput for the hdaps module to perform better"
111 + # Why call this twice?
112 + linux-info_pkg_setup
113 +
114 + MODULE_NAMES="${MODULE_NAMES} hdaps(extra:)"
115 + BUILD_PARAMS="${BUILD_PARAMS} HDAPS=1"
116 +
117 + CONFIG_CHECK="~!SENSORS_HDAPS"
118 + ERROR_SENSORS_HDAPS="${P} with USE=hdaps conflicts with in-kernel HDAPS (CONFIG_SENSORS_HDAPS)"
119 + linux-info_pkg_setup
120 + fi
121 +}
122 +
123 +pkg_pretend() {
124 + tp_smapi_pkg_pretend
125 +}
126 +
127 +pkg_setup() {
128 + # run again as pkg_pretend is not var safe
129 + tp_smapi_pkg_pretend
130 +}
131 +
132 +src_compile() {
133 + # Kernel Makefiles may pull in -mpreferred-stack-boundary=3
134 + # which requires that SSE disabled or compilation will fail.
135 + # So we need to ensure that appended user CLAGS do not re-enable SSE
136 + # https://bugs.gentoo.org/show_bug.cgi?id=492964
137 + replace-flags '-msse*' ''
138 + replace-flags '-mssse3' ''
139 +
140 + linux-mod_src_compile
141 +}
142 +
143 +src_install() {
144 + linux-mod_src_install
145 + einstalldocs
146 + newinitd "${FILESDIR}/${PN}-0.40-initd" smapi
147 + newconfd "${FILESDIR}/${PN}-0.40-confd" smapi
148 +}