From patchwork Mon Dec 14 19:24:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 556598 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-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 60F431402A1 for ; Tue, 15 Dec 2015 06:26:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=v8Nyzz1M; dkim-atps=neutral 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 1a8YjT-0003HS-OI; Mon, 14 Dec 2015 19:24:27 +0000 Received: from mail-pf0-x22f.google.com ([2607:f8b0:400e:c00::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a8YjR-00032D-BK for linux-mtd@lists.infradead.org; Mon, 14 Dec 2015 19:24:26 +0000 Received: by pfbu66 with SMTP id u66so65852286pfb.3 for ; Mon, 14 Dec 2015 11:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=9Wmb3FBZ1R8krMDooLVBAH2NwVHHPIAVh26l75Dgfho=; b=v8Nyzz1MlsJSIJ11SIv8iwSsW5mBn/asJ9PZ7eRrq2AxJ4LS4Tb9QevAiohVu+nOPn GSaStyWCYIY19czxfXJ9AgraEEu1i3D8YLpFmX9QpQS4zl/mnLe4vl7gFcWKOnUdqWE2 ltHfxKiLsyB0K6hiO0PcDLqDVOR5DeRbdo+kEeaznxpnKQetBcVyIUxbL7zLEtP5LLkb 4bnKjMeKQKP0adxOkzc9egYgxE1zYMEd8P1F5SdaQ3naycCjVftzYzMKwQ51fXDJDjNt bpElkJRYpP+8rkUg6yVRTxhiLTzmJFKJ+79pS8dRebm8aMoxAD++xaFPaWIfbagIM/Fj GAbA== X-Received: by 10.98.72.152 with SMTP id q24mr38701326pfi.156.1450121044659; Mon, 14 Dec 2015 11:24:04 -0800 (PST) Received: from google.com ([2620:0:1000:1301:899:e7a7:c913:fe59]) by smtp.gmail.com with ESMTPSA id n28sm44075758pfb.8.2015.12.14.11.24.03 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 14 Dec 2015 11:24:04 -0800 (PST) Date: Mon, 14 Dec 2015 11:24:02 -0800 From: Brian Norris To: Heiko Schocher Subject: Re: [PATCH for-4.4] mtd: fix cmdlinepart parser, early naming for auto-filled MTD Message-ID: <20151214192402.GA124396@google.com> References: <1449878281-94986-1-git-send-email-computersforpeace@gmail.com> <566BA661.9000407@denx.de> <20151212053918.GA19361@brian-ubuntu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151212053918.GA19361@brian-ubuntu> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151214_112425_537268_C30E2F44 X-CRM114-Status: GOOD ( 19.84 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c00:0:0:0:22f listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Frans Klaver , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On Fri, Dec 11, 2015 at 09:39:18PM -0800, Brian Norris wrote: > On Sat, Dec 12, 2015 at 05:45:21AM +0100, Heiko Schocher wrote: > > Am 12.12.2015 um 00:58 schrieb Brian Norris: > > >Commit 807f16d4db95 ("mtd: core: set some defaults when dev.parent is > > >set") attempted to provide some default settings for MTDs that > > > (a) assign the parent device and > > > (b) don't provide their own name or owner > > > > > >However, this isn't a perfect drop-in replacement for the boilerplate > > >found in some drivers, because the MTD name is used by partition > > >parsers like cmdlinepart, but the name isn't set until add_mtd_device(), > > >after the parsing is completed. This means cmdlinepart sees a NULL name > > >and therefore will not work properly. > > > > > >Fix this by moving the default name and owner assignment to be first in > > >the MTD registration process. > > > > > >Fixes: 807f16d4db95 ("mtd: core: set some defaults when dev.parent is set") > > >Reported-by: Heiko Schocher > > >Signed-off-by: Brian Norris > > >Cc: Heiko Schocher > > >Cc: Frans Klaver > > >--- > > >Heiko, can you provide testing feedback (e.g., 'Tested-by: ...')? > > > > Sorry, does not work for me: > > > > Based on: > > pollux:linux hs [20151212] $ git describe master > > v4.4-rc4-135-gb9d8545 > > > > and this patch, shows the same problem, > > [...] BTW, can you please include the relevant log snippets when replying in the future? > Ugh, I see the problem. In nand_base.c, nand_get_flash_type(): > > if (!mtd->name) > mtd->name = type->name; Specifically, I think we could hack around this with something like the following additional patch. Untested: diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index ece544efccc3..9f169566fba4 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -3826,6 +3826,9 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, if (!type) type = nand_flash_ids; + if (!mtd->name && mtd->dev.parent) + mtd->name = dev_name(mtd->dev.parent); + for (; type->name != NULL; type++) { if (is_full_id_nand(type)) { if (find_full_id_nand(mtd, chip, type, id_data, &busw))