Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp666899imu; Fri, 11 Jan 2019 07:05:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN4gL+JuhViWK09lfbXN2r6pHnJQPLWhzq3syc4L34FkBzsFC68Bcy9OofrmVgMwHXtZaOTP X-Received: by 2002:a63:60cf:: with SMTP id u198mr13787230pgb.323.1547219125350; Fri, 11 Jan 2019 07:05:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547219125; cv=none; d=google.com; s=arc-20160816; b=LQXg/dnJF7ZhNVYloUIdU/3XNPL6bjQCbdru6KP3IgSPSMX+7s9q3X0m8ZbsNQHaQb 7V5igGNA4tSYsKJlhUsHXh++6EVRqGPpuJyzcLyjV/Et2SovBXn5UHjSynIu7dZ15JFO rMzBAxWAqZyyo6MlD3VZYOZeNyTXzYUHZcWnUA2ZFFpW3DK4ieqmnnfGUQoF1a3jGiF7 mz+C6vW3TOQK0m/vNMC+xf3Oy9wodI13B73aG8ZeMtbrmhY5EVWRq23HXOw+NCnig72l a0eIjtW1EKfDXjtyKaxOWghfopkcCzwgePAkoSrF9DcT5vUAe8gQIo8hRnp4o927no+a CWCw== 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:message-id:subject:cc :to:from:date; bh=6lGZBGbmNnRnr2dYAunNcWtPyEm9JbGHzu2cyoxQ2nI=; b=cxQEW3lSTos+ri6u6yJazxZeAHt8DEmwQ/DTTSx9v9JOiGDaKPqXtRgebcQod/2BFd xUuIpTz18pU8ObOjG7xE+N84KZ+oKAIn3H5OenjXPrw386qUIUsLO68s1mXLe4Fd6L// e7PcDCjggRO7lwOCF7Gr2NJhMPTGitLFFh9pyEwVqpoCMcNNLC6Xf+GhunxcLniBwtmO ykhkI1aMDH/wqhlSGuHGXgoLQUnoSnJm4IGwKVoxc0VxYK0DfGJfU7aMJtf+9Mn/jf9n dLben60hB1Gn/SmfIqQ4Uc38WO4vFRY3RX5oxQBQaBAs49CAO9jjl239LpE2mYLDzqPc Oz+Q== 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 o32si36781407pld.407.2019.01.11.07.05.09; Fri, 11 Jan 2019 07:05:25 -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 S2390323AbfAKPCJ (ORCPT + 99 others); Fri, 11 Jan 2019 10:02:09 -0500 Received: from mail.bootlin.com ([62.4.15.54]:54228 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389215AbfAKObn (ORCPT ); Fri, 11 Jan 2019 09:31:43 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 8AF90209BD; Fri, 11 Jan 2019 15:31:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (alyon-652-1-22-18.w109-213.abo.wanadoo.fr [109.213.145.18]) by mail.bootlin.com (Postfix) with ESMTPSA id 313A7209BC; Fri, 11 Jan 2019 15:31:41 +0100 (CET) Date: Fri, 11 Jan 2019 15:31:41 +0100 From: Alexandre Belloni To: Anson Huang Cc: "a.zummo@towertech.it" , "linux-rtc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: Re: [PATCH] rtc: snvs: make sure clock is enabled for interrupt handle Message-ID: <20190111143141.GC2547@piout.net> References: <1547190255-9388-1-git-send-email-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547190255-9388-1-git-send-email-Anson.Huang@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 11/01/2019 07:09:02+0000, Anson Huang wrote: > During system suspend, the SNVS RTC's clock will be disabled in > noirq suspend phase, but SNVS RTC's alarm interrupt could still > arrive, system will hang if SNVS RTC driver tries to access register > without clock enabled, this patch fixes the issue of this scenario. > Are you sure this is the real issue? I don't think the handler can be called before the resume_noirq callback. Isn't the issue that your clock driver has not yet resumed by the time you call the rtc driver resume_noirq callback ? > Signed-off-by: Anson Huang > --- > drivers/rtc/rtc-snvs.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c > index b2483a7..0b9eff1 100644 > --- a/drivers/rtc/rtc-snvs.c > +++ b/drivers/rtc/rtc-snvs.c > @@ -239,6 +239,9 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id) > u32 lpsr; > u32 events = 0; > > + if (data->clk) > + clk_enable(data->clk); > + Anyway, won't that need a clk_prepare_enable because it has been clk_disable_unprepare in suspend_noirq? And this is something you can not do in atomic context -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com