[PATCH xf86-input-synaptics v2 03/13] Allocate SynapticsPrivate.comm->hwState

Chase Douglas chase.douglas at canonical.com
Thu Feb 9 18:24:47 PST 2012


This is needed for when SynapticsHwState can't be allocated on the stack.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/alpscomm.c  |    2 +-
 src/eventcomm.c |    2 +-
 src/ps2comm.c   |    2 +-
 src/synaptics.c |    3 +++
 src/synproto.h  |    2 +-
 5 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/alpscomm.c b/src/alpscomm.c
index 7ae2da1..dbc3554 100644
--- a/src/alpscomm.c
+++ b/src/alpscomm.c
@@ -211,7 +211,7 @@ ALPSReadHwState(InputInfoPtr pInfo,
 		struct CommData *comm, struct SynapticsHwState *hwRet)
 {
     unsigned char *buf = comm->protoBuf;
-    struct SynapticsHwState *hw = &(comm->hwState);
+    struct SynapticsHwState *hw = comm->hwState;
 
     if (!ALPS_get_packet(comm, pInfo))
 	return FALSE;
diff --git a/src/eventcomm.c b/src/eventcomm.c
index ce26934..1ae8442 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -702,7 +702,7 @@ EventReadHwState(InputInfoPtr pInfo,
 {
     struct input_event ev;
     Bool v;
-    struct SynapticsHwState *hw = &(comm->hwState);
+    struct SynapticsHwState *hw = comm->hwState;
     SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
     SynapticsParameters *para = &priv->synpara;
 
diff --git a/src/ps2comm.c b/src/ps2comm.c
index b7995ee..74bd937 100644
--- a/src/ps2comm.c
+++ b/src/ps2comm.c
@@ -521,7 +521,7 @@ PS2ReadHwStateProto(InputInfoPtr pInfo,
 	       struct CommData *comm, struct SynapticsHwState *hwRet)
 {
     unsigned char *buf = comm->protoBuf;
-    struct SynapticsHwState *hw = &(comm->hwState);
+    struct SynapticsHwState *hw = comm->hwState;
     SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
     SynapticsParameters *para = &priv->synpara;
     struct PS2SynapticsHwInfo *synhw;
diff --git a/src/synaptics.c b/src/synaptics.c
index 03ed54d..a6d3bca 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -935,6 +935,7 @@ DeviceClose(DeviceIntPtr dev)
     priv->timer = NULL;
     free_shm_data(priv);
     SynapticsHwStateFree(&priv->local_hw_state);
+    SynapticsHwStateFree(&priv->comm.hwState);
     return RetValue;
 }
 
@@ -1184,6 +1185,8 @@ no_touch:
     if (!priv->local_hw_state)
 	return !Success;
 
+    priv->comm.hwState = SynapticsHwStateAlloc(priv);
+
     if (!alloc_shm_data(pInfo))
     {
 	free(priv->local_hw_state);
diff --git a/src/synproto.h b/src/synproto.h
index 3f09bb2..74becca 100644
--- a/src/synproto.h
+++ b/src/synproto.h
@@ -64,7 +64,7 @@ struct CommData {
     int protoBufTail;
 
     /* Used for keeping track of partial HwState updates. */
-    struct SynapticsHwState hwState;
+    struct SynapticsHwState *hwState;
     Bool oneFinger;
     Bool twoFingers;
     Bool threeFingers;
-- 
1.7.8.3



More information about the xorg-devel mailing list