On Tue, May 7, 2019 at 11:10 PM Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote: > > On Tue, 7 May 2019 23:06:32 +0800 > Zhuohao Lee <zhuohao@xxxxxxxxxxxx> wrote: > > > > > > > > @@ -231,8 +231,11 @@ static int m25p_probe(struct spi_mem *spimem) > > > > > > > > > > Can we add this to function that is generic to all spi-nor devices, > > > > > instead of making this specific to m25p? > > > > I can't find a better way to insert the spi_nor_debugfs_create() > > > > inside spi_nor.c. > > > > Another way is adding spi_nor_debugfs_create() to all of the caller. > > > > What do you think? Any other suggestion? > > > > > > That, or maybe create a new spi_nor_device_register that does both > > > mtd_device_register and that spi_nor_debugfs_create call? > > Thanks for suggestion. I feel that putting the mtd_device_register > > (high level api) inside the spi-nor (low level api) > > isn't perfect. This also will limit the caller to call this api to > > register mtd device with debugfs and lost the flexibility. > > I'll keep the original idea that adding spi_nor_debugfs_create() to > > all of the caller. > > Why don't you move that to the MTD layer? If you add partname/partid > fields to mtd_info you'll have everything you need to make that generic. > It's then up to the upper layer to fill those fields before calling > mtd_device_register(). > Ah... i took the wrong way. I removed the partname/partid from mtd.h. So, i can't use it inside the mtd_core.c. Instead, i created spi_nor_debugfs_create() for creating debugfs. i'll submit a patch to add back the partname/partid to mtd.h > > > > > > > > > > > > + return; > > > > > > + } > > > > > > + debugfs_create_file("flashid", S_IRUSR, root, nor, > > > > > > + &flashid_dbg_fops); > > > > > > + debugfs_create_file("flashname", S_IRUSR, root, nor, > > > > > > + &flashname_dbg_fops); > > I thought we agreed on partname/partid. Any reason for switching back > to flashname/flashid? Sorry, per reply above, i took the wrong approach. So, i used old name because i put the debugfs stuff in spi-nor.c. ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/