Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2387685imu; Thu, 17 Jan 2019 13:17:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN5DQHWCLYf4xXv1Jap4rVjkqu+04Rc0uJkuRg2FgcauxQY2Hv7QMS4D1u2LnwpaEo0YfqxR X-Received: by 2002:a17:902:15a8:: with SMTP id m37mr16721639pla.129.1547759827304; Thu, 17 Jan 2019 13:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547759827; cv=none; d=google.com; s=arc-20160816; b=uG1KVl9T5dsY8L57ePwxLNIO12/LxSbukH19B3XwyPKzU9eBrVHGxHeArjS0u6hxbU y5wqnq/QQK33Hr+/II4iD53579U+IXKI2AqG3rFV31JF7awOjxblbRWIQsLgT90Fg958 d7G+lKRNwkZ5R+wmesGjxscj2G73nc7crDBHcljqWWxSDJLOzzbFKlzu/MGs/UHy3cg8 B+4PmLKH1BEFXQ/AZR+ymel5zfJlhFi2TDtwkN6scyZU085uvIksxBUUoi7C+QUoJ0Oq 8skbSOhiQZfXxnunUnOBNA2Igb1h7JMkWEfjgOiNlD6WK5mvNC40FGtrj+J89KGaNj0J x0Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=+usq7AdIh9oeh+L74j2atON+sofyrJw4utC+SQNLrBA=; b=dmzlhUmDH5DxIijEVqmpjakPNWY1SMhk9R4KKUc0qkAj8LpbB4frzN29g18mha5Hc+ knfP6mNWBGKl2ihEcVoz+FQRofJVQWJJBSZPnXTifXNJkmnM/J/RoMTqHM0WQdWuaE+j io3qhG1e70i3QHeuPLgFjvQx/t58pv4UGjHQwSjjbgE8/mVMjSRhcNSuLV4T++tI6f2k a6DC0a5GhPtUyrPTqwGSc9uY+8omcO1l93wxyFw83PVvfacChINTNwT5y4scYpJ9lvjZ lYgGnkZrbCgQZEEQCZu2aMwi2wVaAeKnnR0B+0rh6kKkCxTYxxrzJuznanSOaGtCTlgd yBcw== ARC-Authentication-Results: i=1; mx.google.com; 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 b7si2646917plb.234.2019.01.17.13.16.47; Thu, 17 Jan 2019 13:17:07 -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; 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 S1729312AbfAQVPB (ORCPT + 99 others); Thu, 17 Jan 2019 16:15:01 -0500 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]:36070 "EHLO mx0a-002e3701.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726905AbfAQVPB (ORCPT ); Thu, 17 Jan 2019 16:15:01 -0500 Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0HL781g016458; Thu, 17 Jan 2019 21:14:13 GMT Received: from g2t2352.austin.hpe.com (g2t2352.austin.hpe.com [15.233.44.25]) by mx0a-002e3701.pphosted.com with ESMTP id 2q2vemtr6x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Jan 2019 21:14:13 +0000 Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2352.austin.hpe.com (Postfix) with ESMTP id F0359A7; Thu, 17 Jan 2019 21:14:11 +0000 (UTC) Received: from anatevka (anatevka.americas.hpqcorp.net [10.34.81.61]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id B6FC336; Thu, 17 Jan 2019 21:14:10 +0000 (UTC) Date: Thu, 17 Jan 2019 14:14:10 -0700 From: Jerry Hoemann To: Guenter Roeck 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 Subject: Re: [PATCHv2] watchdog: qcom: Add suspend/resume support Message-ID: <20190117211410.GA30749@anatevka> Reply-To: Jerry.Hoemann@hpe.com References: <20190117151942.6092-1-saiprakash.ranjan@codeaurora.org> <154775022743.169631.1716489383315213219@swboyd.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-17_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901170147 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 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. -- ----------------------------------------------------------------------------- Jerry Hoemann Software Engineer Hewlett Packard Enterprise -----------------------------------------------------------------------------