From patchwork Mon Feb 12 09:44:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127954 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3039902ljc; Mon, 12 Feb 2018 01:45:15 -0800 (PST) X-Google-Smtp-Source: AH8x224DZobjenjEnr1aQHx3RI2sdK72nCrTFnYRaAZyuyo+2pUCrt5YNEVyKeSMmF0bEsKTiAU4 X-Received: by 10.99.103.129 with SMTP id b123mr8694722pgc.177.1518428715562; Mon, 12 Feb 2018 01:45:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428715; cv=none; d=google.com; s=arc-20160816; b=DaYcsoTs0eKJz9sSzzAzfGqS/APehHXAWCdIpUSBVnn6A4i/kowLelo/vUEJpsWHTM RlRFF9U/NPVye0MNVnD77oq94Qe5JhlTftunpbp1U1VWS/ZpIuyeZOQ1aj9Nupdhl9Lg mbKYCQTDHCpHI/Ye9wQYsBbG3gaQxuEJQo81fqpvaN0UYU1izusSKlnBAZMglzXSSqJA FkgDDkF1j1jefoO/VAhoMp2TyklrTFm2m6lRp/BuTE6BPOG/nepotC23gORW345V9w9/ GOud/2ZwrDHFhF4modnHkSFwzNuU1QkJRs4TTaSASJuNGJrQ3ybcbtdt8kdoYWPNnQjq Uzlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=3LGZTNpl9dqzJf/ttFsiEocr38hNSWuY1G42pMJFy/Q=; b=YS/Z9RsfQ8UNXkADrmit+o9MSYCRFwto+tvjIj0GP6SxuZXDxtqkDbAl1NX6bIJS7D h2TSU1acF9GSpo39xYavWpcpi/B1w43kw5r/pmao/sJSBt1vEEiYYV5J0ElGVSFkADIF It3W5xSfTsnzJpwUaLIoNujJukWaZvUqu+Iq72YtVusVJTd6QPUpfANWcgxstgd3NTcw U8I2iPg+/Ce7CStCszXLk02nKLTuCWdYMwBAhKMQYNUEavFVW9olmZwPp9GFi1ZZMcOV EjAIlncZ9Hi1aDYHBKkHvo0Z6ESf6GUuEeLaMhC02nlY+8c8ES44t5EA1DCr4Xlv9dBx wqqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=AU3Bl67g; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id i6-v6si2428811plt.26.2018.02.12.01.45.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:45:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=AU3Bl67g; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E4356E105; Mon, 12 Feb 2018 09:45:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1CFCD6E116 for ; Mon, 12 Feb 2018 09:45:08 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9j62Z009799; Mon, 12 Feb 2018 03:45:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428706; bh=wCbMuXuobc2njkHneRHZAVS/pPvDxz2ipcTGTYQ5ZyM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=AU3Bl67gY/zzAYTxPbWhK047RGgsX4kUs0PSs6hMTVWWmHa5MF81PuEWc+jFYdn0L 3FxX9PAhj55NR7Gnp2Ausmdaq5rQLXUcINxe4ASCAxN0j4kMW+Qai+yn2jrKjWtq/Q AeOzbD1pgEsYy10Nq/WXhl9dhMl8rCwrsFj+iPcg= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j6Ki018993; Mon, 12 Feb 2018 03:45:06 -0600 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:05 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:05 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0Mx003439; Mon, 12 Feb 2018 03:45:04 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 02/24] drm/omap: cleanup fbdev init/free Date: Mon, 12 Feb 2018 11:44:32 +0200 Message-ID: <1518428694-18018-3-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" omap_fbdev_init() and omap_fbdev_free() use priv->fbdev directly. However, omap_fbdev_init() returns the fbdev, and omap_drv.c also assigns the return value to priv->fbdev. This is slightly confusing. Clean this up by removing the omap_fbdev_init() return value, as we don't care whether fbdev init succeeded or not. Also change omap_drv.c to call omap_fbdev_init() always, and omap_fbdev_init() does the check if fbdev was initialized. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 9 ++++----- drivers/gpu/drm/omapdrm/omap_fbdev.c | 10 +++++----- drivers/gpu/drm/omapdrm/omap_fbdev.h | 5 ++--- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index dd68b2556f5b..485684c637ff 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -584,7 +584,7 @@ static int pdev_probe(struct platform_device *pdev) for (i = 0; i < priv->num_crtcs; i++) drm_crtc_vblank_off(priv->crtcs[i]); - priv->fbdev = omap_fbdev_init(ddev); + omap_fbdev_init(ddev); drm_kms_helper_poll_init(ddev); omap_modeset_enable_external_hpd(); @@ -602,8 +602,8 @@ static int pdev_probe(struct platform_device *pdev) err_cleanup_helpers: omap_modeset_disable_external_hpd(); drm_kms_helper_poll_fini(ddev); - if (priv->fbdev) - omap_fbdev_free(ddev); + + omap_fbdev_free(ddev); err_cleanup_modeset: drm_mode_config_cleanup(ddev); omap_drm_irq_uninstall(ddev); @@ -632,8 +632,7 @@ static int pdev_remove(struct platform_device *pdev) omap_modeset_disable_external_hpd(); drm_kms_helper_poll_fini(ddev); - if (priv->fbdev) - omap_fbdev_free(ddev); + omap_fbdev_free(ddev); drm_atomic_helper_shutdown(ddev); diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 632ebcf2165f..30ce3d562414 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -242,7 +242,7 @@ static struct drm_fb_helper *get_fb(struct fb_info *fbi) } /* initialize fbdev helper */ -struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) +void omap_fbdev_init(struct drm_device *dev) { struct omap_drm_private *priv = dev->dev_private; struct omap_fbdev *fbdev = NULL; @@ -275,7 +275,7 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) priv->fbdev = helper; - return helper; + return; fini: drm_fb_helper_fini(helper); @@ -283,9 +283,6 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) kfree(fbdev); dev_warn(dev->dev, "omap_fbdev_init failed\n"); - /* well, limp along without an fbdev.. maybe X11 will work? */ - - return NULL; } void omap_fbdev_free(struct drm_device *dev) @@ -296,6 +293,9 @@ void omap_fbdev_free(struct drm_device *dev) DBG(); + if (!priv->fbdev) + return; + drm_fb_helper_unregister_fbi(helper); drm_fb_helper_fini(helper); diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.h b/drivers/gpu/drm/omapdrm/omap_fbdev.h index 1f5ba0996a1a..3bd6ea661a18 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.h +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.h @@ -24,12 +24,11 @@ struct drm_device; struct drm_fb_helper; #ifdef CONFIG_DRM_FBDEV_EMULATION -struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev); +void omap_fbdev_init(struct drm_device *dev); void omap_fbdev_free(struct drm_device *dev); #else -static inline struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) +static inline void omap_fbdev_init(struct drm_device *dev) { - return NULL; } static inline void omap_fbdev_free(struct drm_device *dev) {