From patchwork Sun Oct 8 23:28:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 115173 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp1960274qgn; Sun, 8 Oct 2017 16:30:54 -0700 (PDT) X-Received: by 10.98.185.26 with SMTP id z26mr8537069pfe.218.1507505454072; Sun, 08 Oct 2017 16:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507505454; cv=none; d=google.com; s=arc-20160816; b=B2QlOi9D0ZViNGfn4bKDRB2iZsUwTgWMMR9K6l5qpSawCDVDsGCMv6M2AHF9L12z+U TugRixch9/Qx7Lw2d1LA0yCcMdp84Prh2UIaWFWBhINn00p8WQSeV+2E73i/Cq9SIdo1 6KWkitHd6UbyMC/CLDGgnrzKWtSi6NI+C8GkVdfiKdJgRHdWt61fdgvzelv36oTD41ex 9Foy29uEjFmyWE4HQK3Jhf1tNQSY8vJyyHQ+FrsBgriJghrNyDcTSB2TkTt94PUr4WnW HuLWpSTecaR5IZtITW+JY3twl+vxMZn1TnMiw8Yn0elYuBMBId9Ct/6jG38lf2Pj7B8O LM1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=60z9KLDbYt7YIkE3INeQ3WgZvhXns9TPduswSc7KuoE=; b=R3aNa7ST/RtLrLr46oYDRLpp3gW3XE6d4rhoplc1oTqHHDStBwSXMiHqlUhsUD5W5G 1HLgTX9bQq0mnpc+a2syFa881YNA4X2ifdsV02J4QiRmpE0NFPd0qC+SouomMBT/tsnj CZxqT71N5Uv9/JBrUbdrRY9nM3WTB1Jqz/RwWqyUr9RY+mfDfj9N4GCGStbSzcy8innM H8QALu9/FPG0nAwhBFCbTLxxTLE5ZaXrN0YOROKncF5IgBZHCHJkIeI+6K4VSdDJe0SB +5m74D+yi5CpsW7dGhuW37VyggKBjwBYi4d/0JysIFQXoFUbdvl6pXXcqbr8AOFW8p3c /oGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JHjXSeEj; spf=pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-watchdog-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s5si5076273pgq.650.2017.10.08.16.30.53 for ; Sun, 08 Oct 2017 16:30:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JHjXSeEj; spf=pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-watchdog-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751545AbdJHXax (ORCPT ); Sun, 8 Oct 2017 19:30:53 -0400 Received: from mail-lf0-f54.google.com ([209.85.215.54]:50197 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751489AbdJHXax (ORCPT ); Sun, 8 Oct 2017 19:30:53 -0400 Received: by mail-lf0-f54.google.com with SMTP id a132so17407287lfa.7 for ; Sun, 08 Oct 2017 16:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=fwudXSwF0yIUEpzF7eRmAq2vc+/q0mvM6FNuvdPlfBQ=; b=JHjXSeEj12QKHLjiMiHmxBd91If6FjWZUHIBNfw2X3KjphH/faQiffjzNGoNVgsre7 qKGmmdcBBUE+M6Phb25qZNf0aZWu5bIbD5w/F+kjv8wJpr+coaKYlb30dKJQVvLAZ6xn /BgjHz5hImKNJpbD1Maz2BOMT8I11pg3w00rk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fwudXSwF0yIUEpzF7eRmAq2vc+/q0mvM6FNuvdPlfBQ=; b=T2t5EDW9CX/g/H8I0rwvjH3q0cTlvhvrdyuRkmCGrOxgeLk1K28e2xsd13xym7WlC9 ZYQd0raufWjWWu6RRUBryXzn1L/J5zbAUYndRExcZ2UnQvs/SAGAxzSoPAzgi+UzQyDl 8t+6KFPwryNgon1uVEG3kvlk61/2OC1SJTBx8HmNh6TmFsU9ZtTSXEqkW41SkPFaPD1J zEJw1I7CHmrVZjRDtIcfub4YX3qPfvbjX7ahrf02vZXKz2GGbBWbOA9ZZf7+OGpbHCpK 62CM8xSY9LIcSvXDfAJBFhstOppYwo6muRSFHaWwFn1ZJQKk5DmakWTgXjtqyppZ/ZIZ wevw== X-Gm-Message-State: AMCzsaXDPyF8H8iwVi7Ahg3F1WNuZo57c5hoiLAozTp1tw0+BI5Q4G7n r3TdXGY9qJ26OuDZv9oI83VwjVSU8Tw= X-Google-Smtp-Source: AOwi7QCuGGYcjmgiCDtn+TKbcGdQ6dyXSJDWB0Ie4gO2T0QXHcJchp3/tLzOPVsiQAFdgYj2QoYGHw== X-Received: by 10.46.87.77 with SMTP id r13mr3848440ljd.44.1507505451615; Sun, 08 Oct 2017 16:30:51 -0700 (PDT) Received: from localhost.localdomain (c-367171d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.113.54]) by smtp.gmail.com with ESMTPSA id e33sm1131439lfi.36.2017.10.08.16.30.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Oct 2017 16:30:50 -0700 (PDT) From: Linus Walleij To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, Linus Walleij Subject: [PATCH 1/2 v2] watchdog: gpio: Add some local helper variables Date: Mon, 9 Oct 2017 01:28:46 +0200 Message-Id: <20171008232847.7358-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org This add "dev" and "np" variables to make the probe() function a bit easier to read. Reviewed-by: Guenter Roeck Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Collected Guenther's review tag. --- drivers/watchdog/gpio_wdt.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) -- 2.13.5 -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c index cb66c2f99ff1..448e6c3ba73c 100644 --- a/drivers/watchdog/gpio_wdt.c +++ b/drivers/watchdog/gpio_wdt.c @@ -101,6 +101,8 @@ static const struct watchdog_ops gpio_wdt_ops = { static int gpio_wdt_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; struct gpio_wdt_priv *priv; enum of_gpio_flags flags; unsigned int hw_margin; @@ -108,19 +110,19 @@ static int gpio_wdt_probe(struct platform_device *pdev) const char *algo; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); - priv->gpio = of_get_gpio_flags(pdev->dev.of_node, 0, &flags); + priv->gpio = of_get_gpio_flags(np, 0, &flags); if (!gpio_is_valid(priv->gpio)) return priv->gpio; priv->active_low = flags & OF_GPIO_ACTIVE_LOW; - ret = of_property_read_string(pdev->dev.of_node, "hw_algo", &algo); + ret = of_property_read_string(np, "hw_algo", &algo); if (ret) return ret; if (!strcmp(algo, "toggle")) { @@ -133,12 +135,12 @@ static int gpio_wdt_probe(struct platform_device *pdev) return -EINVAL; } - ret = devm_gpio_request_one(&pdev->dev, priv->gpio, f, - dev_name(&pdev->dev)); + ret = devm_gpio_request_one(dev, priv->gpio, f, + dev_name(dev)); if (ret) return ret; - ret = of_property_read_u32(pdev->dev.of_node, + ret = of_property_read_u32(np, "hw_margin_ms", &hw_margin); if (ret) return ret; @@ -146,7 +148,7 @@ static int gpio_wdt_probe(struct platform_device *pdev) if (hw_margin < 2 || hw_margin > 65535) return -EINVAL; - priv->always_running = of_property_read_bool(pdev->dev.of_node, + priv->always_running = of_property_read_bool(np, "always-running"); watchdog_set_drvdata(&priv->wdd, priv); @@ -155,9 +157,9 @@ static int gpio_wdt_probe(struct platform_device *pdev) priv->wdd.ops = &gpio_wdt_ops; priv->wdd.min_timeout = SOFT_TIMEOUT_MIN; priv->wdd.max_hw_heartbeat_ms = hw_margin; - priv->wdd.parent = &pdev->dev; + priv->wdd.parent = dev; - if (watchdog_init_timeout(&priv->wdd, 0, &pdev->dev) < 0) + if (watchdog_init_timeout(&priv->wdd, 0, dev) < 0) priv->wdd.timeout = SOFT_TIMEOUT_DEF; watchdog_stop_on_reboot(&priv->wdd);