From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ABD2C43613 for ; Thu, 20 Jun 2019 08:33:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 161632085A for ; Thu, 20 Jun 2019 08:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725877AbfFTIdQ (ORCPT ); Thu, 20 Jun 2019 04:33:16 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:48089 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbfFTIdQ (ORCPT ); Thu, 20 Jun 2019 04:33:16 -0400 X-Originating-IP: 92.137.69.152 Received: from localhost (alyon-656-1-672-152.w92-137.abo.wanadoo.fr [92.137.69.152]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 05CC440011; Thu, 20 Jun 2019 08:33:10 +0000 (UTC) Date: Thu, 20 Jun 2019 10:33:09 +0200 From: Alexandre Belloni To: Ken Sloat Cc: "nicolas.ferre@microchip.com" , "ludovic.desroches@microchip.com" , "wim@linux-watchdog.org" , "linux@roeck-us.net" , "linux-arm-kernel@lists.infradead.org" , "linux-watchdog@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 1/1] watchdog: atmel: atmel-sama5d4-wdt: Disable watchdog on system suspend Message-ID: <20190620083309.GU23549@piout.net> References: <20190614125310.29458-1-ksloat@aampglobal.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190614125310.29458-1-ksloat@aampglobal.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org On 14/06/2019 12:53:22+0000, Ken Sloat wrote: > From: Ken Sloat > > Currently, the atmel-sama5d4-wdt continues to run after system suspend. > Unless the system resumes within the watchdog timeout period so the > userspace can kick it, the system will be reset. This change disables > the watchdog on suspend if it is active and re-enables on resume. These > actions occur during the late and early phases of suspend and resume > respectively to minimize chances where a lock could occur while the > watchdog is disabled. > > Signed-off-by: Ken Sloat Acked-by: Alexandre Belloni > --- > Changes in v2: > -Consolidate resume and resume early statements. > > drivers/watchdog/sama5d4_wdt.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c > index 111695223aae..0d123f8cbcc6 100644 > --- a/drivers/watchdog/sama5d4_wdt.c > +++ b/drivers/watchdog/sama5d4_wdt.c > @@ -280,7 +280,17 @@ static const struct of_device_id sama5d4_wdt_of_match[] = { > MODULE_DEVICE_TABLE(of, sama5d4_wdt_of_match); > > #ifdef CONFIG_PM_SLEEP > -static int sama5d4_wdt_resume(struct device *dev) > +static int sama5d4_wdt_suspend_late(struct device *dev) > +{ > + struct sama5d4_wdt *wdt = dev_get_drvdata(dev); > + > + if (watchdog_active(&wdt->wdd)) > + sama5d4_wdt_stop(&wdt->wdd); > + > + return 0; > +} > + > +static int sama5d4_wdt_resume_early(struct device *dev) > { > struct sama5d4_wdt *wdt = dev_get_drvdata(dev); > > @@ -291,12 +301,17 @@ static int sama5d4_wdt_resume(struct device *dev) > */ > sama5d4_wdt_init(wdt); > > + if (watchdog_active(&wdt->wdd)) > + sama5d4_wdt_start(&wdt->wdd); > + > return 0; > } > #endif > > -static SIMPLE_DEV_PM_OPS(sama5d4_wdt_pm_ops, NULL, > - sama5d4_wdt_resume); > +static const struct dev_pm_ops sama5d4_wdt_pm_ops = { > + SET_LATE_SYSTEM_SLEEP_PM_OPS(sama5d4_wdt_suspend_late, > + sama5d4_wdt_resume_early) > +}; > > static struct platform_driver sama5d4_wdt_driver = { > .probe = sama5d4_wdt_probe, > -- > 2.17.1 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB166C43613 for ; Thu, 20 Jun 2019 08:33:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0DD62085A for ; Thu, 20 Jun 2019 08:33:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pLqvwlFG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0DD62085A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xO0k8uZsb8gls8JhWQLBwYlnkSSWN817ibjdBW5sTCU=; b=pLqvwlFGci0Utk LCtX9tpiJkE/2aVBPTLk3USD8qxaYgZXEqLTMuyiTbu7iIO5xGpkCQcjdVGKoUiihIDgOxBdDlCds eRlRj5Afdm6ErY+RDNuedcycIyObuDOU2+zP48rifA2Y5JzRKiVeywpOl8RK9QM2octqYsUUnIJIY ucEKRCSg1KE1BCdkd6gA50jZmikcJwo+7eQrZEfQADPXltQr98EpyqY7h5+FFv/TR44a2sHcrkaI7 OapUvThu6aTy9aVC8Q9+lmbMIokws1LIzUzDXoecTFG/aiL0bnFMTrwpHfWPl7ie54NhoQXvXdDWY sJFFD7nSSe4ZxzsTwn0w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdsVc-0007jE-Ay; Thu, 20 Jun 2019 08:33:28 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdsVZ-0007ig-Er for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2019 08:33:27 +0000 X-Originating-IP: 92.137.69.152 Received: from localhost (alyon-656-1-672-152.w92-137.abo.wanadoo.fr [92.137.69.152]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 05CC440011; Thu, 20 Jun 2019 08:33:10 +0000 (UTC) Date: Thu, 20 Jun 2019 10:33:09 +0200 From: Alexandre Belloni To: Ken Sloat Subject: Re: [PATCH v2 1/1] watchdog: atmel: atmel-sama5d4-wdt: Disable watchdog on system suspend Message-ID: <20190620083309.GU23549@piout.net> References: <20190614125310.29458-1-ksloat@aampglobal.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190614125310.29458-1-ksloat@aampglobal.com> User-Agent: Mutt/1.11.4 (2019-03-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190620_013325_660483_9E3E60F6 X-CRM114-Status: GOOD ( 19.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-watchdog@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "ludovic.desroches@microchip.com" , "linux@roeck-us.net" , "wim@linux-watchdog.org" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 14/06/2019 12:53:22+0000, Ken Sloat wrote: > From: Ken Sloat > > Currently, the atmel-sama5d4-wdt continues to run after system suspend. > Unless the system resumes within the watchdog timeout period so the > userspace can kick it, the system will be reset. This change disables > the watchdog on suspend if it is active and re-enables on resume. These > actions occur during the late and early phases of suspend and resume > respectively to minimize chances where a lock could occur while the > watchdog is disabled. > > Signed-off-by: Ken Sloat Acked-by: Alexandre Belloni > --- > Changes in v2: > -Consolidate resume and resume early statements. > > drivers/watchdog/sama5d4_wdt.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c > index 111695223aae..0d123f8cbcc6 100644 > --- a/drivers/watchdog/sama5d4_wdt.c > +++ b/drivers/watchdog/sama5d4_wdt.c > @@ -280,7 +280,17 @@ static const struct of_device_id sama5d4_wdt_of_match[] = { > MODULE_DEVICE_TABLE(of, sama5d4_wdt_of_match); > > #ifdef CONFIG_PM_SLEEP > -static int sama5d4_wdt_resume(struct device *dev) > +static int sama5d4_wdt_suspend_late(struct device *dev) > +{ > + struct sama5d4_wdt *wdt = dev_get_drvdata(dev); > + > + if (watchdog_active(&wdt->wdd)) > + sama5d4_wdt_stop(&wdt->wdd); > + > + return 0; > +} > + > +static int sama5d4_wdt_resume_early(struct device *dev) > { > struct sama5d4_wdt *wdt = dev_get_drvdata(dev); > > @@ -291,12 +301,17 @@ static int sama5d4_wdt_resume(struct device *dev) > */ > sama5d4_wdt_init(wdt); > > + if (watchdog_active(&wdt->wdd)) > + sama5d4_wdt_start(&wdt->wdd); > + > return 0; > } > #endif > > -static SIMPLE_DEV_PM_OPS(sama5d4_wdt_pm_ops, NULL, > - sama5d4_wdt_resume); > +static const struct dev_pm_ops sama5d4_wdt_pm_ops = { > + SET_LATE_SYSTEM_SLEEP_PM_OPS(sama5d4_wdt_suspend_late, > + sama5d4_wdt_resume_early) > +}; > > static struct platform_driver sama5d4_wdt_driver = { > .probe = sama5d4_wdt_probe, > -- > 2.17.1 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel