Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6387812ybf; Thu, 5 Mar 2020 19:44:10 -0800 (PST) X-Google-Smtp-Source: ADFU+vvaVg4xL+AnUEMl9F2HQBk8B6pKyinRm9iuk71sEXRXNoBZ9TIQAoKK+ky28Apc/teYziJG X-Received: by 2002:aca:75c1:: with SMTP id q184mr1225948oic.35.1583466250438; Thu, 05 Mar 2020 19:44:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583466250; cv=none; d=google.com; s=arc-20160816; b=GoNgBfWD5Ye8Gkhk5HGV+R61BcG0wPQyA1aFFJG4BVBsId6IORp1KUPef34Uw3zbr1 W3QwoqBsICCjbawN2qjE1XsSXbB2gfdNMq/oA8KW7ByDNRVT1uLT2dcfyvT2nKiFzkYS wi2NtTABRJZRqCT+XwiUV/WxCX124O6oCdmnG50xX06ccefkBGOyodTqylyYTBLPQi3c tq1UzsWOdDDK4Z/HRQIfysJcR6Kyomxf0Df8eEQFH580Cego93TZnzyBK8Jp3YJt8uIJ Ux62mhVPbIckV5+E5kxnHXOk6MG3oOEqZwYArginj5hmr/wFl2/1L0N/WxQnu8UJjmWp vgCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=xJw2maeljjTEQsCNdt8PGI4oDxXrG1PYfV3Yy+ZhcDA=; b=espRqBNkH4V5gSq5FI76uWI2d2oE9SEBGjq1OzDN+27h6N1dggsC8VrVsOFwDgOIMV Ktqylmo/EVs4Kgyl0sCcpumH5wyAu23hlUVIbMh1Pvy9ef1+RwyWhm2jDkWQzEug0rZL JUiMB3lj+TAi66WDTyeWSDaD6W673khrDZ2HA5GmNQ+TDiAEM4LdPGCm/7LRXtJOatIk gq+km0IXLdz4hgLsXmPICZ6Vl/b4vGVVQCTOnPppg4hKz8z9xD2I6orZDSSc34DATGS0 d1kElmQniq3iMrGJySRBpaL3x6oDGg1ES7GOb8Jh+LtWpCMwfn0QhR2UoXPeXpMXzrDi gi8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j12si649583oie.187.2020.03.05.19.43.59; Thu, 05 Mar 2020 19:44:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726954AbgCFDno (ORCPT + 99 others); Thu, 5 Mar 2020 22:43:44 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11182 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726891AbgCFDno (ORCPT ); Thu, 5 Mar 2020 22:43:44 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 8F573D82C60CE5F3CFE7; Fri, 6 Mar 2020 11:43:40 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Fri, 6 Mar 2020 11:43:32 +0800 From: Tian Tao To: , , , , , , , , , CC: Subject: [PATCH] drm/hisilicon: Code cleanup for hibmc_drv_vdac Date: Fri, 6 Mar 2020 11:43:00 +0800 Message-ID: <1583466184-7060-3-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583466184-7060-1-git-send-email-tiantao6@hisilicon.com> References: <1583466184-7060-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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org code cleanup for hibmc_drv_vdac.c, no actual function changes. Signed-off-by: Tian Tao Signed-off-by: Gong junjie --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 49 ++++++++---------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c index 678ac2e..f0e6bb8 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c @@ -52,32 +52,6 @@ static const struct drm_connector_funcs hibmc_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static struct drm_connector * -hibmc_connector_init(struct hibmc_drm_private *priv) -{ - struct drm_device *dev = priv->dev; - struct drm_connector *connector; - int ret; - - connector = devm_kzalloc(dev->dev, sizeof(*connector), GFP_KERNEL); - if (!connector) { - DRM_ERROR("failed to alloc memory when init connector\n"); - return ERR_PTR(-ENOMEM); - } - - ret = drm_connector_init(dev, connector, - &hibmc_connector_funcs, - DRM_MODE_CONNECTOR_VGA); - if (ret) { - DRM_ERROR("failed to init connector: %d\n", ret); - return ERR_PTR(ret); - } - drm_connector_helper_add(connector, - &hibmc_connector_helper_funcs); - - return connector; -} - static void hibmc_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adj_mode) @@ -109,13 +83,6 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv) struct drm_connector *connector; int ret; - connector = hibmc_connector_init(priv); - if (IS_ERR(connector)) { - DRM_ERROR("failed to create connector: %ld\n", - PTR_ERR(connector)); - return PTR_ERR(connector); - } - encoder = devm_kzalloc(dev->dev, sizeof(*encoder), GFP_KERNEL); if (!encoder) { DRM_ERROR("failed to alloc memory when init encoder\n"); @@ -131,6 +98,22 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv) } drm_encoder_helper_add(encoder, &hibmc_encoder_helper_funcs); + connector = devm_kzalloc(dev->dev, sizeof(*connector), GFP_KERNEL); + if (!connector) { + DRM_ERROR("failed to alloc memory when init connector\n"); + return -ENOMEM; + } + + ret = drm_connector_init(dev, connector, + &hibmc_connector_funcs, + DRM_MODE_CONNECTOR_VGA); + if (ret) { + DRM_ERROR("failed to init connector: %d\n", ret); + return ret; + } + + drm_connector_helper_add(connector, &hibmc_connector_helper_funcs); + drm_connector_register(connector); drm_connector_attach_encoder(connector, encoder); return 0; -- 2.7.4