From patchwork Wed Aug 31 11:00:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1115522 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7VB0ZOX023798 for ; Wed, 31 Aug 2011 11:00:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755146Ab1HaLAi (ORCPT ); Wed, 31 Aug 2011 07:00:38 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:54385 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755054Ab1HaLAg (ORCPT ); Wed, 31 Aug 2011 07:00:36 -0400 Received: from localhost.localdomain (unknown [91.178.27.34]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 12BA935AAC; Wed, 31 Aug 2011 11:00:34 +0000 (UTC) From: Laurent Pinchart To: linux-fbdev@vger.kernel.org Cc: linux-sh@vger.kernel.org, magnus.damm@gmail.com, dhobsong@igel.co.jp Subject: [PATCH v2 6/8] fbdev: sh_mobile_lcdc: Avoid forward declarations Date: Wed, 31 Aug 2011 13:00:57 +0200 Message-Id: <1314788459-31791-7-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1314788459-31791-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1314788459-31791-1-git-send-email-laurent.pinchart@ideasonboard.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 31 Aug 2011 11:00:39 +0000 (UTC) Reorder probe/remove functions to avoid forward declarations. Signed-off-by: Laurent Pinchart --- drivers/video/sh_mobile_lcdcfb.c | 102 ++++++++++++++++++------------------- 1 files changed, 50 insertions(+), 52 deletions(-) diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index b6da1d6..366315b 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -1434,7 +1434,56 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb, return NOTIFY_OK; } -static int sh_mobile_lcdc_remove(struct platform_device *pdev); +static int sh_mobile_lcdc_remove(struct platform_device *pdev) +{ + struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev); + struct fb_info *info; + int i; + + fb_unregister_client(&priv->notifier); + + for (i = 0; i < ARRAY_SIZE(priv->ch); i++) + if (priv->ch[i].info && priv->ch[i].info->dev) + unregister_framebuffer(priv->ch[i].info); + + sh_mobile_lcdc_stop(priv); + + for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { + info = priv->ch[i].info; + + if (!info || !info->device) + continue; + + if (priv->ch[i].sglist) + vfree(priv->ch[i].sglist); + + if (info->screen_base) + dma_free_coherent(&pdev->dev, info->fix.smem_len, + info->screen_base, + priv->ch[i].dma_handle); + fb_dealloc_cmap(&info->cmap); + framebuffer_release(info); + } + + for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { + if (priv->ch[i].bl) + sh_mobile_lcdc_bl_remove(priv->ch[i].bl); + } + + if (priv->dot_clk) + clk_put(priv->dot_clk); + + if (priv->dev) + pm_runtime_disable(priv->dev); + + if (priv->base) + iounmap(priv->base); + + if (priv->irq) + free_irq(priv->irq, priv); + kfree(priv); + return 0; +} static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) { @@ -1691,57 +1740,6 @@ err1: return error; } -static int sh_mobile_lcdc_remove(struct platform_device *pdev) -{ - struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev); - struct fb_info *info; - int i; - - fb_unregister_client(&priv->notifier); - - for (i = 0; i < ARRAY_SIZE(priv->ch); i++) - if (priv->ch[i].info && priv->ch[i].info->dev) - unregister_framebuffer(priv->ch[i].info); - - sh_mobile_lcdc_stop(priv); - - for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { - info = priv->ch[i].info; - - if (!info || !info->device) - continue; - - if (priv->ch[i].sglist) - vfree(priv->ch[i].sglist); - - if (info->screen_base) - dma_free_coherent(&pdev->dev, info->fix.smem_len, - info->screen_base, - priv->ch[i].dma_handle); - fb_dealloc_cmap(&info->cmap); - framebuffer_release(info); - } - - for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { - if (priv->ch[i].bl) - sh_mobile_lcdc_bl_remove(priv->ch[i].bl); - } - - if (priv->dot_clk) - clk_put(priv->dot_clk); - - if (priv->dev) - pm_runtime_disable(priv->dev); - - if (priv->base) - iounmap(priv->base); - - if (priv->irq) - free_irq(priv->irq, priv); - kfree(priv); - return 0; -} - static struct platform_driver sh_mobile_lcdc_driver = { .driver = { .name = "sh_mobile_lcdc_fb",