Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3681161rdh; Tue, 28 Nov 2023 00:17:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4jg6oV41TtcIS7Gthi/zrHu0jNFVlt5OVC+rV+rhaUQyeKME3YYRtkFfRC5lO9Bkt09R7 X-Received: by 2002:a9d:750b:0:b0:6c6:4843:2abe with SMTP id r11-20020a9d750b000000b006c648432abemr15209342otk.14.1701159468093; Tue, 28 Nov 2023 00:17:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701159468; cv=none; d=google.com; s=arc-20160816; b=l3VbPbbRpyJ27gq0lHfRWQi57gMWD4f//VGQIMwiIiJsAOZ/aW1E9dk+rNs0Kj9KLd +wSvp6Io7kS8TOH1OHQBisNHTqOML/hD7Hcw0X8EMm3WWA9hkPiT2PKIzGN9oh+biBLC n1PzqKIUw9rFDPMcFucSlfhiC8rQ4cwNQmM1DbK8/X1uvAtcuuQbHvlhN9zrrJ6OoY6u ht6nRz3vyI2uX15/PaMfG8UBXRSRs+ZN9RgVxPbNqdYhvSG8lWMbeCBxuU3dlO7QubVm WqomkPyzG0FzAvqdI6oPKATvWXG/FEEAYMmzKlKlagptFOocbbW5j68tIcvNYBwqe+gd 0sMA== 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 :dkim-signature; bh=Y4Wr4h/sMDnfzbPjNwH2tnrPnZjpSAEhASSy/nyDSXw=; fh=n9j1ofctKSeYxvmwnbKmIbkuN2/6NCaqclsXgGVH+6A=; b=c0dw3GBTVzcF1CFRTjqbQaDnmjxWmE89ea8MLlKoDz/Alv6FiCnUGif7HOChKmLcK5 Xv9APf2LCXtPaFy0dQHlGZWWhtg3CbXyZvjCzyXCZnrGnUQe7ZoOX/3aoQzVshnwkcdR AVvWUEoefZic6rGOfrLneVkw0z16MqHZFpKvw+ixozCfV1maQ75qQWfQ50PqawGJBkuz iLAXF9eu+5tTWKpx1v5sjbcJoHEwhhjqzavMNkXSR1p1zYMONFx8zD+5vavkaNfJfyb3 dhCLI50X/ctDj3kAKMYgGPcnu6imje+QnYolCDhe7weBUCdgE+YN92SRjBVPCrXjsNPn idiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nbg6Wp9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 18-20020a630112000000b005be33e97880si11737041pgb.167.2023.11.28.00.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:17:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nbg6Wp9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 2DA6E8079C99; Tue, 28 Nov 2023 00:15:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344053AbjK1IPT (ORCPT + 99 others); Tue, 28 Nov 2023 03:15:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbjK1IPS (ORCPT ); Tue, 28 Nov 2023 03:15:18 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB15BB0 for ; Tue, 28 Nov 2023 00:15:24 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52388C433CA; Tue, 28 Nov 2023 08:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701159324; bh=zQr1xBOtXgf76hvY3IaRnRFWQ2A+yIS/Y/GYRlcI1+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nbg6Wp9WUsqKZ/go1Xy9CpNUUL5gGB+L9as+dv+nZXUrIo9TRY0hfg8h0t8wJUiqA y8pqgLchu0CwQpioQQciJqoagJ0k1BFdLLCfY0YDjWEo2KZs3XaKSH1DAx8guKnXGH 44B+/b3B+6BDBDOeq9dpGHs/dqUbtRpd7K2Bq0uPnUBeotFvBp0TvhLAMYOWGFNbm0 zr3s4TQsCgcCGd0Qz/ICu51hl2iYCLXCokjtq6uHuS0n/QjopHSEafFy7V8jnV++Ly Nf3Tbt4m31SAfFFS9yX+GqVx+KwkporAobnNs+QSkxPq2NVpXogaGX2DSSZKZJEGwc 0lSOjZbR/fNIw== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1r7tG4-00053x-2h; Tue, 28 Nov 2023 09:15:52 +0100 From: Johan Hovold To: "Lorenzo Pieralisi" , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , "Bjorn Helgaas" Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , Rob Herring , Nirmal Patel , Jonathan Derrick , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , Manivannan Sadhasivam Subject: [PATCH v2 5/6] PCI/ASPM: Clean up disable link state parameter Date: Tue, 28 Nov 2023 09:15:11 +0100 Message-ID: <20231128081512.19387-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231128081512.19387-1-johan+linaro@kernel.org> References: <20231128081512.19387-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 28 Nov 2023 00:15:55 -0800 (PST) Replace the current 'sem' parameter to the __pci_disable_link_state() helper with a more descriptive 'locked' parameter, which indicates whether a pci_bus_sem read lock is already held. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Johan Hovold --- drivers/pci/pcie/aspm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 5eb462772354..d7a3ca555cc1 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -1041,7 +1041,7 @@ static struct pcie_link_state *pcie_aspm_get_link(struct pci_dev *pdev) return bridge->link_state; } -static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) +static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool locked) { struct pcie_link_state *link = pcie_aspm_get_link(pdev); @@ -1060,7 +1060,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) return -EPERM; } - if (sem) + if (!locked) down_read(&pci_bus_sem); mutex_lock(&aspm_lock); if (state & PCIE_LINK_STATE_L0S) @@ -1082,7 +1082,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) link->clkpm_disable = 1; pcie_set_clkpm(link, policy_to_clkpm_state(link)); mutex_unlock(&aspm_lock); - if (sem) + if (!locked) up_read(&pci_bus_sem); return 0; @@ -1090,7 +1090,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) int pci_disable_link_state_locked(struct pci_dev *pdev, int state) { - return __pci_disable_link_state(pdev, state, false); + return __pci_disable_link_state(pdev, state, true); } EXPORT_SYMBOL(pci_disable_link_state_locked); @@ -1105,7 +1105,7 @@ EXPORT_SYMBOL(pci_disable_link_state_locked); */ int pci_disable_link_state(struct pci_dev *pdev, int state) { - return __pci_disable_link_state(pdev, state, true); + return __pci_disable_link_state(pdev, state, false); } EXPORT_SYMBOL(pci_disable_link_state); -- 2.41.0