From patchwork Sat May 30 02:24:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 6512231 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD4F2C0020 for ; Sat, 30 May 2015 02:25:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5CFB207AA for ; Sat, 30 May 2015 02:25:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E2300207AE for ; Sat, 30 May 2015 02:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757322AbbE3CZe (ORCPT ); Fri, 29 May 2015 22:25:34 -0400 Received: from ring0.de ([5.45.105.125]:54614 "EHLO ring0.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752782AbbE3CZd (ORCPT ); Fri, 29 May 2015 22:25:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 From: Sebastian Reichel To: dmitry.torokhov@gmail.com Cc: Pavel Machek , maxime.ripard@free-electrons.com, kernel list , linux-omap@vger.kernel.org, linux-input@vger.kernel.org, Sebastian Reichel Subject: [PATCH] Input: of_touchscreen - remove interdependence of max/fuzz values Date: Sat, 30 May 2015 04:24:34 +0200 Message-Id: <1432952674-15228-1-git-send-email-sre@kernel.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <20150530022111.GA28241@earth> References: <20150530022111.GA28241@earth> 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 Commit 3eea8b5d68c8 introduced a dependency between touchscreen-max-* and touchscreen-fuzz-*, so that either both must be specified or none of them. If only one of them is specified the other value will be reset to 0. This commit restores the previous behaviour, that the drivers default value will be used for the unspecified value. Reported-By: Pavel Machek Fixes: 3eea8b5d68c8 (Input: of_touchscreen - rework the DT parsing function) Signed-off-by: Sebastian Reichel --- drivers/input/touchscreen/of_touchscreen.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/of_touchscreen.c b/drivers/input/touchscreen/of_touchscreen.c index b82b520..7d2cf59 100644 --- a/drivers/input/touchscreen/of_touchscreen.c +++ b/drivers/input/touchscreen/of_touchscreen.c @@ -42,8 +42,11 @@ static void touchscreen_set_params(struct input_dev *dev, } absinfo = &dev->absinfo[axis]; - absinfo->maximum = max; - absinfo->fuzz = fuzz; + + if (max) + absinfo->maximum = max; + if (fuzz) + absinfo->fuzz = fuzz; } /** @@ -65,23 +68,17 @@ void touchscreen_parse_of_params(struct input_dev *dev) maximum = of_get_optional_u32(np, "touchscreen-size-x"); fuzz = of_get_optional_u32(np, "touchscreen-fuzz-x"); - if (maximum || fuzz) { - touchscreen_set_params(dev, ABS_X, maximum, fuzz); - touchscreen_set_params(dev, ABS_MT_POSITION_X, maximum, fuzz); - } + touchscreen_set_params(dev, ABS_X, maximum, fuzz); + touchscreen_set_params(dev, ABS_MT_POSITION_X, maximum, fuzz); maximum = of_get_optional_u32(np, "touchscreen-size-y"); fuzz = of_get_optional_u32(np, "touchscreen-fuzz-y"); - if (maximum || fuzz) { - touchscreen_set_params(dev, ABS_Y, maximum, fuzz); - touchscreen_set_params(dev, ABS_MT_POSITION_Y, maximum, fuzz); - } + touchscreen_set_params(dev, ABS_Y, maximum, fuzz); + touchscreen_set_params(dev, ABS_MT_POSITION_Y, maximum, fuzz); maximum = of_get_optional_u32(np, "touchscreen-max-pressure"); fuzz = of_get_optional_u32(np, "touchscreen-fuzz-pressure"); - if (maximum || fuzz) { - touchscreen_set_params(dev, ABS_PRESSURE, maximum, fuzz); - touchscreen_set_params(dev, ABS_MT_PRESSURE, maximum, fuzz); - } + touchscreen_set_params(dev, ABS_PRESSURE, maximum, fuzz); + touchscreen_set_params(dev, ABS_MT_PRESSURE, maximum, fuzz); } EXPORT_SYMBOL(touchscreen_parse_of_params);