Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6220717rwi; Tue, 18 Oct 2022 09:31:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4c/sg4a2MFd+R6E3sAbmvPVyNSZuHHI5sCATSPW4MOBtvjgU7yJ+92uwEkX51U6VjUS23S X-Received: by 2002:a17:907:e89:b0:78d:cdd7:5a28 with SMTP id ho9-20020a1709070e8900b0078dcdd75a28mr3267585ejc.167.1666110659532; Tue, 18 Oct 2022 09:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666110659; cv=none; d=google.com; s=arc-20160816; b=0ta0/yuP7qyylAqlp8RysCH570XJEo0/nKrM7frKxpyN9Wp+oEsvUmHwUqZUZn/FiM rO9ImOUxv1tdayk3dh6gSzTZ2ivSiCjMNWSeKmW+C49ONh/ZtLLCK9TAd3D7DOvCGUhw kvFvqP2scrRT+7agTuCdYVUT8asaxKWtltpVcOhmAdIs7iiQe967BoL0SHrnA0lTDSRZ DqWKumT3rFlq5VjRzxRHmHp2qUflQTOIg3fdTfyHuI3UQGnpaRTjC+CzVgCplQu2cnAb lOTumsRrp940qUGjR8QWhGU6pHdOyaFBSmbuvipmD7rNYp/ybad0SrOXwgUOgi2Ji8Ol /uEw== 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; bh=tOxpnPyBl0pvea05JqVpGLfhly7wlMcSMVXCOgewxNc=; b=YnipNsf3hd1SLBLUDEyKACr1MOq891caBt0EQ1TCEgvbIgxB20vabND17bKEzqL5rr 99QfQ08gNCuzGs0waOIQNgtNNhkdG5yZ9JkXjdC0N3RzhHOssUtxPpYFkQpmxIFC2CG1 HbQs17zWg0nmtbelUP7fineQKZZeegKYV1/p35sSc37qA6lYAU4DDL7AdzHk6w53AXVf +q9iWK6uvTQvUr2J8IWYFMjg8SYdF/xzlZnQWGzIrNKipk/rRmLx4wgGJZLgD1YbUMVB 3xVvgoJ5TlXTY58Noca9fhirQnnC0WB8N6nVSIPt1laI9Tz19FuBVbCBZLnWJF9JFGIJ vZcw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020aa7d597000000b00445f660de5asi10109677edq.141.2022.10.18.09.30.33; Tue, 18 Oct 2022 09:30:59 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbiJRQJr (ORCPT + 99 others); Tue, 18 Oct 2022 12:09:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229852AbiJRQJo (ORCPT ); Tue, 18 Oct 2022 12:09:44 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 598BA22BFD; Tue, 18 Oct 2022 09:09:40 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.0.0) id 349dc4d4a828391b; Tue, 18 Oct 2022 18:09:37 +0200 Received: from kreacher.localnet (unknown [213.134.183.104]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id BA45666695D; Tue, 18 Oct 2022 18:09:36 +0200 (CEST) From: "Rafael J. Wysocki" To: Alexandre Belloni Cc: Alessandro Zummo , Mario Limonciello , linux-rtc@vger.kernel.org, Bjorn Helgaas , LKML , Linux ACPI , Linux PM , Mel Gorman , Zhang Rui , Todd Brandt Subject: [PATCH] rtc: rtc-cmos: Fix wake alarm breakage Date: Tue, 18 Oct 2022 18:09:31 +0200 Message-ID: <5887691.lOV4Wx5bFT@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.183.104 X-CLIENT-HOSTNAME: 213.134.183.104 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrfeelvddgieejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepffffffekgfehheffleetieevfeefvefhleetjedvvdeijeejledvieehueevueffnecukfhppedvudefrddufeegrddukeefrddutdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekfedruddtgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepuddupdhrtghpthhtoheprghlvgigrghnughrvgdrsggvlhhlohhnihessghoohhtlhhinhdrtghomhdprhgtphhtthhopegrrdiiuhhmmhhosehtohifvghrthgvtghhrdhithdprhgtphhtthhopehmrghrihhordhlihhmohhntghivghllhhosegrmhgurdgtohhmpdhrtghpthhtoheplhhinhhugidqrhhttgesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehhvghlghgrrghssehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmghhorhhmrghnsehtvggthhhsihhnghhulhgrrhhithihrdhnvghtpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehtohguugdrvgdrsghrrghnughtsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=11 Fuz1=11 Fuz2=11 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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 From: Rafael J. Wysocki Commit 4919d3eb2ec0 ("rtc: cmos: Fix event handler registration ordering issue") overlooked the fact that cmos_do_probe() depended on the preparations carried out by cmos_wake_setup() and the wake alarm stopped working after the ordering of them had been changed. Address this by partially reverting commit 4919d3eb2ec0 so that cmos_wake_setup() is called before cmos_do_probe() again and moving the rtc_wake_setup() invocation from cmos_wake_setup() directly to the callers of cmos_do_probe() where it will happen after a successful completion of the latter. Fixes: 4919d3eb2ec0 ("rtc: cmos: Fix event handler registration ordering issue") Reported-by: Zhang Rui Reported-by: Todd Brandt Signed-off-by: Rafael J. Wysocki --- @Bjorn: This is the minimum fix. Folding cmos_wake_setup() into cmos_do_probe() requires changes that are a bit intrusive for post-rc1, but I will do that later. --- drivers/rtc/rtc-cmos.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) Index: linux-pm/drivers/rtc/rtc-cmos.c =================================================================== --- linux-pm.orig/drivers/rtc/rtc-cmos.c +++ linux-pm/drivers/rtc/rtc-cmos.c @@ -1233,6 +1233,9 @@ static u32 rtc_handler(void *context) static inline void rtc_wake_setup(struct device *dev) { + if (acpi_disabled) + return; + acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev); /* * After the RTC handler is installed, the Fixed_RTC event should @@ -1286,7 +1289,6 @@ static void cmos_wake_setup(struct devic use_acpi_alarm_quirks(); - rtc_wake_setup(dev); acpi_rtc_info.wake_on = rtc_wake_on; acpi_rtc_info.wake_off = rtc_wake_off; @@ -1354,6 +1356,8 @@ static int cmos_pnp_probe(struct pnp_dev { int irq, ret; + cmos_wake_setup(&pnp->dev); + if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) { irq = 0; #ifdef CONFIG_X86 @@ -1372,7 +1376,7 @@ static int cmos_pnp_probe(struct pnp_dev if (ret) return ret; - cmos_wake_setup(&pnp->dev); + rtc_wake_setup(&pnp->dev); return 0; } @@ -1461,6 +1465,7 @@ static int __init cmos_platform_probe(st int irq, ret; cmos_of_init(pdev); + cmos_wake_setup(&pdev->dev); if (RTC_IOMAPPED) resource = platform_get_resource(pdev, IORESOURCE_IO, 0); @@ -1474,7 +1479,7 @@ static int __init cmos_platform_probe(st if (ret) return ret; - cmos_wake_setup(&pdev->dev); + rtc_wake_setup(&pdev->dev); return 0; }