From patchwork Sat Feb 15 05:56:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 3655701 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E9217BF40C for ; Sat, 15 Feb 2014 05:59:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 13DF82020E for ; Sat, 15 Feb 2014 05:59:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 316172020F for ; Sat, 15 Feb 2014 05:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751338AbaBOF7R (ORCPT ); Sat, 15 Feb 2014 00:59:17 -0500 Received: from fallback6.mail.ru ([94.100.176.134]:36492 "EHLO fallback6.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751043AbaBOF7Q (ORCPT ); Sat, 15 Feb 2014 00:59:16 -0500 Received: from smtp25.mail.ru (smtp25.mail.ru [94.100.176.178]) by fallback6.mail.ru (mPOP.Fallback_MX) with ESMTP id CAEF83175FBE for ; Sat, 15 Feb 2014 09:59:14 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=JM8fw8KUKaEK6btGGqSAwURZ3R020AyWPp8n/z5RtqA=; b=EFeRv02I6ScxQOTv+42XxnlrB+CJwlpiKXnwTU2f5UmwQEDPsS+yZE8Y3u6iyGZ5Bwlk6LK2IxbM7tfX916yXGm3uAgnajL7VzLUqZW6hpKJoOXki22SwQ2IHoOFcs43FhPFRQnvr+Xf5W2hYXfyxgzbCDgcsOl0miSOp4ci43k=; Received: from [188.134.40.128] (port=53872 helo=shc.zet) by smtp25.mail.ru with esmtpa (envelope-from ) id 1WEYF1-00010T-6h; Sat, 15 Feb 2014 09:56:43 +0400 From: Alexander Shiyan To: linux-fbdev@vger.kernel.org Cc: Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Sascha Hauer , Alexander Shiyan Subject: [PATCH 5/5] video: imxfb: Convert to SIMPLE_DEV_PM_OPS Date: Sat, 15 Feb 2014 09:56:26 +0400 Message-Id: <1392443786-30527-5-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392443786-30527-1-git-send-email-shc_work@mail.ru> References: <1392443786-30527-1-git-send-email-shc_work@mail.ru> X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Mras: Ok Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RDNS_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of assigning the pm_ops fields individually we can simply use SIMPLE_DEV_PM_OPS. Signed-off-by: Alexander Shiyan --- drivers/video/imxfb.c | 59 ++++++++++++++++++--------------------------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 398a8ca..086e024 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -622,37 +622,6 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf return 0; } -#ifdef CONFIG_PM -/* - * Power management hooks. Note that we won't be called from IRQ context, - * unlike the blank functions above, so we may sleep. - */ -static int imxfb_suspend(struct platform_device *dev, pm_message_t state) -{ - struct fb_info *info = platform_get_drvdata(dev); - struct imxfb_info *fbi = info->par; - - pr_debug("%s\n", __func__); - - imxfb_disable_controller(fbi); - return 0; -} - -static int imxfb_resume(struct platform_device *dev) -{ - struct fb_info *info = platform_get_drvdata(dev); - struct imxfb_info *fbi = info->par; - - pr_debug("%s\n", __func__); - - imxfb_enable_controller(fbi); - return 0; -} -#else -#define imxfb_suspend NULL -#define imxfb_resume NULL -#endif - static int imxfb_init_fbinfo(struct platform_device *pdev) { struct imx_fb_platform_data *pdata = dev_get_platdata(&pdev->dev); @@ -1063,23 +1032,37 @@ static int imxfb_remove(struct platform_device *pdev) return 0; } -static void imxfb_shutdown(struct platform_device *dev) +static int __maybe_unused imxfb_suspend(struct device *dev) { - struct fb_info *info = platform_get_drvdata(dev); + struct fb_info *info = dev_get_drvdata(dev); struct imxfb_info *fbi = info->par; + imxfb_disable_controller(fbi); + + return 0; } +static int __maybe_unused imxfb_resume(struct device *dev) +{ + struct fb_info *info = dev_get_drvdata(dev); + struct imxfb_info *fbi = info->par; + + imxfb_enable_controller(fbi); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(imxfb_pm_ops, imxfb_suspend, imxfb_resume); + static struct platform_driver imxfb_driver = { - .suspend = imxfb_suspend, - .resume = imxfb_resume, - .probe = imxfb_probe, - .remove = imxfb_remove, - .shutdown = imxfb_shutdown, .driver = { .name = DRIVER_NAME, .of_match_table = imxfb_of_dev_id, + .owner = THIS_MODULE, + .pm = &imxfb_pm_ops, }, + .probe = imxfb_probe, + .remove = imxfb_remove, .id_table = imxfb_devtype, }; module_platform_driver(imxfb_driver);