Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3943543pxm; Tue, 1 Mar 2022 08:15:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJydNSLO7sLbaV7hWBFD0+fXc69n2m+zReSdl6eFAIeSID9obkIdApBi3wLwgSHhriZXgpny X-Received: by 2002:a05:6402:270b:b0:410:d71d:3f06 with SMTP id y11-20020a056402270b00b00410d71d3f06mr24759151edd.10.1646151303427; Tue, 01 Mar 2022 08:15:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646151303; cv=none; d=google.com; s=arc-20160816; b=dEYNzP5G9aD3mAcHb6mM+UZdx4b7tCwXK6M1GeVfQd8X5KknyrWZEQ4nEhtuDGNSKq NgLIN42f3godpbRxlbUBjhTdTtwXM+iPpsvmfXoJFVx/R2zKoZCak7JGpruL2Zf5nnlF i0fUyANaErqLjAN4p1ZamNIUeI6i50lkKC5zYz1FtoXB7kS4LRzPUjgboeoGbd9lAKXy FB/mwA47JBxvYtnICnC3JH1cXShYI+ZUREaDz1py5gUfMxE3ozAe35lTImGWWQmwQn3c Z5pOiROqe6/L8SKdzGv6/lI5O9y+CH2/oVCp1iLBJUczcCm3ZqTOK7/Y03os3ZzD2vem PwOA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=SiBbFJCKuZ3OQnC8duTiCLF5hmEwEETvZMAIa1BnuPE=; b=YC5/K9Ht2tWjpgkKWShh8pCEhsM748oP/jqylVDB8Y2oFztgQr73xPkoDxfTUkn1lu c+Le8bPipdEs0ASzEi3Egb06F+TONOG8KgiKsb0K17WLU37yeCHHw1WqI2hUNu4WMq8i mmT72sBjJy2FiB1Hg5b4xUl7t/NbxMPZOuRziuXyK1c8vlZLXhg6xE7tXQak+Ped/Rw2 D48b4nhemj6AGLk4Q647Wu8C/vz/o4rmXnIlMY7g0QkFYlr2gmWJPy/8mt7deXMqzeTr YTHpxz+ijmO2UM85R0edybcrJ2KPC8mpTJX0hvqUQWGU9nQnPV3WC3vXuaEP0EFSf5cv 2Geg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=PdN2ZCGH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gq22-20020a170906e25600b006d11631a1edsi8328166ejb.103.2022.03.01.08.14.40; Tue, 01 Mar 2022 08:15:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=PdN2ZCGH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234932AbiCANNL (ORCPT + 99 others); Tue, 1 Mar 2022 08:13:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232317AbiCANNK (ORCPT ); Tue, 1 Mar 2022 08:13:10 -0500 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10B37C12; Tue, 1 Mar 2022 05:12:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1646140348; x=1677676348; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=SiBbFJCKuZ3OQnC8duTiCLF5hmEwEETvZMAIa1BnuPE=; b=PdN2ZCGHKG4diZ3dHtN989eFS+bOJ54N2JbpdqCWu8pIVR86BoY1yZE0 AILomtcQx34OwxYtQfIA3eZ8HKE2YdvJHkS9l3TWgiRj0jt48XpBGooUW O0Y7o5vJtHgXKEQWlLZWEiUZI+W4w+UtM5PddHe1D3910TUtFOtjP2HDA 5bmofDrgBvq9E1ibK5PEn645+X5/KfhtxouJFUP94yNoguESJzuJQxRUY w5pQA/Dvsd9PLozeenHFNUqRhg/k1fE77/fDYJE62kqmEqVSqm4dqihiq 6RhC6ilgBoSUXQQjHf0FJVTfNUZHuzdSVMg01CFJe/sG/cxkU+JkUPCi/ g==; From: Vincent Whitchurch To: Alessandro Zummo , Alexandre Belloni CC: , Vincent Whitchurch , , Subject: [PATCH] rtc: pcf8563: clear RTC_FEATURE_ALARM if no irq Date: Tue, 1 Mar 2022 14:12:20 +0100 Message-ID: <20220301131220.4011810-1-vincent.whitchurch@axis.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If there is no IRQ hooked up, clear RTC_FEATURE_ALARM to make the core ensure that userspace is made aware that alarms are not supported. Signed-off-by: Vincent Whitchurch --- Notes: Could there be some board which uses the RTC for wakeup using wakealarm but which doesn't have an IRQ? Then this patch will stop it from working since wakealarm requires RTC_FEATURE_ALARM too. It's unclear how that needs to be addressed. There seems to be a lot of variation in how different RTC drivers handle these flags. Some call device_set_wakeup_capable(), either conditionally based on the irq or always, while others don't call it at all. Some call dev_init_wakeup(), others don't. Some don't clear RTC_FEATURE_ALARM if wakeup-source is set, others don't check wakeup-source and only clear RTC_FEATURE_ALARM based on the irq. Others never clear RTC_FEATURE_ALARM. drivers/rtc/rtc-pcf8563.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index c8bddfb94129..ade3a564bd33 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c @@ -580,6 +580,8 @@ static int pcf8563_probe(struct i2c_client *client, client->irq); return err; } + } else { + clear_bit(RTC_FEATURE_ALARM, pcf8563->rtc->features); } err = devm_rtc_register_device(pcf8563->rtc); -- 2.34.1