[PATCH xf86-input-synaptics 03/10] Allocate SynapticsPrivate.comm->hwState
Chase Douglas
chase.douglas at canonical.com
Wed Feb 8 18:35:12 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 | 4 ++++
src/synproto.h | 2 +-
5 files changed, 8 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 6213f84..3326aef 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -936,6 +936,8 @@ DeviceClose(DeviceIntPtr dev)
free_shm_data(priv);
SynapticsHwStateFree(priv->local_hw_state);
priv->local_hw_state = NULL;
+ SynapticsHwStateFree(priv->comm.hwState);
+ priv->comm.hwState = NULL;
return RetValue;
}
@@ -1185,6 +1187,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 7ec5142..4245fcc 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