Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6387946ybf; Thu, 5 Mar 2020 19:44:21 -0800 (PST) X-Google-Smtp-Source: ADFU+vuOePkV7WoHxlCdotOX6RgoSbjPkSqQRegf4KBjaJn5AomDjzYF/LwTdVtJoO133hKONhGK X-Received: by 2002:aca:902:: with SMTP id 2mr1258921oij.88.1583466260994; Thu, 05 Mar 2020 19:44:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583466260; cv=none; d=google.com; s=arc-20160816; b=Kyf1k0DT8fxhKil5HPXPz7FOGUAZnV72lY7H0buylBdWGQZrVyHNudPzdJGTJT/mAx /JgJzt1fh2NHYgavlUhi/V50GmhNDhfHEy1vIpwMCAWkQ2yLFyTl5WBCYwkmpaXPYae+ YKDmX5Y4tBjex90/gNtZTz7UlKhn06UspP7fbSTDkWX3WFg2M/ibSogI26nKRdNMZigF tfjAKkQ43Ec3rrfJpu/ZpXUlJtNhZDZyoYnyaunbCmMAzAhbV76pyYHve0LpJiYteHMR YCqVQUl12ioB8w1G5fSIaMKQbkQZ9vt88zbbcR3Pm7SBZM6bINa96mtSOBuveBB9jw1x vP3w== 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=wPrZCD2byGfwwdG9RubvsRe0v8xqjtgykjg/4Pk35JDVweBMC6ItU9IV3PFktpAR9s qH+kvqjoQ8E74nPQ7jQkxsdfv+TitenOhJTyg0tDUy6DiQqrcY0iSZhqv35Ke6YXQwsR W4V95sYyGI+GovulEWAygci0a9UWvngsHncL1MB+EUKAEc5eNwsiMSqge58BKWpX94+z kM1H1jmCCPMRRv1u0ZnZ/pFaNta0RLKZakXcn066jP+1HA7tCRoCtRsaVUVs48W/CPAi /3XtezdGQnGIY9yl8iVr3ySBWWmuTXJUq8Vd55CeBFF4qIyNHHA/zgBdBsDxYp+Z1YDV ABmQ== 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 h13si586842otn.112.2020.03.05.19.44.09; Thu, 05 Mar 2020 19:44:20 -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 S1727052AbgCFDns (ORCPT + 99 others); Thu, 5 Mar 2020 22:43:48 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11181 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726490AbgCFDnn (ORCPT ); Thu, 5 Mar 2020 22:43:43 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 8A50CF91B8D15A427E9D; 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:33 +0800 From: Tian Tao To: , , , , , , , , , CC: Subject: [PATCH 2/4] drm/hisilicon: Code cleanup for hibmc_drv_vdac Date: Fri, 6 Mar 2020 11:43:02 +0800 Message-ID: <1583466184-7060-5-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