Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2414pxu; Thu, 3 Dec 2020 17:25:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjxWBG1QTnneCV6DTAg5MepyeXCpPF2Kw9mjdXScpSlr/ozGovIfAOoZ15wdQzmCKTEVBT X-Received: by 2002:a17:906:80d1:: with SMTP id a17mr5026535ejx.472.1607045140070; Thu, 03 Dec 2020 17:25:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607045140; cv=none; d=google.com; s=arc-20160816; b=mkk1clJiee7zNPpaT7eQEKKLwIH6hteiGAyjroKjduiAdccVidYRBkKd0dLNSligcp r1TSYAnVbbojS7HuVyG40JHPejAWgWVgakvErlL8JBXyKyepphtCjxfhjWCdus3EYfDU e0hK5VYtWboGwODXXjcOvLv2DOHC4q9E5KjCcQ1edESCYKaxg/n8aIdxvtvL0Er6+NEv E+SkZDfiZZhYRaljdVOMa3SvWoAbiNRBDnWYYwnn03HgkL0s6C0gOlvSbGqpgpDiEhuY ub46frE/XvB7OcGj63Wv07NHNOxKy7RRu7NbiGq5di9XHrZ47Amds6VK6JeNYvkVyREh H2og== 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=aG6UKEVG0hfzzt1xpp31fdrWzDj03XXpvv8aldtfjKs=; b=FuG9d4Mcif1ulwdX0ESpQPfvVb2Fi62YvCIPW9kLx9FwvkUF+IGJiiNCOl1H2OjeyV Jr15tvgeTc+fCrac3v0NULWp6LbFpg7oSYLjhRcGYcXZq1bKgutizMGqGf+NVIzgAIx8 uDfLazF295/M8e2lajOgDpJZbGKw7Fbdv1t3r4DV63lNRqhv8Qjj9yZkKzhpTeMk9nNt aasz+5naWDfK0SoQuGl5JVk2C7dgUjRk1eWrTUpeukS0xe74KN8BXR4OY30Kywzl8ct9 mDdwPSB67mhkXjnb5yr/6z+/xRE1hOPoZ+nbYp4EyQe6nitm9xiqjRWd/r3SGB4ONdPU g5Yg== 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 y26si461053ejb.149.2020.12.03.17.25.17; Thu, 03 Dec 2020 17:25:40 -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 S2388599AbgLDBXt (ORCPT + 99 others); Thu, 3 Dec 2020 20:23:49 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9001 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728484AbgLDBXs (ORCPT ); Thu, 3 Dec 2020 20:23:48 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CnFLk4swBzhmDW; Fri, 4 Dec 2020 09:22:38 +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; Fri, 4 Dec 2020 09:23:03 +0800 From: Tian Tao To: , , , , , , , , Subject: [PATCH 1/2] drm/hisilicon: Use managed mode-config init Date: Fri, 4 Dec 2020 09:23:08 +0800 Message-ID: <1607044999-47666-3-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607044999-47666-1-git-send-email-tiantao6@hisilicon.com> References: <1607044999-47666-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 5aea2e9..04fee18 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -82,7 +82,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; @@ -111,14 +113,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. */ @@ -248,7 +242,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