Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1041289pxb; Tue, 14 Sep 2021 14:57:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlDJboCqdU0W2GIMvpSfSpx4Ui964Hn5l6UvpgELmR2dfH45NMd8wSQ0O1woeRsivYBszK X-Received: by 2002:a05:6638:2588:: with SMTP id s8mr13845971jat.43.1631656645352; Tue, 14 Sep 2021 14:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631656645; cv=none; d=google.com; s=arc-20160816; b=Rsr4dK+4pZYiuif1oL2ItD9zwWL1k3rzegZzMP4/y6oWy0dgYhPeYFFAtmi334AApO mt6pDqlLfvHmBuzaMkgNuO9biablItkQwqvyOOKmYXafq7BgMRr6Y6mClcRk34pKVgTB S+/FtBucpN8uoqKy/Zln3pEt4KbbOE1XRn5cQFoJscUChEl6PasQ039kjcqkbY6NBQL9 FvkJV8vPITmh638bIdUoiucOjdfQ/kcREKSyDZG/v047XcuqbWLkCJQvBSZFHLBXXzK3 MwTDgUJJHgePPznAdhCkgP9O0HGF4t+d7mMpZcdND+2PQDWidMc48B8vWRgm31k9Lu/A uRcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ckKIGLGMwRa4o6vj8OPpyBMp+GMwyAEu1RkxZ54rweU=; b=s/fQWOG2HIbDFwMnWmS6Ha5wZrgoX0hfw7HnzQgyLQuDODDq2tp/OEORBOE2EBziex F1Vue3N/UXsaGLp8wE56GTxXHZSz4JHId3mdgCMG3LK4lR5ykXRQjdYRrFoZQr3np+3i 2tUHWAlutika1UHRvJ6C+YVkt3OfhxakMWD/vIYQht3Ib9spimmWhJNWk2OSgUmvR2Y+ p9k2lu5bU2nDUGQxmasGM6Ar4UENFKKpb0wQ4vvGal1KHzCQFepCIbTMel+J1y9R3ksn Kx/mDBbhNXcEcUeNwAyr4XlsbiD56NHLziK6ckn4Dq/2OAnBU6981d4BvJG25YZW72Pe MTXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 11si11379121ilq.55.2021.09.14.14.57.13; Tue, 14 Sep 2021 14:57:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234572AbhINV4P (ORCPT + 99 others); Tue, 14 Sep 2021 17:56:15 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:43819 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233952AbhINV4O (ORCPT ); Tue, 14 Sep 2021 17:56:14 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B3CE340005; Tue, 14 Sep 2021 21:54:55 +0000 (UTC) Date: Tue, 14 Sep 2021 23:54:55 +0200 From: Alexandre Belloni To: jianbin zhang Cc: "a.zummo@towertech.it" , "linux-kernel@vger.kernel.org" , "linux-rtc@vger.kernel.org" Subject: Re: [PATCH] rtc: Disable alarm irq if alarm is enabled and alarm time is less than or equal to current time Message-ID: References: <9c817836-64d6-1452-189f-2783c4138ace@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9c817836-64d6-1452-189f-2783c4138ace@quicinc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/09/2021 10:50:33+0800, jianbin zhang wrote: > > On 9/11/21 3:05 AM, Alexandre Belloni wrote: > > Hello, > > > > Please format your patch properly. > > I am so sorry for bothering you because of the patch format. I test the patch format in the local and > > the format works well. Such case will not occur. > > > > If device is booted up by rtc alarm, the alarm irq will still be enabled and the alarm time is less than current rtc time before any alarm is set or canceled . > > > > > > If device is shut down this time, it will boot up automatically as the alarm irq is enabled and alarm time is less than current rtc time. > > > > > > > > > > > > For the situation that the alarm time and rtc time are equal to boot up the device, we expect irq to be false until another alarm is reconfigured, then irq becomes true again. > > > > > > > > > > > > So disable alarm irq if alarm is enabled and alarm time is less than or equal to current rtc time. > > > > > You should probably fix your driver instead of messing with the core. > > From what I understand, you have: > > > > 1/ set the alarm > > 2/ shutdown > > 3/ alarm happens, the device boots > > 4/ shutdown > > 5/ alarm irq is still set, device boots again > > > > At step 3, your driver has to acknowledge and clear the irq > > Thanks for great reviewing. > 1/Yeah, the steps you understand are right. > 2/In fact I met the issue when using the core rtc driver.That means I do not have a private driver on the issue. > Well, the core isn't a driver, which driver are you using? -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com