Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2310803pxu; Mon, 7 Dec 2020 03:20:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyztUwi3X+55kCaDvid0vkg7S3DVXzTbVYKsML82g4EkP7R7Pb85hx4mmUTz88g5cJSDx0 X-Received: by 2002:a17:906:13c5:: with SMTP id g5mr18220561ejc.125.1607340036559; Mon, 07 Dec 2020 03:20:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607340036; cv=none; d=google.com; s=arc-20160816; b=h5aFcO2if1nQgTN2fkk01mC1SK2hs1fJfUdqv25yE3P1J/gZUOtSo6wE8cJoL6bmBy WExZOwvc/K0K3hJJ158bv6J3ARPdPBbsw3wqts4budEXPIf4omc9KSibvu87APlRReJP AGMVXEFJfH34xU2/IohFPPucQyExocZ3papGYGFiGls82Hdd45H1SvZwt63Wbe2GmYP/ Iar7Nzf93MaHcVm/nsTmK4j3uUGcTC+8wpK2q+DVcylJTxvLO6IYUC8p9NWpbj5NaDH8 uiTL66PEHIRbZWakI6rYoiDU1W3C6+JhVpeFim1ohnjv0ZGhCnDf67BMoyxwOfG6iPTw /6EA== 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=+CZ/NPK5e7/nFjBSYmaK1ftV0oP4Mm0Dz0wk/3wh5ik=; b=tYBbRpbAeZIK13hmuolTTIpldsy8dn4w9t5y1Klod5cw6Uhyim3i+okiCPTQH/YxUE ppfW2aNHCi3Cz1dwbnH65DILcfGuvrTd1k8VJy+c0oOZAl9VIPcvj7us0nCG1fmLNiau zjZ1GRc5LYObY8JlMw29I/8oT4Q9pWeLOXDY6oW+K6yZRjxlXiia4bdBWoFhibU+1202 ZQtUjrXWQPDkxm8bkoaqabEVDY3djqQlrhe1WvEd/aRmMCtkxTD5Beu+vaXmBxuI+W6A TVuiJysyEPOOlaNZhlM+5+UtTHRfaNvu30fk6GbeKpWfdLCYcHsjOeAfZYCcce5PJxET GFKA== 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 g16si6738149ejf.689.2020.12.07.03.20.13; Mon, 07 Dec 2020 03:20:36 -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 S1726757AbgLGLQ4 (ORCPT + 99 others); Mon, 7 Dec 2020 06:16:56 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9111 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726456AbgLGLQw (ORCPT ); Mon, 7 Dec 2020 06:16:52 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CqLMP285YzM1qP; Mon, 7 Dec 2020 19:15:29 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Mon, 7 Dec 2020 19:16:04 +0800 From: Tian Tao To: , , , , , , , , Subject: [PATCH drm/hisilicon v2 1/2] drm/hisilicon: Use managed mode-config init Date: Mon, 7 Dec 2020 19:16:17 +0800 Message-ID: <1607339778-20460-2-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607339778-20460-1-git-send-email-tiantao6@hisilicon.com> References: <1607339778-20460-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. v2: Remove the unused structure member variable mode_config_initialized. Signed-off-by: Tian Tao Reviewed-by: Thomas Zimmermann --- 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