From patchwork Wed Jan 18 17:46:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9524447 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 D32506020B for ; Wed, 18 Jan 2017 17:51:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C386726E8A for ; Wed, 18 Jan 2017 17:51:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B819E2860E; Wed, 18 Jan 2017 17:51: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 2D08126E8A for ; Wed, 18 Jan 2017 17:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753109AbdARRvd (ORCPT ); Wed, 18 Jan 2017 12:51:33 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:58939 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753312AbdARRsy (ORCPT ); Wed, 18 Jan 2017 12:48:54 -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=vYN3Sj6vktFW7hv92NWZtmTNseBsHEhPRZ2jiGqombY=; b=tboelPLZXiuQIi jZCg8APnNnpyHKrWBTNnqj8CI82Wd+WjUfgkpEHG/aUuS0MuihdUq2tZTe36qX+onkbBzh6ePfTpk nmFPsYMu+Mc6XHgWr33Q+ByUpfLqnF0j2AY+QKHQZCBBwGRQSuRf3CW4+LOBJBsU+lKfX2xJbulIY gfA0sgO6LSQvDjHQLtOdWK1/4/g6d7C2fCkpK0IiGtRdNoKWnmM0/bkhYraZ/6JtwFPeDXVR9IHIb De86AbM6PnXLs7Cb3xyWMzYcsiX3JRt1Vhn9eDLmrH8beebZWVid2iQygCbtPc62Hq+8Q/FUqcl8r y0KS945RKJoMCxfdoalQ==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:45172 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1cTuKz-001kA7-H8; Wed, 18 Jan 2017 17:47:57 +0000 From: Guenter Roeck To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes Date: Wed, 18 Jan 2017 09:46:34 -0800 Message-Id: <1484761614-12225-14-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484761614-12225-1-git-send-email-linux@roeck-us.net> References: <1484761614-12225-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 Use local variable 'dev' instead of dereferencing it several times. Other relevant changes: Replace devm_add_action() with devm_add_action_or_reset() This conversion was done automatically with coccinelle using the following semantic patches. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches - Replace devm_add_action() followed by failure action with devm_add_action_or_reset() - Drop unnecessary braces around conditional return statements - Use local variable 'struct device *dev' consistently Signed-off-by: Guenter Roeck --- drivers/input/misc/bfin_rotary.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c index a0fc18fdfc0c..9f5790c6e06b 100644 --- a/drivers/input/misc/bfin_rotary.c +++ b/drivers/input/misc/bfin_rotary.c @@ -141,25 +141,23 @@ static int bfin_rotary_probe(struct platform_device *pdev) /* Basic validation */ if ((pdata->rotary_up_key && !pdata->rotary_down_key) || - (!pdata->rotary_up_key && pdata->rotary_down_key)) { + (!pdata->rotary_up_key && pdata->rotary_down_key)) return -EINVAL; - } if (pdata->pin_list) { error = peripheral_request_list(pdata->pin_list, - dev_name(&pdev->dev)); + dev_name(dev)); if (error) { dev_err(dev, "requesting peripherals failed: %d\n", error); return error; } - error = devm_add_action(dev, bfin_rotary_free_action, - pdata->pin_list); + error = devm_add_action_or_reset(dev, bfin_rotary_free_action, + pdata->pin_list); if (error) { dev_err(dev, "setting cleanup action failed: %d\n", error); - peripheral_free_list(pdata->pin_list); return error; } } @@ -189,7 +187,7 @@ static int bfin_rotary_probe(struct platform_device *pdev) input->name = pdev->name; input->phys = "bfin-rotary/input0"; - input->dev.parent = &pdev->dev; + input->dev.parent = dev; input_set_drvdata(input, rotary); @@ -224,8 +222,8 @@ static int bfin_rotary_probe(struct platform_device *pdev) return -ENOENT; } - error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, - 0, dev_name(dev), rotary); + error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, 0, + dev_name(dev), rotary); if (error) { dev_err(dev, "unable to claim irq %d; error %d\n", rotary->irq, error); @@ -239,7 +237,7 @@ static int bfin_rotary_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, rotary); - device_init_wakeup(&pdev->dev, 1); + device_init_wakeup(dev, 1); return 0; }