Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp3165777pxy; Wed, 4 Aug 2021 04:08:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9H0diFEVXdBzJKGFHv/IK8fjKSHBsLMJGxRAehlYKzIpQ2CAofJzoLXaih/pT4dz59WCs X-Received: by 2002:a05:6402:603:: with SMTP id n3mr30209331edv.61.1628075281145; Wed, 04 Aug 2021 04:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628075281; cv=none; d=google.com; s=arc-20160816; b=NJKGL8AfvMptcJ2DTMyLkyPzSkgJSXax8OJlKqWAYKYkY2sOPJBonoWd3WK9N9DgWV mwrEAy51+aW7Kp51df3f9U/Yb2/Uz+FhVphzuDZrdk0U1kF4m9CBHkZSAI2RNCYMsFA3 6M6OyMNcE4YxMBpW2ckE/goik1KOC/T+xRibqld+oXHW8L3A7r+rIh4PoutTwzDME6+m 29WIrDas0fIBPb1SwktuWmVu01JAm8RkqWotTB2wkrpVCB+VjODhnl6COzJnRrGeWTUS pt/JUJ0ao7dNS6j3mktFQh7C9LDQNV0uapEGyCXgdhTMzK5clNZyBxqw6I8zoSrUe/Y7 uHdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PO1HQJPwb6pI1WiOSnrbgiJ9M4xrymsWmHJ6pPeR8Z0=; b=TwwuIvfSTEYSWn0USQBKc8fFu9MHcgHmh0O2BPHHwng7XAq8f1toeYoY2qP4D3/8Mk trGOd9ygw6mts974PEdDitWj548vOZZUDR6gFhX/D15tDPmee6F/e00Vj9FfD3mq++u6 wLu/e2O30oHuFBNJDUP4Ku0T5/lFZ7H+qR6LxgLP3z8HFO3p3UDCukmL6nySyHzlP+4W xht63WiVDN0WS9fRhSZY/K6cMjDVR02ZKYcoJTdk1tnla7SIJKCr/pT0yEcS3I9lwpYg nwj8Tf3UdOIH55TcGJOalX/z4PBknepuhYD66gu0T+87U8Uv6FQ3bNpWgujU9nB/0Jgy 7JKg== 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 s18si2054445eji.655.2021.08.04.04.07.37; Wed, 04 Aug 2021 04:08:01 -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 S237524AbhHDKmp (ORCPT + 99 others); Wed, 4 Aug 2021 06:42:45 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:32915 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237506AbhHDKme (ORCPT ); Wed, 4 Aug 2021 06:42:34 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 462AAFF803; Wed, 4 Aug 2021 10:41:59 +0000 (UTC) From: Alexandre Belloni To: Alessandro Zummo , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 2/4] rtc: s5m: signal the core when alarm are not available Date: Wed, 4 Aug 2021 12:41:30 +0200 Message-Id: <20210804104133.5158-2-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210804104133.5158-1-alexandre.belloni@bootlin.com> References: <20210804104133.5158-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clear the RTC_FEATURE_ALARM bit to signal to the core when alarms are not available to ensure the alarm callbacks are never called and userspace is aware alarms are not supported. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-s5m.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index 4c1596c55de8..ee195697e6c6 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c @@ -794,25 +794,20 @@ static int s5m_rtc_probe(struct platform_device *pdev) info->rtc_dev->ops = &s5m_rtc_ops; - err = devm_rtc_register_device(info->rtc_dev); - if (err) - return err; - if (!info->irq) { - dev_info(&pdev->dev, "Alarm IRQ not available\n"); - return 0; - } - - ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, - s5m_rtc_alarm_irq, 0, "rtc-alarm0", - info); - if (ret < 0) { - dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", - info->irq, ret); - return ret; + clear_bit(RTC_FEATURE_ALARM, info->rtc_dev->features); + } else { + ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, + s5m_rtc_alarm_irq, 0, "rtc-alarm0", + info); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", + info->irq, ret); + return ret; + } } - return 0; + return devm_rtc_register_device(info->rtc_dev); } #ifdef CONFIG_PM_SLEEP -- 2.31.1