From patchwork Tue Apr 9 17:23:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 10891831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 555FB1708 for ; Tue, 9 Apr 2019 17:24:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44AC028942 for ; Tue, 9 Apr 2019 17:24:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3964A2894C; Tue, 9 Apr 2019 17:24:23 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 C9DB728942 for ; Tue, 9 Apr 2019 17:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726636AbfDIRYV (ORCPT ); Tue, 9 Apr 2019 13:24:21 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35594 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726556AbfDIRYU (ORCPT ); Tue, 9 Apr 2019 13:24:20 -0400 Received: by mail-pf1-f196.google.com with SMTP id t21so7796636pfh.2; Tue, 09 Apr 2019 10:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BTbLDR4gnZ7lFPmSCCa0QIInTL3LtlTlBWa9cvu84sM=; b=NgO5WhP0ViQOQ67MmOnc7P+BOFX3ODs7bfwlSYsjIjsI5fLs7fClX2BQb9B74V9V2r B2+0DNQz7+Sd2ACrzYmYPZh9jkuOZrdQ4ViO4Vxbk8c6z6MsXk3hKxD2dT0b5DBFKKdt h1j43GRpUvri0iiGPK0zp3Q66FvPqEpIPrxTHWg4p9JLdMwBe2p66s1w2QYi+0iYTpFY vMw9ltLbGBH03rQ4f/Y8N+vl3m2LHycYqUzyn6qDVbQCDAj3LyizmZD2sXc5YG5pbCcL HsORUjjWHifwHn1sFQxQc/ZS+gZi3fSzJlsOVefy+sl94Is0Pui2LxnthGmws+9HDekX IQtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=BTbLDR4gnZ7lFPmSCCa0QIInTL3LtlTlBWa9cvu84sM=; b=f8n97yX9F5l1UkKvzJ06Dcf7ImjaqJuv12yQuxnWluGgZxzg9ENY81wuntcA6tuK3S a8T1EjHAJeNx64g9PNEGriIpqa5nFJxILU4lIffA2yusYXuzcBYz3S6kA5gVKB0Q1L1L bj6lo5mW3+6lwy4WEf2Dbmkt9mu18/c9sTFSGZg46+Hwe0y/Y96uC1obQBw3h4HUDBDd 5xuK2IjkwNVMmQ5y6GiVS4G4rZWnJw4dhfCPgETCHS3C+up7dbO3dZHZeTEzi3huLRn5 IqEGrIGtjwz37TjHrNn1gzMJX/8sCaHh7g09qaxJ+je5s5apzguKx/u9CAU2O8c2Nzw5 ptLg== X-Gm-Message-State: APjAAAU3WnpFqGncExh5cCPulc5wMqzzo3zDUQRlZVZCr75REeousi6B OSGHpyh6+8Bxt+k3oC3TF+M= X-Google-Smtp-Source: APXvYqyZbGEfHz99IbERUPIpeCYQUuPgVmJryMgmJIIz/W2Vu7ABU/1nqFf6vzsqsu0Q0MAQGbGecA== X-Received: by 2002:a63:2f44:: with SMTP id v65mr35494829pgv.141.1554830660198; Tue, 09 Apr 2019 10:24:20 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 4sm45069219pfn.159.2019.04.09.10.24.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 10:24:19 -0700 (PDT) From: Guenter Roeck To: Wim Van Sebroeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH 06/23] watchdog: mlx_wdt: Use 'dev' instead of dereferencing it repeatedly Date: Tue, 9 Apr 2019 10:23:44 -0700 Message-Id: <1554830641-9247-7-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554830641-9247-1-git-send-email-linux@roeck-us.net> References: <1554830641-9247-1-git-send-email-linux@roeck-us.net> Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce local variable 'struct device *dev' and use it instead of dereferencing it repeatedly. The 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 Signed-off-by: Guenter Roeck --- drivers/watchdog/mlx_wdt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/watchdog/mlx_wdt.c b/drivers/watchdog/mlx_wdt.c index 70c2cbf9c993..03b9ac4b99af 100644 --- a/drivers/watchdog/mlx_wdt.c +++ b/drivers/watchdog/mlx_wdt.c @@ -233,20 +233,21 @@ static int mlxreg_wdt_init_timeout(struct mlxreg_wdt *wdt, static int mlxreg_wdt_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct mlxreg_core_platform_data *pdata; struct mlxreg_wdt *wdt; int rc; - pdata = dev_get_platdata(&pdev->dev); + pdata = dev_get_platdata(dev); if (!pdata) { - dev_err(&pdev->dev, "Failed to get platform data.\n"); + dev_err(dev, "Failed to get platform data.\n"); return -EINVAL; } - wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); if (!wdt) return -ENOMEM; - wdt->wdd.parent = &pdev->dev; + wdt->wdd.parent = dev; wdt->regmap = pdata->regmap; mlxreg_wdt_config(wdt, pdata); @@ -266,12 +267,11 @@ static int mlxreg_wdt_probe(struct platform_device *pdev) set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); } mlxreg_wdt_check_card_reset(wdt); - rc = devm_watchdog_register_device(&pdev->dev, &wdt->wdd); + rc = devm_watchdog_register_device(dev, &wdt->wdd); register_error: if (rc) - dev_err(&pdev->dev, - "Cannot register watchdog device (err=%d)\n", rc); + dev_err(dev, "Cannot register watchdog device (err=%d)\n", rc); return rc; }