[PATCH evemu 5/5] Use accessors instead of direct access fields

Peter Hutterer peter.hutterer at who-t.net
Mon Nov 11 15:10:51 PST 2013


On Mon, Nov 11, 2013 at 05:04:09PM -0500, Benjamin Tissoires wrote:
> 
> 
> On Thu, Oct 24, 2013 at 2:03 AM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> > No functional changes, this is preparation work for the libevdev backend.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> 
> Any particular reasons for not having converted all of the direct access fields?
> Do you mind if I add (or squash) on top of that the patch attached in the end?
> There is still some direct uses, but I'm not sure whether we should convert them or not...

no specific reasons, but this branch jumped around a few times so must've
been a bad rebase. feel free to squash the patch in, thanks.
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
   Peter


> BTW, I applied 2-4:
> 427c2fd..dd8d5e7  master -> master
> 
> Cheers,
> Benjamin
> 
> --
> 
> From 096c282bc532a6fc79a63e65620017d49680ee71 Mon Sep 17 00:00:00 2001
> From: Benjamin Tissoires <benjamin.tissoires at redhat.com>
> Date: Mon, 11 Nov 2013 17:01:01 -0500
> Subject: [PATCH evemu] Use accessors instead of direct access fields (second
>  round)
> 
> No functional changes.
> 
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires at redhat.com>
> ---
>  src/evemu.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/src/evemu.c b/src/evemu.c
> index f2fcb7c..2d6864f 100644
> --- a/src/evemu.c
> +++ b/src/evemu.c
> @@ -368,12 +368,12 @@ static void write_desc(const struct evemu_device *dev, FILE *fp)
>  					    "#       Fuzz  %6d\n"
>  					    "#       Flat  %6d\n"
>  					    "#       Resolution %d\n",
> -					    dev->abs[j].value,
> -					    dev->abs[j].minimum,
> -					    dev->abs[j].maximum,
> -					    dev->abs[j].fuzz,
> -					    dev->abs[j].flat,
> -					    dev->abs[j].resolution);
> +					    evemu_get_abs_current_value(dev, j),
> +					    evemu_get_abs_minimum(dev, j),
> +					    evemu_get_abs_maximum(dev,j),
> +					    evemu_get_abs_fuzz(dev, j),
> +					    evemu_get_abs_flat(dev, j),
> +					    evemu_get_abs_resolution(dev, j));
>  			}
>  		}
>  	}
> @@ -877,7 +877,7 @@ static int set_mask(const struct evemu_device *dev, int type, int fd)
>  
>  		/* kernel doesn't like those */
>  		if (type == EV_ABS &&
> -			dev->abs[i].maximum == 0 && dev->abs[i].minimum == 0)
> +			evemu_get_abs_maximum(dev, i) == 0 && evemu_get_abs_minimum(dev, i) == 0)
>  			continue;
>  
>  		ret = set_event_bit(fd, type, i);
> @@ -898,10 +898,10 @@ int evemu_create(const struct evemu_device *dev, int fd)
>  	for (i = 0; i < ABS_CNT; i++) {
>  		if (!evemu_has_event(dev, EV_ABS, i))
>  			continue;
> -		udev.absmax[i] = dev->abs[i].maximum;
> -		udev.absmin[i] = dev->abs[i].minimum;
> -		udev.absfuzz[i] = dev->abs[i].fuzz;
> -		udev.absflat[i] = dev->abs[i].flat;
> +		udev.absmax[i] = evemu_get_abs_maximum(dev, i);
> +		udev.absmin[i] = evemu_get_abs_minimum(dev, i);
> +		udev.absfuzz[i] = evemu_get_abs_fuzz(dev, i);
> +		udev.absflat[i] = evemu_get_abs_flat(dev, i);
>  	}
>  
>  	ret = set_prop(dev, fd);
> -- 
> 1.8.3.1
> 


More information about the Input-tools mailing list