Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5561823pxb; Sun, 7 Nov 2021 15:13:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOq68LgqbtnBICcb0O+JsX2WhfsiJAljx8w2Pjnca8MGGRkDZfAWAYJ7zkGf2wIbIW8MKm X-Received: by 2002:a50:d8cf:: with SMTP id y15mr102831044edj.66.1636326817662; Sun, 07 Nov 2021 15:13:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636326817; cv=none; d=google.com; s=arc-20160816; b=ncExrjE9Dr7raEKNH59tR2eo+EHV1j3AjmN+i+fz0Oi1Ee1kPZ55p7TAmT0GkGTTT8 iz/TReurhS+gk5hgBqg+cap2g6Qb+FuJ0xZA4duUxZY4BPYLyhKOIv9TQJGoa3oP19yB dytBivUgAqSO1XKb5DoBIylZS+NBJUWxYyDMNlbGp3Gd+ifdVkwSIQpOSL/loGcXhlhp 5CG4nhdT8+I4s2TXk9d+c8wAwNK8/e9LRZAAdEZy0LByObCBxJ1EbOGdUYQBiVUfeg4y KJviI0CGaWzpmBbHbXLluK5VbQ00/F5WHHLq1Or2PgI6kIV1Wps4asqwaLuxPyHJHylM zANQ== 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=poWzBna8Q7V3exJi/2cqueSy7kuer5ibESKko9F1UGU=; b=JvjvILSxzlqkFHJ39v3Vu6bUBBcEfYdJ5bOO8GK/Sq4CBpdpZR56Q3+5jnsEx3ZnEA fqoW7LLLzghyd3b5WwwUGQh8wLeN2SV63M+egNlYpQfPROcCJDaeGA0f68BKcmIqa88k j5Dz4VxNRVivFmt2aSX5a3ipfUkBwE77I3hn84Lc8gWpVZEsfpjdSp3idTzt+kHW5eQF 0ucg4NTNTbPALE4Yt+5ybLgiBtbEZFBzd0v7Ua50tKdVdw/qfy5Q3vhetxayg3aBAqzS vz04s9+iDAnN5aFnsFwsPscvc73SgtV/oqJKJlam1NUJLJomcI9iiGIYzRA1vrLsAcHw Sc5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HOjupI9r; 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 18si15595133ejc.318.2021.11.07.15.13.04; Sun, 07 Nov 2021 15:13:37 -0800 (PST) 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=HOjupI9r; 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 S235826AbhKGQcs (ORCPT + 99 others); Sun, 7 Nov 2021 11:32:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235791AbhKGQcm (ORCPT ); Sun, 7 Nov 2021 11:32:42 -0500 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 51D67C061570; Sun, 7 Nov 2021 08:29:59 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id m14so52081717edd.0; Sun, 07 Nov 2021 08:29:59 -0800 (PST) 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=poWzBna8Q7V3exJi/2cqueSy7kuer5ibESKko9F1UGU=; b=HOjupI9r75bO2EzvidRff/ggfTph1/BGa6gkGDgs1zef4PXXVYVXy2Hpl/MM40NLzW U6ZojXBWMYOVxUWOwmJfbzHuQvFcwS5KpL8/9bezOBXbSBIKirKGAcuGtQFDYhTNbHX/ is1MToBp5DOchkhzK+f7OurXlV9H9O61ilc4/tiHgOOKn2/tm0xGnf7+IbtNBZgCfePl bRri+qmJIqgQjGNWkXdx0DCwsW/uzT1WI9TRrfdrcFYD8wS/gsFvZ3JUoWRIl5YYOepS NsSVbLs4QHoqz/YtANR8+ynezt80AUDkDoUSFGQQ/eS+7T2kdkzPgLI8qEY9B1OypTba VkNQ== 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=poWzBna8Q7V3exJi/2cqueSy7kuer5ibESKko9F1UGU=; b=TYQ/itYWYCuA1OVIRnZIxwKTrbvtGDOcT/I1zqYIVefTNVS4IewXAO1naJ6s+Zilsd imwBqWf3FGxdR8EhDXDfKTblLn5YMyK+4TUOdMUuSDxzlqViCwPgB5RMg7AvUV/pI2pz QvaB1JelswbuFFr18IuEsB6npBgYBkDLAqs2fLWvq5ArkIlQta9wGbTE+VPUgc6TXjmJ 5kbei6RYSuei24QM8Q/hAr/p/02DIE6owSlNYsTvIE16LWkAcV7iK/iBPHJSMcluYBha KS63x1ojplmeGHhRCBLQl2InA4BBHmHflwPm+bmX6SxjWGFZNMgMtLfCDZ9traQ1B5S2 gtpA== X-Gm-Message-State: AOAM532azrk/Pe9QdZeuIT4K6xe66i1NdEFYRNjtvbiNIdhAGA8Qn1HU 01mAitlNvSoc/xy+i371FyL8TuXlLCs= X-Received: by 2002:a17:907:3e0a:: with SMTP id hp10mr59581317ejc.318.1636302597962; Sun, 07 Nov 2021 08:29:57 -0800 (PST) Received: from localhost.localdomain ([2a02:ab88:109:9f0:f6a6:7fbe:807a:e1cc]) by smtp.googlemail.com with ESMTPSA id hq37sm7195270ejc.116.2021.11.07.08.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Nov 2021 08:29:57 -0800 (PST) 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 v4 4/5] PCI/ASPM: Remove struct pcie_link_state.downstream Date: Sun, 7 Nov 2021 17:29:40 +0100 Message-Id: <20211107162941.1196-5-refactormyself@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211107162941.1196-1-refactormyself@gmail.com> References: <20211107162941.1196-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" Information on the downstream component is cached in struct pcie_link_state.downstream it obtained within alloc_pcie_link_state() by calling pci_function_0() - remove *downstream* from the struct pcie_link_state. - replaces references to pcie_link_state.downstream with a call to pci_function_0(pdev->subordinate). Signed-off-by: Saheed O. Bolarinwa --- drivers/pci/pcie/aspm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 90c7a0b379f4..12623556f750 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -48,7 +48,6 @@ struct aspm_latency { struct pcie_link_state { struct pci_dev *pdev; /* Upstream component of the Link */ - struct pci_dev *downstream; /* Downstream component, function 0 */ struct list_head sibling; /* node in link_list */ /* ASPM state */ @@ -462,7 +461,8 @@ static void pci_clear_and_set_dword(struct pci_dev *pdev, int pos, static void aspm_calc_l1ss_info(struct pcie_link_state *link, u32 parent_l1ss_cap, u32 child_l1ss_cap) { - struct pci_dev *child = link->downstream, *parent = link->pdev; + struct pci_dev *parent = link->pdev; + struct pci_dev *child = pci_function_0(link->pdev->subordinate); u32 val1, val2, scale1, scale2; u32 t_common_mode, t_power_on, l1_2_threshold, scale, value; u32 ctl1 = 0, ctl2 = 0; @@ -552,7 +552,8 @@ static void aspm_calc_l1ss_info(struct pcie_link_state *link, static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) { - struct pci_dev *child = link->downstream, *parent = link->pdev; + struct pci_dev *parent = link->pdev; + struct pci_dev *child = pci_function_0(link->pdev->subordinate); u32 parent_lnkcap, child_lnkcap; u16 parent_lnkctl, child_lnkctl; u32 parent_l1ss_cap, child_l1ss_cap; @@ -694,7 +695,8 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) static void pcie_config_aspm_l1ss(struct pcie_link_state *link, u32 state) { u32 val, enable_req; - struct pci_dev *child = link->downstream, *parent = link->pdev; + struct pci_dev *parent = link->pdev; + struct pci_dev *child = pci_function_0(link->pdev->subordinate); enable_req = (link->aspm_enabled ^ state) & state; @@ -753,7 +755,8 @@ static void pcie_config_aspm_dev(struct pci_dev *pdev, u32 val) static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state) { u32 upstream = 0, dwstream = 0; - struct pci_dev *child = link->downstream, *parent = link->pdev; + struct pci_dev *parent = link->pdev; + struct pci_dev *child = pci_function_0(link->pdev->subordinate); struct pci_bus *linkbus = parent->subordinate; /* Enable only the states that were not explicitly disabled */ @@ -879,7 +882,6 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev) INIT_LIST_HEAD(&link->sibling); link->pdev = pdev; - link->downstream = pci_function_0(pdev->subordinate); list_add(&link->sibling, &link_list); pdev->link_state = link; -- 2.20.1