From patchwork Sat Jan 21 18:45:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9530581 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 7095E6046E for ; Sat, 21 Jan 2017 18:47:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62C5C28468 for ; Sat, 21 Jan 2017 18:47:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56FB0283EF; Sat, 21 Jan 2017 18:47:35 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 C89B128468 for ; Sat, 21 Jan 2017 18:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751486AbdAUSr3 (ORCPT ); Sat, 21 Jan 2017 13:47:29 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:49623 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751472AbdAUSrT (ORCPT ); Sat, 21 Jan 2017 13:47:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=References:In-Reply-To:Message-Id:Date:Subject: Cc:To:From; bh=QOfOUom6HpU3zfn0L8CVrGLnxAxslZxd7EzdJ2hlOIU=; b=IHXqfhLkugYOvP YOSZVIdFl+8bzK/N7Z7xW8Luco5UnALGxcVE8o/sSbZF5D62mcnvJ+8/oqICo557+ECZnbpH/d/5L /TquZtomqMyp0+KBobGjej2wxPDcPbjoT7BG/PsyiX2xjnl0rbQitE6sJjRuEnVA22zgaKCdTiLXf 3MR3tuKh7FNCDZFOBT3GbHpoXA20FGQ5DjmMi/gIpChY1aHmKXd7zXGJ1b1i8cG4A5gRspZeD3+3N LUaJtpdaT0Ob70Y30XsxaPyB61VmpVPtAg0fQhGRgSykxr5RTJPRLgQWQB9opnqim7vdvCnh2z+Ad XwbgMG2KJIeWmb6oifLQ==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:48084 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1cV0h3-001scY-NX; Sat, 21 Jan 2017 18:47:18 +0000 From: Guenter Roeck To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Dan Murphy , Jingkui Wang , John Stultz , Jorge Ramirez-Ortiz Subject: [PATCH 05/13] Input: misc - Use local variables consistently Date: Sat, 21 Jan 2017 10:45:57 -0800 Message-Id: <1485024365-3368-6-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485024365-3368-1-git-send-email-linux@roeck-us.net> References: <1485024365-3368-1-git-send-email-linux@roeck-us.net> X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: 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 If a function declares a variable to access a structure element, use it conssistently. The conversion was done automatically with coccinelle using the following semantic patch. // Catch function parameters. // Handle those first to trigger reformatting. @@ identifier d; identifier fn; identifier svar; identifier elem; type T; identifier i; expression e; identifier fn; expression list es; @@ fn(...) { ... T d = &svar->elem; <... when != d = e; - fn(&svar->elem, es) + fn(d, es) ...> } // Now address non-functions and multiple transformations in function // parameters. @@ identifier d; identifier fn; identifier svar; identifier elem; type T; identifier i; expression e; @@ fn(...) { ... T d = &svar->elem; <... when != d = e; ( - &svar->elem + d | - svar->elem.i + d->i ) ...> } Signed-off-by: Guenter Roeck --- drivers/input/misc/drv260x.c | 2 +- drivers/input/misc/gpio_tilt_polled.c | 2 +- drivers/input/misc/hisi_powerkey.c | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index 0a2b865b1000..fb089d36c0d6 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c @@ -538,7 +538,7 @@ static int drv260x_probe(struct i2c_client *client, haptics->input_dev = devm_input_allocate_device(dev); if (!haptics->input_dev) { - dev_err(&client->dev, "Failed to allocate input device\n"); + dev_err(dev, "Failed to allocate input device\n"); return -ENOMEM; } diff --git a/drivers/input/misc/gpio_tilt_polled.c b/drivers/input/misc/gpio_tilt_polled.c index f103b99d1852..6e217a45e39a 100644 --- a/drivers/input/misc/gpio_tilt_polled.c +++ b/drivers/input/misc/gpio_tilt_polled.c @@ -138,7 +138,7 @@ static int gpio_tilt_polled_probe(struct platform_device *pdev) input->name = pdev->name; input->phys = DRV_NAME"/input0"; - input->dev.parent = &pdev->dev; + input->dev.parent = dev; input->id.bustype = BUS_HOST; input->id.vendor = 0x0001; diff --git a/drivers/input/misc/hisi_powerkey.c b/drivers/input/misc/hisi_powerkey.c index 675539c529ce..c4c42124a059 100644 --- a/drivers/input/misc/hisi_powerkey.c +++ b/drivers/input/misc/hisi_powerkey.c @@ -75,9 +75,9 @@ static int hi65xx_powerkey_probe(struct platform_device *pdev) struct input_dev *input; int irq, i, error; - input = devm_input_allocate_device(&pdev->dev); + input = devm_input_allocate_device(dev); if (!input) { - dev_err(&pdev->dev, "failed to allocate input device\n"); + dev_err(dev, "failed to allocate input device\n"); return -ENOMEM; } @@ -111,12 +111,11 @@ static int hi65xx_powerkey_probe(struct platform_device *pdev) error = input_register_device(input); if (error) { - dev_err(&pdev->dev, "failed to register input device: %d\n", - error); + dev_err(dev, "failed to register input device: %d\n", error); return error; } - device_init_wakeup(&pdev->dev, 1); + device_init_wakeup(dev, 1); return 0; }