Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2428612rwb; Wed, 30 Nov 2022 06:33:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Z6qiD5zk0jqJmGjG/XcIisgmm0kLF2A9ca5e/vQCK89FQEegDF2X4+/mjI2V2vXLMCg7J X-Received: by 2002:aa7:91d6:0:b0:574:c543:f804 with SMTP id z22-20020aa791d6000000b00574c543f804mr25610204pfa.51.1669818838811; Wed, 30 Nov 2022 06:33:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669818838; cv=pass; d=google.com; s=arc-20160816; b=umOP13xHmxGocfhvap0k2XJHhWLmJt8bVewHaKt3uJRj3ELPbHFfwWUjVQeG8FmVoG 3s16+2k4/b679BjNxNO4u4PUhMjBLTvdTL+Ac68koKB1kA/0AAxbbNPcKXSiz6uB2oTR V/pnsSry5RS5VVBmt5XKtlhtEPRDdO5IWAAPqBuLI3lrRz1aRhs1Pwuyta9O4htIzY/B hOR+XNOg09YloV1qAfHn8kSOp+k3qPpnxAbYtWrmwDZWBxDK8Z23Eq4YuJ/e9Z4GA6Sh Qgk2SedhjcAYxrYa/5YnTlw23qcQL+HSa926OgzNDIRh9MLliBMhkOoi8Y9eEh1k8z0b bEZQ== 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=NjpRKMepunFhsKnEHlMmrI3T8Oy+HxsC0vITn12Pscw=; b=UYdB6F8P5Wp29kaOPh1xrOMiL1meto8hi3MsR2yDHmt62e4soko1xU/jCZjRbk5H0V j6hJTDceahjjX+rmZ8n6NIeFXbT89gTHMf2JekBTEZlY/Fb+S0FKpXRtfIJcU19Rjw7Q BcUx2fBHh9oc4J2oksu4++z2nPr/IB1pNyBbPXIfvuf8uX6mDw8+AkrP5asMJIPEiyYU kWxi7GfAP7+fEywLUTipigyXQEG3kd0Qy2P2mbEFTebnXKJgH7d0Fr4/8zq0hpFLDsDP pYcG1S6pW9l1aFUFtpZKV8h4LYCeVvjC42jX95jkIrk45+rL/0BztUm/hx5FoDWtFgPm cB9w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b="2omJr/Rt"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x22-20020a17090aca1600b0021942473a5fsi1585863pjt.122.2022.11.30.06.33.47; Wed, 30 Nov 2022 06:33:58 -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="2omJr/Rt"; 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 S229610AbiK3ODN (ORCPT + 83 others); Wed, 30 Nov 2022 09:03:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbiK3ODC (ORCPT ); Wed, 30 Nov 2022 09:03:02 -0500 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2040.outbound.protection.outlook.com [40.107.8.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D04BF13DEB; Wed, 30 Nov 2022 06:03:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WLCRmmtgIuNi8/oD/RbO7p53Nuyl4NhgSugPgmJlaOd+/qfToRFO64M1C1OkQzWjKb9y+CYBZN9ti0TauYaCTxk9iVEN1x1NmPyzL4OYRepks+sxWrQMCkj9FuPWI8eWFcMjxsD0F7vSvDhOXcuyonahzj1UlDIvMrLZKBaC5KcDM6b02yuc/a9GyBF81I8Au/AVrxKuiZTWb8vq7AJkAnpjMIo/HO4jnRTxK/EPwoXP+BKAV1W9+e+0ZgUrGnKM4FNqncMopk2c8UyvD4XiwW3uqRFrVyWkU0bCzlMfg1sOWIErpveAAUq5mRPeMlrwX2uKT6XfzPMzYUMZURwnYw== 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=NjpRKMepunFhsKnEHlMmrI3T8Oy+HxsC0vITn12Pscw=; b=HwqzCz19+UwTAikdcV9sQkD5ZA0KolejGH+BaI9OXWCHYcZvLNWS2UUjM3wDZ4vXJvJVBVpXkFpZC0J9wFRq12TVqz8fLqQIDqEuuQ/BFNLa+DU+BM+9XMq7sKpG4KYqVUlZfou95Jza46g8oLpWfiQslxIetS4QYELyJtOVtMPjFd3EAmyHNNIXk40Hdq6TDY7R8s88ZIF6gTUdwbxKimwolGs4Zg4ZUJg7e22OCGrxhMFgwzjKCfwvCtlUqbf+fLs9bez9EXjYYr/sKNfgelW0b97e+SRZpXrenGf46oi5rVL6EzUHChGfy3ZFbTzDpXG/L1jBeQki9SeUUkALXQ== 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=NjpRKMepunFhsKnEHlMmrI3T8Oy+HxsC0vITn12Pscw=; b=2omJr/RtHafj49vlB0L5kIubL8UBhahu1BTdyHaRLyaLmpHWyFsJr61WWYmV6kc2i47lLIdSabDYxFu4or5sXBQWFde5MeIM8eMoRUvgIqtgv8jnsbUd1g46RMqjXotZxyqw+SGrDgM6Z72e/z8AflMWHWRmuAMdW/i1WwabhMs= 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 AS2PR08MB8695.eurprd08.prod.outlook.com (2603:10a6:20b:55e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Wed, 30 Nov 2022 14:02:52 +0000 Received: from DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::3643:6226:28c:e637]) by DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::3643:6226:28c:e637%2]) with mapi id 15.20.5880.008; Wed, 30 Nov 2022 14:02:52 +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 3/5] drm/rockchip: vop2: use symmetric function pair vop2_{create,destroy}_crtcs Date: Wed, 30 Nov 2022 15:02:15 +0100 Message-Id: <20221130140217.3196414-4-michael.riesch@wolfvision.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221130140217.3196414-1-michael.riesch@wolfvision.net> References: <20221130140217.3196414-1-michael.riesch@wolfvision.net> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: ZR0P278CA0182.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:44::15) To DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9155:EE_|AS2PR08MB8695:EE_ X-MS-Office365-Filtering-Correlation-Id: 54c026ac-92c5-4319-1e63-08dad2db9245 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hPVIVnWqgpCM+4XaMP1ndKVN0GlPwxKy4oSJyfmvCh/dXjrEdZUlXrpcPRrAOxheifggTGbbiDt7m+6kuclq9cc1XSjPxAtUb7qClKCwNCqvILqxLZRpx9E/fA8W+xTHnQEVDAlma6PpoMWeWpbTnjBePP+q8rL1ny7HPu6QhF8CT1ImMJoz1Dqm+9W7kKBN9yLYsHu+CamBQCzezVOccZ34WyCZHLipNM2OoTo+Psf5/5pj6vg4q5aKC+r20EzqU99TyqeNvM+zHiRodoTKYcuhIi1XgA8KVzh1xB+vHRf+mM/p3HmVYOy9s7vrT0LQWJnFC4gtQEvuZB5ecY/rZzmJuzedbRpue4MNS9e6Bm7Ahcc0C2QxCPG7o4vbYfmX4S2F6DiSpaoiHJw77OLj1f6+E7OJYFA9bGxy4gRC7H2YZowVn7alMuq+EOQeDdBUHhV1PBmKIySQaQu9DDvPMOep7iNjJ6Bsq30mgfOVE5iPYrdGrK5Z0yeGifn2NTlhA/QkxSyezwZtudsZnY2GFCjRJ9Jcyoc/mxnbKmzH+BVdKkp5HORCs7tpH69xgajtn/mVSOQmEd0h0fjUHIG0PvLnWOBb/n8Sl5O27xzPq9T/mbYWLolAk0DYmO5/85ASENEoO7mafLkQhc5fTTJONA== 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)(346002)(366004)(136003)(396003)(376002)(39850400004)(451199015)(38100700002)(6486002)(54906003)(478600001)(316002)(8936002)(2906002)(41300700001)(83380400001)(1076003)(2616005)(86362001)(6512007)(107886003)(6666004)(36756003)(52116002)(6506007)(66556008)(7416002)(186003)(8676002)(66476007)(44832011)(5660300002)(66946007)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?nV1626GhlNG1HlEiQG7GkvXP2+1rbteLOo8mE8YoN7eAWEs5J2bN6Cwpaprt?= =?us-ascii?Q?u+YTeiw//TcfRGHTfIF4ZadIAyhFwGgxKNQuke88aYoU4WGBNUKd5bJxy5Vs?= =?us-ascii?Q?HgzoU6CBu2KV7SkKmENwAGcLTTNDRL1/VjvOdCcuOJIXB7FoNKjKUOq/bMZb?= =?us-ascii?Q?zNwV8BCktd98mN2TUtYo3UBF8yVLdNrffYB1E14+R2x6QCjQUqpESG22iHjS?= =?us-ascii?Q?yr6Aw20IgiETyF/uqAm5Ui6EQQ3c9+aqALQsX2ZBAXkqmIp5rZHhNxnY0343?= =?us-ascii?Q?YJ69e5IaKiY3KhuY6hDX0qt3hCjKkzd1UZanZ97DuPYCtUV71UyhWqFcPwU8?= =?us-ascii?Q?QSz+1xs3aMdJH3uLO/qCcWXFHMfAI52wtGuzJlw/FppZBYflSdo3/L9PAKV5?= =?us-ascii?Q?poiq2uapVaSdNQ49n/hSPAo9qulPPFHhrbvs9lsa3KM3xlGiuUPTzcjpeeJP?= =?us-ascii?Q?914hEbBSBfqofvJCgy/n972QbS2Ve2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?Q?EAf5mPyGgFiXaUoZ1LKOH8PXruz8c5CtNRI5Z57Fi3yLiLANy3l06C520H0B?= =?us-ascii?Q?tU67QJPcqnA2ktLon65dd5UxCnFuJfSeTqntEfK2Oqlf/G28PLTdFq2RLBhX?= =?us-ascii?Q?GcFDC/p0izLCN+Hf8O5dXBzOM99APsLYbi3bqse1FFLSPl4KhXqniApkAkrK?= =?us-ascii?Q?QPyNHCv9wAj/9tL/mkanQ7SX4cwP2KrCEpqjpkBs/OOBzv25yZJt642OtOAS?= =?us-ascii?Q?M/bzAJNQAD6NLzRzgvX8+sfHTFIoD33NLdVsKjIE4rWhAbOxO+EN/iYr5T2h?= =?us-ascii?Q?y+rrxg=3D=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 54c026ac-92c5-4319-1e63-08dad2db9245 X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9155.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2022 14:02:52.0801 (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: RY+Qr2Cw3+O5Lc5GRNOb+4pR4JN4tC4YHntdidSw21JTHK165xdIxVSAlDIWubH4gZ4o45k+mEJ5AEgD0NB/X0qjgm/ViOd7kH3l2GCsAcs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8695 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 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 --- 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 105a548d0abe..94fddbf70ff6 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; @@ -2371,15 +2371,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] = { @@ -2683,7 +2693,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; @@ -2697,19 +2707,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 = { -- 2.30.2