Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2042892pxu; Sun, 6 Dec 2020 16:54:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIxL9Hn27ytDHT6dZYCYKDetvZQrutxWBiA8v7oo8Sz/JrGZFPrervw0G0Uot6zeGLbwR7 X-Received: by 2002:aa7:c7d8:: with SMTP id o24mr1402751eds.328.1607302496734; Sun, 06 Dec 2020 16:54:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607302496; cv=none; d=google.com; s=arc-20160816; b=DmsQwUU8b8PWJ8bQkBJnQ/iEAfEiXpPcD3w0qm4zvgpM0+miWLvsFc3uOoud4YPxNT cFq6lMdxEJ1nW6iZ0Ku+pprgbpgXKea+Sr5paBcMT4gOByTJghxqg2wsbEj83IAF7odY a0cYgny4KF1WLmMjClvg22JnqFyyz0kq8lxguq2S/C05G9YjWQb9uPzsAgVwTr6Kb1hN d1yvcjCjtaCZeFR0mqLiofwBghoCL7Jm0ThwAG/3wZzeWRntd6WNU/QPNQcpIg17EpZ+ 0fBZJ3nlKnIiJANFElO4i1jIPwEwNqcShAg4SUg2Qd6SZl3lIU1VHaZjvKjjQJwyxRAE RArw== 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=isLzebkaACsITYzixtnqaPEhq2f3ZiKXzNeQ7fJrtYw=; b=y4ZK+2c7rZhIYlmZqj1ko4LsAjyjjt5rvzthtJM947+Ena78ivoCoz2V+so9LIeA1b BGYHJARWRDtD8CVP9CCM4n9U+FBRpoIafxbOC6R4pgRovATa72zfbHfYkumRPV/iJGM6 8MdtAtKh0CrXSD23dzzqhljP8nfhowdwJiZN/Er0H5MCgUZOxIiciMu9lxIO9uLEsNbh M+8cYb5X+CB9fXiG6vzGyvKJAk+vPASOnei8TpnIfcTHBEppN4lzIkKB72qW7NXxsvgt fzPk84Aigcuwhe+6x2TK/8D+lqAI3ePEqCvHR3YwKpQRn7gBn+yjlizJWCEwmyAnUoG3 H0Jw== 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 g24si5542866ejh.77.2020.12.06.16.54.00; Sun, 06 Dec 2020 16:54:56 -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 S1728564AbgLGAuC (ORCPT + 99 others); Sun, 6 Dec 2020 19:50:02 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:8951 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728485AbgLGAuB (ORCPT ); Sun, 6 Dec 2020 19:50:01 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Cq4SS1RqmzhnS8; Mon, 7 Dec 2020 08:48:56 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Mon, 7 Dec 2020 08:49:18 +0800 From: Tian Tao To: , , , , , , , , Subject: [PATCH drm/hisilicon 1/2] drm/hisilicon: Use managed mode-config init Date: Mon, 7 Dec 2020 08:49:31 +0800 Message-ID: <1607302172-60123-2-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607302172-60123-1-git-send-email-tiantao6@hisilicon.com> References: <1607302172-60123-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 | 13 +++---------- 1 file changed, 3 insertions(+), 10 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..d631f82 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -96,7 +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); + ret = drmm_mode_config_init(dev); + if (ret) + return ret; priv->mode_config_initialized = true; dev->mode_config.min_width = 0; @@ -125,14 +127,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 +256,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; } -- 2.7.4