[PATCH synaptics 5/8] Remove arg proto_ops in ReadHwState()

Peter Hutterer peter.hutterer at who-t.net
Sun Feb 27 19:20:26 PST 2011


On Sun, Feb 27, 2011 at 01:11:48AM +0500, Alexandr Shadchin wrote:
> Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin at gmail.com>
> ---
> Before need apply [PATCH synaptics] Fix build on BSD
> http://lists.x.org/archives/xorg-devel/2011-February/019664.html
> 
>  src/alpscomm.c  |    3 +--
>  src/eventcomm.c |    1 -
>  src/ps2comm.c   |   13 ++++++++++---
>  src/ps2comm.h   |    3 +++
>  src/psmcomm.c   |    3 +--
>  src/synaptics.c |    3 +--
>  src/synproto.h  |    1 -
>  7 files changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/src/alpscomm.c b/src/alpscomm.c
> index 56f74ac..3872f5c 100644
> --- a/src/alpscomm.c
> +++ b/src/alpscomm.c
> @@ -33,10 +33,10 @@
>  #endif
>  
>  #include <xorg-server.h>
> -#include "ps2comm.h"
>  #include "synproto.h"
>  #include "synaptics.h"
>  #include "synapticsstr.h"
> +#include "ps2comm.h"
>  #include <xf86.h>
>  
>  
> @@ -206,7 +206,6 @@ ALPS_process_packet(unsigned char *packet, struct SynapticsHwState *hw)
>  
>  static Bool
>  ALPSReadHwState(InputInfoPtr pInfo,
> -		struct SynapticsProtocolOperations *proto_ops,
>  		struct CommData *comm, struct SynapticsHwState *hwRet)
>  {
>      unsigned char *buf = comm->protoBuf;
> diff --git a/src/eventcomm.c b/src/eventcomm.c
> index 1a31c54..d394d3f 100644
> --- a/src/eventcomm.c
> +++ b/src/eventcomm.c
> @@ -316,7 +316,6 @@ SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev)
>  
>  static Bool
>  EventReadHwState(InputInfoPtr pInfo,
> -		 struct SynapticsProtocolOperations *proto_ops,
>  		 struct CommData *comm, struct SynapticsHwState *hwRet)
>  {
>      struct input_event ev;
> diff --git a/src/ps2comm.c b/src/ps2comm.c
> index 1ea09c9..b676ddc 100644
> --- a/src/ps2comm.c
> +++ b/src/ps2comm.c
> @@ -37,10 +37,10 @@
>  #endif
>  
>  #include <xorg-server.h>
> -#include "ps2comm.h"
>  #include "synproto.h"
>  #include "synaptics.h"
>  #include "synapticsstr.h"
> +#include "ps2comm.h"
>  #include <xf86.h>
>  
>  #define MAX_UNSYNC_PACKETS 10				/* i.e. 10 to 60 bytes */
> @@ -513,8 +513,8 @@ ps2_synaptics_get_packet(InputInfoPtr pInfo, struct SynapticsHwInfo *synhw,
>      return FALSE;
>  }
>  
> -static Bool
> -PS2ReadHwState(InputInfoPtr pInfo,
> +Bool
> +PS2ReadHwStatePriv(InputInfoPtr pInfo,

something like PS2ReadHwStateProto seems a better description of the
function. Priv is a bit ambiguous, especially since the Priv one is called
from two places and not actually the private one.

Cheers,
  Peter

>  	       struct SynapticsProtocolOperations *proto_ops,
>  	       struct CommData *comm, struct SynapticsHwState *hwRet)
>  {
> @@ -654,6 +654,13 @@ PS2ReadHwState(InputInfoPtr pInfo,
>  }
>  
>  static Bool
> +PS2ReadHwState(InputInfoPtr pInfo,
> +               struct CommData *comm, struct SynapticsHwState *hwRet)
> +{
> +    return PS2ReadHwStatePriv(pInfo, &psaux_proto_operations, comm, hwRet);
> +}
> +
> +static Bool
>  PS2AutoDevProbe(InputInfoPtr pInfo)
>  {
>      return FALSE;
> diff --git a/src/ps2comm.h b/src/ps2comm.h
> index 99ff3ec..733759a 100644
> --- a/src/ps2comm.h
> +++ b/src/ps2comm.h
> @@ -103,5 +103,8 @@ struct SynapticsHwInfo {
>  
>  Bool ps2_putbyte(int fd, byte b);
>  void ps2_print_ident(const struct SynapticsHwInfo *synhw);
> +Bool PS2ReadHwStatePriv(InputInfoPtr pInfo,
> +			struct SynapticsProtocolOperations *proto_ops,
> +			struct CommData *comm, struct SynapticsHwState *hwRet);
>  
>  #endif /* _PS2COMM_H_ */
> diff --git a/src/psmcomm.c b/src/psmcomm.c
> index 88263ae..ea8cf88 100644
> --- a/src/psmcomm.c
> +++ b/src/psmcomm.c
> @@ -157,10 +157,9 @@ PSMQueryHardware(InputInfoPtr pInfo)
>  
>  static Bool
>  PSMReadHwState(InputInfoPtr pInfo,
> -	       struct SynapticsProtocolOperations *proto_ops,
>  	       struct CommData *comm, struct SynapticsHwState *hwRet)
>  {
> -    return psaux_proto_operations.ReadHwState(pInfo, proto_ops, comm, hwRet);
> +    return PS2ReadHwStatePriv(pInfo, &psm_proto_operations, comm, hwRet);
>  }
>  
>  static Bool PSMAutoDevProbe(InputInfoPtr pInfo)
> diff --git a/src/synaptics.c b/src/synaptics.c
> index b1d027f..1a559a2 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -1196,8 +1196,7 @@ static Bool
>  SynapticsGetHwState(InputInfoPtr pInfo, SynapticsPrivate *priv,
>  		    struct SynapticsHwState *hw)
>  {
> -    return priv->proto_ops->ReadHwState(pInfo, priv->proto_ops,
> -					&priv->comm, hw);
> +    return priv->proto_ops->ReadHwState(pInfo, &priv->comm, hw);
>  }
>  
>  /*
> diff --git a/src/synproto.h b/src/synproto.h
> index a899a73..3fe70b9 100644
> --- a/src/synproto.h
> +++ b/src/synproto.h
> @@ -86,7 +86,6 @@ struct SynapticsProtocolOperations {
>      void (*DeviceOffHook)(InputInfoPtr pInfo);
>      Bool (*QueryHardware)(InputInfoPtr pInfo);
>      Bool (*ReadHwState)(InputInfoPtr pInfo,
> -			struct SynapticsProtocolOperations *proto_ops,
>  			struct CommData *comm, struct SynapticsHwState *hwRet);
>      Bool (*AutoDevProbe)(InputInfoPtr pInfo);
>      void (*ReadDevDimensions)(InputInfoPtr pInfo);
> -- 
> 1.7.3.5
> 


More information about the xorg-devel mailing list