From patchwork Tue Dec 14 20:09:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 75544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from canuck.infradead.org (canuck.infradead.org [134.117.69.58]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 367C3B6F14 for ; Wed, 15 Dec 2010 07:36:22 +1100 (EST) Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PSbWv-0001KI-Bw; Tue, 14 Dec 2010 20:31:25 +0000 Received: from d1.icnet.pl ([212.160.220.21]) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PSbWr-0001Jp-Mi; Tue, 14 Dec 2010 20:31:22 +0000 Received: from 87-205-12-81.ip.netia.com.pl ([87.205.12.81] helo=vclass.intranet) by d1.icnet.pl with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1PSbWq-0006Fp-Qe; Tue, 14 Dec 2010 21:31:20 +0100 From: Janusz Krzysztofik Organization: Tele-Info-System, Poznan, PL To: Artem Bityutskiy Subject: [PATCH v2] MTD: NAND: ams-delta: convert to platform driver Date: Tue, 14 Dec 2010 21:09:40 +0100 User-Agent: KMail/1.9.10 References: <201012111840.05270.jkrzyszt@tis.icnet.pl> <1292346023.2538.103.camel@localhost> In-Reply-To: <1292346023.2538.103.camel@localhost> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201012142109.42784.jkrzyszt@tis.icnet.pl> X-SA-Exim-Scanned: No (on d1.icnet); SAEximRunCond expanded to false X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20101214_153122_123330_A24C3D93 X-CRM114-Status: GOOD ( 17.62 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Tony Lindgren , David Woodhouse , linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In its current form, the driver may interfere with different hardware on Acked-by: Tony Lindgren different boards if built into the kernel, hence is not suitable for inclusion into a defconfig, inteded to be usable with multiple OMAP1 cpu and machine types. Convert it to a platform driver, that should be free from this issue. Created and tested against linux-2.6.37-rc5 on Amstrad Delta. Signed-off-by: Janusz Krzysztofik --- Tuesday 14 December 2010 18:00:23 Artem Bityutskiy wrote: > Sorry, but would it please be possible to split this few small patches - > this one is too difficult to review, at least for me. v1 -> v2 changes: - remove any changes that were not essential for actually converting the driver to a platform driver and modifying its user, ie. the Amstrad Delta board, to register a corresponding platform device on startup, - re-word the commit message a little bit. arch/arm/mach-omap1/board-ams-delta.c | 6 ++++++ drivers/mtd/nand/ams-delta.c | 31 ++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) --- linux-2.6.37-rc5/drivers/mtd/nand/ams-delta.c.orig 2010-12-14 20:25:58.000000000 +0100 +++ linux-2.6.37-rc5/drivers/mtd/nand/ams-delta.c 2010-12-14 20:26:40.000000000 +0100 @@ -4,6 +4,7 @@ * Copyright (C) 2006 Jonathan McDowell * * Derived from drivers/mtd/toto.c + * Converted to platform driver by Janusz Krzysztofik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -151,7 +152,7 @@ static int ams_delta_nand_ready(struct m /* * Main initialization routine */ -static int __init ams_delta_init(void) +static int __devinit ams_delta_init(struct platform_device *pdev) { struct nand_chip *this; int err = 0; @@ -219,20 +222,40 @@ static int __init ams_delta_init(void) return err; } -module_init(ams_delta_init); - /* * Clean up routine */ -static void __exit ams_delta_cleanup(void) +static int __devexit ams_delta_cleanup(struct platform_device *pdev) { /* Release resources, unregister device */ nand_release(ams_delta_mtd); /* Free the MTD device structure */ kfree(ams_delta_mtd); + + return 0; +} + +static struct platform_driver ams_delta_nand_driver = { + .probe = ams_delta_init, + .remove = __devexit_p(ams_delta_cleanup), + .driver = { + .name = "ams-delta-nand", + .owner = THIS_MODULE, + }, +}; + +static int __init ams_delta_nand_init(void) +{ + return platform_driver_register(&ams_delta_nand_driver); +} +module_init(ams_delta_nand_init); + +static void __exit ams_delta_nand_exit(void) +{ + platform_driver_unregister(&ams_delta_nand_driver); } -module_exit(ams_delta_cleanup); +module_exit(ams_delta_nand_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Jonathan McDowell "); --- linux-2.6.37-rc5/arch/arm/mach-omap1/board-ams-delta.c.orig 2010-12-09 23:13:04.000000000 +0100 +++ linux-2.6.37-rc5/arch/arm/mach-omap1/board-ams-delta.c 2010-12-14 20:26:40.000000000 +0100 @@ -181,6 +181,11 @@ static struct omap_board_config_kernel a { OMAP_TAG_LCD, &ams_delta_lcd_config }, }; +static struct platform_device ams_delta_nand_device = { + .name = "ams-delta-nand", + .id = -1 +}; + static struct resource ams_delta_kp_resources[] = { [0] = { .start = INT_KEYBOARD, @@ -273,6 +278,7 @@ void __init amsdelta_reserve(void) } static struct platform_device *ams_delta_devices[] __initdata = { + &ams_delta_nand_device, &ams_delta_kp_device, &ams_delta_lcd_device, &ams_delta_led_device,