Re: nvmem creates multiple devices with the same name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 21 May 2019 10:56:41 +0200
Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote:

> Hi all,
> 
> nvmem derives the device name directly from the partition name of the
> underlying device. IMO this is wrong since it's not possible to create
> two partitions with the same name on different devices. In my case I
> have a NAND device and a SPI NOR device which both happen to have a
> partition named 'barebox'. This ends up with:

Hm, I think I had suggested to use dev_name(&mtd->dev) instead of
mtd->name at some point. But then you have the problem that MTD
numbering is dependent on the probe order which is not guaranteed to
stay the same, so exposing nvmem devices using "mtdXX" name is not super
user-friendly.

> 
> [   11.222196] sysfs: cannot create duplicate filename '/bus/nvmem/devices/barebox'
> [   11.230136] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W         5.2.0-rc1-00014-g793f23e5adb0-dirty #676
> [   11.240414] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
> [   11.247174] [<c0112928>] (unwind_backtrace) from [<c010d140>] (show_stack+0x10/0x14)
> [   11.255171] [<c010d140>] (show_stack) from [<c0bd65cc>] (dump_stack+0xd8/0x110)
> [   11.262722] [<c0bd65cc>] (dump_stack) from [<c031682c>] (sysfs_warn_dup+0x50/0x64)
> [   11.270527] [<c031682c>] (sysfs_warn_dup) from [<c0316b34>] (sysfs_do_create_link_sd+0xcc/0xd8)
> [   11.279487] [<c0316b34>] (sysfs_do_create_link_sd) from [<c06792a0>] (bus_add_device+0x80/0xfc)
> [   11.288441] [<c06792a0>] (bus_add_device) from [<c0676208>] (device_add+0x328/0x608)
> [   11.296423] [<c0676208>] (device_add) from [<c08bde64>] (nvmem_register.part.1+0x168/0x5e4)
> [   11.305030] [<c08bde64>] (nvmem_register.part.1) from [<c06edb34>] (add_mtd_device+0x1e8/0x404)
> [   11.313988] [<c06edb34>] (add_mtd_device) from [<c06f1004>] (add_mtd_partitions+0x74/0x15c)
> [   11.322589] [<c06f1004>] (add_mtd_partitions) from [<c06f0da8>] (parse_mtd_partitions+0x180/0x368)
> [   11.331807] [<c06f0da8>] (parse_mtd_partitions) from [<c06ede68>] (mtd_device_parse_register+0x40/0x164)
> [   11.341560] [<c06ede68>] (mtd_device_parse_register) from [<c070654c>] (m25p_probe+0x118/0x200)
> [   11.350513] [<c070654c>] (m25p_probe) from [<c073863c>] (spi_drv_probe+0x80/0xa4)
> 
> While it's easy to rename the partitions I see no reason why it should
> be illegal to have two different (mtd) devices with eqeally named
> partitions. Are there any suggestions how to register the nvmem devices
> with a different name?

Note that some MTD users are expecting MTD names to be unique to work
properly, the example I have in mind is UBI that can be passed the
partition to attach to using the ubi:<part-name> format, but I'm pretty
sure we have other places making the same assumption. I guess not
enforcing mtd->name uniqueness was a bad idea, but I'm not sure we can
change that now.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux