From patchwork Thu Aug 30 11:40:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: archit taneja X-Patchwork-Id: 1387631 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 0EF0D3FDF5 for ; Thu, 30 Aug 2012 11:42:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754677Ab2H3Lmt (ORCPT ); Thu, 30 Aug 2012 07:42:49 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:41012 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753018Ab2H3Lms (ORCPT ); Thu, 30 Aug 2012 07:42:48 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id q7UBgmka019460; Thu, 30 Aug 2012 06:42:48 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7UBgmBW000920; Thu, 30 Aug 2012 06:42:48 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Thu, 30 Aug 2012 06:42:47 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7UBgljg025962; Thu, 30 Aug 2012 06:42:47 -0500 Received: from localhost (a0393947pc.apr.dhcp.ti.com [172.24.137.248]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id q7UBgjr25211; Thu, 30 Aug 2012 06:42:46 -0500 (CDT) From: Archit Taneja To: CC: , , , Archit Taneja Subject: [PATCH v2 07/23] OMAPFB: remove manager->device references Date: Thu, 30 Aug 2012 17:10:29 +0530 Message-ID: <1346326845-16583-8-git-send-email-archit@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1346326845-16583-1-git-send-email-archit@ti.com> References: <1345528711-27801-1-git-send-email-archit@ti.com> <1346326845-16583-1-git-send-email-archit@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org With the introduction of output entities, managers will now connect to outputs. Use the helper op for managers named get_device. This will abstract away the information on how to get the device from an overlay manager. Using the helper function will reduce the number of pointer dereferences a user of OMAPDSS needs to do and reduce risk of a NULL dereference. Signed-off-by: Archit Taneja --- drivers/video/omap2/omapfb/omapfb-main.c | 7 +++++-- drivers/video/omap2/omapfb/omapfb.h | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index fc671d3..c6992be 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c @@ -2353,6 +2353,7 @@ static int __init omapfb_probe(struct platform_device *pdev) struct omap_overlay *ovl; struct omap_dss_device *def_display; struct omap_dss_device *dssdev; + struct omap_dss_device *mgr_device; DBG("omapfb_probe\n"); @@ -2426,8 +2427,10 @@ static int __init omapfb_probe(struct platform_device *pdev) /* gfx overlay should be the default one. find a display * connected to that, and use it as default display */ ovl = omap_dss_get_overlay(0); - if (ovl->manager && ovl->manager->device) { - def_display = ovl->manager->device; + mgr_device = ovl->manager ? + ovl->manager->get_device(ovl->manager) : NULL; + if (mgr_device) { + def_display = mgr_device; } else { dev_warn(&pdev->dev, "cannot find default display\n"); def_display = NULL; diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h index 30361a0..2782b1f 100644 --- a/drivers/video/omap2/omapfb/omapfb.h +++ b/drivers/video/omap2/omapfb/omapfb.h @@ -148,8 +148,9 @@ static inline struct omap_dss_device *fb2display(struct fb_info *fbi) /* XXX: returns the display connected to first attached overlay */ for (i = 0; i < ofbi->num_overlays; i++) { - if (ofbi->overlays[i]->manager) - return ofbi->overlays[i]->manager->device; + struct omap_overlay_manager *mgr = ofbi->overlays[i]->manager; + if (mgr) + return mgr->get_device(mgr); } return NULL;