[PATCH synaptics 1/4] ps2comm: replace nested debug macro function call with single function call

Peter Hutterer peter.hutterer at who-t.net
Tue Mar 13 22:06:55 PDT 2012


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/ps2comm.c |   60 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/ps2comm.c b/src/ps2comm.c
index 5b34414..63022c0 100644
--- a/src/ps2comm.c
+++ b/src/ps2comm.c
@@ -77,9 +77,9 @@
 #define PS2_RES_SAMPLE_RATE(r)	((r) & 0xff)
 
 #ifdef DEBUG
-#define PS2DBG(x) (x)
+#define PS2DBG(...) xf86Msg(X_INFO, __VA_ARGS__)
 #else
-#define PS2DBG(x)
+#define PS2DBG(...)
 #endif
 
 /*****************************************************************************
@@ -95,13 +95,13 @@ ps2_getbyte(int fd, byte *b)
 {
     if (xf86WaitForInput(fd, 50000) > 0) {
 	if (xf86ReadSerial(fd, b, 1) != 1) {
-	    PS2DBG(ErrorF("ps2_getbyte: No byte read\n"));
+	    PS2DBG("ps2_getbyte: No byte read\n");
 	    return FALSE;
 	}
-	PS2DBG(ErrorF("ps2_getbyte: byte %02X read\n", *b));
+	PS2DBG("ps2_getbyte: byte %02X read\n", *b);
 	return TRUE;
     }
-    PS2DBG(ErrorF("ps2_getbyte: timeout xf86WaitForInput\n"));
+    PS2DBG("ps2_getbyte: timeout xf86WaitForInput\n");
     return FALSE;
 }
 
@@ -114,16 +114,16 @@ ps2_putbyte(int fd, byte b)
     byte ack;
 
     if (xf86WriteSerial(fd, &b, 1) != 1) {
-	PS2DBG(ErrorF("ps2_putbyte: error xf86WriteSerial\n"));
+	PS2DBG("ps2_putbyte: error xf86WriteSerial\n");
 	return FALSE;
     }
-    PS2DBG(ErrorF("ps2_putbyte: byte %02X send\n", b));
+    PS2DBG("ps2_putbyte: byte %02X send\n", b);
     /* wait for an ACK */
     if (!ps2_getbyte(fd, &ack)) {
 	return FALSE;
     }
     if (ack != PS2_ACK) {
-	PS2DBG(ErrorF("ps2_putbyte: wrong acknowledge 0x%02x\n", ack));
+	PS2DBG("ps2_putbyte: wrong acknowledge 0x%02x\n", ack);
 	return FALSE;
     }
     return TRUE;
@@ -160,7 +160,7 @@ ps2_special_cmd(int fd, byte cmd)
 static Bool
 ps2_send_cmd(int fd, byte c)
 {
-    PS2DBG(ErrorF("send command: 0x%02X\n", c));
+    PS2DBG("send command: 0x%02X\n", c);
     return (ps2_special_cmd(fd, c) &&
 	    ps2_putbyte(fd, PS2_CMD_STATUS_REQUEST));
 }
@@ -175,7 +175,7 @@ ps2_send_cmd(int fd, byte c)
 static Bool
 ps2_synaptics_set_mode(int fd, byte mode)
 {
-    PS2DBG(ErrorF("set mode byte to: 0x%02X\n", mode));
+    PS2DBG("set mode byte to: 0x%02X\n", mode);
     return (ps2_special_cmd(fd, mode) &&
 	    ps2_putbyte(fd, PS2_CMD_SET_SAMPLE_RATE) &&
 	    ps2_putbyte(fd, 0x14));
@@ -190,22 +190,22 @@ ps2_synaptics_reset(int fd)
     byte r[2];
 
     xf86FlushInput(fd);
-    PS2DBG(ErrorF("Reset the Touchpad...\n"));
+    PS2DBG("Reset the Touchpad...\n");
     if (!ps2_putbyte(fd, PS2_CMD_RESET)) {
-	PS2DBG(ErrorF("...failed\n"));
+	PS2DBG("...failed\n");
 	return FALSE;
     }
     xf86WaitForInput(fd, 4000000);
     if (ps2_getbyte(fd, &r[0]) && ps2_getbyte(fd, &r[1])) {
 	if (r[0] == 0xAA && r[1] == 0x00) {
-	    PS2DBG(ErrorF("...done\n"));
+	    PS2DBG("...done\n");
 	    return TRUE;
 	} else {
-	    PS2DBG(ErrorF("...failed. Wrong reset ack 0x%02x, 0x%02x\n", r[0], r[1]));
+	    PS2DBG("...failed. Wrong reset ack 0x%02x, 0x%02x\n", r[0], r[1]);
 	    return FALSE;
 	}
     }
-    PS2DBG(ErrorF("...failed\n"));
+    PS2DBG("...failed\n");
     return FALSE;
 }
 
@@ -218,7 +218,7 @@ ps2_synaptics_model_id(int fd, struct PS2SynapticsHwInfo *synhw)
 {
     byte mi[3];
 
-    PS2DBG(ErrorF("Read mode id...\n"));
+    PS2DBG("Read mode id...\n");
 
     synhw->model_id = 0;
     if (ps2_send_cmd(fd, SYN_QUE_MODEL) &&
@@ -226,11 +226,11 @@ ps2_synaptics_model_id(int fd, struct PS2SynapticsHwInfo *synhw)
 	ps2_getbyte(fd, &mi[1]) &&
 	ps2_getbyte(fd, &mi[2])) {
 	synhw->model_id = (mi[0] << 16) | (mi[1] << 8) | mi[2];
-	PS2DBG(ErrorF("model-id %06X\n", synhw->model_id));
-	PS2DBG(ErrorF("...done.\n"));
+	PS2DBG("model-id %06X\n", synhw->model_id);
+	PS2DBG("...done.\n");
 	return TRUE;
     }
-    PS2DBG(ErrorF("...failed.\n"));
+    PS2DBG("...failed.\n");
     return FALSE;
 }
 
@@ -243,7 +243,7 @@ ps2_synaptics_capability(int fd, struct PS2SynapticsHwInfo *synhw)
 {
     byte cap[3];
 
-    PS2DBG(ErrorF("Read capabilites...\n"));
+    PS2DBG("Read capabilites...\n");
 
     synhw->capabilities = 0;
     synhw->ext_cap = 0;
@@ -252,7 +252,7 @@ ps2_synaptics_capability(int fd, struct PS2SynapticsHwInfo *synhw)
 	ps2_getbyte(fd, &cap[1]) &&
 	ps2_getbyte(fd, &cap[2])) {
 	synhw->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2];
-	PS2DBG(ErrorF("capabilities %06X\n", synhw->capabilities));
+	PS2DBG("capabilities %06X\n", synhw->capabilities);
 	if (SYN_CAP_VALID(synhw)) {
 	    if (SYN_EXT_CAP_REQUESTS(synhw)) {
 		if (ps2_send_cmd(fd, SYN_QUE_EXT_CAPAB) &&
@@ -260,17 +260,17 @@ ps2_synaptics_capability(int fd, struct PS2SynapticsHwInfo *synhw)
 		    ps2_getbyte(fd, &cap[1]) &&
 		    ps2_getbyte(fd, &cap[2])) {
 		    synhw->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2];
-		    PS2DBG(ErrorF("ext-capability %06X\n", synhw->ext_cap));
+		    PS2DBG("ext-capability %06X\n", synhw->ext_cap);
 		} else {
-		    PS2DBG(ErrorF("synaptics says, that it has extended-capabilities, "
-				  "but I cannot read them."));
+		    PS2DBG("synaptics says, that it has extended-capabilities, "
+				  "but I cannot read them.");
 		}
 	    }
-	    PS2DBG(ErrorF("...done.\n"));
+	    PS2DBG("...done.\n");
 	    return TRUE;
 	}
     }
-    PS2DBG(ErrorF("...failed.\n"));
+    PS2DBG("...failed.\n");
     return FALSE;
 }
 
@@ -283,7 +283,7 @@ ps2_synaptics_identify(int fd, struct PS2SynapticsHwInfo *synhw)
 {
     byte id[3];
 
-    PS2DBG(ErrorF("Identify Touchpad...\n"));
+    PS2DBG("Identify Touchpad...\n");
 
     synhw->identity = 0;
     if (ps2_send_cmd(fd, SYN_QUE_IDENTIFY) &&
@@ -291,13 +291,13 @@ ps2_synaptics_identify(int fd, struct PS2SynapticsHwInfo *synhw)
 	ps2_getbyte(fd, &id[1]) &&
 	ps2_getbyte(fd, &id[2])) {
 	synhw->identity = (id[0] << 16) | (id[1] << 8) | id[2];
-	PS2DBG(ErrorF("ident %06X\n", synhw->identity));
+	PS2DBG("ident %06X\n", synhw->identity);
 	if (SYN_ID_IS_SYNAPTICS(synhw)) {
-	    PS2DBG(ErrorF("...done.\n"));
+	    PS2DBG("...done.\n");
 	    return TRUE;
 	}
     }
-    PS2DBG(ErrorF("...failed.\n"));
+    PS2DBG("...failed.\n");
     return FALSE;
 }
 
-- 
1.7.7.6



More information about the xorg-devel mailing list