From patchwork Fri Sep 6 20:54:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 173304 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp1235604ilq; Fri, 6 Sep 2019 13:54:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzcGVVI5m2vCDgCAbrrkLkcb1T1MnosreXtKqI2GwihwzDk1Q9PICyd11cceArEB/aVsab1 X-Received: by 2002:a62:e209:: with SMTP id a9mr1819094pfi.164.1567803259270; Fri, 06 Sep 2019 13:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567803259; cv=none; d=google.com; s=arc-20160816; b=WCLEEF/OMZ0Gr8Q9gqyZK5jzKhpYJvO+NQTnfFntOWd2E0ZbV9f11qYPMuAZgh/LEo geK3LSH4i71eDuzlQBDKinDDPzDMkPrvM7IhWF2zq9wJQf7FGZC5Gi1MLUDxKlIkB8OS HmA7KRdafv4x3KSzWDonja7V+dxqGiTdsT3LJ4rn0dzRO4FmHo6wD2gxjfaVexoIQuW6 uxVIX7hvZoV9/yNmWIMLrBdQoufQnRM7w/ZaHLLrw/nFpYbKYEj97yRfBDlWsilOUYBs uYIm5LgfIlMh6fO7PLQgdi99XZwcRuxCdZJquxWE1BM5y2yF0QV+zJVvz8g1yiicUEz4 8RpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qwXLokDJ/37TfRHAsvE0/1njv7WBc49AKQIAlVWAmLM=; b=SAMYMLfe97HmAPtZr2++jk7PRuJXARdpGW5iGm4g6mHL0/B8+j9WBicLNdhdoUx2a7 Ctom6l0KCyauHBz88d9Fye/NT5FBHrE5qlY6h6DOCNHq3fP2ijliT3SkbXQGQHftTDk5 eyIYPNspUU1XGvBA3A5XuOmVg4ZXomb63AZQXcnQxkCom9WosdMJJUbQQHcxsIHzUxRX SzQAh4jpWnKkQE9g52rapVL2NldBpcZi7AqlBWQ4Oc/raUJ6Tr/9ddJqWyVb+RDXGm0n q6Ffc358VCdW6nQ0gtOgzAgFhzqiQMdIo6c7Wb6Ao+5gL6ATzfrXLJwZ/E3fo7GODvdG Yd1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PzqTLNLR; 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=pass (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 s4si6594170pfe.173.2019.09.06.13.54.19 for ; Fri, 06 Sep 2019 13:54:19 -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=pass header.i=@linaro.org header.s=google header.b=PzqTLNLR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403983AbfIFUyS (ORCPT ); Fri, 6 Sep 2019 16:54:18 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39700 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728590AbfIFUyR (ORCPT ); Fri, 6 Sep 2019 16:54:17 -0400 Received: by mail-wm1-f65.google.com with SMTP id q12so8482150wmj.4 for ; Fri, 06 Sep 2019 13:54:16 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=qwXLokDJ/37TfRHAsvE0/1njv7WBc49AKQIAlVWAmLM=; b=PzqTLNLRT1tud8QVmEGktFRyB88eueo49aN/+xqss+6TmuxIu/fG5nacsOlxOxP+ZY vgXAwV7C6ArBOG3HXfJMHEZv1kbvr4TdaS4sbCJwjn0DATBwiBsBamKnL5iHjFJb3uQ5 u8zudW53uL+ZxhGRx6qfwhpQtjKT1AiFv/tPZsNkjBEfagXy3yptquCwapAf7FX0MJRi KO8U3M/A7Xp8ADkwh200FRuiwquLLJM0v5s59v7q6IwprCRmuVyCt0foBEKFn7geS4KR 5ARJbeFS3OgXqat2XLF9MRN4TvUwMEgWD+Q7T4yYwGTa1Yh+7DJNLAemjuYRsUCXhJq3 0bCA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=qwXLokDJ/37TfRHAsvE0/1njv7WBc49AKQIAlVWAmLM=; b=gZmlTnOu2EixSAFzCQTOXHUE86GRNq+jnbHLl256zdYihFxlnAWB4fj4q6/mM7NQ/7 bpTJF6Cj1F+/mEv2TkY35UcfdDOedysiKWkOmAZgYNVMNRzLue4esNPtZJ3EuxxroLfD W8yTBtF9ElaBv/ZrLsoOp2KXDeaThZPDBlZOuaDpi2YgEbLWMg7/jaELhfmiWUVHg/QD lVTKHzUC4R5u05qnOY+xlyyQA7tVGk+xWkFlcuUU/3yDyWMra9MhOno3bpzjLEAXIex6 us8qwXqwdA1fNBXM6ZbAzdLrEFvwYaq4bn/JNbsGqHfA5d1CI3xL4EQPSKCfaTUYVU6I SQ7g== X-Gm-Message-State: APjAAAUlk/Ot4JmLP7ST67De/i2A/OfWl9OwCcvpoa+IiufJjjUW7F15 55tvCx+92qiyS7BmTBstfL/wgw== X-Received: by 2002:a1c:1bcf:: with SMTP id b198mr9304300wmb.0.1567803256233; Fri, 06 Sep 2019 13:54:16 -0700 (PDT) Received: from localhost.localdomain (124.red-83-36-179.dynamicip.rima-tde.net. [83.36.179.124]) by smtp.gmail.com with ESMTPSA id q5sm317416wmq.3.2019.09.06.13.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Sep 2019 13:54:15 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, bjorn.andersson@linaro.org, linux@roeck-us.net, wim@linux-watchdog.org, agross@kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] watchdog: qcom: support pre-timeout when the bark irq is available Date: Fri, 6 Sep 2019 22:54:10 +0200 Message-Id: <20190906205411.31666-2-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190906205411.31666-1-jorge.ramirez-ortiz@linaro.org> References: <20190906205411.31666-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Use the bark interrupt as the pre-timeout notifier whenever this interrupt is available. By default, the pretimeout notification shall occur one second earlier than the timeout. Signed-off-by: Jorge Ramirez-Ortiz --- drivers/watchdog/qcom-wdt.c | 70 ++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 5 deletions(-) -- 2.23.0 diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c index 7be7f87be28f..935c78a882a3 100644 --- a/drivers/watchdog/qcom-wdt.c +++ b/drivers/watchdog/qcom-wdt.c @@ -1,8 +1,10 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2014, The Linux Foundation. All rights reserved. */ +#include #include #include +#include #include #include #include @@ -19,6 +21,9 @@ enum wdt_reg { WDT_BITE_TIME, }; +#define QCOM_WDT_ENABLE BIT(0) +#define QCOM_WDT_ENABLE_IRQ BIT(1) + static const u32 reg_offset_data_apcs_tmr[] = { [WDT_RST] = 0x38, [WDT_EN] = 0x40, @@ -54,15 +59,35 @@ struct qcom_wdt *to_qcom_wdt(struct watchdog_device *wdd) return container_of(wdd, struct qcom_wdt, wdd); } +static inline int qcom_get_enable(struct watchdog_device *wdd) +{ + int enable = QCOM_WDT_ENABLE; + + if (wdd->pretimeout) + enable |= QCOM_WDT_ENABLE_IRQ; + + return enable; +} + +static irqreturn_t qcom_wdt_isr(int irq, void *arg) +{ + struct watchdog_device *wdd = arg; + + watchdog_notify_pretimeout(wdd); + + return IRQ_HANDLED; +} + static int qcom_wdt_start(struct watchdog_device *wdd) { struct qcom_wdt *wdt = to_qcom_wdt(wdd); + unsigned int bark = wdd->timeout - wdd->pretimeout; writel(0, wdt_addr(wdt, WDT_EN)); writel(1, wdt_addr(wdt, WDT_RST)); - writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BARK_TIME)); + writel(bark * wdt->rate, wdt_addr(wdt, WDT_BARK_TIME)); writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BITE_TIME)); - writel(1, wdt_addr(wdt, WDT_EN)); + writel(qcom_get_enable(wdd), wdt_addr(wdt, WDT_EN)); return 0; } @@ -89,6 +114,13 @@ static int qcom_wdt_set_timeout(struct watchdog_device *wdd, return qcom_wdt_start(wdd); } +static int qcom_wdt_set_pretimeout(struct watchdog_device *wdd, + unsigned int timeout) +{ + wdd->pretimeout = timeout; + return qcom_wdt_start(wdd); +} + static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action, void *data) { @@ -105,7 +137,7 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action, writel(1, wdt_addr(wdt, WDT_RST)); writel(timeout, wdt_addr(wdt, WDT_BARK_TIME)); writel(timeout, wdt_addr(wdt, WDT_BITE_TIME)); - writel(1, wdt_addr(wdt, WDT_EN)); + writel(QCOM_WDT_ENABLE, wdt_addr(wdt, WDT_EN)); /* * Actually make sure the above sequence hits hardware before sleeping. @@ -121,6 +153,7 @@ static const struct watchdog_ops qcom_wdt_ops = { .stop = qcom_wdt_stop, .ping = qcom_wdt_ping, .set_timeout = qcom_wdt_set_timeout, + .set_pretimeout = qcom_wdt_set_pretimeout, .restart = qcom_wdt_restart, .owner = THIS_MODULE, }; @@ -133,6 +166,15 @@ static const struct watchdog_info qcom_wdt_info = { .identity = KBUILD_MODNAME, }; +static const struct watchdog_info qcom_wdt_pt_info = { + .options = WDIOF_KEEPALIVEPING + | WDIOF_MAGICCLOSE + | WDIOF_SETTIMEOUT + | WDIOF_PRETIMEOUT + | WDIOF_CARDRESET, + .identity = KBUILD_MODNAME, +}; + static void qcom_clk_disable_unprepare(void *data) { clk_disable_unprepare(data); @@ -146,7 +188,7 @@ static int qcom_wdt_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; const u32 *regs; u32 percpu_offset; - int ret; + int irq, ret; regs = of_device_get_match_data(dev); if (!regs) { @@ -204,7 +246,25 @@ static int qcom_wdt_probe(struct platform_device *pdev) return -EINVAL; } - wdt->wdd.info = &qcom_wdt_info; + /* check if there is pretimeout support */ + irq = platform_get_irq(pdev, 0); + if (irq > 0) { + ret = devm_request_irq(dev, irq, qcom_wdt_isr, + IRQF_TRIGGER_RISING, + "wdt_bark", &wdt->wdd); + if (ret) + return ret; + + wdt->wdd.info = &qcom_wdt_pt_info; + wdt->wdd.pretimeout = 1; + } else { + if (irq == -EPROBE_DEFER) + return -EPROBE_DEFER; + + wdt->wdd.info = &qcom_wdt_info; + wdt->wdd.pretimeout = 0; + } + wdt->wdd.ops = &qcom_wdt_ops; wdt->wdd.min_timeout = 1; wdt->wdd.max_timeout = 0x10000000U / wdt->rate; From patchwork Fri Sep 6 20:54:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 173305 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp1235622ilq; Fri, 6 Sep 2019 13:54:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdciB4yjhwd9sq/QTuOZQO4Hx5/k0/Nms3CU8ezfPZbzWED019HmwCDqiVJlko6W5qR1Ji X-Received: by 2002:a62:3844:: with SMTP id f65mr13418792pfa.142.1567803260415; Fri, 06 Sep 2019 13:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567803260; cv=none; d=google.com; s=arc-20160816; b=xpiVBPFtR3z8K5RsCaM3VstLIC6hicAefEE6H8AKwcCIEvDtHwecDpfSs96nN4iubw YOirGi2tjnUppR8gKrBmKDuE4HFg4gf4Un9/T6OH5j8ktIdGp2IDmpPyj4SSGutZTFkX oYZd9omw2BMxGGZESxrtaN0SW16hCfGetmpVhH7fj8KxYSzGEV0LqOTPrGMPVLS/fKKM NTAQM+1aHqWxziRwUDdXrIkaYVrGZ8vBmXbIdAL422k0m0tfVK7nG7VFFAvQHpdOLBQI XTHQsEsSa7S0vpT6e/UmiivXpwAwQ/teAN54zo8TKo7iJXGUdrpFsSGNAbZqHMniJhau ytcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fcen4t8ALRC/eyTecR6xj2ycvqKCwBYdO81MLFjTX94=; b=GeFmO08yBb0zFLRK/MamssLavKbfO7kINRHd7GV7SVmtwDKjnucMaZKX5uC8soxrlJ ccyzVaKkhz2IyvBjElT3MGn9GZpEmMfn0OM8ph1rVZKqNtneZtcB4HAyxSxEOzVFiA5d 4qW/1BBuFqCqMxpjDDNCAMSwbp15kZwmtwdSVQ+Ri4T4aq1NQAQykWaDqmf5VJxRHc0q aKUbNl/MfrcfiaMsIBM8IIz0Xzal52CLNuM0ACOiBHIeDG2T5wCI/mTRYYuKmCjY4kYL OGod19EFEIMN4aLQLknIcAnomxbtkWBq7DEV0UTthWnGUD+SSHgJlhuWm5EdY1KSfTKN 1HTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OVQATcHv; 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=pass (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 s4si6594170pfe.173.2019.09.06.13.54.20 for ; Fri, 06 Sep 2019 13:54:20 -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=pass header.i=@linaro.org header.s=google header.b=OVQATcHv; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403987AbfIFUyT (ORCPT ); Fri, 6 Sep 2019 16:54:19 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:32870 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730739AbfIFUyS (ORCPT ); Fri, 6 Sep 2019 16:54:18 -0400 Received: by mail-wm1-f66.google.com with SMTP id r17so8218542wme.0 for ; Fri, 06 Sep 2019 13:54:17 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=fcen4t8ALRC/eyTecR6xj2ycvqKCwBYdO81MLFjTX94=; b=OVQATcHvrR2G3H50mlV29q3R3sZxjU4siUCn8rM/DditB7+reiuxabkbg49orRaHKY NwdNnCoCOvM6Eg8Qd4gSpCR+z5c56WwyEpo0bTkQClbFvy48BMKWK0hJypAoQSx07W9a W4hjF5ttQ4wkLS6qffiOUN3ljwOWiAqnm7+RJH0SDSS+haBT5EvoDis3M7e2bOTxej5B PAW5wcFYRo/0FtWVYwXoHfTeHbTGwIphie+LtGJEmSvIDG2ZGtWeSp7L3Xsqw7rXfR5o vuxK7s1XPg1PM0P5sfmDx6fKLxkIUeDqjN8hKGDLcUyiiN7KslFNxmM9k0jQF36FNlq2 X36w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=fcen4t8ALRC/eyTecR6xj2ycvqKCwBYdO81MLFjTX94=; b=TnSYwey3veVc8iIAGR/KoqTu1fiwYj64avdO/a0RB8L5zrgIGGti3l/8yYmfHYmV1e IqehdPK2NXANdofAQQd4iLF15Oili8Jk5aZpYzGUThetZqJj8SeS3nAqTDWG6XPHnMeI 5/x4THk0uXHiSyitFWcG9ZH1jMdC/KZ6YCFsoPhV+gbB0RQAw6ExLQ/3NF532eNDoVGa ILBiu7E90yEHEhmwBc0/BkYSalpH/8x2Hv8wB9mBYDE4frQM49yaH2MdAHjLuSJkycnm bbeyWWs2kKAYp4vD9IiSbtqRnHuvkKl+vWhD7ldPCD5A27S7kd715v8MQ+KP6vxylfW8 3L2A== X-Gm-Message-State: APjAAAXWzZp+pGPmhGUR4Ymcc+0MImO1gtmnrSdS98lCU8DGYLriBIbq 7TAm+HrQmz4KQmgshl6Q+LjHvw== X-Received: by 2002:a1c:ef13:: with SMTP id n19mr9159278wmh.48.1567803257227; Fri, 06 Sep 2019 13:54:17 -0700 (PDT) Received: from localhost.localdomain (124.red-83-36-179.dynamicip.rima-tde.net. [83.36.179.124]) by smtp.gmail.com with ESMTPSA id q5sm317416wmq.3.2019.09.06.13.54.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Sep 2019 13:54:16 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, bjorn.andersson@linaro.org, linux@roeck-us.net, wim@linux-watchdog.org, agross@kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] watchdog: qcom: remove unnecessary variable from private storage Date: Fri, 6 Sep 2019 22:54:11 +0200 Message-Id: <20190906205411.31666-3-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190906205411.31666-1-jorge.ramirez-ortiz@linaro.org> References: <20190906205411.31666-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org there is no need to continue keeping the clock in private storage. Signed-off-by: Jorge Ramirez-Ortiz --- drivers/watchdog/qcom-wdt.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) -- 2.23.0 Reviewed-by: Guenter Roeck diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c index 935c78a882a3..e98f5a3d83ea 100644 --- a/drivers/watchdog/qcom-wdt.c +++ b/drivers/watchdog/qcom-wdt.c @@ -42,7 +42,6 @@ static const u32 reg_offset_data_kpss[] = { struct qcom_wdt { struct watchdog_device wdd; - struct clk *clk; unsigned long rate; void __iomem *base; const u32 *layout; @@ -189,6 +188,7 @@ static int qcom_wdt_probe(struct platform_device *pdev) const u32 *regs; u32 percpu_offset; int irq, ret; + struct clk *clk; regs = of_device_get_match_data(dev); if (!regs) { @@ -215,19 +215,18 @@ static int qcom_wdt_probe(struct platform_device *pdev) if (IS_ERR(wdt->base)) return PTR_ERR(wdt->base); - wdt->clk = devm_clk_get(dev, NULL); - if (IS_ERR(wdt->clk)) { + clk = devm_clk_get(dev, NULL); + if (IS_ERR(clk)) { dev_err(dev, "failed to get input clock\n"); - return PTR_ERR(wdt->clk); + return PTR_ERR(clk); } - ret = clk_prepare_enable(wdt->clk); + ret = clk_prepare_enable(clk); if (ret) { dev_err(dev, "failed to setup clock\n"); return ret; } - ret = devm_add_action_or_reset(dev, qcom_clk_disable_unprepare, - wdt->clk); + ret = devm_add_action_or_reset(dev, qcom_clk_disable_unprepare, clk); if (ret) return ret; @@ -239,7 +238,7 @@ static int qcom_wdt_probe(struct platform_device *pdev) * that it would bite before a second elapses it's usefulness is * limited. Bail if this is the case. */ - wdt->rate = clk_get_rate(wdt->clk); + wdt->rate = clk_get_rate(clk); if (wdt->rate == 0 || wdt->rate > 0x10000000U) { dev_err(dev, "invalid clock rate\n");