All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: "russianneuromancer @ ya . ru" <russianneuromancer@ya.ru>,
	Gregor Riepl <onitake@gmail.com>,
	linux-input@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 1/4] input: of_touchscreen: Preserve flags passed into touchscreen_parse_properties
Date: Fri,  9 Dec 2016 11:35:19 +0100	[thread overview]
Message-ID: <20161209103522.3833-1-hdegoede@redhat.com> (raw)

touchscreen_parse_properties preserves the exisiting max and fuzz
values for axis if not specified as a device_property.

But it would set invert_x / invert_y / swap_x_y to false when
not specified as a device_property, rather then preserving them,
this is not consistent.

All current users of touchscreen_parse_properties pass in a kzalloc-ed
struct touchscreen_properties (or NULL), so preserving the existing
value for these flags preserves existing behavior.

Allowing a caller of touchscreen_parse_properties to set one of these
flags beforehand is useful on ACPI based tablets, where the ACPI
touchscreen node often only contains info on the gpio and the irq
and is missing any info on the axis. In this case drivers may want
to fill in some of these values based on e.g. DMI identification
if a specific model tablet before calling touchscreen_parse_properties.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/input/touchscreen/of_touchscreen.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/of_touchscreen.c b/drivers/input/touchscreen/of_touchscreen.c
index 8d7f9c8..180a334 100644
--- a/drivers/input/touchscreen/of_touchscreen.c
+++ b/drivers/input/touchscreen/of_touchscreen.c
@@ -116,12 +116,12 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch,
 
 	prop->max_x = input_abs_get_max(input, axis);
 	prop->max_y = input_abs_get_max(input, axis + 1);
-	prop->invert_x =
-		device_property_read_bool(dev, "touchscreen-inverted-x");
-	prop->invert_y =
-		device_property_read_bool(dev, "touchscreen-inverted-y");
-	prop->swap_x_y =
-		device_property_read_bool(dev, "touchscreen-swapped-x-y");
+	if (device_property_read_bool(dev, "touchscreen-inverted-x"))
+		prop->invert_x = true;
+	if (device_property_read_bool(dev, "touchscreen-inverted-y"))
+		prop->invert_y = true;
+	if (device_property_read_bool(dev, "touchscreen-swapped-x-y"))
+		prop->swap_x_y = true;
 
 	if (prop->swap_x_y)
 		swap(input->absinfo[axis], input->absinfo[axis + 1]);
-- 
2.9.3


             reply	other threads:[~2016-12-09 10:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09 10:35 Hans de Goede [this message]
2016-12-09 10:35 ` [PATCH 2/4] Input: silead_gsl1680: gpiod_get returning -EBUSY is not an error Hans de Goede
2016-12-27 22:14   ` Dmitry Torokhov
2016-12-31 16:45     ` Hans de Goede
2016-12-31 17:06       ` Gregor Riepl
2016-12-31 18:57         ` Hans de Goede
2016-12-09 10:35 ` [PATCH 3/4] Input: silead_gsl1680: Allow silead_ts_read_props to override default resolution Hans de Goede
2016-12-09 10:35 ` [PATCH 4/4] Input: silead_gsl1680: Add support for setting resolution based on dmi data Hans de Goede
2016-12-27 22:27   ` Dmitry Torokhov
2016-12-31 17:09     ` 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=20161209103522.3833-1-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=onitake@gmail.com \
    --cc=russianneuromancer@ya.ru \
    /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.