Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2240667imu; Thu, 17 Jan 2019 10:39:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Bw1a3m1DW7R5zUENxCTMouszFz4RsGiPW2BJDt4Lxscy/sH78qxQRCZ+RREjxriq8tVu2 X-Received: by 2002:a65:434d:: with SMTP id k13mr14613014pgq.269.1547750391754; Thu, 17 Jan 2019 10:39:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547750391; cv=none; d=google.com; s=arc-20160816; b=dJG4EYqUiS+F6sK1uKcpjqWUChnWOfIddEaUKfqqP/96qjQHZ+Ret9lqtZiydl3nI9 a+jImF9sw+tNorKEarwcIMyKMdM4gd5tWYSeFPsXI2HEvDrPM6SzL5DCkkZx1Uc+RmXe EEgchH8+bEjxA1nJQBpR2m4EAjYNWXfx9Tf4eySebyjVPWJmOZpji2IoRfNDJhBTxyJk quux3569r5OUjwJUOGS+EmV0UAcMblU0PBSCluA04mpZCdEq7FcT3eQabXDSwH4ik8vx iwSJ8Q+9jdRsISvCec8rUzivTBvzAggWbXPPjSxk19VfYOOpXH++4ncXHWjhEyhrIR3H OHtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:from:message-id:to:cc:references :in-reply-to:user-agent:subject:content-transfer-encoding :mime-version:dkim-signature; bh=Iwme1IJBrOll4LMdbMEnsclPpzmiRPiz5uaby3aLiM0=; b=KmMO2PI4hgmJU5in2wXtweBCUi4NuxjWgWVYKNUAun8VydXmN01npoypjskjX+XSvP xI4BfyYIC8LywwFXMzK8UD01e7pHdABt6eWX7OB9q8e6Etb/oKzOfxGyQ2atPcJbOXxq ixqnHfcaU/1i/dhoDAgO1VZsMdL4CRFf/8tTQuBoLk/h/2mxmJb4ptxuF5t6nfNIy3Uw vDcCht6PXxdI2hdb4c+fQlkm2y4oVjqlpDeolQgfyNjs9V6H4TFAkRhMYdCuxV9L46SM efaoVJicUEHZlzoPlvIsMWs07Rd/hMKiFYrJ7uddFL5Qlrw5qXusODe1F4txhYhjG2nO V8gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="I5hxFv/j"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si2276593pgm.508.2019.01.17.10.39.36; Thu, 17 Jan 2019 10:39:51 -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=@chromium.org header.s=google header.b="I5hxFv/j"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727327AbfAQShK (ORCPT + 99 others); Thu, 17 Jan 2019 13:37:10 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41678 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726900AbfAQShJ (ORCPT ); Thu, 17 Jan 2019 13:37:09 -0500 Received: by mail-pg1-f196.google.com with SMTP id m1so4802021pgq.8 for ; Thu, 17 Jan 2019 10:37:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:subject:user-agent :in-reply-to:references:cc:to:message-id:from:date; bh=Iwme1IJBrOll4LMdbMEnsclPpzmiRPiz5uaby3aLiM0=; b=I5hxFv/jkLE38D/g2QLZ2U+muN4vWmD65O93e7B78rbFQl9RZjo5zcVxyLkJ9aicqe IqZ1k58mIJoPc/vQxLdBkSWpp2DfX0BJ4APP109iP0s/uuVm+EE4kckJGeLAg70uJHE/ I4UPlaWJgJKAakQpeb31R7DoiTa+NETXnsrf4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding:subject :user-agent:in-reply-to:references:cc:to:message-id:from:date; bh=Iwme1IJBrOll4LMdbMEnsclPpzmiRPiz5uaby3aLiM0=; b=Tw3vARORx4Va7FNV3SOiP08AXHpJpbKRxtywwDYJ79H03QTUKek8JTH5W5HkrW51Ez 5u+s9pqWlXiyApgXbhGjfmadae6OpwZkfRnHOG/IoUDfStXKWjPtTDNDykHGVcUxQkDV 86UTzTmCgM3zGxVSW6gmTDx9Frs0G8yAF/pVNrC3WDV8vGUway7Xso2SKhkVBO86vSVC PF7C95iFt67FBbJP10/LIPMd5dPYgIzO0h01T0p0JpBCCMyTO+JAaApkH/A10xvKU8CE BYeVMKTEqJiu5ayjke1VUUu2IYNGLvA1jG4y/FiZJjVM+L6x3db/Zd5a7UWbPWOSBxVV 1tgw== X-Gm-Message-State: AJcUukehFUV5nTr/ShtP4OO9mLRui4tMFnZld+Bvzl+3zH48zcwIW+Hs WIhhFaH5Z7HuiMjMCQjt+vqnmQ== X-Received: by 2002:a63:8742:: with SMTP id i63mr14326263pge.298.1547750229112; Thu, 17 Jan 2019 10:37:09 -0800 (PST) Received: from localhost ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id b2sm3216692pgg.87.2019.01.17.10.37.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jan 2019 10:37:08 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCHv2] watchdog: qcom: Add suspend/resume support User-Agent: alot/0.8 In-Reply-To: <20190117151942.6092-1-saiprakash.ranjan@codeaurora.org> References: <20190117151942.6092-1-saiprakash.ranjan@codeaurora.org> Cc: Rajendra Nayak , Vivek Gautam , Sibi Sankar , Doug Anderson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Sai Prakash Ranjan To: Guenter Roeck , Guenter Roeck , Sai Prakash Ranjan , Wim Van Sebroeck , linux-watchdog@vger.kernel.org Message-ID: <154775022743.169631.1716489383315213219@swboyd.mtv.corp.google.com> From: Stephen Boyd Date: Thu, 17 Jan 2019 10:37:07 -0800 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 *p= dev) > return 0; > } > =20 > +static int __maybe_unused qcom_wdt_suspend(struct device *dev) > +{ > + struct qcom_wdt *wdt =3D 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 =3D 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.