Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2961835ybz; Mon, 27 Apr 2020 07:39:32 -0700 (PDT) X-Google-Smtp-Source: APiQypJV1MMv3rY5KPwdwd5xgES4ssNwOahvklaq2nCfugY7jHCsUJ3cLbvzsrWCNfapfaf3PA/i X-Received: by 2002:a05:6402:1596:: with SMTP id c22mr19732463edv.100.1587998372522; Mon, 27 Apr 2020 07:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587998372; cv=none; d=google.com; s=arc-20160816; b=VewocRu7O7Ys24RDS5ObmvYYfhaiin5QfBqTmKhKc7Eowltr6wry8YtVbU9XzT/FqX WPG+86EAOhuhvzouXj1YTgES77PIsn799vbBJRanA1ixCCF1UCkIW7SmXfMELCik/EmK XmaPckrbcc0qTaUe1kIFifrfU3HlJ5Qn8d1RMYXn79jQ4/4tzqkGgmIUSbvB2DFqBHSY usEvoEaF3C6Rww5Q0DNnsw95ZpKNk+F2rYi4jHMmMvayNBXnQtAxsQGest+SwjiJKqO2 oJU4qlP/r5VwJ1JdCbExiwakt29XkrHnLx19SJ7rWHeC2qbJqJ85JIlVvbnXfpEvHBl1 n87g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=AiC4Y6Fc22UC59q2VR2m2pYdbcs5PjLSWbeFPAI3oL0=; b=Tot4UWL0n/wwSguVvZnkSs/eni20xsh4puCOilabQS70Zw9hvuedznT9UX7CvUWcmL 9gEUzrc+gVTs+kE2JZGwC4yQYEHItfenOgSj71HXrQOek3EFx++HRs8jd1m+6R3QQ4Pd q4e9OOHWmJ9t9FKA78oc00wYTEFhPl5ttB2eRx04thV561kXCrASA/4lb2c0gGbjh+vU 1Q2oEJWBd3mgUdVHqcjQPH/7Ja7UiM+TH8CIFRcTAuU3uqSkgsDPxugU7wux3QA5gfFU r8SozSNp0CcHdFKT7vNkonaScZ+cb2DUTtyCt78cpiEukkMqXiQgVC//GhnUFfXqkSl6 1fSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay15si334475ejb.1.2020.04.27.07.39.02; Mon, 27 Apr 2020 07:39:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728014AbgD0OhR (ORCPT + 99 others); Mon, 27 Apr 2020 10:37:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727115AbgD0OhR (ORCPT ); Mon, 27 Apr 2020 10:37:17 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33A23C0610D5 for ; Mon, 27 Apr 2020 07:37:17 -0700 (PDT) Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 43A212A074A; Mon, 27 Apr 2020 15:37:15 +0100 (BST) Date: Mon, 27 Apr 2020 16:37:11 +0200 From: Boris Brezillon To: Miquel Raynal Cc: Ricardo Ribalda Delgado , Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, LKML , Tudor Ambarus Subject: Re: [PATCH v2] mtd: Fix mtd not the same name not registered if nvmem Message-ID: <20200427163711.07614619@collabora.com> In-Reply-To: <20200427162222.1c2b2c85@xps13> References: <20200401100240.445447-1-ribalda@kernel.org> <20200402065953.9974-1-ribalda@kernel.org> <20200427162222.1c2b2c85@xps13> Organization: Collabora X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 27 Apr 2020 16:22:22 +0200 Miquel Raynal wrote: > Hi Ricardo, > > Ricardo Ribalda Delgado wrote on Tue, 14 Apr 2020 > 15:47:23 +0200: > > > Ping? > > > > On Thu, Apr 2, 2020 at 8:59 AM Ricardo Ribalda Delgado > > wrote: > > > > > > When the nvmem framework is enabled, a nvmem device is created per mtd > > > device/partition. > > > > > > It is not uncommon that a device can have multiple mtd devices with > > > partitions that have the same name. Eg, when there DT overlay is allowed > > > and the same device with mtd is attached twice. > > > > > > Under that circumstances, the mtd fails to register due to a name > > > duplication on the nvmem framework. > > > > > > With this patch we add a _1, _2, _X to the subsequent names if there is > > > a collition, and throw a warning, instead of not starting the mtd > > > device. > > > > > > [ 8.948991] sysfs: cannot create duplicate filename '/bus/nvmem/devices/Production Data' > > > [ 8.948992] CPU: 7 PID: 246 Comm: systemd-udevd Not tainted 5.5.0-qtec-standard #13 > > > [ 8.948993] Hardware name: AMD Dibbler/Dibbler, BIOS 05.22.04.0019 10/26/2019 > > > [ 8.948994] Call Trace: > > > [ 8.948996] dump_stack+0x50/0x70 > > > [ 8.948998] sysfs_warn_dup.cold+0x17/0x2d > > > [ 8.949000] sysfs_do_create_link_sd.isra.0+0xc2/0xd0 > > > [ 8.949002] bus_add_device+0x74/0x140 > > > [ 8.949004] device_add+0x34b/0x850 > > > [ 8.949006] nvmem_register.part.0+0x1bf/0x640 > > > ... > > > [ 8.948926] mtd mtd8: Failed to register NVMEM device > > > > > > Signed-off-by: Ricardo Ribalda Delgado > > Thanks for proposing this change. Indeed we are aware of the problem > and the best solution that we could come up with was to create an > additional "unique_name" field to the mtd_info structure. This new > field would have the form: > > [] > > The separator might be '~' (but I am completely open on that), and that > would give for instance: > > my-controller~my-device~my-part~mysub-part I'd prefer something slightly more standard for the separator, like '/', which is what we usually use when we want to represent a path in a tree. I do agree on the general approach though. Note that controller name is normally hidden in the root MTD device name, and it's the driver responsibility to come up with a name that does not collide with other MTD drivers. We can of course try to pick a different name if we see another device with the same name, but we should definitely warn about that so drivers are patched accordingly.