From patchwork Thu Jan 19 14:39:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Riesch X-Patchwork-Id: 45819 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp365913wrn; Thu, 19 Jan 2023 06:45:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXuOiU6/SBRYh+Y8mHSDpefIjWhkPKmoLfBVf29Ebxj8H/JdWsBqngKbf99iNnqYpTggugas X-Received: by 2002:a05:6a20:1b21:b0:b8:ad30:717c with SMTP id ch33-20020a056a201b2100b000b8ad30717cmr9541836pzb.9.1674139539564; Thu, 19 Jan 2023 06:45:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674139539; cv=pass; d=google.com; s=arc-20160816; b=IXAA8svEBwYWxnqWpqKuKvHsn9lO9ZgqVxb0UwCU+XCzyNSH7s9kpmao6cMVFKDfsh QLPTvWJf9/kSB73At5pHV6BW8x1uTCDmb7k+AoKboq920ClcQMC2i0HgMcgj+J9nAUQo BnJYBtYrqIpypkB6aw2B3vMm7ZsqIbvSdEwl/VG/nX2wflxTSvBEznyD+JoDi/d/CNtm KxlYxpgNHZaVtWH8r9if4JHht64QOlFHhv8vNPNu0eZBeAWwOv9/XB8O4joYZC9N2O6m tnz7LtKeLRisWjHubTXTgFWiaGL1Yv0J0Ci7EcBD6gKdQ1D9BSg9QmyQgIbkG9K83HJM ZU/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bTDa3bsgB3lbqNtRTVwHqGScdV7FWISBbpPdc4IEoFw=; b=O/6WxlY6XnoiLpLbqtVGlZzUrlqYQ2R3AxXhbsxE82l6a3eQCw68VONMXjFbuSohOE onLDQddZkIPnxfsJ21mNbQNgvyiABpM7ohPnzS5Al3P4PzROAZYfuizWiO0tzYQ0d8MW C2ugPFAh1tNeWsxQr7q+wQYj+XhUoW0rkIGHBXbarRMAwk5rqMFPXYlkjcypkRJzErg7 8C109CAa6KMb8EwkggEp8gxzk+tpfZ9qP5Mujjh/MW2kEYk0V2Mdo5m6RmdvqOiUIcnP hvDaDdnyguGLWgvvt/vjhFt51FpG0sXp7oSTm6iaSskk1tsBO/4tCsyIPjHLmL3NDrGd nPtw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=habd9RtT; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h191-20020a6383c8000000b004c62c4e242csi7226191pge.546.2023.01.19.06.45.26; Thu, 19 Jan 2023 06:45:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=habd9RtT; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231325AbjASOmg (ORCPT + 99 others); Thu, 19 Jan 2023 09:42:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231148AbjASOlT (ORCPT ); Thu, 19 Jan 2023 09:41:19 -0500 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2066.outbound.protection.outlook.com [40.107.241.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F23E829A3; Thu, 19 Jan 2023 06:39:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DHcFwAwCG4SA05srllycvh56XvLHZtWeRmSUtNt4Fmc0iYpZEW/j1YjiDNlqoeoTcXIZDc1kqi/OgnH1/zkros44OvWZ6iIu98gVgDJ2d+HsqE0KRPQMq+v+3QMU8dI7PFANhtUnNtTZN1aScqyqIGhByWKB5pqEftbxsh+pjz28IH5j147t8kKAdQiaKMYC/tKTnzpOm7Y43zEaGjR/YamTsqzx2qWDHjWdl+8pmjM8X1XEgMblJi/fH4tAvYh56cWmSPD6kdrASaR/whtJ7ihkEdb44UcJEjOlx2zr3BGHf+AeTN5Uh0FaYq5FsD9RY9XpNIBBFvZlQOOTBE8jhg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bTDa3bsgB3lbqNtRTVwHqGScdV7FWISBbpPdc4IEoFw=; b=j5sWQA4VfXtx6hbgHj4X6rZjQ/hwI1thp2AcU9lxDlCmII2mfeDVEwXrxECAtSpcW3vnximyPXelptwIsddATAKsrkJ9EbqE1tbFdIoLBspChPFl20ax9wQYrEi7o9TmYOr5R+DmypdIrB+9IBlyoH1/p6M3IGILWU0GX2mxBokXrrUwPbHNQv3obGFCEBKqW1OQIRM04/B8Km2PnRJZ5Y0lDK5lXoIs/GdGJuQq3gLEqg+lqf7OGslh9xz2oJRu+pyxFp1lMNw4hqgajKdE5nnOF+36h5GaQTs9emxLqGEiQLua242FKVTZoQ5ig/2rEzUo2Zo/rTReVA9Y11aQWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bTDa3bsgB3lbqNtRTVwHqGScdV7FWISBbpPdc4IEoFw=; b=habd9RtTyf0V9FqcvR7dlzJ93zOJeIl41zXRPls8d0kFX4GB1pM6QMFS/9P9Je3MyNDAR3bUmRcBz2JbTb3J+ci2M5oriOftXVhhEJxoaE950PjtfB3178c8/qa3uUj6QgabMBo4ljOl20rHKCtJUtGdQf3VV7bRCFAtopPbWbE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) by DB9PR08MB6556.eurprd08.prod.outlook.com (2603:10a6:10:261::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Thu, 19 Jan 2023 14:39:30 +0000 Received: from DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::4718:6092:e763:4219]) by DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::4718:6092:e763:4219%2]) with mapi id 15.20.6002.024; Thu, 19 Jan 2023 14:39:30 +0000 From: Michael Riesch To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Sandy Huang , David Airlie , Daniel Vetter , Sascha Hauer , Michael Riesch Subject: [PATCH v2 4/6] drm/rockchip: vop2: use symmetric function pair vop2_{create,destroy}_crtcs Date: Thu, 19 Jan 2023 15:39:09 +0100 Message-Id: <20230119143911.3793654-5-michael.riesch@wolfvision.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230119143911.3793654-1-michael.riesch@wolfvision.net> References: <20230119143911.3793654-1-michael.riesch@wolfvision.net> X-ClientProxiedBy: VI1PR07CA0152.eurprd07.prod.outlook.com (2603:10a6:802:16::39) To DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9155:EE_|DB9PR08MB6556:EE_ X-MS-Office365-Filtering-Correlation-Id: e8eb3cab-14ab-4bff-c207-08dafa2af948 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Amhqask3UacCpQfY16L0PNn0CWQ0zY5gV8ajcbe28f04dG4P37TtNuWv/rKmcUy0i+uOb0UqgNyapJVY0ax1UV7YKhbdFlxqtDaBnkvDaZu+FYERkvhDzjcjFWAidg53/ghlGqdV7J6zU8lFvFYg7G5NKNXgNlq6BNFW5yYBLWNpk06b10zzCT5Hx1G35Pt1/HadThLxR808fmYvXugqZUD0Vm7DDG24NsdL6NtDtgFU0YqvImOT8/fAK84BERV6okiPy6u17mkQX7llzxLKRYxEuu10jMQk7sZs72l42dJLBWOyH7I3qROElbB5E4CarZGoAAAcV6O4RsXixABBXmWu82ilRkX7uKbx+qSBPHBHVaH2BnIQc+NbLRH9cF0smCsthcabqupchf4GeiSpFkxzhPqFIAXAbgeZoZTGuNi9ooJC0uS6AhzZqThxJ1IwuuxcvhbQ19ObzbFok3TSCLgJYiHxp0TN7c0cJZYDOAZPQ1DIM3cX3ofmHiOi+w4TLPUw7LrECn1/rfHte8SAxtOkSIlAEBqPUbyBT+B5EvIbP+Dv688/Q1DRA60zN4mUIQWqe6TyJ6SZco90wtNjrtMMK1WCiH9fQ3vNhPzx92hk8tI+spBI3lPTs3SppEgBzmed0i9xruBt/ulSqbbQRg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR08MB9155.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(366004)(346002)(136003)(39850400004)(396003)(451199015)(2616005)(52116002)(36756003)(478600001)(6512007)(8936002)(186003)(6486002)(5660300002)(83380400001)(41300700001)(7416002)(38100700002)(44832011)(316002)(1076003)(66556008)(66946007)(66476007)(86362001)(8676002)(107886003)(2906002)(4326008)(54906003)(6666004)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CIwsjhm+Kk8aFjXIY5PIHkB/OoIGHUNzn1s1BcKlPKanb8xUczLHioBTB24Bb9bG0LR1Xtw1n7YQlrKLBS1aFDHg2KQ9UaE4GSiJMxM40MS2l5uJHmXnowTM45tuNBN9Ia+67G3FqvUcA2zycIYZ0J97BtF7GkxG5oB8MrgDc3wjL9EiKmsqbexdi7fcBcks2J1aRRRJ/rrEx1tmRzsAl165bM07uH7wWoTlIc+ZsiSNyiuo494yu3q50H+0c2H2IIkXycuqFF/MY74yhdVsUO82w1gV8FWS4xhAQLCl79LXCwLag6IdXxESbbNUFS7sSt4K9P9A/1Q4jCUaTqeeKMT1uuDWyTtawhA0145r1RxueRqKil243gw7DhjHwgBuHmuTwRCDG0/fY55JloMOnGzU1UNa3bp4adEMbQuzdolwwPARWpe/CzgZGMC299KSNof1r85bYz4CbNc90tdA+5FBt5M8wSzSXw/8Nlz99Uz9nOXgn5391PmfILc9titONB/ZcoKdLslUG1X69ptcXnkiaF9bT6PjNJSnrZzAmMlbrU//vPYxhnRb3FMDbmBV/CVB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q8rh1fbbWsHS+d8lWLaU= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: e8eb3cab-14ab-4bff-c207-08dafa2af948 X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9155.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 14:39:30.5149 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rvkHGKFTReS6mnofLwKIEQXiukh0GANR+sMAMDSd8dM+DIoZ94B3Ume+uPxj5iMxqsS18DKYtaVEaNgWB3YLdQeu74tscgqqtYnMNpbS5+g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6556 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755462542011476550?= X-GMAIL-MSGID: =?utf-8?q?1755462542011476550?= Let the function name vop2_create_crtcs reflect that the function creates multiple CRTCS. Also, use a symmetric function pair to create and destroy the CRTCs and the corresponding planes. Signed-off-by: Michael Riesch --- v2: - no changes drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 31 ++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 374ef821b453..06fcdfa7b885 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -2246,7 +2246,7 @@ static struct vop2_video_port *find_vp_without_primary(struct vop2 *vop2) #define NR_LAYERS 6 -static int vop2_create_crtc(struct vop2 *vop2) +static int vop2_create_crtcs(struct vop2 *vop2) { const struct vop2_data *vop2_data = vop2->data; struct drm_device *drm = vop2->drm; @@ -2372,15 +2372,25 @@ static int vop2_create_crtc(struct vop2 *vop2) return 0; } -static void vop2_destroy_crtc(struct drm_crtc *crtc) +static void vop2_destroy_crtcs(struct vop2 *vop2) { - of_node_put(crtc->port); + struct drm_device *drm = vop2->drm; + struct list_head *crtc_list = &drm->mode_config.crtc_list; + struct list_head *plane_list = &drm->mode_config.plane_list; + struct drm_crtc *crtc, *tmpc; + struct drm_plane *plane, *tmpp; + + list_for_each_entry_safe(plane, tmpp, plane_list, head) + drm_plane_cleanup(plane); /* * Destroy CRTC after vop2_plane_destroy() since vop2_disable_plane() * references the CRTC. */ - drm_crtc_cleanup(crtc); + list_for_each_entry_safe(crtc, tmpc, crtc_list, head) { + of_node_put(crtc->port); + drm_crtc_cleanup(crtc); + } } static struct reg_field vop2_cluster_regs[VOP2_WIN_MAX_REG] = { @@ -2684,7 +2694,7 @@ static int vop2_bind(struct device *dev, struct device *master, void *data) if (ret) return ret; - ret = vop2_create_crtc(vop2); + ret = vop2_create_crtcs(vop2); if (ret) return ret; @@ -2698,19 +2708,10 @@ static int vop2_bind(struct device *dev, struct device *master, void *data) static void vop2_unbind(struct device *dev, struct device *master, void *data) { struct vop2 *vop2 = dev_get_drvdata(dev); - struct drm_device *drm = vop2->drm; - struct list_head *plane_list = &drm->mode_config.plane_list; - struct list_head *crtc_list = &drm->mode_config.crtc_list; - struct drm_crtc *crtc, *tmpc; - struct drm_plane *plane, *tmpp; pm_runtime_disable(dev); - list_for_each_entry_safe(plane, tmpp, plane_list, head) - drm_plane_cleanup(plane); - - list_for_each_entry_safe(crtc, tmpc, crtc_list, head) - vop2_destroy_crtc(crtc); + vop2_destroy_crtcs(vop2); } const struct component_ops vop2_component_ops = {