From patchwork Fri Dec 9 10:35:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9467815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4BBFD60586 for ; Fri, 9 Dec 2016 10:35:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40C2A28573 for ; Fri, 9 Dec 2016 10:35:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 320F7285B7; Fri, 9 Dec 2016 10:35:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9B6128573 for ; Fri, 9 Dec 2016 10:35:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932393AbcLIKf0 (ORCPT ); Fri, 9 Dec 2016 05:35:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46136 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932349AbcLIKf0 (ORCPT ); Fri, 9 Dec 2016 05:35:26 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 80B3781F07; Fri, 9 Dec 2016 10:35:25 +0000 (UTC) Received: from shalem.localdomain.com (vpn1-6-165.ams2.redhat.com [10.36.6.165]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB9AZNef008389; Fri, 9 Dec 2016 05:35:24 -0500 From: Hans de Goede To: Dmitry Torokhov Cc: "russianneuromancer @ ya . ru" , Gregor Riepl , linux-input@vger.kernel.org, Hans de Goede Subject: [PATCH 1/4] input: of_touchscreen: Preserve flags passed into touchscreen_parse_properties Date: Fri, 9 Dec 2016 11:35:19 +0100 Message-Id: <20161209103522.3833-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 09 Dec 2016 10:35:25 +0000 (UTC) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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]);