From patchwork Wed Aug 21 20:01:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Francis, David" X-Patchwork-Id: 11108107 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D2831395 for ; Wed, 21 Aug 2019 20:02:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 65D3A2339E for ; Wed, 21 Aug 2019 20:02:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 65D3A2339E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 085856E9FE; Wed, 21 Aug 2019 20:02:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-CO1-obe.outbound.protection.outlook.com (mail-eopbgr720075.outbound.protection.outlook.com [40.107.72.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7496D6E9ED; Wed, 21 Aug 2019 20:02:07 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z1eh0WG/Ud7nK5Ql1EnJMce1GfpnlldH8pwRqt7HZJkYtx1LgZJhCMw3YoMzY4rY6Xz+FlUWq8KJ+nOTYIyyeVzXfqkP0LvsBNG2wR/Sx60+tEg9sI5bDD7t8l/mj/Pi0NoSIocVUEAMok5SlbXRrWnQdh8PWFDP1zgrPaMBpHDi2M4Ryfz1ZZttlnQfYBvcsQAKUmTGusebpnGPVyclsdmtKRnEM3bJrUfSlNWaBYdu0EDhBjFSfxITPKrRNEOL4iF0o0dX4sKUjhg+j3wOgy3oQ2Af1fFsZd7C70IpR9JVzq8Iq6FpTFQTtw7R7JeXAl84bZJeGmAHT5fvbCHzSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LIOQCXzZMMk4zbtiEaTFAFHv2xGdqyRxGN8x3R9ewBk=; b=RIywKyOYwXPxS896P13DX0qqsEPapNXmEgFHGzL8loN/TN81W5llQ7D3YcVTOzEwa47FStyFevC+ppmQ7A+s3jVDfEorh4tvH+FyjGl2fZqQ3s5OfilCkubsyqai9e2x3tCvmrbTrGbhVdRThpuFfimdnvRtJjbvUG06XZxwT7JPibmJ0WqVlVJrARnVwT7MlbeI/iDAvM++pTV5BTd0XTdDBGcvZl6At8Gps17/XfawpBX4X1RkGR0DTBXBJ8pICniixbqTADf4ZAuULqdzTu4i6bAnT5BS7WJSL6Zd6dpNZJNdM15vIXWKnp/f12L8C2L1jvf28GGomGRwGQyG1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from BN4PR12CA0008.namprd12.prod.outlook.com (2603:10b6:403:2::18) by BN7PR12MB2706.namprd12.prod.outlook.com (2603:10b6:408:2a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Wed, 21 Aug 2019 20:02:04 +0000 Received: from CO1NAM03FT063.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::205) by BN4PR12CA0008.outlook.office365.com (2603:10b6:403:2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2199.14 via Frontend Transport; Wed, 21 Aug 2019 20:02:04 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT063.mail.protection.outlook.com (10.152.81.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Wed, 21 Aug 2019 20:02:02 +0000 Received: from localhost.localdomain (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Wed, 21 Aug 2019 15:01:41 -0500 From: David Francis To: , Subject: [PATCH v3 11/16] drm/dp-mst: Fill branch->num_ports Date: Wed, 21 Aug 2019 16:01:24 -0400 Message-ID: <20190821200129.11575-12-David.Francis@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190821200129.11575-1-David.Francis@amd.com> References: <20190821200129.11575-1-David.Francis@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(39860400002)(346002)(396003)(376002)(2980300002)(428003)(199004)(189003)(48376002)(50226002)(186003)(476003)(1076003)(486006)(16586007)(316002)(110136005)(5660300002)(478600001)(26005)(126002)(50466002)(76176011)(70206006)(70586007)(51416003)(426003)(4326008)(446003)(2906002)(53936002)(36756003)(47776003)(336012)(8676002)(81166006)(2616005)(450100002)(81156014)(356004)(6666004)(49486002)(11346002)(8936002)(305945005)(86362001)(14444005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR12MB2706; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 22eb72c7-d6bf-46aa-2dff-08d726726ef7 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:BN7PR12MB2706; X-MS-TrafficTypeDiagnostic: BN7PR12MB2706: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-Forefront-PRVS: 0136C1DDA4 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: YnQ3sXpBwT33YcAjsOZbXRtTWBKhaw+ZOMGZzb0y0BdmQ3B0AQYIS5WXP/KLWKB3cyK5eWTTDtJsBrIKz15eEl3EWroPaUNlmo+6oCqd2MjVAS4eZGYbufO9fN+GfyvBizP/C56MfOMUvT/72MUkQIArR4q7xj4Cw6MpLplgFAIGKh6tfvaaI4j4Mld0F9UBiNZArhzJiVsM5XSSjargU9/6uWDlKXa0jw1SUNxZbHXCvRq0ZC9LSbCKtfInFmU5ukuYih6Kq037I9tYPFiroboos5Fsu0/WJcpt8cIa5C8d5auMc7JYO3BukBEZkd2j34smrrnVLqxi12IdohZQ7j+kvmINnfLxNke/Wn7vaC3zd++kJzFijQckku9Xk2SfH6qybPC4k33Fq43XPDj5e4nnJptAm0AXso2+1RNRFjc= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2019 20:02:02.3983 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22eb72c7-d6bf-46aa-2dff-08d726726ef7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2706 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LIOQCXzZMMk4zbtiEaTFAFHv2xGdqyRxGN8x3R9ewBk=; b=vC8GtjnPZfgMnrKYZNbq+MYahJQC2Aesot6v1nVQhDBFEaVUDqKvOJDIL/IGZ7m0poDa8Qjf2JmxkEiK/uwMBrUNatB9Jn9gDtAUeVKHxl9BFz7SlSPTfWkwh2Ki0+O0unGWf4lC9p9MtT7hQtXNUm5G2i5Cde1KfWASy2ZoO64= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Francis Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This field on drm_dp_mst_branch was never filled Initialize it to zero when the list of ports is created. When a port is added to the list, increment num_ports, and when a port is removed from the list, decrement num_ports. v2: remember to decrement on port removal Signed-off-by: David Francis Reviewed-by: Lyude Paul --- drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index ad5ccc08c40a..7decb5bef062 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -918,6 +918,7 @@ static struct drm_dp_mst_branch *drm_dp_add_mst_branch_device(u8 lct, u8 *rad) INIT_LIST_HEAD(&mstb->ports); kref_init(&mstb->topology_kref); kref_init(&mstb->malloc_kref); + mstb->num_ports = 0; return mstb; } @@ -1670,6 +1671,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, mutex_lock(&mstb->mgr->lock); drm_dp_mst_topology_get_port(port); list_add(&port->next, &mstb->ports); + mstb->num_ports++; mutex_unlock(&mstb->mgr->lock); } @@ -1704,6 +1706,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, /* remove it from the port list */ mutex_lock(&mstb->mgr->lock); list_del(&port->next); + mstb->num_ports--; mutex_unlock(&mstb->mgr->lock); /* drop port list reference */ drm_dp_mst_topology_put_port(port);