From patchwork Fri Dec 5 20:36:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 418300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1C56114010B for ; Sat, 6 Dec 2014 07:38:30 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xwzcn-0003fT-1T; Fri, 05 Dec 2014 20:37:13 +0000 Received: from mail-la0-x236.google.com ([2a00:1450:4010:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xwzck-0003bn-MV for linux-mtd@lists.infradead.org; Fri, 05 Dec 2014 20:37:11 +0000 Received: by mail-la0-f54.google.com with SMTP id pv20so1310611lab.27 for ; Fri, 05 Dec 2014 12:36:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=NuGAcdPmdXU0BUsM3+PTloUXzc+BUxdI9GI5QNyMq7Y=; b=xAkNA77Ib7tJacqgIlkXFa49u3nga52E20RSSO7cyGA8wI9VAa/r26zN7ATKGFTqFt 4T5MlrtHHxeU9+iyjdperDiSJUypHtQvIDfxpHw+DI6FNNfYfnm56b1VTYlV1tF4kS2o B6dJ6PmmGS4OLkK6FEO+fPa2xhbddNJlBi5My5w8gr9Lig1ApUfCfgaFHUuwn82FwhK3 w7ZMajue/wqJGvwg09WzlAuMzjnaipbaALxTgfbGRH5qFjAiXswLDk556RQtA888g11n uNjPNYeB7ErMOCvLpS22FbBKkUgNfdQH12T28rYagcTdAcbifTgNx0ho8WUnbA5Uxib9 sEaA== MIME-Version: 1.0 X-Received: by 10.112.64.10 with SMTP id k10mr4693528lbs.72.1417811808195; Fri, 05 Dec 2014 12:36:48 -0800 (PST) Received: by 10.152.179.137 with HTTP; Fri, 5 Dec 2014 12:36:48 -0800 (PST) In-Reply-To: References: Date: Fri, 5 Dec 2014 18:36:48 -0200 Message-ID: Subject: Re: mtd: unable to unregister device From: Fabio Estevam To: Brian Norris X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141205_123710_922181_1559CEF4 X-CRM114-Status: GOOD ( 11.71 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:4010:c03:0:0:0:236 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Frank Li , Huang Shijie , Ezequiel Garcia , "linux-mtd@lists.infradead.org" X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On Fri, Dec 5, 2014 at 1:55 PM, Fabio Estevam wrote: > Hi, > > Running top of head linus tree or linux-next I observe the following issue: > > fsl-quadspi is autloaded as a kernel module: > > [ 9.670508] fsl-quadspi 21e4000.qspi: s25fl128s (16384 Kbytes) > [ 9.763432] fsl-quadspi 21e4000.qspi: s25fl128s (16384 Kbytes) > [ 9.847063] fsl-quadspi 21e4000.qspi: QuadSPI SPI NOR flash driver > > root@freescale /$ cat /proc/mtd > dev: size erasesize name > mtd0: 01000000 00010000 "21e4000.qspi" > mtd1: 01000000 00010000 "21e4000.qspi" > > root@freescale /$ rmmod fsl-quadspi > root@freescale /$ cat /proc/mtd > dev: size erasesize name > mtd0: 00000000 00000000 "(null)" > mtd0: 00000000 00000000 "(null)" > mtd0: 00000000 00000000 "(null)" If I change it like this: Then rmmod works as expected: root@freescale /$ rmmod fsl-quadspi root@freescale /$ cat /proc/mtd dev: size erasesize name --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -960,7 +960,7 @@ static int fsl_qspi_remove(struct platform_device *pdev) struct fsl_qspi *q = platform_get_drvdata(pdev); int i; - for (i = 0; i < q->nor_num; i++) + for (i = 0; i < FSL_QSPI_MAX_CHIP; i++) mtd_device_unregister(&q->mtd[i]); /* disable the hardware */