Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4788746iob; Mon, 9 May 2022 01:27:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvop89DCpjV0Ut+WtXgJwFYfRG/2wuhqHYvwxB9j95of9+yYVakdgEuJ0AJZfI5IhGxDGt X-Received: by 2002:a17:902:d48d:b0:15e:a480:78b2 with SMTP id c13-20020a170902d48d00b0015ea48078b2mr15229912plg.19.1652084847851; Mon, 09 May 2022 01:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652084847; cv=none; d=google.com; s=arc-20160816; b=SDMTUxuHGvQpBx3z8+FhTf41/tqKhH5lR98B4FjCLShZPep7RrKnEUrxR6/022df3z ScwPBGNuD1YT1qpSEw0sKnf6vHumDQS1ean8m5GsQJinaKAybJxrDNQm3bxiUSOlrbJy 2fo/fdHZVX51+7NQi4dfeMpfuwJiS/pU+raHMae0QAveAkY2+wSGG5406WG1HjRpBN/U GgoQK0pX6xQ7Tz5aNzxd0UvVeRp55NRRHkM3Og565Bz+WDPjJ+H4BIaAtbfIjx3qdkmN e7Nef8O9mi53+C0Dgz5iLvG803Ni9rE4e0/eBYY2stGy4hoVNvSrqQ83EemVyeXkToFf 65UQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=CbrZ8V5gz6dJUygpL7ClGTYFkWLqr2A98osF/VxbOmk=; b=eZ77tb8nWrl7GLJL0+YlB/13spd0abBq8TC6Di9r8EOAHvmWZpCj6Iqw0WBdXR44nl I2Tg9Rcis5V8aGZ3TaS+Ze+KmREZBtdari+ARuLJH4gjb+j02uik2epa8ymedpe9YGug kjeU3pAuM/zrP9fbuvI6rJnLke0KDCllH2BJweU6pQ/YJwSkEY03tSTk+Dqv2S4oYR0h VoiGXjoRcIlPaD4SgrXumgGmVSzktMm+9iat01FqOxWYAd8u/SQpuLoebv9y0RBh45a/ 1ERo7l3YqG9liRkCfuGTpDVRnJxJbgrCSVQE3fIT5EKvp9EuEZmh7TULwb2lbVXDBYIv ILRw== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 123-20020a630481000000b003c232c574c8si11394279pge.342.2022.05.09.01.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 01:27:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D7E141EE093; Mon, 9 May 2022 01:13:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384135AbiEESgN (ORCPT + 99 others); Thu, 5 May 2022 14:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385213AbiEESaP (ORCPT ); Thu, 5 May 2022 14:30:15 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EC9D5EDF0; Thu, 5 May 2022 11:20:48 -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 a9ec237065783df5; Thu, 5 May 2022 20:19:39 +0200 Received: from kreacher.localnet (unknown [213.134.161.219]) (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 4FEE266C2F2; Thu, 5 May 2022 20:19:38 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PCI Cc: LKML , Linux PM , Mika Westerberg , Bjorn Helgaas , Nathan Chancellor , Anders Roxell Subject: [PATCH v1 04/11] PCI/PM: Unfold pci_platform_power_transition() in pci_power_up() Date: Thu, 05 May 2022 20:05:15 +0200 Message-ID: <1922486.PYKUYFuaPT@kreacher> In-Reply-To: <4738492.GXAFRqVoOG@kreacher> References: <4738492.GXAFRqVoOG@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.161.219 X-CLIENT-HOSTNAME: 213.134.161.219 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrfedugdduvdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppedvudefrddufeegrdduiedurddvudelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudeiuddrvdduledphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepjedprhgtphhtthhopehlihhnuhigqdhptghisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhhikhgrrdifvghsthgvrhgsvghrgheslhhinhhugidrihhnthgv lhdrtghomhdprhgtphhtthhopehhvghlghgrrghssehkvghrnhgvlhdrohhrghdprhgtphhtthhopehnrghthhgrnheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprghnuggvrhhsrdhrohigvghllheslhhinhgrrhhordhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Some actions carried out by pci_platform_power_transition(() in pci_power_up() are redundant, but before dealing with them, make pci_power_up() call the pci_platform_power_transition() code directly (and avoid a redundant check when pm_cap is unset while at it). Signed-off-by: Rafael J. Wysocki --- drivers/pci/pci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) Index: linux-pm/drivers/pci/pci.c =================================================================== --- linux-pm.orig/drivers/pci/pci.c +++ linux-pm/drivers/pci/pci.c @@ -1194,8 +1194,15 @@ int pci_power_up(struct pci_dev *dev) { bool need_restore = false; u16 pmcsr; + int ret; - pci_platform_power_transition(dev, PCI_D0); + ret = platform_pci_set_power_state(dev, PCI_D0); + if (!ret) { + pci_update_current_state(dev, PCI_D0); + } else if (!dev->pm_cap) { /* Fall back to PCI_D0 */ + dev->current_state = PCI_D0; + return 0; + } if (dev->current_state == PCI_D0) return 0;