OSDN Git Service

tp_smapi: fix a building issue with clang
authorChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 21 Jun 2018 10:52:20 +0000 (18:52 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 21 Jun 2018 10:52:20 +0000 (18:52 +0800)
The clang complains:

/android-x86/out/target/product/x86_64/obj/kmodule/tp_smapi/tp_smapi.c:202:14: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions
                         "m"((u16)smapi_port)
                             ~~~~~^~~~~~~~~~
1 error generated.

tp_smapi/tp_smapi.c

index 43fde49..5e17845 100644 (file)
@@ -107,7 +107,7 @@ static struct { u8 rc; char *msg; int ret; } smapi_retcode[] =
 
 #define SMAPI_MAX_RETRIES 10
 #define SMAPI_PORT2 0x4F           /* fixed port, meaning unclear */
-static unsigned short smapi_port;  /* APM control port, normally 0xB2 */
+static u16 smapi_port;             /* APM control port, normally 0xB2 */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
 static DECLARE_MUTEX(smapi_mutex);
@@ -199,7 +199,7 @@ static int smapi_request(u32 inEBX, u32 inECX,
                         "=m"(tmpEDI),
                         "=m"(tmpESI)
                        :"m"(inEBX), "m"(inECX), "m"(inEDI), "m"(inESI),
-                        "m"((u16)smapi_port)
+                        "m"(smapi_port)
                        :"%eax", "%ebx", "%ecx", "%edx", "%edi",
                         "%esi");