Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2248111pxu; Mon, 7 Dec 2020 01:08:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxe6VXZ04QIUVgIm9RDPeM1JnNSTqGPuDZtdDLcP4efo8nv1qSJ2muSdlXWoxhTIWJ/6AyM X-Received: by 2002:a50:f304:: with SMTP id p4mr14691269edm.118.1607332134339; Mon, 07 Dec 2020 01:08:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607332134; cv=none; d=google.com; s=arc-20160816; b=wYPaT091We7Dr84XP6+jGyf/uKMO5XRsbRSalIZSh0v66+M6JXXgtonSId8OVjz+bd hUbKA9GevmGQXZq2ubAMvbiW9yPDgbFB8LBDBI371Ay/SwyIp59zRge+hNrkaqiYxtvN Tb88P4J8iKH4HpuO+Lkc470gCHjlDReYR+ZkUtyZFdWCxr6hK0B02dY14HyNgIpV7rvo wBFvu8Ko0if5TW5/avxgisYgVAiA+MySyplhTLQ5cOqgmvPfP67ncnF+I5gR6ugTLJfi 7paduuEvtnsuHY6tiitocP45dAgzP3NSXAPDysoW0Zv5LA/L3AJbU/Yb0KJeq0txnXBw InVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:to:from; bh=ocgloUQRaHMlNl/GTZpFa40itN1AZZMQXI3qSADaiMM=; b=omAMQBP6OWFSyOy1YUv5BA5WobP8rtrsccYingPOW0+rAIlknBCjZtIQ/iYnfmG97/ cS3T7dRLYk5HR7mAgQtwhrmVDGooik8VH730OAwT1uVMwWQhaqEvGQnD9jA7muCpcAOv 0NL6T6Kuz8eTpW3XCZ0a/78qAilfgcdcVVXUYqQiWkuI9GfFH1SV3ik78Gk+wneGPnF3 R7UPis6GfgzxpRG/jaRyi8qej890BOKbsf/F5WvC+zH11ZUNNt0x1CRZRpcv99D6lKzQ tnr8x05wjdTTc2dEmUr/liVn6zdOzQTdwBVYJ1PHlu94x10fnu1/erZqeeVV0ik1M0FG dWwQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si1556202eju.216.2020.12.07.01.08.31; Mon, 07 Dec 2020 01:08:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726666AbgLGJFd (ORCPT + 99 others); Mon, 7 Dec 2020 04:05:33 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9023 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726489AbgLGJFc (ORCPT ); Mon, 7 Dec 2020 04:05:32 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CqHS72cyNzhnjR; Mon, 7 Dec 2020 17:04:23 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Mon, 7 Dec 2020 17:04:52 +0800 From: Tian Tao To: , , , , , , , , Subject: [PATCH drm/hisilicon v2 1/2] drm/hisilicon: Use managed mode-config init Date: Mon, 7 Dec 2020 17:05:05 +0800 Message-ID: <1607331906-19005-2-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607331906-19005-1-git-send-email-tiantao6@hisilicon.com> References: <1607331906-19005-1-git-send-email-tiantao6@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using drmm_mode_config_init() sets up managed release of modesetting resources. Signed-off-by: Tian Tao --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 14 +++----------- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h | 1 - 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c index 3687753..7f01213 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -96,8 +96,9 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv) struct drm_device *dev = &priv->dev; int ret; - drm_mode_config_init(dev); - priv->mode_config_initialized = true; + ret = drmm_mode_config_init(dev); + if (ret) + return ret; dev->mode_config.min_width = 0; dev->mode_config.min_height = 0; @@ -125,14 +126,6 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv) return 0; } -static void hibmc_kms_fini(struct hibmc_drm_private *priv) -{ - if (priv->mode_config_initialized) { - drm_mode_config_cleanup(&priv->dev); - priv->mode_config_initialized = false; - } -} - /* * It can operate in one of three modes: 0, 1 or Sleep. */ @@ -262,7 +255,6 @@ static int hibmc_unload(struct drm_device *dev) drm_atomic_helper_shutdown(dev); pci_disable_msi(dev->pdev); - hibmc_kms_fini(priv); dev->dev_private = NULL; return 0; } diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h index a49c10e..7d263f4 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h @@ -42,7 +42,6 @@ struct hibmc_drm_private { struct drm_crtc crtc; struct drm_encoder encoder; struct hibmc_connector connector; - bool mode_config_initialized; }; static inline struct hibmc_connector *to_hibmc_connector(struct drm_connector *connector) -- 2.7.4