[PATCH synaptics] Return true/false from SetDeviceAndProtocol

Jeremy Huddleston jeremyhu at apple.com
Tue Nov 29 23:46:23 PST 2011


Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On Nov 29, 2011, at 3:40 PM, Peter Hutterer wrote:

> Instead of requiring the caller to know which private field indicates
> failure, just return true on success or false on failure.
> 
> No functional change.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> src/synaptics.c |    7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/synaptics.c b/src/synaptics.c
> index 1c9b6db..8fbddc8 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -265,7 +265,7 @@ SanitizeDimensions(InputInfoPtr pInfo)
>     }
> }
> 
> -static void
> +static Bool
> SetDeviceAndProtocol(InputInfoPtr pInfo)
> {
>     SynapticsPrivate *priv = pInfo->private;
> @@ -286,6 +286,8 @@ SetDeviceAndProtocol(InputInfoPtr pInfo)
>     free(device);
> 
>     priv->proto_ops = protocols[i].proto_ops;
> +
> +    return (priv->proto_ops != NULL);
> }
> 
> /*
> @@ -714,8 +716,7 @@ SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
>     }
> 
>     /* may change pInfo->options */
> -    SetDeviceAndProtocol(pInfo);
> -    if (priv->proto_ops == NULL) {
> +    if (!SetDeviceAndProtocol(pInfo)) {
>         xf86IDrvMsg(pInfo, X_ERROR, "Synaptics driver unable to detect protocol\n");
>         goto SetupProc_fail;
>     }
> -- 
> 1.7.7.1
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list