Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5129677yba; Wed, 10 Apr 2019 12:01:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAW01b+AOcsX7k/dE8X6Eep/fATRRhMSDAlwDCWWoXYiIJXfCd8wwG0kEr3LRUM0aqjZHc X-Received: by 2002:aa7:818a:: with SMTP id g10mr43852792pfi.178.1554922888163; Wed, 10 Apr 2019 12:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554922888; cv=none; d=google.com; s=arc-20160816; b=1HIj21ohUSKEcBry4hnJ61iIubbYbVrmsXmP3dZNamb5lipwvqFuQkMQBjDZtSNZP4 Q6Ggy6RjhuvvdWn7NqcsW1v9IwO00RA0vDiugoGlAN6du46svxOt8RC+0gELqFjaHgGT KZZpTPvv1XMVkk8FCh3BymQBGurmTQtGztb3VcFNLa7rQTUHtLqYH4LY1UTdxF9P9fhl 2qEhGH0WIPF9T9SORC/eWMtI4OgM4BfwwjfEdt+XiKy7yah15vqGW03Y8bniMYTZV5Xf o4zAzwiz5/WVQzmLWCSQ5GFdQNC35hjhDe0MonOW7G0GkxTGD+a5ued0LAMEzvCjfYZw 2alA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=seHjBqaBud1mYkVOqcRVoUipgYEoJz3N4GGlHqlC5Ho=; b=sCHCwLNijUKeBvgPzjtBVZzD8tvT2V9KpIVsTYYpvV8W7XAFr9UGshmcIT5dO9dioU jbIANKmb+8EQbsiNKu4DsOVAlyIIpURRvycqaZLbC+lz+WxBBaJMiniprebtn7nkFmZI 6+4TW5hZmfxdvOjejdxxjUw8NuUuraNMtjTe8bVva8VNCBg4/ySsTdySLI8hHahLx1lB nsQAGOag8PbAGK4xOwSzwlqsXY7LTaco0nTrZ6zhwhbkWzkYmJJvdWtYiHEnOnITk/pW 0ER9MakJXe5Y97X8FqdZeverxQhsl1m1Pf6ciTMlgsbrATqhWFotRydVluqVBwGVY+b2 hsLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="fhnCtIi/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z72si32178417pgd.401.2019.04.10.12.01.12; Wed, 10 Apr 2019 12:01:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="fhnCtIi/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388004AbfDJQ3w (ORCPT + 99 others); Wed, 10 Apr 2019 12:29:52 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36424 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387854AbfDJQ2T (ORCPT ); Wed, 10 Apr 2019 12:28:19 -0400 Received: by mail-pf1-f196.google.com with SMTP id z5so1798098pfn.3; Wed, 10 Apr 2019 09:28:19 -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=seHjBqaBud1mYkVOqcRVoUipgYEoJz3N4GGlHqlC5Ho=; b=fhnCtIi/YM7sz501nGK9jfCOfSn5uGcPccRiGXqQsNdL8CphFvZdvZ+t+x3wiPxf7p 9tSdt2QnVruhXY9X7CpSPCvboTQWbLC6yblGnLSVCt7LlHu2GtY/1kxtolcV30OM7AZU r4J+tIbAUGLWRXb+wwDVcYBWEykK1ZqoT8nTsSfFl5OaRMlWu5M6QCe6pbL9clUqfYWd 6WJXpBhQtXFuvUoX8/PDvvWtWT5eyTCqvrcOHrfr+NQsEKs+1MMv9U2AhXweMtENDHRg wq1q/7O0tyCpEWk/BFl9o1zk4s5idfVxzaThEZV+rSJSZwSOi9dW6b3FsKnCrzOmdw/8 MTiw== 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=seHjBqaBud1mYkVOqcRVoUipgYEoJz3N4GGlHqlC5Ho=; b=RrPg6WsXUFhqjWi4hmv4OtfN4KNDILweSkuHA+wVylOojB5+b4U+S4Em0+EyJurifx fXb/DN0h0Xzy7LZoa8oTa3CGb6NEfMj+WKWcor+BszNGJGII929rHKl2SgiSzkuhzxsU 3Krv38bwJYa0sFqMNfd/2LCy49QGddo4zEQx8aXT3JPGqiMAYbn3g1E21iSoGlYQZ/vP 3DNzIJDtN7ZIvHcgx+kl4Qzfzg/b+y4YtBFZ/8NJgMgMyCNLquit3D0qw0O1HURIgCRH KE/e6nPOcUGc9taPsHh/KJfpULoV5nxRIxXNp6AY+ahHQrQehJUJUGlIRLOEBZEX8uDQ VBfQ== X-Gm-Message-State: APjAAAXx/iLKLlA/6moTtW2DNdYQ2cZl5aJQZxpXssXG2qunizvWHFs2 WM5ZutQ44Lw13dYNPY77XvU= X-Received: by 2002:a63:ef4c:: with SMTP id c12mr29053510pgk.43.1554913699097; Wed, 10 Apr 2019 09:28:19 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id j12sm43483028pgg.79.2019.04.10.09.28.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 09:28:18 -0700 (PDT) From: Guenter Roeck To: Wim Van Sebroeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH 08/22] watchdog: wm831x_wdt: Use 'dev' instead of dereferencing it repeatedly Date: Wed, 10 Apr 2019 09:27:49 -0700 Message-Id: <1554913683-25454-9-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554913683-25454-1-git-send-email-linux@roeck-us.net> References: <1554913683-25454-1-git-send-email-linux@roeck-us.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/wm831x_wdt.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c index 116c2f47b463..9b6565a3fab4 100644 --- a/drivers/watchdog/wm831x_wdt.c +++ b/drivers/watchdog/wm831x_wdt.c @@ -180,8 +180,9 @@ static const struct watchdog_ops wm831x_wdt_ops = { static int wm831x_wdt_probe(struct platform_device *pdev) { - struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); - struct wm831x_pdata *chip_pdata = dev_get_platdata(pdev->dev.parent); + struct device *dev = &pdev->dev; + struct wm831x *wm831x = dev_get_drvdata(dev->parent); + struct wm831x_pdata *chip_pdata = dev_get_platdata(dev->parent); struct wm831x_watchdog_pdata *pdata; struct wm831x_wdt_drvdata *driver_data; struct watchdog_device *wm831x_wdt; @@ -198,8 +199,7 @@ static int wm831x_wdt_probe(struct platform_device *pdev) if (reg & WM831X_WDOG_DEBUG) dev_warn(wm831x->dev, "Watchdog is paused\n"); - driver_data = devm_kzalloc(&pdev->dev, sizeof(*driver_data), - GFP_KERNEL); + driver_data = devm_kzalloc(dev, sizeof(*driver_data), GFP_KERNEL); if (!driver_data) return -ENOMEM; @@ -210,7 +210,7 @@ static int wm831x_wdt_probe(struct platform_device *pdev) wm831x_wdt->info = &wm831x_wdt_info; wm831x_wdt->ops = &wm831x_wdt_ops; - wm831x_wdt->parent = &pdev->dev; + wm831x_wdt->parent = dev; watchdog_set_nowayout(wm831x_wdt, nowayout); watchdog_set_drvdata(wm831x_wdt, driver_data); @@ -240,10 +240,9 @@ static int wm831x_wdt_probe(struct platform_device *pdev) reg |= pdata->software << WM831X_WDOG_RST_SRC_SHIFT; if (pdata->update_gpio) { - ret = devm_gpio_request_one(&pdev->dev, - pdata->update_gpio, - GPIOF_OUT_INIT_LOW, - "Watchdog update"); + ret = devm_gpio_request_one(dev, pdata->update_gpio, + GPIOF_OUT_INIT_LOW, + "Watchdog update"); if (ret < 0) { dev_err(wm831x->dev, "Failed to request update GPIO: %d\n", @@ -268,7 +267,7 @@ static int wm831x_wdt_probe(struct platform_device *pdev) } } - ret = devm_watchdog_register_device(&pdev->dev, &driver_data->wdt); + ret = devm_watchdog_register_device(dev, &driver_data->wdt); if (ret != 0) { dev_err(wm831x->dev, "watchdog_register_device() failed: %d\n", ret); -- 2.7.4