Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp145318pxb; Tue, 28 Sep 2021 17:47:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4A2uHf89pWLdpwAEATATtO9q6Pba6JfBNnBxtjAqCls2gSBy8aWYMEGwU+J+n3T6zHD5r X-Received: by 2002:a17:90b:1d05:: with SMTP id on5mr3206025pjb.204.1632876421611; Tue, 28 Sep 2021 17:47:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632876421; cv=none; d=google.com; s=arc-20160816; b=sJM/tHUBqJZ6ImkOeSqLBCf/jx0F7ijzUJSfUAaxBntW5yzXgOnq7e9EzfC1l4UAks +lsiE2PZA+mMabQlsuYSXW/AwAV15uVO7ECPHqzKCVaIEpqHj+sEoLwjOtthnR5iJvHl 0lB90XoIhy41sbPqcmHMikhyEAuH1mdixLm7Dfdh5+FPhwD4oS5w4MbUJHgLKSrpLyyZ oZA1cKhN/XJhxavU5qeWZsxx+sPXNNrMksUGD2u4i497imSCokHZRW2L2dKZq9lD/y1M GbbYv0qYMjTWFlUu7hktAn2V1OiRsavBpm1G8BTg1pA1JUFkFa0cUAyqGypZ18bxbh1x /nMg== 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=RvkhxBWTCQGc5UyPf7Ik8EwSava2UkxqSV31MfuF8nE=; b=wuSHb5M6P7sw4Sc5oNvWQr5pYJPGah3Mo8Gh4nctaPppA5XPZ48SxwtD8I1LM9LAEf nMBLt+JTNZ2rIqUfNOBEOL/HXX4WrfHB3bmaICn0KPya1oGVe8cZeupjwSWvEEzK3v6j fNMxcdnQH1qYHxXovuG8O7GFAn12iMS3TKSx2ra52Qq5feEIkWt7jOI87mHzyf86ng6P D6BCPcnth82QFXmKAuM8E4KWtemMvERF266wBhEWAnswS4YUJ4HG34kKXjjqlX1oKM0D +koMcmyt3Rvt3E4wE+I766iHFfPee4kcWHtsymWmPuOtT2g867ts3GFiPJ/4G85a54j5 lmoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QmKx3iZK; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si873184pgp.539.2021.09.28.17.46.49; Tue, 28 Sep 2021 17:47:01 -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=@gmail.com header.s=20210112 header.b=QmKx3iZK; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243574AbhI2AqA (ORCPT + 99 others); Tue, 28 Sep 2021 20:46:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243529AbhI2Aps (ORCPT ); Tue, 28 Sep 2021 20:45:48 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A51C3C061749; Tue, 28 Sep 2021 17:44:08 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id dj4so1959564edb.5; Tue, 28 Sep 2021 17:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RvkhxBWTCQGc5UyPf7Ik8EwSava2UkxqSV31MfuF8nE=; b=QmKx3iZK2fcPq3tcKQWeGQpK56PhAEBPSlHylMW2fvWhv77rsW98W1VMTBQ5HGT79f tFyQ6kdzzKhRWgJ8ZxdvZCnNQz1Gkg3rT8drlqbySlC+HKsY6U4LA5tcwAEYJfpzhI/y JUiN5BT/jYmYVf8q0ffCgTVRscUnL27Je6YziBpJDdZaZZ3bcpuB2ROcirimI9RYIPwB BBOZekQwo6auv8VitAspG+8RjyW9uNpcu+g7MbJnThjujqHNqpISf7UAc9KyXlkRBm0M pNmjd/ZLWZK5TTF2Iip4r+FQQUPbyBUYjHX+T/qQ7BxS38tpBDD2CoOVWw5G8mBbuX67 hpBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RvkhxBWTCQGc5UyPf7Ik8EwSava2UkxqSV31MfuF8nE=; b=edsOd1Wb6gz78D+AobmVtPHMESHRSI5KbWYe0GtwntgA0vV+dC2uoL29EPNMIEm/6u uIM5tepNoK4BWgP8BTEpZauaMpQXRbJiHNH2SCRINXUtRw+ZAE87dqkQO+ho24uP094j HpkFnnmyykyfeZJtfmt5vrEkcxjzehHAgjLk+SUqdEna2gVCKhDWggEieJvCxnt7CBJ0 DOia8kkgOY/XoVoJl3piH79Mldsr2HHavUQM0jBPvr4c9Os/YrRLUDTHuHk0NisuGoNG zh0XLV9Gkx+FD6iY79ulL+fQtKwSvQdd3rBfiR0orlHxzElAE6rRUovPZyVMdKEFtqgF wx9g== X-Gm-Message-State: AOAM5304K2R3oEsgHnQS7h4IV4qvgqYe34y48Zo29jh23LxxRfKFbe0/ O8bBnfDtUM4Yf3wSt1b13wUZQ68YlzY= X-Received: by 2002:a05:6402:19a9:: with SMTP id o9mr11227421edz.233.1632876247239; Tue, 28 Sep 2021 17:44:07 -0700 (PDT) Received: from localhost.localdomain ([2a02:ab88:10f:c9f0:35c7:3af0:a197:61d0]) by smtp.googlemail.com with ESMTPSA id r19sm383578edt.54.2021.09.28.17.44.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 17:44:06 -0700 (PDT) From: "Saheed O. Bolarinwa" To: helgaas@kernel.org Cc: "Bolarinwa O. Saheed" , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v1 3/4] PCI/ASPM: Remove struct pcie_link_state.clkpm_enabled Date: Wed, 29 Sep 2021 02:43:59 +0200 Message-Id: <20210929004400.25717-4-refactormyself@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210929004400.25717-1-refactormyself@gmail.com> References: <20210929004400.25717-1-refactormyself@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Bolarinwa O. Saheed" The clkpm_enabled member of the struct pcie_link_state stores the current Clock PM state for the device. However, when the state changes it is persisted and can be retrieve by calling pcie_get_clkpm_state() introduced in patch [1/3] in this series. This patch: - removes clkpm_enabled from the struct pcie_link_state - removes all instance where clkpm_enable is set - replaces references to clkpm_enabled with a call to pcie_get_clkpm_state() Signed-off-by: Bolarinwa O. Saheed --- drivers/pci/pcie/aspm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 9e65da9a22dd..368828cd427d 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -61,7 +61,6 @@ struct pcie_link_state { u32 aspm_disable:7; /* Disabled ASPM state */ /* Clock PM state */ - u32 clkpm_enabled:1; /* Current Clock PM state */ u32 clkpm_disable:1; /* Clock PM disabled */ /* Exit latencies */ @@ -190,7 +189,6 @@ static void pcie_set_clkpm_nocheck(struct pcie_link_state *link, int enable) pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL, PCI_EXP_LNKCTL_CLKREQ_EN, val); - link->clkpm_enabled = !!enable; } static void pcie_set_clkpm(struct pcie_link_state *link, int enable) @@ -203,14 +201,13 @@ static void pcie_set_clkpm(struct pcie_link_state *link, int enable) if (!capable || link->clkpm_disable) enable = 0; /* Need nothing if the specified equals to current state */ - if (link->clkpm_enabled == enable) + if (pcie_get_clkpm_state(link->pdev) == enable) return; pcie_set_clkpm_nocheck(link, enable); } static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist) { - link->clkpm_enabled = pcie_get_clkpm_state(link->pdev); link->clkpm_disable = blacklist ? 1 : 0; } @@ -1287,7 +1284,7 @@ static ssize_t clkpm_show(struct device *dev, struct pci_dev *pdev = to_pci_dev(dev); struct pcie_link_state *link = pcie_aspm_get_link(pdev); - return sysfs_emit(buf, "%d\n", link->clkpm_enabled); + return sysfs_emit(buf, "%d\n", pcie_get_clkpm_state(link->pdev)); } static ssize_t clkpm_store(struct device *dev, -- 2.20.1