From patchwork Tue Apr 9 17:23:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 10891841 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 B1E7A1515 for ; Tue, 9 Apr 2019 17:25:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E3982839C for ; Tue, 9 Apr 2019 17:25:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9187528947; Tue, 9 Apr 2019 17:25:08 +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 35E152839C for ; Tue, 9 Apr 2019 17:25:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726513AbfDIRZC (ORCPT ); Tue, 9 Apr 2019 13:25:02 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42001 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726917AbfDIRYl (ORCPT ); Tue, 9 Apr 2019 13:24:41 -0400 Received: by mail-pg1-f193.google.com with SMTP id p6so9680840pgh.9; Tue, 09 Apr 2019 10:24:41 -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=LjXyeY61Q8IuuG1hh9T51lQPEaZHlcAN/+KWHwI+dVE=; b=dXIHLeaKyxHPjUY4JJgxryi/6ufUxkP/CHFSdqR+fmn0stHaLNbGM5agKZyAKvgMTD EOF5aSlOlf59xUDvJy6CfvpYsn0M9fUhOgyO3LoyWnoiUCQPDQ3r1bDRgtGa1jpXJWs9 yD0ZZ1ZFC331fibCFf7eWP0QEEWFG4811ypbEUw1eDbieVcneiqnWyWFWRj8qJLKT0LQ L210dAJJ1HbGzBTlIwjh5zBW8MlF4VeMKX9MuZaIILM9VkwKFc6ZM52IJwdKQWz9sDju CwFns9vk6yZFC5AVJfqiZq2lDMQ+Ml1hZApt07Nsyfp+zr0XF3I+uAkWKAE1ruBJwZE1 ZnZw== 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=LjXyeY61Q8IuuG1hh9T51lQPEaZHlcAN/+KWHwI+dVE=; b=Wvp5xhUBZJ6bqmrMueURxIITvC9i/QhNq24RSLTzk5lHrBPQBz3WivSdAjy6G6NYBH +s7wj1hP1qA0JKqCidGz4ns4UFNa8ez+GQSPne6VqUnPKlhBSVpwFzsLhoZu17fVAXIL 6XKygLZRIGJ1qDy6Hrvjfu5giJBuCw29BG4DVYsix37R3KFrWDos4GCOo2NJQ6bMzHrq /8IKShL3ymHZPhEQhJncV3nQ1kaexde+gWfTR3nnU9h4hFd8bXDZnbESjG9ftVxNc0rp NL92rXeNzLPsy4f6G6FmV5eOVY4m7VdbpJaKmwVBLdYUp/InIig1Iz/MAiEAtCOA/iAG pmog== X-Gm-Message-State: APjAAAWCO9Fsddtm8cDOPbtahKDNtBpTD/RhX2Qyy8gSgH7lMAgRDG0p 0ea957eUAEXUO0Yo4hsGMvKqWbkO X-Google-Smtp-Source: APXvYqwwX4X15/vOJSIOcGoNs31H6HZ1IkyLKtNz6ucoR3CGTvSkSnFaYZjXFCbBiPa0GCd/lU9leA== X-Received: by 2002:a63:c104:: with SMTP id w4mr36190874pgf.409.1554830681136; Tue, 09 Apr 2019 10:24:41 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id s9sm17492543pfe.183.2019.04.09.10.24.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 10:24:40 -0700 (PDT) From: Guenter Roeck To: Wim Van Sebroeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH 21/23] watchdog: stpmic1_wdt: Use 'dev' instead of dereferencing it repeatedly Date: Tue, 9 Apr 2019 10:23:59 -0700 Message-Id: <1554830641-9247-22-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/stpmic1_wdt.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/watchdog/stpmic1_wdt.c b/drivers/watchdog/stpmic1_wdt.c index ad431d8ad95f..45d0c543466f 100644 --- a/drivers/watchdog/stpmic1_wdt.c +++ b/drivers/watchdog/stpmic1_wdt.c @@ -81,18 +81,19 @@ static const struct watchdog_ops pmic_watchdog_ops = { static int pmic_wdt_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; int ret; struct stpmic1 *pmic; struct stpmic1_wdt *wdt; - if (!pdev->dev.parent) + if (!dev->parent) return -EINVAL; - pmic = dev_get_drvdata(pdev->dev.parent); + pmic = dev_get_drvdata(dev->parent); if (!pmic) return -EINVAL; - wdt = devm_kzalloc(&pdev->dev, sizeof(struct stpmic1_wdt), GFP_KERNEL); + wdt = devm_kzalloc(dev, sizeof(struct stpmic1_wdt), GFP_KERNEL); if (!wdt) return -ENOMEM; @@ -102,15 +103,15 @@ static int pmic_wdt_probe(struct platform_device *pdev) wdt->wdtdev.ops = &pmic_watchdog_ops; wdt->wdtdev.min_timeout = PMIC_WDT_MIN_TIMEOUT; wdt->wdtdev.max_timeout = PMIC_WDT_MAX_TIMEOUT; - wdt->wdtdev.parent = &pdev->dev; + wdt->wdtdev.parent = dev; wdt->wdtdev.timeout = PMIC_WDT_DEFAULT_TIMEOUT; - watchdog_init_timeout(&wdt->wdtdev, 0, &pdev->dev); + watchdog_init_timeout(&wdt->wdtdev, 0, dev); watchdog_set_nowayout(&wdt->wdtdev, nowayout); watchdog_set_drvdata(&wdt->wdtdev, wdt); - ret = devm_watchdog_register_device(&pdev->dev, &wdt->wdtdev); + ret = devm_watchdog_register_device(dev, &wdt->wdtdev); if (ret) return ret;