Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2566177lkm; Mon, 20 Sep 2021 18:52:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycOVH/zy+djc43RGEVHIEJBda5NrTK5/h65dJg7jEHkyCMQE/Ze537sWPbHcwDDuPIWO75 X-Received: by 2002:a6b:144c:: with SMTP id 73mr5541215iou.174.1632189099301; Mon, 20 Sep 2021 18:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632189099; cv=none; d=google.com; s=arc-20160816; b=Q1pm6pnzGlwY6ySkOAIea62bj9j7DKCnDI3glUrwuQwduzGpI0h+BRLocmWN90Lx8p +7mx5smkuGQaShyXsFz4duTvDt8LMh6bAtv+kayv2zTC88vYOQ1ipZJFogykq5wV+ZaJ 9SOiykrVVQn/RFuBfdbitsx1b/DIjvnXTDJLJNWKhW3qI8iQUDDCMLUbqQZyuFSXZZHZ dCz36EGFwXQkbNuuk/SjLYHDnVp3/DkaBN9L6gSitxZj4p9QlVwDAt0VHJA6lpsc+I3k JWkEZtDg3PrCDlpMCoBj1dAMn58AmNtYEbg4nqp9OAeXeWaGH0BVwmcXnC5uC9v5gs7o wfQg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s0uTd5q7sifWaKz9OKdjEzAdDVp0p/1KQUqpv8JYhvQ=; b=sGaFs9Zo5eG743fVicMIUlJTo8lHL9ge0zxI77eeZwk2OQIHZTmDNhbgP/VowsARbY qSg8jVf8O5glUCyJRAMrlhp8OX6BK6R+Z1fhRTQFwiWxI4kHuQ6Nnx3iM7bqUYtMwSYw mX1u9McJgO5AHHYRlvqDE7E85fzDF3wB4fMmMNnZFeB8F6X3qUivfSC1dXDshBs/Kqj6 kB+v6CGK9CLcbotTOkyoEyX7TJw8buxlYnNlSvUYRAsH8p3gQ7MEyy6nY0xIDRCk32pt gc57sFmXdvlS36CmMsI+bsvkxHOHyLZkP8PRaSLLtlyzKq8+tIehYG+69SuLrF2PqPbR +JGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b5ZrGuEP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j24si15202285jaa.10.2021.09.20.18.51.28; Mon, 20 Sep 2021 18:51:39 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b5ZrGuEP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350203AbhITSA1 (ORCPT + 99 others); Mon, 20 Sep 2021 14:00:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:54552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355189AbhITRyS (ORCPT ); Mon, 20 Sep 2021 13:54:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A2A1061C11; Mon, 20 Sep 2021 17:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158010; bh=l16qG+F5o+7kNpPs82jL7PXkKb+2Vx1dGgZH8LU5+/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5ZrGuEPIZsudzCIZGCQLE40q4SdqqTWfDPJYgRt5USAQZSsmRHebxRArHPxgUJGu iRYsRTVZY83BewNNW4uh6+5bQZtWndiwtCS3y01qKWCbCE2BnvVFSkErDtMa3qbbE7 oJd5l4Spp+6MrPQj1Rqd6rRPqLo15qntmd5M4FQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , "Rafael J. Wysocki" Subject: [PATCH 4.19 254/293] PM: base: power: dont try to use non-existing RTC for storing data Date: Mon, 20 Sep 2021 18:43:36 +0200 Message-Id: <20210920163942.081415111@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163933.258815435@linuxfoundation.org> References: <20210920163933.258815435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Juergen Gross commit 0560204b360a332c321124dbc5cdfd3364533a74 upstream. If there is no legacy RTC device, don't try to use it for storing trace data across suspend/resume. Cc: Signed-off-by: Juergen Gross Reviewed-by: Rafael J. Wysocki Link: https://lore.kernel.org/r/20210903084937.19392-2-jgross@suse.com Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/base/power/trace.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/base/power/trace.c +++ b/drivers/base/power/trace.c @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -165,6 +166,9 @@ void generate_pm_trace(const void *trace const char *file = *(const char **)(tracedata + 2); unsigned int user_hash_value, file_hash_value; + if (!x86_platform.legacy.rtc) + return; + user_hash_value = user % USERHASH; file_hash_value = hash_string(lineno, file, FILEHASH); set_magic_time(user_hash_value, file_hash_value, dev_hash_value); @@ -267,6 +271,9 @@ static struct notifier_block pm_trace_nb static int early_resume_init(void) { + if (!x86_platform.legacy.rtc) + return 0; + hash_value_early_read = read_magic_time(); register_pm_notifier(&pm_trace_nb); return 0; @@ -277,6 +284,9 @@ static int late_resume_init(void) unsigned int val = hash_value_early_read; unsigned int user, file, dev; + if (!x86_platform.legacy.rtc) + return 0; + user = val % USERHASH; val = val / USERHASH; file = val % FILEHASH;