[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200427162222.1c2b2c85@xps13>
Date: Mon, 27 Apr 2020 16:22:22 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Ricardo Ribalda Delgado <ribalda@...nel.org>
Cc: Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
linux-mtd@...ts.infradead.org, LKML <linux-kernel@...r.kernel.org>,
Boris Brezillon <boris.brezillon@...labora.com>,
Tudor Ambarus <tudor.ambarus@...rochip.com>
Subject: Re: [PATCH v2] mtd: Fix mtd not the same name not registered if
nvmem
Hi Ricardo,
Ricardo Ribalda Delgado <ribalda@...nel.org> wrote on Tue, 14 Apr 2020
15:47:23 +0200:
> Ping?
>
> On Thu, Apr 2, 2020 at 8:59 AM Ricardo Ribalda Delgado
> <ribalda@...nel.org> 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 <ribalda@...nel.org>
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:
[<parent-unique-name><separator>]<mtd-name>
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
Then, you might use this mtd->unique_name instead of mtd->name. Would
you give this logic a try?
Thanks,
Miquèl
Powered by blists - more mailing lists