All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
To: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Dmitry Torokhov
	<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	LM Sensors <lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [lm-sensors] [PATCH 1/5] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller
Date: Wed, 25 Dec 2013 02:40:58 -0800	[thread overview]
Message-ID: <20131225104058.GA18980@roeck-us.net> (raw)
In-Reply-To: <1387923847-1294-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Tue, Dec 24, 2013 at 11:24:03PM +0100, Hans de Goede wrote:
> Note the sun4i-ts controller is capable of detecting a second touch, but when
> a second touch is present then the accuracy becomes so bad the reported touch
> location is not useable.
> 
> The original android driver contains some complicated heuristics using the
> aprox. distance between the 2 touches to see if the user is making a pinch
> open / close movement, and then reports emulated multi-touch events around
> the last touch coordinate (as the dual-touch coordinates are worthless).
> 
> These kinds of heuristics are just asking for trouble (and don't belong
> in the kernel). So this driver offers straight forward, reliable single
> touch functionality only.
> 
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/input/touchscreen/Kconfig    |  10 ++
>  drivers/input/touchscreen/Makefile   |   1 +
>  drivers/input/touchscreen/sun4i-ts.c | 272 +++++++++++++++++++++++++++++++++++

[ ... ]

> +
> +static int sun4i_ts_probe(struct platform_device *pdev)
> +{
> +	struct sun4i_ts_data *ts;
> +	int ret = -ENOMEM;
> +
> +	ts = kzalloc(sizeof(struct sun4i_ts_data), GFP_KERNEL);

How about using devm_kzalloc() here ? That would simplify the cleanup
path significantly as you could just return from most error cases.

Guenter

WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux@roeck-us.net>
To: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Dmitry Torokhov
	<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	LM Sensors <lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [lm-sensors] [PATCH 1/5] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller
Date: Wed, 25 Dec 2013 10:40:58 +0000	[thread overview]
Message-ID: <20131225104058.GA18980@roeck-us.net> (raw)
In-Reply-To: <1387923847-1294-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Tue, Dec 24, 2013 at 11:24:03PM +0100, Hans de Goede wrote:
> Note the sun4i-ts controller is capable of detecting a second touch, but when
> a second touch is present then the accuracy becomes so bad the reported touch
> location is not useable.
> 
> The original android driver contains some complicated heuristics using the
> aprox. distance between the 2 touches to see if the user is making a pinch
> open / close movement, and then reports emulated multi-touch events around
> the last touch coordinate (as the dual-touch coordinates are worthless).
> 
> These kinds of heuristics are just asking for trouble (and don't belong
> in the kernel). So this driver offers straight forward, reliable single
> touch functionality only.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/input/touchscreen/Kconfig    |  10 ++
>  drivers/input/touchscreen/Makefile   |   1 +
>  drivers/input/touchscreen/sun4i-ts.c | 272 +++++++++++++++++++++++++++++++++++

[ ... ]

> +
> +static int sun4i_ts_probe(struct platform_device *pdev)
> +{
> +	struct sun4i_ts_data *ts;
> +	int ret = -ENOMEM;
> +
> +	ts = kzalloc(sizeof(struct sun4i_ts_data), GFP_KERNEL);

How about using devm_kzalloc() here ? That would simplify the cleanup
path significantly as you could just return from most error cases.

Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

WARNING: multiple messages have this Message-ID (diff)
From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [lm-sensors] [PATCH 1/5] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller
Date: Wed, 25 Dec 2013 02:40:58 -0800	[thread overview]
Message-ID: <20131225104058.GA18980@roeck-us.net> (raw)
In-Reply-To: <1387923847-1294-2-git-send-email-hdegoede@redhat.com>

On Tue, Dec 24, 2013 at 11:24:03PM +0100, Hans de Goede wrote:
> Note the sun4i-ts controller is capable of detecting a second touch, but when
> a second touch is present then the accuracy becomes so bad the reported touch
> location is not useable.
> 
> The original android driver contains some complicated heuristics using the
> aprox. distance between the 2 touches to see if the user is making a pinch
> open / close movement, and then reports emulated multi-touch events around
> the last touch coordinate (as the dual-touch coordinates are worthless).
> 
> These kinds of heuristics are just asking for trouble (and don't belong
> in the kernel). So this driver offers straight forward, reliable single
> touch functionality only.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/input/touchscreen/Kconfig    |  10 ++
>  drivers/input/touchscreen/Makefile   |   1 +
>  drivers/input/touchscreen/sun4i-ts.c | 272 +++++++++++++++++++++++++++++++++++

[ ... ]

> +
> +static int sun4i_ts_probe(struct platform_device *pdev)
> +{
> +	struct sun4i_ts_data *ts;
> +	int ret = -ENOMEM;
> +
> +	ts = kzalloc(sizeof(struct sun4i_ts_data), GFP_KERNEL);

How about using devm_kzalloc() here ? That would simplify the cleanup
path significantly as you could just return from most error cases.

Guenter

  parent reply	other threads:[~2013-12-25 10:40 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-24 22:24 [PATCH 0/5] input: Add new sun4i-ts driver for Allwinner sunxi SoC's Hans de Goede
2013-12-24 22:24 ` Hans de Goede
2013-12-24 22:24 ` [lm-sensors] " Hans de Goede
     [not found] ` <1387923847-1294-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-24 22:24   ` [PATCH 1/5] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller Hans de Goede
2013-12-24 22:24     ` Hans de Goede
2013-12-24 22:24     ` [lm-sensors] " Hans de Goede
     [not found]     ` <1387923847-1294-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-25 10:40       ` Guenter Roeck [this message]
2013-12-25 10:40         ` Guenter Roeck
2013-12-25 10:40         ` Guenter Roeck
2013-12-26  8:37       ` Thomas Petazzoni
2013-12-26  8:37         ` Thomas Petazzoni
2013-12-26  8:37         ` [lm-sensors] " Thomas Petazzoni
2013-12-26 22:15     ` Dmitry Torokhov
2013-12-26 22:15       ` Dmitry Torokhov
2013-12-26 22:15       ` [lm-sensors] " Dmitry Torokhov
     [not found]       ` <20131226221558.GA18562-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>
2013-12-26 22:33         ` Hans de Goede
2013-12-26 22:33           ` Hans de Goede
2013-12-26 22:33           ` [lm-sensors] " Hans de Goede
     [not found]           ` <52BCAEA2.6040607-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-26 23:30             ` Dmitry Torokhov
2013-12-26 23:30               ` Dmitry Torokhov
2013-12-26 23:30               ` [lm-sensors] " Dmitry Torokhov
2013-12-24 22:24   ` [PATCH 2/5] input: sun4i-ts: Add support for temperature sensor Hans de Goede
2013-12-24 22:24     ` Hans de Goede
2013-12-24 22:24     ` [lm-sensors] " Hans de Goede
     [not found]     ` <1387923847-1294-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-25 10:37       ` Guenter Roeck
2013-12-25 10:37         ` Guenter Roeck
2013-12-25 10:37         ` Guenter Roeck
     [not found]         ` <20131225103723.GA18256-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-12-25 10:54           ` Hans de Goede
2013-12-25 10:54             ` [linux-sunxi] " Hans de Goede
2013-12-25 10:54             ` [lm-sensors] [linux-sunxi] " Hans de Goede
     [not found]             ` <52BAB963.30707-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-26 22:19               ` Re: [lm-sensors] " Dmitry Torokhov
2013-12-26 22:19                 ` [linux-sunxi] " Dmitry Torokhov
2013-12-26 22:19                 ` [lm-sensors] [linux-sunxi] " Dmitry Torokhov
2013-12-26  8:39       ` Thomas Petazzoni
2013-12-26  8:39         ` Thomas Petazzoni
2013-12-26  8:39         ` [lm-sensors] " Thomas Petazzoni
2013-12-24 22:24   ` [PATCH 3/5] ARM: dts: sun4i: Add rtp controller node Hans de Goede
2013-12-24 22:24     ` Hans de Goede
2013-12-24 22:24     ` [lm-sensors] " Hans de Goede
2013-12-24 22:24   ` [PATCH 4/5] ARM: dts: sun5i: " Hans de Goede
2013-12-24 22:24     ` Hans de Goede
2013-12-24 22:24     ` [lm-sensors] " Hans de Goede
2013-12-24 22:24   ` [PATCH 5/5] ARM: dts: sun7i: " Hans de Goede
2013-12-24 22:24     ` Hans de Goede
2013-12-24 22:24     ` [lm-sensors] " Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131225104058.GA18980@roeck-us.net \
    --to=linux-0h96xk9xttrk1umjsbkqmq@public.gmane.org \
    --cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.