All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mtd: core: Remove partid and partname debugfs files
@ 2021-12-17 12:26 ` Tudor Ambarus
  0 siblings, 0 replies; 18+ messages in thread
From: Tudor Ambarus @ 2021-12-17 12:26 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, zhuohao, p.yadav, michael
  Cc: linux-mtd, linux-kernel, Tudor Ambarus

SPI NOR has equivalent sysfs device attributes, thus let's remove the
duplicated debugfs entries. There's no one else using partid and partname
debugfs files, thus remove them from the mtd core as well.

If you find the idea acceptable, I would like to queue these through
spi-nor/next, I'll have some other patches that will depend on these.

Tudor Ambarus (2):
  mtd: spi-nor: Remove debugfs entries that duplicate sysfs entries
  mtd: core: Remove partid and partname debugfs files

 drivers/mtd/mtdcore.c      | 35 +----------------------------------
 drivers/mtd/spi-nor/core.c | 12 ------------
 include/linux/mtd/mtd.h    |  3 ---
 3 files changed, 1 insertion(+), 49 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 0/2] mtd: core: Remove partid and partname debugfs files
@ 2021-12-17 12:26 ` Tudor Ambarus
  0 siblings, 0 replies; 18+ messages in thread
From: Tudor Ambarus @ 2021-12-17 12:26 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, zhuohao, p.yadav, michael
  Cc: linux-mtd, linux-kernel, Tudor Ambarus

SPI NOR has equivalent sysfs device attributes, thus let's remove the
duplicated debugfs entries. There's no one else using partid and partname
debugfs files, thus remove them from the mtd core as well.

If you find the idea acceptable, I would like to queue these through
spi-nor/next, I'll have some other patches that will depend on these.

Tudor Ambarus (2):
  mtd: spi-nor: Remove debugfs entries that duplicate sysfs entries
  mtd: core: Remove partid and partname debugfs files

 drivers/mtd/mtdcore.c      | 35 +----------------------------------
 drivers/mtd/spi-nor/core.c | 12 ------------
 include/linux/mtd/mtd.h    |  3 ---
 3 files changed, 1 insertion(+), 49 deletions(-)

-- 
2.25.1


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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/2] mtd: spi-nor: Remove debugfs entries that duplicate sysfs entries
  2021-12-17 12:26 ` Tudor Ambarus
@ 2021-12-17 12:26   ` Tudor Ambarus
  -1 siblings, 0 replies; 18+ messages in thread
From: Tudor Ambarus @ 2021-12-17 12:26 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, zhuohao, p.yadav, michael
  Cc: linux-mtd, linux-kernel, Tudor Ambarus

SPI NOR sysfs defines partname and jedec_id device attributes, which
duplicate the information from debugfs. Since the sysfs directory
structure and the attributes in each directory define an ABI between the
kernel and user space, thus it can never be removed, remove the debugfs
entries so that we don't duplicate the information.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/mtd/spi-nor/core.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 2e21d5ac0e2d..435bd17af0b4 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3126,16 +3126,6 @@ static const struct flash_info *spi_nor_match_id(struct spi_nor *nor,
 	return NULL;
 }
 
-static void spi_nor_debugfs_init(struct spi_nor *nor,
-				 const struct flash_info *info)
-{
-	struct mtd_info *mtd = &nor->mtd;
-
-	mtd->dbg.partname = info->name;
-	mtd->dbg.partid = devm_kasprintf(nor->dev, GFP_KERNEL, "spi-nor:%*phN",
-					 info->id_len, info->id);
-}
-
 static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor,
 						       const char *name)
 {
@@ -3243,8 +3233,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,
 
 	nor->info = info;
 
-	spi_nor_debugfs_init(nor, info);
-
 	mutex_init(&nor->lock);
 
 	/* Init flash parameters based on flash_info struct and SFDP */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 1/2] mtd: spi-nor: Remove debugfs entries that duplicate sysfs entries
@ 2021-12-17 12:26   ` Tudor Ambarus
  0 siblings, 0 replies; 18+ messages in thread
From: Tudor Ambarus @ 2021-12-17 12:26 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, zhuohao, p.yadav, michael
  Cc: linux-mtd, linux-kernel, Tudor Ambarus

SPI NOR sysfs defines partname and jedec_id device attributes, which
duplicate the information from debugfs. Since the sysfs directory
structure and the attributes in each directory define an ABI between the
kernel and user space, thus it can never be removed, remove the debugfs
entries so that we don't duplicate the information.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/mtd/spi-nor/core.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 2e21d5ac0e2d..435bd17af0b4 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3126,16 +3126,6 @@ static const struct flash_info *spi_nor_match_id(struct spi_nor *nor,
 	return NULL;
 }
 
-static void spi_nor_debugfs_init(struct spi_nor *nor,
-				 const struct flash_info *info)
-{
-	struct mtd_info *mtd = &nor->mtd;
-
-	mtd->dbg.partname = info->name;
-	mtd->dbg.partid = devm_kasprintf(nor->dev, GFP_KERNEL, "spi-nor:%*phN",
-					 info->id_len, info->id);
-}
-
 static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor,
 						       const char *name)
 {
@@ -3243,8 +3233,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,
 
 	nor->info = info;
 
-	spi_nor_debugfs_init(nor, info);
-
 	mutex_init(&nor->lock);
 
 	/* Init flash parameters based on flash_info struct and SFDP */
-- 
2.25.1


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/2] mtd: core: Remove partid and partname debugfs files
  2021-12-17 12:26 ` Tudor Ambarus
@ 2021-12-17 12:26   ` Tudor Ambarus
  -1 siblings, 0 replies; 18+ messages in thread
From: Tudor Ambarus @ 2021-12-17 12:26 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, zhuohao, p.yadav, michael
  Cc: linux-mtd, linux-kernel, Tudor Ambarus

partid and partname debugfs file are no longer used in mtd, remove
dead code.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/mtd/mtdcore.c   | 35 +----------------------------------
 include/linux/mtd/mtd.h |  3 ---
 2 files changed, 1 insertion(+), 37 deletions(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 9186268d361b..1977755fc955 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -336,49 +336,16 @@ static const struct device_type mtd_devtype = {
 	.release	= mtd_release,
 };
 
-static int mtd_partid_debug_show(struct seq_file *s, void *p)
-{
-	struct mtd_info *mtd = s->private;
-
-	seq_printf(s, "%s\n", mtd->dbg.partid);
-
-	return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(mtd_partid_debug);
-
-static int mtd_partname_debug_show(struct seq_file *s, void *p)
-{
-	struct mtd_info *mtd = s->private;
-
-	seq_printf(s, "%s\n", mtd->dbg.partname);
-
-	return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(mtd_partname_debug);
-
 static struct dentry *dfs_dir_mtd;
 
 static void mtd_debugfs_populate(struct mtd_info *mtd)
 {
-	struct mtd_info *master = mtd_get_master(mtd);
 	struct device *dev = &mtd->dev;
-	struct dentry *root;
 
 	if (IS_ERR_OR_NULL(dfs_dir_mtd))
 		return;
 
-	root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
-	mtd->dbg.dfs_dir = root;
-
-	if (master->dbg.partid)
-		debugfs_create_file("partid", 0400, root, master,
-				    &mtd_partid_debug_fops);
-
-	if (master->dbg.partname)
-		debugfs_create_file("partname", 0400, root, master,
-				    &mtd_partname_debug_fops);
+	mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
 }
 
 #ifndef CONFIG_MMU
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index f5e7dfc2e4e9..00cb269d0261 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -188,9 +188,6 @@ struct module;	/* only needed for owner field in mtd_info */
  */
 struct mtd_debug_info {
 	struct dentry *dfs_dir;
-
-	const char *partname;
-	const char *partid;
 };
 
 /**
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/2] mtd: core: Remove partid and partname debugfs files
@ 2021-12-17 12:26   ` Tudor Ambarus
  0 siblings, 0 replies; 18+ messages in thread
From: Tudor Ambarus @ 2021-12-17 12:26 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, zhuohao, p.yadav, michael
  Cc: linux-mtd, linux-kernel, Tudor Ambarus

partid and partname debugfs file are no longer used in mtd, remove
dead code.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/mtd/mtdcore.c   | 35 +----------------------------------
 include/linux/mtd/mtd.h |  3 ---
 2 files changed, 1 insertion(+), 37 deletions(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 9186268d361b..1977755fc955 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -336,49 +336,16 @@ static const struct device_type mtd_devtype = {
 	.release	= mtd_release,
 };
 
-static int mtd_partid_debug_show(struct seq_file *s, void *p)
-{
-	struct mtd_info *mtd = s->private;
-
-	seq_printf(s, "%s\n", mtd->dbg.partid);
-
-	return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(mtd_partid_debug);
-
-static int mtd_partname_debug_show(struct seq_file *s, void *p)
-{
-	struct mtd_info *mtd = s->private;
-
-	seq_printf(s, "%s\n", mtd->dbg.partname);
-
-	return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(mtd_partname_debug);
-
 static struct dentry *dfs_dir_mtd;
 
 static void mtd_debugfs_populate(struct mtd_info *mtd)
 {
-	struct mtd_info *master = mtd_get_master(mtd);
 	struct device *dev = &mtd->dev;
-	struct dentry *root;
 
 	if (IS_ERR_OR_NULL(dfs_dir_mtd))
 		return;
 
-	root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
-	mtd->dbg.dfs_dir = root;
-
-	if (master->dbg.partid)
-		debugfs_create_file("partid", 0400, root, master,
-				    &mtd_partid_debug_fops);
-
-	if (master->dbg.partname)
-		debugfs_create_file("partname", 0400, root, master,
-				    &mtd_partname_debug_fops);
+	mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
 }
 
 #ifndef CONFIG_MMU
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index f5e7dfc2e4e9..00cb269d0261 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -188,9 +188,6 @@ struct module;	/* only needed for owner field in mtd_info */
  */
 struct mtd_debug_info {
 	struct dentry *dfs_dir;
-
-	const char *partname;
-	const char *partid;
 };
 
 /**
-- 
2.25.1


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/2] mtd: spi-nor: Remove debugfs entries that duplicate sysfs entries
  2021-12-17 12:26   ` Tudor Ambarus
@ 2021-12-20 12:59     ` Pratyush Yadav
  -1 siblings, 0 replies; 18+ messages in thread
From: Pratyush Yadav @ 2021-12-20 12:59 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: miquel.raynal, richard, vigneshr, zhuohao, michael, linux-mtd,
	linux-kernel

On 17/12/21 02:26PM, Tudor Ambarus wrote:
> SPI NOR sysfs defines partname and jedec_id device attributes, which
> duplicate the information from debugfs. Since the sysfs directory
> structure and the attributes in each directory define an ABI between the
> kernel and user space, thus it can never be removed, remove the debugfs
> entries so that we don't duplicate the information.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

Reviewed-by: Pratyush Yadav <p.yadav@ti.com>

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/2] mtd: spi-nor: Remove debugfs entries that duplicate sysfs entries
@ 2021-12-20 12:59     ` Pratyush Yadav
  0 siblings, 0 replies; 18+ messages in thread
From: Pratyush Yadav @ 2021-12-20 12:59 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: miquel.raynal, richard, vigneshr, zhuohao, michael, linux-mtd,
	linux-kernel

On 17/12/21 02:26PM, Tudor Ambarus wrote:
> SPI NOR sysfs defines partname and jedec_id device attributes, which
> duplicate the information from debugfs. Since the sysfs directory
> structure and the attributes in each directory define an ABI between the
> kernel and user space, thus it can never be removed, remove the debugfs
> entries so that we don't duplicate the information.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

Reviewed-by: Pratyush Yadav <p.yadav@ti.com>

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/2] mtd: core: Remove partid and partname debugfs files
  2021-12-17 12:26 ` Tudor Ambarus
@ 2021-12-20 13:05   ` Michael Walle
  -1 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2021-12-20 13:05 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: miquel.raynal, richard, vigneshr, zhuohao, p.yadav, linux-mtd,
	linux-kernel

Am 2021-12-17 13:26, schrieb Tudor Ambarus:
> SPI NOR has equivalent sysfs device attributes, thus let's remove the
> duplicated debugfs entries. There's no one else using partid and 
> partname
> debugfs files, thus remove them from the mtd core as well.
> 
> If you find the idea acceptable, I would like to queue these through
> spi-nor/next, I'll have some other patches that will depend on these.

I'm fine with it.

-michael

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/2] mtd: core: Remove partid and partname debugfs files
@ 2021-12-20 13:05   ` Michael Walle
  0 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2021-12-20 13:05 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: miquel.raynal, richard, vigneshr, zhuohao, p.yadav, linux-mtd,
	linux-kernel

Am 2021-12-17 13:26, schrieb Tudor Ambarus:
> SPI NOR has equivalent sysfs device attributes, thus let's remove the
> duplicated debugfs entries. There's no one else using partid and 
> partname
> debugfs files, thus remove them from the mtd core as well.
> 
> If you find the idea acceptable, I would like to queue these through
> spi-nor/next, I'll have some other patches that will depend on these.

I'm fine with it.

-michael

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] mtd: core: Remove partid and partname debugfs files
  2021-12-17 12:26   ` Tudor Ambarus
@ 2021-12-20 13:07     ` Pratyush Yadav
  -1 siblings, 0 replies; 18+ messages in thread
From: Pratyush Yadav @ 2021-12-20 13:07 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: miquel.raynal, richard, vigneshr, zhuohao, michael, linux-mtd,
	linux-kernel

On 17/12/21 02:26PM, Tudor Ambarus wrote:
> partid and partname debugfs file are no longer used in mtd, remove
> dead code.

Hmm, spi-nor was the only user? Quick grepping does confirm that.

> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
>  drivers/mtd/mtdcore.c   | 35 +----------------------------------
>  include/linux/mtd/mtd.h |  3 ---
>  2 files changed, 1 insertion(+), 37 deletions(-)
> 
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 9186268d361b..1977755fc955 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -336,49 +336,16 @@ static const struct device_type mtd_devtype = {
>  	.release	= mtd_release,
>  };
>  
> -static int mtd_partid_debug_show(struct seq_file *s, void *p)
> -{
> -	struct mtd_info *mtd = s->private;
> -
> -	seq_printf(s, "%s\n", mtd->dbg.partid);
> -
> -	return 0;
> -}
> -
> -DEFINE_SHOW_ATTRIBUTE(mtd_partid_debug);
> -
> -static int mtd_partname_debug_show(struct seq_file *s, void *p)
> -{
> -	struct mtd_info *mtd = s->private;
> -
> -	seq_printf(s, "%s\n", mtd->dbg.partname);
> -
> -	return 0;
> -}
> -
> -DEFINE_SHOW_ATTRIBUTE(mtd_partname_debug);
> -
>  static struct dentry *dfs_dir_mtd;
>  
>  static void mtd_debugfs_populate(struct mtd_info *mtd)
>  {
> -	struct mtd_info *master = mtd_get_master(mtd);
>  	struct device *dev = &mtd->dev;
> -	struct dentry *root;
>  
>  	if (IS_ERR_OR_NULL(dfs_dir_mtd))
>  		return;
>  
> -	root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
> -	mtd->dbg.dfs_dir = root;
> -
> -	if (master->dbg.partid)
> -		debugfs_create_file("partid", 0400, root, master,
> -				    &mtd_partid_debug_fops);
> -
> -	if (master->dbg.partname)
> -		debugfs_create_file("partname", 0400, root, master,
> -				    &mtd_partname_debug_fops);
> +	mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);

What is the point of having creating the directory if there is not going 
to be anything in it at all? I think we should drop the entire thing if 
there is no intention of using it.

>  }
>  
>  #ifndef CONFIG_MMU
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index f5e7dfc2e4e9..00cb269d0261 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -188,9 +188,6 @@ struct module;	/* only needed for owner field in mtd_info */
>   */
>  struct mtd_debug_info {
>  	struct dentry *dfs_dir;
> -
> -	const char *partname;
> -	const char *partid;
>  };
>  
>  /**
> -- 
> 2.25.1
> 

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] mtd: core: Remove partid and partname debugfs files
@ 2021-12-20 13:07     ` Pratyush Yadav
  0 siblings, 0 replies; 18+ messages in thread
From: Pratyush Yadav @ 2021-12-20 13:07 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: miquel.raynal, richard, vigneshr, zhuohao, michael, linux-mtd,
	linux-kernel

On 17/12/21 02:26PM, Tudor Ambarus wrote:
> partid and partname debugfs file are no longer used in mtd, remove
> dead code.

Hmm, spi-nor was the only user? Quick grepping does confirm that.

> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
>  drivers/mtd/mtdcore.c   | 35 +----------------------------------
>  include/linux/mtd/mtd.h |  3 ---
>  2 files changed, 1 insertion(+), 37 deletions(-)
> 
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 9186268d361b..1977755fc955 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -336,49 +336,16 @@ static const struct device_type mtd_devtype = {
>  	.release	= mtd_release,
>  };
>  
> -static int mtd_partid_debug_show(struct seq_file *s, void *p)
> -{
> -	struct mtd_info *mtd = s->private;
> -
> -	seq_printf(s, "%s\n", mtd->dbg.partid);
> -
> -	return 0;
> -}
> -
> -DEFINE_SHOW_ATTRIBUTE(mtd_partid_debug);
> -
> -static int mtd_partname_debug_show(struct seq_file *s, void *p)
> -{
> -	struct mtd_info *mtd = s->private;
> -
> -	seq_printf(s, "%s\n", mtd->dbg.partname);
> -
> -	return 0;
> -}
> -
> -DEFINE_SHOW_ATTRIBUTE(mtd_partname_debug);
> -
>  static struct dentry *dfs_dir_mtd;
>  
>  static void mtd_debugfs_populate(struct mtd_info *mtd)
>  {
> -	struct mtd_info *master = mtd_get_master(mtd);
>  	struct device *dev = &mtd->dev;
> -	struct dentry *root;
>  
>  	if (IS_ERR_OR_NULL(dfs_dir_mtd))
>  		return;
>  
> -	root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
> -	mtd->dbg.dfs_dir = root;
> -
> -	if (master->dbg.partid)
> -		debugfs_create_file("partid", 0400, root, master,
> -				    &mtd_partid_debug_fops);
> -
> -	if (master->dbg.partname)
> -		debugfs_create_file("partname", 0400, root, master,
> -				    &mtd_partname_debug_fops);
> +	mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);

What is the point of having creating the directory if there is not going 
to be anything in it at all? I think we should drop the entire thing if 
there is no intention of using it.

>  }
>  
>  #ifndef CONFIG_MMU
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index f5e7dfc2e4e9..00cb269d0261 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -188,9 +188,6 @@ struct module;	/* only needed for owner field in mtd_info */
>   */
>  struct mtd_debug_info {
>  	struct dentry *dfs_dir;
> -
> -	const char *partname;
> -	const char *partid;
>  };
>  
>  /**
> -- 
> 2.25.1
> 

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] mtd: core: Remove partid and partname debugfs files
  2021-12-20 13:07     ` Pratyush Yadav
@ 2021-12-20 13:23       ` Tudor.Ambarus
  -1 siblings, 0 replies; 18+ messages in thread
From: Tudor.Ambarus @ 2021-12-20 13:23 UTC (permalink / raw)
  To: p.yadav
  Cc: miquel.raynal, richard, vigneshr, zhuohao, michael, linux-mtd,
	linux-kernel

On 12/20/21 3:07 PM, Pratyush Yadav wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 17/12/21 02:26PM, Tudor Ambarus wrote:
>> partid and partname debugfs file are no longer used in mtd, remove

s/file/files

>> dead code.
> 
> Hmm, spi-nor was the only user? Quick grepping does confirm that.

Yes.

> 
>>
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>> ---
>>  drivers/mtd/mtdcore.c   | 35 +----------------------------------
>>  include/linux/mtd/mtd.h |  3 ---
>>  2 files changed, 1 insertion(+), 37 deletions(-)
>>
>> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
>> index 9186268d361b..1977755fc955 100644
>> --- a/drivers/mtd/mtdcore.c
>> +++ b/drivers/mtd/mtdcore.c
>> @@ -336,49 +336,16 @@ static const struct device_type mtd_devtype = {
>>       .release        = mtd_release,
>>  };
>>
>> -static int mtd_partid_debug_show(struct seq_file *s, void *p)
>> -{
>> -     struct mtd_info *mtd = s->private;
>> -
>> -     seq_printf(s, "%s\n", mtd->dbg.partid);
>> -
>> -     return 0;
>> -}
>> -
>> -DEFINE_SHOW_ATTRIBUTE(mtd_partid_debug);
>> -
>> -static int mtd_partname_debug_show(struct seq_file *s, void *p)
>> -{
>> -     struct mtd_info *mtd = s->private;
>> -
>> -     seq_printf(s, "%s\n", mtd->dbg.partname);
>> -
>> -     return 0;
>> -}
>> -
>> -DEFINE_SHOW_ATTRIBUTE(mtd_partname_debug);
>> -
>>  static struct dentry *dfs_dir_mtd;
>>
>>  static void mtd_debugfs_populate(struct mtd_info *mtd)
>>  {
>> -     struct mtd_info *master = mtd_get_master(mtd);
>>       struct device *dev = &mtd->dev;
>> -     struct dentry *root;
>>
>>       if (IS_ERR_OR_NULL(dfs_dir_mtd))
>>               return;
>>
>> -     root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
>> -     mtd->dbg.dfs_dir = root;
>> -
>> -     if (master->dbg.partid)
>> -             debugfs_create_file("partid", 0400, root, master,
>> -                                 &mtd_partid_debug_fops);
>> -
>> -     if (master->dbg.partname)
>> -             debugfs_create_file("partname", 0400, root, master,
>> -                                 &mtd_partname_debug_fops);
>> +     mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
> 
> What is the point of having creating the directory if there is not going
> to be anything in it at all? I think we should drop the entire thing if
There will be files in it: mtdswap_stats, nandsim_wear_report, docg3 files.

$ git grep dbg.dfs_dir drivers/mtd/
drivers/mtd/devices/docg3.c:    struct dentry *root = floor->dbg.dfs_dir;
drivers/mtd/mtdcore.c:  mtd->dbg.dfs_dir = root;
drivers/mtd/mtdcore.c:          debugfs_remove_recursive(mtd->dbg.dfs_dir);
drivers/mtd/mtdswap.c:  struct dentry *root = d->mtd->dbg.dfs_dir;
drivers/mtd/nand/raw/nandsim.c: struct dentry *root = nsmtd->dbg.dfs_dir;
drivers/mtd/ubi/debug.c:                debugfs_remove_recursive(ubi->dbg.dfs_dir);

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] mtd: core: Remove partid and partname debugfs files
@ 2021-12-20 13:23       ` Tudor.Ambarus
  0 siblings, 0 replies; 18+ messages in thread
From: Tudor.Ambarus @ 2021-12-20 13:23 UTC (permalink / raw)
  To: p.yadav
  Cc: miquel.raynal, richard, vigneshr, zhuohao, michael, linux-mtd,
	linux-kernel

On 12/20/21 3:07 PM, Pratyush Yadav wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 17/12/21 02:26PM, Tudor Ambarus wrote:
>> partid and partname debugfs file are no longer used in mtd, remove

s/file/files

>> dead code.
> 
> Hmm, spi-nor was the only user? Quick grepping does confirm that.

Yes.

> 
>>
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>> ---
>>  drivers/mtd/mtdcore.c   | 35 +----------------------------------
>>  include/linux/mtd/mtd.h |  3 ---
>>  2 files changed, 1 insertion(+), 37 deletions(-)
>>
>> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
>> index 9186268d361b..1977755fc955 100644
>> --- a/drivers/mtd/mtdcore.c
>> +++ b/drivers/mtd/mtdcore.c
>> @@ -336,49 +336,16 @@ static const struct device_type mtd_devtype = {
>>       .release        = mtd_release,
>>  };
>>
>> -static int mtd_partid_debug_show(struct seq_file *s, void *p)
>> -{
>> -     struct mtd_info *mtd = s->private;
>> -
>> -     seq_printf(s, "%s\n", mtd->dbg.partid);
>> -
>> -     return 0;
>> -}
>> -
>> -DEFINE_SHOW_ATTRIBUTE(mtd_partid_debug);
>> -
>> -static int mtd_partname_debug_show(struct seq_file *s, void *p)
>> -{
>> -     struct mtd_info *mtd = s->private;
>> -
>> -     seq_printf(s, "%s\n", mtd->dbg.partname);
>> -
>> -     return 0;
>> -}
>> -
>> -DEFINE_SHOW_ATTRIBUTE(mtd_partname_debug);
>> -
>>  static struct dentry *dfs_dir_mtd;
>>
>>  static void mtd_debugfs_populate(struct mtd_info *mtd)
>>  {
>> -     struct mtd_info *master = mtd_get_master(mtd);
>>       struct device *dev = &mtd->dev;
>> -     struct dentry *root;
>>
>>       if (IS_ERR_OR_NULL(dfs_dir_mtd))
>>               return;
>>
>> -     root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
>> -     mtd->dbg.dfs_dir = root;
>> -
>> -     if (master->dbg.partid)
>> -             debugfs_create_file("partid", 0400, root, master,
>> -                                 &mtd_partid_debug_fops);
>> -
>> -     if (master->dbg.partname)
>> -             debugfs_create_file("partname", 0400, root, master,
>> -                                 &mtd_partname_debug_fops);
>> +     mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
> 
> What is the point of having creating the directory if there is not going
> to be anything in it at all? I think we should drop the entire thing if
There will be files in it: mtdswap_stats, nandsim_wear_report, docg3 files.

$ git grep dbg.dfs_dir drivers/mtd/
drivers/mtd/devices/docg3.c:    struct dentry *root = floor->dbg.dfs_dir;
drivers/mtd/mtdcore.c:  mtd->dbg.dfs_dir = root;
drivers/mtd/mtdcore.c:          debugfs_remove_recursive(mtd->dbg.dfs_dir);
drivers/mtd/mtdswap.c:  struct dentry *root = d->mtd->dbg.dfs_dir;
drivers/mtd/nand/raw/nandsim.c: struct dentry *root = nsmtd->dbg.dfs_dir;
drivers/mtd/ubi/debug.c:                debugfs_remove_recursive(ubi->dbg.dfs_dir);
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] mtd: core: Remove partid and partname debugfs files
  2021-12-20 13:23       ` Tudor.Ambarus
@ 2021-12-20 19:05         ` Pratyush Yadav
  -1 siblings, 0 replies; 18+ messages in thread
From: Pratyush Yadav @ 2021-12-20 19:05 UTC (permalink / raw)
  To: Tudor.Ambarus
  Cc: miquel.raynal, richard, vigneshr, zhuohao, michael, linux-mtd,
	linux-kernel

On 20/12/21 01:23PM, Tudor.Ambarus@microchip.com wrote:
> On 12/20/21 3:07 PM, Pratyush Yadav wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > On 17/12/21 02:26PM, Tudor Ambarus wrote:
> >> partid and partname debugfs file are no longer used in mtd, remove
> 
> s/file/files
> 
> >> dead code.
> > 
> > Hmm, spi-nor was the only user? Quick grepping does confirm that.
> 
> Yes.
> 
> > 
> >>
> >> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> >> ---
> >>  drivers/mtd/mtdcore.c   | 35 +----------------------------------
> >>  include/linux/mtd/mtd.h |  3 ---
> >>  2 files changed, 1 insertion(+), 37 deletions(-)
> >>
> >> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> >> index 9186268d361b..1977755fc955 100644
> >> --- a/drivers/mtd/mtdcore.c
> >> +++ b/drivers/mtd/mtdcore.c
> >> @@ -336,49 +336,16 @@ static const struct device_type mtd_devtype = {
> >>       .release        = mtd_release,
> >>  };
> >>
> >> -static int mtd_partid_debug_show(struct seq_file *s, void *p)
> >> -{
> >> -     struct mtd_info *mtd = s->private;
> >> -
> >> -     seq_printf(s, "%s\n", mtd->dbg.partid);
> >> -
> >> -     return 0;
> >> -}
> >> -
> >> -DEFINE_SHOW_ATTRIBUTE(mtd_partid_debug);
> >> -
> >> -static int mtd_partname_debug_show(struct seq_file *s, void *p)
> >> -{
> >> -     struct mtd_info *mtd = s->private;
> >> -
> >> -     seq_printf(s, "%s\n", mtd->dbg.partname);
> >> -
> >> -     return 0;
> >> -}
> >> -
> >> -DEFINE_SHOW_ATTRIBUTE(mtd_partname_debug);
> >> -
> >>  static struct dentry *dfs_dir_mtd;
> >>
> >>  static void mtd_debugfs_populate(struct mtd_info *mtd)
> >>  {
> >> -     struct mtd_info *master = mtd_get_master(mtd);
> >>       struct device *dev = &mtd->dev;
> >> -     struct dentry *root;
> >>
> >>       if (IS_ERR_OR_NULL(dfs_dir_mtd))
> >>               return;
> >>
> >> -     root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
> >> -     mtd->dbg.dfs_dir = root;
> >> -
> >> -     if (master->dbg.partid)
> >> -             debugfs_create_file("partid", 0400, root, master,
> >> -                                 &mtd_partid_debug_fops);
> >> -
> >> -     if (master->dbg.partname)
> >> -             debugfs_create_file("partname", 0400, root, master,
> >> -                                 &mtd_partname_debug_fops);
> >> +     mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
> > 
> > What is the point of having creating the directory if there is not going
> > to be anything in it at all? I think we should drop the entire thing if
> There will be files in it: mtdswap_stats, nandsim_wear_report, docg3 files.
> 
> $ git grep dbg.dfs_dir drivers/mtd/
> drivers/mtd/devices/docg3.c:    struct dentry *root = floor->dbg.dfs_dir;
> drivers/mtd/mtdcore.c:  mtd->dbg.dfs_dir = root;
> drivers/mtd/mtdcore.c:          debugfs_remove_recursive(mtd->dbg.dfs_dir);
> drivers/mtd/mtdswap.c:  struct dentry *root = d->mtd->dbg.dfs_dir;
> drivers/mtd/nand/raw/nandsim.c: struct dentry *root = nsmtd->dbg.dfs_dir;
> drivers/mtd/ubi/debug.c:                debugfs_remove_recursive(ubi->dbg.dfs_dir);

Ok, I didn't see that. In that case,

Reviewed-by: Pratyush Yadav <p.yadav@ti.com>

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] mtd: core: Remove partid and partname debugfs files
@ 2021-12-20 19:05         ` Pratyush Yadav
  0 siblings, 0 replies; 18+ messages in thread
From: Pratyush Yadav @ 2021-12-20 19:05 UTC (permalink / raw)
  To: Tudor.Ambarus
  Cc: miquel.raynal, richard, vigneshr, zhuohao, michael, linux-mtd,
	linux-kernel

On 20/12/21 01:23PM, Tudor.Ambarus@microchip.com wrote:
> On 12/20/21 3:07 PM, Pratyush Yadav wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > On 17/12/21 02:26PM, Tudor Ambarus wrote:
> >> partid and partname debugfs file are no longer used in mtd, remove
> 
> s/file/files
> 
> >> dead code.
> > 
> > Hmm, spi-nor was the only user? Quick grepping does confirm that.
> 
> Yes.
> 
> > 
> >>
> >> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> >> ---
> >>  drivers/mtd/mtdcore.c   | 35 +----------------------------------
> >>  include/linux/mtd/mtd.h |  3 ---
> >>  2 files changed, 1 insertion(+), 37 deletions(-)
> >>
> >> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> >> index 9186268d361b..1977755fc955 100644
> >> --- a/drivers/mtd/mtdcore.c
> >> +++ b/drivers/mtd/mtdcore.c
> >> @@ -336,49 +336,16 @@ static const struct device_type mtd_devtype = {
> >>       .release        = mtd_release,
> >>  };
> >>
> >> -static int mtd_partid_debug_show(struct seq_file *s, void *p)
> >> -{
> >> -     struct mtd_info *mtd = s->private;
> >> -
> >> -     seq_printf(s, "%s\n", mtd->dbg.partid);
> >> -
> >> -     return 0;
> >> -}
> >> -
> >> -DEFINE_SHOW_ATTRIBUTE(mtd_partid_debug);
> >> -
> >> -static int mtd_partname_debug_show(struct seq_file *s, void *p)
> >> -{
> >> -     struct mtd_info *mtd = s->private;
> >> -
> >> -     seq_printf(s, "%s\n", mtd->dbg.partname);
> >> -
> >> -     return 0;
> >> -}
> >> -
> >> -DEFINE_SHOW_ATTRIBUTE(mtd_partname_debug);
> >> -
> >>  static struct dentry *dfs_dir_mtd;
> >>
> >>  static void mtd_debugfs_populate(struct mtd_info *mtd)
> >>  {
> >> -     struct mtd_info *master = mtd_get_master(mtd);
> >>       struct device *dev = &mtd->dev;
> >> -     struct dentry *root;
> >>
> >>       if (IS_ERR_OR_NULL(dfs_dir_mtd))
> >>               return;
> >>
> >> -     root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
> >> -     mtd->dbg.dfs_dir = root;
> >> -
> >> -     if (master->dbg.partid)
> >> -             debugfs_create_file("partid", 0400, root, master,
> >> -                                 &mtd_partid_debug_fops);
> >> -
> >> -     if (master->dbg.partname)
> >> -             debugfs_create_file("partname", 0400, root, master,
> >> -                                 &mtd_partname_debug_fops);
> >> +     mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(dev), dfs_dir_mtd);
> > 
> > What is the point of having creating the directory if there is not going
> > to be anything in it at all? I think we should drop the entire thing if
> There will be files in it: mtdswap_stats, nandsim_wear_report, docg3 files.
> 
> $ git grep dbg.dfs_dir drivers/mtd/
> drivers/mtd/devices/docg3.c:    struct dentry *root = floor->dbg.dfs_dir;
> drivers/mtd/mtdcore.c:  mtd->dbg.dfs_dir = root;
> drivers/mtd/mtdcore.c:          debugfs_remove_recursive(mtd->dbg.dfs_dir);
> drivers/mtd/mtdswap.c:  struct dentry *root = d->mtd->dbg.dfs_dir;
> drivers/mtd/nand/raw/nandsim.c: struct dentry *root = nsmtd->dbg.dfs_dir;
> drivers/mtd/ubi/debug.c:                debugfs_remove_recursive(ubi->dbg.dfs_dir);

Ok, I didn't see that. In that case,

Reviewed-by: Pratyush Yadav <p.yadav@ti.com>

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: (subset) [PATCH 0/2] mtd: core: Remove partid and partname debugfs files
  2021-12-17 12:26 ` Tudor Ambarus
@ 2021-12-29  8:27   ` Tudor Ambarus
  -1 siblings, 0 replies; 18+ messages in thread
From: Tudor Ambarus @ 2021-12-29  8:27 UTC (permalink / raw)
  To: Tudor Ambarus, zhuohao, richard, miquel.raynal, p.yadav,
	vigneshr, michael
  Cc: linux-mtd, linux-kernel

On Fri, 17 Dec 2021 14:26:34 +0200, Tudor Ambarus wrote:
> SPI NOR has equivalent sysfs device attributes, thus let's remove the
> duplicated debugfs entries. There's no one else using partid and partname
> debugfs files, thus remove them from the mtd core as well.
> 
> If you find the idea acceptable, I would like to queue these through
> spi-nor/next, I'll have some other patches that will depend on these.
> 
> [...]

Applied to spi-nor/next, thanks!

[1/2] mtd: spi-nor: Remove debugfs entries that duplicate sysfs entries
      https://git.kernel.org/mtd/c/5f340402bbfc

Best regards,
-- 
Tudor Ambarus <tudor.ambarus@microchip.com>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: (subset) [PATCH 0/2] mtd: core: Remove partid and partname debugfs files
@ 2021-12-29  8:27   ` Tudor Ambarus
  0 siblings, 0 replies; 18+ messages in thread
From: Tudor Ambarus @ 2021-12-29  8:27 UTC (permalink / raw)
  To: Tudor Ambarus, zhuohao, richard, miquel.raynal, p.yadav,
	vigneshr, michael
  Cc: linux-mtd, linux-kernel

On Fri, 17 Dec 2021 14:26:34 +0200, Tudor Ambarus wrote:
> SPI NOR has equivalent sysfs device attributes, thus let's remove the
> duplicated debugfs entries. There's no one else using partid and partname
> debugfs files, thus remove them from the mtd core as well.
> 
> If you find the idea acceptable, I would like to queue these through
> spi-nor/next, I'll have some other patches that will depend on these.
> 
> [...]

Applied to spi-nor/next, thanks!

[1/2] mtd: spi-nor: Remove debugfs entries that duplicate sysfs entries
      https://git.kernel.org/mtd/c/5f340402bbfc

Best regards,
-- 
Tudor Ambarus <tudor.ambarus@microchip.com>

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-12-29  8:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 12:26 [PATCH 0/2] mtd: core: Remove partid and partname debugfs files Tudor Ambarus
2021-12-17 12:26 ` Tudor Ambarus
2021-12-17 12:26 ` [PATCH 1/2] mtd: spi-nor: Remove debugfs entries that duplicate sysfs entries Tudor Ambarus
2021-12-17 12:26   ` Tudor Ambarus
2021-12-20 12:59   ` Pratyush Yadav
2021-12-20 12:59     ` Pratyush Yadav
2021-12-17 12:26 ` [PATCH 2/2] mtd: core: Remove partid and partname debugfs files Tudor Ambarus
2021-12-17 12:26   ` Tudor Ambarus
2021-12-20 13:07   ` Pratyush Yadav
2021-12-20 13:07     ` Pratyush Yadav
2021-12-20 13:23     ` Tudor.Ambarus
2021-12-20 13:23       ` Tudor.Ambarus
2021-12-20 19:05       ` Pratyush Yadav
2021-12-20 19:05         ` Pratyush Yadav
2021-12-20 13:05 ` [PATCH 0/2] " Michael Walle
2021-12-20 13:05   ` Michael Walle
2021-12-29  8:27 ` (subset) " Tudor Ambarus
2021-12-29  8:27   ` Tudor Ambarus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.