From patchwork Thu Apr 11 15:00:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Christophe PLAGNIOL-VILLARD X-Patchwork-Id: 2429111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 795583FD40 for ; Thu, 11 Apr 2013 15:05:01 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQJ3U-0005pz-P4; Thu, 11 Apr 2013 15:04:52 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQJ3Q-0003c4-LL; Thu, 11 Apr 2013 15:04:48 +0000 Received: from 14.mo3.mail-out.ovh.net ([188.165.43.98] helo=mo3.mail-out.ovh.net) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQJ37-0003YL-I5 for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2013 15:04:32 +0000 Received: from mail181.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo3.mail-out.ovh.net (Postfix) with SMTP id 7F503FF927B for ; Thu, 11 Apr 2013 17:04:27 +0200 (CEST) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 11 Apr 2013 17:04:27 +0200 Received: from ns32433.ovh.net (HELO localhost) (plagnioj%jcrosoft.com@213.251.161.87) by ns0.ovh.net with SMTP; 11 Apr 2013 17:04:25 +0200 From: Jean-Christophe PLAGNIOL-VILLARD To: linux-arm-kernel@lists.infradead.org X-Ovh-Mailout: 178.32.228.3 (mo3.mail-out.ovh.net) Subject: [PATCH 2/8] video: atmel_lcdfb: introduce atmel_lcdfb_power_control Date: Thu, 11 Apr 2013 17:00:16 +0200 Message-Id: <1365692422-9565-2-git-send-email-plagnioj@jcrosoft.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1365692422-9565-1-git-send-email-plagnioj@jcrosoft.com> References: <20130411145741.GB25242@game.jcrosoft.org> <1365692422-9565-1-git-send-email-plagnioj@jcrosoft.com> X-Ovh-Tracer-Id: 15058066830971153405 X-Ovh-Remote: 213.251.161.87 (ns32433.ovh.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-OVH-SPAMSTATE: OK X-OVH-SPAMSCORE: -100 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeifedruddtucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-Spam-Check: DONE|U 0.5/N X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeifedruddtucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130411_110430_040925_8997E380 X-CRM114-Status: GOOD ( 14.47 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [188.165.43.98 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Nicolas Ferre , devicetree-discuss@lists.ozlabs.org, Jean-Christophe PLAGNIOL-VILLARD , linux-fbdev@vger.kernel.org, Andrew Morton X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org to simplify the check on the presence of the callback Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Cc: linux-fbdev@vger.kernel.org Cc: Nicolas Ferre Cc: Andrew Morton Acked-by: Nicolas Ferre --- drivers/video/atmel_lcdfb.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 98733cd4..9574c47 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c @@ -283,6 +283,13 @@ static void init_contrast(struct atmel_lcdfb_info *sinfo) init_backlight(sinfo); } +static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on) +{ + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; + + if (pdata->atmel_lcdfb_power_control) + pdata->atmel_lcdfb_power_control(on); +} static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = { .type = FB_TYPE_PACKED_PIXELS, @@ -1114,8 +1121,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) fb_add_videomode(&fbmode, &info->modelist); /* Power up the LCDC screen */ - if (pdata->atmel_lcdfb_power_control) - pdata->atmel_lcdfb_power_control(1); + atmel_lcdfb_power_control(sinfo, 1); dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n", info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base); @@ -1169,8 +1175,7 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev) cancel_work_sync(&sinfo->task); exit_backlight(sinfo); - if (pdata->atmel_lcdfb_power_control) - pdata->atmel_lcdfb_power_control(0); + atmel_lcdfb_power_control(sinfo, 0); unregister_framebuffer(info); atmel_lcdfb_stop_clock(sinfo); clk_put(sinfo->lcdc_clk); @@ -1198,7 +1203,6 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg) { struct fb_info *info = platform_get_drvdata(pdev); struct atmel_lcdfb_info *sinfo = info->par; - struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; /* * We don't want to handle interrupts while the clock is @@ -1208,9 +1212,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg) sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR); lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); - if (pdata->atmel_lcdfb_power_control) - pdata->atmel_lcdfb_power_control(0); - + atmel_lcdfb_power_control(sinfo, 0); atmel_lcdfb_stop(sinfo); atmel_lcdfb_stop_clock(sinfo); @@ -1221,12 +1223,10 @@ static int atmel_lcdfb_resume(struct platform_device *pdev) { struct fb_info *info = platform_get_drvdata(pdev); struct atmel_lcdfb_info *sinfo = info->par; - struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; atmel_lcdfb_start_clock(sinfo); atmel_lcdfb_start(sinfo); - if (pdata->atmel_lcdfb_power_control) - pdata->atmel_lcdfb_power_control(1); + atmel_lcdfb_power_control(sinfo, 1); lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon); /* Enable FIFO & DMA errors */