From patchwork Sat Feb 15 05:56:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 3655711 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 E716ABF13A for ; Sat, 15 Feb 2014 05:59:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BF572018B for ; Sat, 15 Feb 2014 05:59:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1213720203 for ; Sat, 15 Feb 2014 05:59:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751043AbaBOF7R (ORCPT ); Sat, 15 Feb 2014 00:59:17 -0500 Received: from fallback8.mail.ru ([94.100.176.136]:41239 "EHLO fallback8.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751249AbaBOF7R (ORCPT ); Sat, 15 Feb 2014 00:59:17 -0500 Received: from smtp25.mail.ru (smtp25.mail.ru [94.100.176.178]) by fallback8.mail.ru (mPOP.Fallback_MX) with ESMTP id 67BBF50BB514 for ; Sat, 15 Feb 2014 09:59:13 +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=7jiEjjT8DN6DotOF8xXk9bbLOiwvPnXYQRim00e2c9M=; b=FAg3eWt1XkBo06Ft1WxyADU7vJNwZ26ivHlhEkxqVTpxaFjj/C7HuBU53Gi8ujLT26GwoF643SWzI9iN0/Rqy/uJtNS1hYwCKa7jxsXHYLQtVX3eJVMkJXADmrpAnaOPJHeXaRFnT1Fiwh2boC10+PcgtyIt5ZQ2+luy5o+JOlI=; Received: from [188.134.40.128] (port=53872 helo=shc.zet) by smtp25.mail.ru with esmtpa (envelope-from ) id 1WEYF0-00010T-7y; Sat, 15 Feb 2014 09:56:42 +0400 From: Alexander Shiyan To: linux-fbdev@vger.kernel.org Cc: Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Sascha Hauer , Alexander Shiyan Subject: [PATCH 3/5] video: imxfb: Use module_platform_driver() Date: Sat, 15 Feb 2014 09:56:24 +0400 Message-Id: <1392443786-30527-3-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 We have no reason to call fb_get_options() when registering module, so move this call in the probe() and convert the driver to use module_platform_driver() macro. Signed-off-by: Alexander Shiyan --- drivers/video/imxfb.c | 65 +++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 39 deletions(-) diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 5b07053..3137a69 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -874,6 +874,26 @@ static struct lcd_ops imxfb_lcd_ops = { .set_power = imxfb_lcd_set_power, }; +static int imxfb_setup(void) +{ + char *opt, *options = NULL; + + if (fb_get_options("imxfb", &options)) + return -ENODEV; + + if (!options || !*options) + return 0; + + while ((opt = strsep(&options, ",")) != NULL) { + if (!*opt) + continue; + else + fb_mode = opt; + } + + return 0; +} + static int imxfb_probe(struct platform_device *pdev) { struct imxfb_info *fbi; @@ -888,6 +908,10 @@ static int imxfb_probe(struct platform_device *pdev) dev_info(&pdev->dev, "i.MX Framebuffer driver\n"); + ret = imxfb_setup(); + if (ret < 0) + return ret; + of_id = of_match_device(imxfb_of_dev_id, &pdev->dev); if (of_id) pdev->id_entry = of_id->data; @@ -1113,6 +1137,7 @@ static void imxfb_shutdown(struct platform_device *dev) static struct platform_driver imxfb_driver = { .suspend = imxfb_suspend, .resume = imxfb_resume, + .probe = imxfb_probe, .remove = imxfb_remove, .shutdown = imxfb_shutdown, .driver = { @@ -1121,45 +1146,7 @@ static struct platform_driver imxfb_driver = { }, .id_table = imxfb_devtype, }; - -static int imxfb_setup(void) -{ -#ifndef MODULE - char *opt, *options = NULL; - - if (fb_get_options("imxfb", &options)) - return -ENODEV; - - if (!options || !*options) - return 0; - - while ((opt = strsep(&options, ",")) != NULL) { - if (!*opt) - continue; - else - fb_mode = opt; - } -#endif - return 0; -} - -static int __init imxfb_init(void) -{ - int ret = imxfb_setup(); - - if (ret < 0) - return ret; - - return platform_driver_probe(&imxfb_driver, imxfb_probe); -} - -static void __exit imxfb_cleanup(void) -{ - platform_driver_unregister(&imxfb_driver); -} - -module_init(imxfb_init); -module_exit(imxfb_cleanup); +module_platform_driver(imxfb_driver); MODULE_DESCRIPTION("Freescale i.MX framebuffer driver"); MODULE_AUTHOR("Sascha Hauer, Pengutronix");