Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2388952imu; Thu, 17 Jan 2019 13:18:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN7noNQwGDTckxjl+moi050TB3QnpUH0LuyzIwv/kr9NrKWE/S5+A1zWD5z3nxCw5QN4jBCK X-Received: by 2002:a65:590b:: with SMTP id f11mr15022963pgu.60.1547759911103; Thu, 17 Jan 2019 13:18:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547759911; cv=none; d=google.com; s=arc-20160816; b=kINbvLEHm78p2rPldHGejo9Uxu4ANqUW0NzOG/oRgWpR7yJOaec/jNloK9aBB5krVT xz5QBSnVMgMjLqwldUoA7GJwyIzDlDQl/C2E8iUuvi1ldQqy/dwjr3EClTfbPuTbQ2sj 94/TUGbOr7yLk9EnnIK5cSaSaYJn8cs75McvXSVKeVg07f/FSQ85+GNoCqcUdaWtpcVt srutwLYe9gbHN7xdtgIRuOlv9RzDkmyXXwXCra06N0TyCXMPa1r92H0Byc1OScOsbQ4g qKrUU0wl9NfhkNrfl5bHVMuL3nJ8pXR3eqo5Wvq8/gmGf6G/TnSO5W3nHqPqnECn8h8x oxfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=L8+pWFbjCXuZb0yF6AHOy187X+FZaQYqjUOMZpie9bQ=; b=yha5uCdE5xgEhWvdbFyQAjX7w4pbQ4CDJc0XK2iE1Y/V1jBdMCqhcLro7WfeERI9Ug uNv5/DRCChrV4QZBOMZZjbM/m9jievWMA1zA707bCQY35HLnfpSLV9UiDWbNA0VVNdXJ 5nBOkxiRt9FI3+mXdufrxBrXso9Gbf9qpUDhKlXppUzmfSSly753d2b1p22v6ts8x8oT ScLZNZsNVlE6PkMHVF3UgkURjTSTUZlOIC2QJRQorCg/2GwGRGE3ZqEIuGVCwrl5OWhC ueGIAKyi0MsG1gbe8VFOJdW7IxWFy6/1pegjnsO0KMVx9mtg04qxB5cYOdHlCtoiRnty 9BCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ukgrokuh; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l184si2455685pgd.523.2019.01.17.13.18.14; Thu, 17 Jan 2019 13:18:31 -0800 (PST) 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=pass header.i=@google.com header.s=20161025 header.b=Ukgrokuh; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728510AbfAQVRE (ORCPT + 99 others); Thu, 17 Jan 2019 16:17:04 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:34950 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728286AbfAQVRE (ORCPT ); Thu, 17 Jan 2019 16:17:04 -0500 Received: by mail-yb1-f193.google.com with SMTP id h81so3264754ybg.2 for ; Thu, 17 Jan 2019 13:17:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L8+pWFbjCXuZb0yF6AHOy187X+FZaQYqjUOMZpie9bQ=; b=UkgrokuhmHu5BHG9ibxHHWYsSKQA3yFgbi4+RJoVYS4roItRbCA+YtWxsQ3IbIDK5e pDvM+E6OCfoYyABAXjNnhy/jgIkT29DAdAIg/ZFVFfydlbfpF0A8+udmJ3KQVH/OGaTO vvtCH0aH7OLaI74+5J3X087dmFrWAnpfUMDkCkXU0CExTZrM6srsrUS7NrpjCJrAe7G/ XunrDnB5IDTQCVFGiK+3QED+lKX1ms3JGwriAmXv3Wm4VeFIaktUpi9h5AlESJQ2dTc5 Zday/2myvmMO5cZu6rGcDT/6oVsiTJVGQvOafg0pBDZXEYuYh4AFKFunlkL1tnb+oZ8h SNYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L8+pWFbjCXuZb0yF6AHOy187X+FZaQYqjUOMZpie9bQ=; b=ZwrBXzVCQGvLuZdTdLHWGR6QJVviSe0yv5q/WD7veug6sGXYlFTR5/JMu2tATNCRow B+1phwrEVe7O9iFgSiBIhJmvR0BnZSAXuuxa3wT5Kk4q5uBHnJ/JEd7vZX8YWS1Hcf1f uro/HNJRu3pUpRLsfxJSm7fOJq4yP3bzJhqRC3++ne5BW2nZe1XTMLvhMmavVcRF98EH pGgsAW6XjZ0bNeeFgpi4XxN920TBmZk44HDiR6KfjeghJ5mnjsl6l4gVG0uvM3Bv+tAn QsR+lQOd0A4qBOGI6qglE5MmFAuMJOltuBDetF8/yPjCofWEKIEqL+FBIsvyT8ClkWgW yiRQ== X-Gm-Message-State: AJcUukdG7xLr6BBEj+LpnX3i68VD9SipXMuLQSRrOC3yXmJGzowirPRK jV3WzShbbSkHZpmugjdXQfQSwFBPOMf2tUuDps8gzQ== X-Received: by 2002:a25:7ec5:: with SMTP id z188mr3790812ybc.282.1547759822737; Thu, 17 Jan 2019 13:17:02 -0800 (PST) MIME-Version: 1.0 References: <20190117151942.6092-1-saiprakash.ranjan@codeaurora.org> <154775022743.169631.1716489383315213219@swboyd.mtv.corp.google.com> <20190117211410.GA30749@anatevka> In-Reply-To: <20190117211410.GA30749@anatevka> From: Guenter Roeck Date: Thu, 17 Jan 2019 13:16:51 -0800 Message-ID: Subject: Re: [PATCHv2] watchdog: qcom: Add suspend/resume support To: Jerry.Hoemann@hpe.com Cc: Stephen Boyd , Guenter Roeck , Guenter Roeck , Sai Prakash Ranjan , Wim Van Sebroeck , linux-watchdog@vger.kernel.org, Rajendra Nayak , Vivek Gautam , Sibi Sankar , Doug Anderson , linux-arm-kernel@lists.infradead.org, linux-kernel , linux-arm-msm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 17, 2019 at 1:14 PM Jerry Hoemann wrote: > > On Thu, Jan 17, 2019 at 11:09:31AM -0800, Guenter Roeck wrote: > > On Thu, Jan 17, 2019 at 10:37 AM Stephen Boyd wrote: > > > > > > Quoting Sai Prakash Ranjan (2019-01-17 07:19:42) > > > > diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c > > > > index 780971318810..5dfd604477a4 100644 > > > > --- a/drivers/watchdog/qcom-wdt.c > > > > +++ b/drivers/watchdog/qcom-wdt.c > > > > @@ -245,6 +245,28 @@ static int qcom_wdt_remove(struct platform_device *pdev) > > > > return 0; > > > > } > > > > > > > > +static int __maybe_unused qcom_wdt_suspend(struct device *dev) > > > > +{ > > > > + struct qcom_wdt *wdt = dev_get_drvdata(dev); > > > > + > > > > + if (watchdog_active(&wdt->wdd)) > > > > + qcom_wdt_stop(&wdt->wdd); > > > > + > > > > + return 0; > > > > +} > > > > + > > > > +static int __maybe_unused qcom_wdt_resume(struct device *dev) > > > > +{ > > > > + struct qcom_wdt *wdt = dev_get_drvdata(dev); > > > > + > > > > + if (watchdog_active(&wdt->wdd)) > > > > + qcom_wdt_start(&wdt->wdd); > > > > + > > > > + return 0; > > > > +} > > > > > > This looks fairly generic. For example, the Mediatek driver also stops > > > and starts (but also pings after starting). Grepping for 'active' in > > > drivers/watchdog/ finds more examples. Could there be some functions in > > > watchdog core that do the common things like watchdog_stop() and > > > watchdog_start() and watchdog_start_and_ping()? Or maybe a bit can be > > > set during registration so that the 'struct class watchdog_class' can > > > get PM ops to stop and start on suspend/resume of the watchdog character > > > device? > > > > > > Nothing is wrong with the patch, I'm just bemoaning the amount of code > > > duplication here. > > > > > > > Patch(es) to add the functionality to the watchdog core are welcome; > > it should be possible to move the functionality into the core (maybe > > to be enabled with a new watchdog API call). Doing it using the class > > device sounds like an excellent idea. This should be straightforward > > to implement, though the question of "should we ping on resume or not" > > might be an endless source for bike shedding fun. > > > > Guenter > > It could be controlled by a currently unused bit in the > watchdog_info.options. Then people can agree to disagree. > I thought about that, but that would result in inconsistent behavior across drivers. Of course we could be all fancy and make it runtime configurable via ioctl. Guenter