Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1811916pxb; Wed, 20 Oct 2021 12:13:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5VLZUQLFnMnzc5buGxtzzQH2c0Iy9qK5tbAP/DXf6kW0u4OW0na1NjatcxDELf0dKpZPJ X-Received: by 2002:a17:907:168a:: with SMTP id hc10mr1492705ejc.214.1634757190995; Wed, 20 Oct 2021 12:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634757190; cv=none; d=google.com; s=arc-20160816; b=J9TWxJhFgkATKE0G+8EhvCTXCLvqeZbrwqHshDVLv4zVtFj5JImBwTZL2cmJSl/+hw 7cO+jXjqV7UM2+0oI4hnev3PyklXCsRB383AXyd7smA4nRtPsjmvVGrX1Eni0ykoOlnF UmT4Zbj1tXziQUaCdy0mHT7m0xx/alA5W0IqZyGLjgR6gFONXsrDPCrZejhbKpg7BlzN ufAHWjf11yFM/RaT3dHpbd87IzujqVypHhr5Y+UyARVqDrhM7ctoX0p06FEpUzJcrxqU /dk/aNMCgUJCOXHl0xFGgn8DF/GLh5RZXjfRCRDBISwzW9HU9gbP4PIF295hvcMef/Fe w/PQ== 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=ZB82tsfZO+5N0kDrvQl64SZ2eKNyD32ymRp0BV0vpUI=; b=ClXMnyp8rjQk+O9vg+tRmeLC7w/vX/Vf4REvDGeP0nYe37XDzm+IZx9a/67qkJkhdm bmMnTEdvDWMmd5/EzwJRM61Q1/LL2RgHof641m+xlPMHOhcuvqxe/ySmdK1KH41pN6TE Wl1xwB75csGMoxDH0nC1S+03mHNFa3/zDN1ylWanYsF+gv9teB9HCbKFg3H3dztVUuUG pl7F0UhoHg4oaUmYNI0N6KDCDfCK4yPOpBqh/5p39BfhYlJzLOzwsGZcQLR+SFxAA5cQ 79GO1A2ef4sz8oCpSDYiCppFeoRhX6r6O6/PYmaPLVmRVY+JquLCwy2WvzbSubb4xdvO r13g== 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 l2si6315132ejo.671.2021.10.20.12.12.46; Wed, 20 Oct 2021 12:13:10 -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 S231478AbhJTTMk (ORCPT + 99 others); Wed, 20 Oct 2021 15:12:40 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:41968 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231346AbhJTTMk (ORCPT ); Wed, 20 Oct 2021 15:12:40 -0400 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 3.0.0) id 5bf667436b9baf14; Wed, 20 Oct 2021 21:10:24 +0200 Received: from kreacher.localnet (unknown [213.134.162.32]) (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 C153166A919; Wed, 20 Oct 2021 21:10:23 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Linux PM Subject: [PATCH] ACPI: PM: sleep: Do not set suspend_ops unnecessarily Date: Wed, 20 Oct 2021 21:10:17 +0200 Message-ID: <4698118.31r3eYUQgx@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.162.32 X-CLIENT-HOSTNAME: 213.134.162.32 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvgedguddvlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhephfegtdffjeehkeegleejveevtdeugfffieeijeduuddtkefgjedvheeujeejtedvnecukfhppedvudefrddufeegrdduiedvrdefvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduiedvrdefvddphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=3 Fuz1=3 Fuz2=3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki If none of the S1 - S3 sleep states is supported, it is not necessary to register suspend_ops, so don't do that then. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/sleep.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) Index: linux-pm/drivers/acpi/sleep.c =================================================================== --- linux-pm.orig/drivers/acpi/sleep.c +++ linux-pm/drivers/acpi/sleep.c @@ -815,14 +815,18 @@ void __weak acpi_s2idle_setup(void) static void acpi_sleep_suspend_setup(void) { + bool suspend_ops_needed = false; int i; for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) - if (acpi_sleep_state_supported(i)) + if (acpi_sleep_state_supported(i)) { sleep_states[i] = 1; + suspend_ops_needed = true; + } - suspend_set_ops(old_suspend_ordering ? - &acpi_suspend_ops_old : &acpi_suspend_ops); + if (suspend_ops_needed) + suspend_set_ops(old_suspend_ordering ? + &acpi_suspend_ops_old : &acpi_suspend_ops); acpi_s2idle_setup(); }