From patchwork Fri Apr 2 22:16:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hartley Sweeten X-Patchwork-Id: 49327 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B405EB7CF0 for ; Sat, 3 Apr 2010 09:20:49 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NxpAs-0003ol-1Y; Fri, 02 Apr 2010 22:17:10 +0000 Received: from p01c12o144.mxlogic.net ([208.65.145.67]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1NxpAp-0003o2-HL for linux-mtd@lists.infradead.org; Fri, 02 Apr 2010 22:17:08 +0000 Received: from unknown [216.166.12.180] (EHLO p01c12o144.mxlogic.net) by p01c12o144.mxlogic.net(mxl_mta-6.5.0-2) with ESMTP id 3ec66bb4.a04a4b90.12320.00-413.28286.p01c12o144.mxlogic.net (envelope-from ); Fri, 02 Apr 2010 16:17:07 -0600 (MDT) X-MXL-Hash: 4bb66ce3462aeb41-99b69ce76096f308009bd25a4cf37dda79202b02 Received: from unknown [216.166.12.180] by p01c12o144.mxlogic.net(mxl_mta-6.5.0-2) with SMTP id 2dc66bb4.0.12132.00-035.28175.p01c12o144.mxlogic.net (envelope-from ); Fri, 02 Apr 2010 16:16:52 -0600 (MDT) X-MXL-Hash: 4bb66cd42dff1e01-16a2b73bb0cc890613e9095077c8ad43306707a3 Received: from AUSP01VMBX24.collaborationhost.net ([10.2.12.1]) by AUSP01MHUB05.collaborationhost.net ([10.2.8.172]) with mapi; Fri, 2 Apr 2010 17:16:30 -0500 From: H Hartley Sweeten To: Randy Dunlap , lkml Date: Fri, 2 Apr 2010 17:16:27 -0500 Subject: RE: BUG: physmap modprobe & rmmod Thread-Topic: BUG: physmap modprobe & rmmod Thread-Index: AcrSrvrpGOM+Z0x0Rc25T1vnD0oVHAAAH+vg Message-ID: <0D753D10438DA54287A00B0270842697636A7E9CF1@AUSP01VMBX24.collaborationhost.net> References: <20100402134058.c4682716.randy.dunlap@oracle.com> <20100402144727.2c80a6b2.randy.dunlap@oracle.com> In-Reply-To: <20100402144727.2c80a6b2.randy.dunlap@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2010040101)] X-MAIL-FROM: X-SOURCE-IP: [216.166.12.180] X-AnalysisOut: [v=1.0 c=1 a=VphdPIyG4kEA:10 a=kj9zAlcOel0A:10 a=38uLcFpo6n] X-AnalysisOut: [JaFUi5eYvXHw==:17 a=i00gxMtYAAAA:8 a=GgcTZRFqIW8b2UqNVbAA:] X-AnalysisOut: [9 a=ZHTJMDathjNmkwNySr4A:7 a=iwt-rlhAmAK0i3JyYeUgq3-KgzYA:] X-AnalysisOut: [4 a=CjuIK1q_8ugA:10 a=x1WnkoZAwusA:10] X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100402_181707_726378_CA32BBD2 X-CRM114-Status: GOOD ( 12.46 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.0 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [208.65.145.67 listed in list.dnswl.org] Cc: "linux-mtd@lists.infradead.org" , David Woodhouse 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 On Friday, April 02, 2010 2:47 PM, Randy Dunlap wrote: >> 2.6.34-rc2 kernel: >> >> Boot up on a common PC, then: modprobe physmap ; rmmod physmap >> and bang. [snip] > This is with close to an allmodconfig on x86_64, including: > > CONFIG_MTD_PHYSMAP=m > CONFIG_MTD_PHYSMAP_COMPAT=y > CONFIG_MTD_PHYSMAP_START=0x8000000 > CONFIG_MTD_PHYSMAP_LEN=0 > CONFIG_MTD_PHYSMAP_BANKWIDTH=2 That's probably the cause of the BUG. If your not run-time calling physmap_configure(), your resource will be created as: static struct physmap_flash_data physmap_flash_data = { .width = CONFIG_MTD_PHYSMAP_BANKWIDTH, }; static struct resource physmap_flash_resource = { .start = CONFIG_MTD_PHYSMAP_START, .end = CONFIG_MTD_PHYSMAP_START + CONFIG_MTD_PHYSMAP_LEN - 1, .flags = IORESOURCE_MEM, }; In other words: static struct physmap_flash_data physmap_flash_data = { .width = 2, }; static struct resource physmap_flash_resource = { .start = 0x8000000, .end = 0x8000000 + 0 - 1, .flags = IORESOURCE_MEM, }; I don't think your even getting into the physmap_flash_probe routine. Your probably getting the BUG after: platform_device_register(&physmap_flash); Which eventually gets to platform_device_add which is giving you the message: > [ 127.869454] physmap-flash.0: failed to claim resource 0 Try this patch to see if it fixes your BUG. --- mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device If the default Kconfig values are used with MTD_PHYSMAP_COMPAT you end up with a IORESOURCE_MEM of 0 size. This causes platform_device_add to fail during the platform_device_register call. Catch this failure during the physmap_init. Signed-off-by: H Hartley Sweeten --- diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index d9603f7..426461a 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -264,8 +264,11 @@ static int __init physmap_init(void) err = platform_driver_register(&physmap_flash_driver); #ifdef CONFIG_MTD_PHYSMAP_COMPAT - if (err == 0) - platform_device_register(&physmap_flash); + if (err == 0) { + err = platform_device_register(&physmap_flash); + if (err) + platform_driver_unregister(&physmap_flash_driver); + } #endif return err;