Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2351733pxb; Mon, 20 Sep 2021 19:48:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQOBmwnBzVhggjjHDUdaycw7mWLxamwovl6ZrpRW+0bIY2evPSfUn4F8Xl2S1ZFuYXp2iD X-Received: by 2002:a05:6402:17c8:: with SMTP id s8mr32887034edy.130.1632192485105; Mon, 20 Sep 2021 19:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192485; cv=none; d=google.com; s=arc-20160816; b=icf3zkVRv3QTf3wGD4/5B+wRSpLRBSW/FWHrncpajUu1bozsKe98n76UB4XVTyKkTF rkf+ztBRqtmiQq9QOCsEfnnoKR2YIdSlYkeSngMnQvLjSIkG1YwN/7igzGfwibUDYA/0 prkIYWnO0NLtHaDZOp+PvSx3I2V/Adsx4ralROtH381DeOIklWx/rgGoWqSedsoMtm4D bAFGrKLpaieyDAa34YgidZyUIx1fHTmUjTlSuGU3n/sfuGvSeemFNsTP8GjYWwIKhH/q g/kB8uV6TFrMbiLmX1E1Jcfe6PAWHAlNtWI0nhhPkaw/FAOF1Js9lKAno+7WmHPym1j7 XSow== 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=y0IXBOhzesO6WEu29W+zzektXYQnwziRjTCHQ7sl6K4=; b=cnGYcGUJmNkjeu9d/bhPiLQEWALT4CSHQ5eF1yuc8EDbxwMRqXFlxauU+qKRp7uErW bz38s+LTFizFbPEK+6px0eoHgesGLsZ7HIo8/+owcXlDhVLDlVcF435OyQSsTsJCXIb3 eXsYcX99Bl/Cx1Cf5Ayc82YKmme0zcMeiAFlG3wXlIoxIzkkmSTSLnf2QgLz5+aSV9u+ QKhZG92jdW3f/Jg5Ow62wMKw1zBSTdheNxjT2Hy+9z2ZguDJpBln3OVD1nrAs0qlXpF0 OGHYJY8fIC8o5I5WOJB8NlK9WwWwIHdtxdllKG3VfjUAFTb2T7ConpQLzmFnqRtpUg6M TX7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z4jI3FXs; 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 s4si24839741ejm.735.2021.09.20.19.47.40; Mon, 20 Sep 2021 19:48:05 -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=Z4jI3FXs; 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 S1348885AbhITSby (ORCPT + 99 others); Mon, 20 Sep 2021 14:31:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:46128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378749AbhITS0V (ORCPT ); Mon, 20 Sep 2021 14:26:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 504D4632D2; Mon, 20 Sep 2021 17:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158725; bh=XK4wX9LJSIljoTAwtcTaJD3bviCjOBnfqboBhbiu5R0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z4jI3FXsT849tHRZXMfa9RFhinAs2RsM2bBLHUb7DcAsOO8mea8FFFUaBS4JzFTXq S5y3S4aC4imY5FED+npDF/PrmoJi/jwUFTVbA6X1lHuJW0rEIHPiRPtcOO9ch/SL8a qQuouzaMif8P+7U6787cFBBzn2DMelojdgnM/29o= 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 5.10 007/122] PM: base: power: dont try to use non-existing RTC for storing data Date: Mon, 20 Sep 2021 18:42:59 +0200 Message-Id: <20210920163916.003496347@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@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 @@ -13,6 +13,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 __init 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 __init 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;