All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition
@ 2013-11-09 11:43 ` Caizhiyong
  0 siblings, 0 replies; 10+ messages in thread
From: Caizhiyong @ 2013-11-09 11:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Brian Norris, Wanglin (Albert),
	Artem Bityutskiy, linux-kernel, linux-mtd, Karel Zak,
	Shmulik Ladkani, Randy Dunlap, fengguang.wu

From: Cai Zhiyong <caizhiyong@huawei.com>
Date: Sat, 9 Nov 2013 17:54:12 +0800
Subject: [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition

 -Fix compile warning with value and function undeclared.
  this reported by <fengguang.wu@intel.com> and
  Randy Dunlap <rdunlap@infradead.org>

 -support master name is not set when parser partition.
  this feature is supported in the old parser.

Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>
---
 drivers/mtd/Kconfig       |  1 +
 drivers/mtd/cmdlinepart.c | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index daf544a..f8f45e0 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -76,6 +76,7 @@ endif # MTD_REDBOOT_PARTS
 config MTD_CMDLINE_PARTS
 	tristate "Command line partition table parsing"
 	select BLK_CMDLINE_PARSER
+	depends on BLOCK
 	depends on MTD
 	---help---
 	  Allow generic configuration of the MTD partition tables via the kernel
diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
index ba934a4..2074164 100644
--- a/drivers/mtd/cmdlinepart.c
+++ b/drivers/mtd/cmdlinepart.c
@@ -54,6 +54,7 @@
   */
 
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/module.h>
@@ -108,7 +109,12 @@ static int parse_cmdline_partitions(struct mtd_info *master,
 	if (!mtd_cmdline_parts)
 		return 0;
 
-	parts = cmdline_parts_find(mtd_cmdline_parts, master->name);
+	/* If master->name is not set, return the first device partition. */
+	if (!master->name)
+		parts = mtd_cmdline_parts->next_parts;
+	else
+		parts = cmdline_parts_find(mtd_cmdline_parts, master->name);
+
 	if (!parts)
 		return 0;
 
@@ -143,5 +149,5 @@ MODULE_PARM_DESC(mtdparts, "Partitioning specification");
 module_param(mtdparts, charp, 0);
 
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>");
+MODULE_AUTHOR("Cai Zhiyong <caizhiyong@huawei.com>");
 MODULE_DESCRIPTION("Command line configuration of MTD partitions");
-- 
1.8.1.5


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

* [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition
@ 2013-11-09 11:43 ` Caizhiyong
  0 siblings, 0 replies; 10+ messages in thread
From: Caizhiyong @ 2013-11-09 11:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: fengguang.wu, Brian Norris, Artem Bityutskiy, Randy Dunlap,
	linux-kernel, Karel Zak, linux-mtd, Shmulik Ladkani,
	Wanglin (Albert)

From: Cai Zhiyong <caizhiyong@huawei.com>
Date: Sat, 9 Nov 2013 17:54:12 +0800
Subject: [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition

 -Fix compile warning with value and function undeclared.
  this reported by <fengguang.wu@intel.com> and
  Randy Dunlap <rdunlap@infradead.org>

 -support master name is not set when parser partition.
  this feature is supported in the old parser.

Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>
---
 drivers/mtd/Kconfig       |  1 +
 drivers/mtd/cmdlinepart.c | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index daf544a..f8f45e0 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -76,6 +76,7 @@ endif # MTD_REDBOOT_PARTS
 config MTD_CMDLINE_PARTS
 	tristate "Command line partition table parsing"
 	select BLK_CMDLINE_PARSER
+	depends on BLOCK
 	depends on MTD
 	---help---
 	  Allow generic configuration of the MTD partition tables via the kernel
diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
index ba934a4..2074164 100644
--- a/drivers/mtd/cmdlinepart.c
+++ b/drivers/mtd/cmdlinepart.c
@@ -54,6 +54,7 @@
   */
 
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/module.h>
@@ -108,7 +109,12 @@ static int parse_cmdline_partitions(struct mtd_info *master,
 	if (!mtd_cmdline_parts)
 		return 0;
 
-	parts = cmdline_parts_find(mtd_cmdline_parts, master->name);
+	/* If master->name is not set, return the first device partition. */
+	if (!master->name)
+		parts = mtd_cmdline_parts->next_parts;
+	else
+		parts = cmdline_parts_find(mtd_cmdline_parts, master->name);
+
 	if (!parts)
 		return 0;
 
@@ -143,5 +149,5 @@ MODULE_PARM_DESC(mtdparts, "Partitioning specification");
 module_param(mtdparts, charp, 0);
 
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>");
+MODULE_AUTHOR("Cai Zhiyong <caizhiyong@huawei.com>");
 MODULE_DESCRIPTION("Command line configuration of MTD partitions");
-- 
1.8.1.5

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

* Re: [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition
  2013-11-11  3:06   ` Huang Shijie
@ 2013-11-10 18:09     ` Ezequiel Garcia
  -1 siblings, 0 replies; 10+ messages in thread
From: Ezequiel Garcia @ 2013-11-10 18:09 UTC (permalink / raw)
  To: Huang Shijie
  Cc: Caizhiyong, fengguang.wu, Artem Bityutskiy, Wanglin (Albert),
	Randy Dunlap, linux-kernel, Karel Zak, linux-mtd,
	Shmulik Ladkani, Andrew Morton, Brian Norris

On Sun, Nov 10, 2013 at 10:06:59PM -0500, Huang Shijie wrote:
> On Sat, Nov 09, 2013 at 11:43:06AM +0000, Caizhiyong wrote:
> > From: Cai Zhiyong <caizhiyong@huawei.com>
> > Date: Sat, 9 Nov 2013 17:54:12 +0800
> >  
> > @@ -143,5 +149,5 @@ MODULE_PARM_DESC(mtdparts, "Partitioning specification");
> >  module_param(mtdparts, charp, 0);
> >  
> >  MODULE_LICENSE("GPL");
> > -MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>");
> > +MODULE_AUTHOR("Cai Zhiyong <caizhiyong@huawei.com>");
> I tested this patch with several cases, it is ok.
> 

Can you summarize such cases? Or maybe better, just share them all :)
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition
@ 2013-11-10 18:09     ` Ezequiel Garcia
  0 siblings, 0 replies; 10+ messages in thread
From: Ezequiel Garcia @ 2013-11-10 18:09 UTC (permalink / raw)
  To: Huang Shijie
  Cc: Wanglin (Albert),
	Brian Norris, Artem Bityutskiy, Caizhiyong, Randy Dunlap,
	linux-kernel, Karel Zak, linux-mtd, Shmulik Ladkani,
	Andrew Morton, fengguang.wu

On Sun, Nov 10, 2013 at 10:06:59PM -0500, Huang Shijie wrote:
> On Sat, Nov 09, 2013 at 11:43:06AM +0000, Caizhiyong wrote:
> > From: Cai Zhiyong <caizhiyong@huawei.com>
> > Date: Sat, 9 Nov 2013 17:54:12 +0800
> >  
> > @@ -143,5 +149,5 @@ MODULE_PARM_DESC(mtdparts, "Partitioning specification");
> >  module_param(mtdparts, charp, 0);
> >  
> >  MODULE_LICENSE("GPL");
> > -MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>");
> > +MODULE_AUTHOR("Cai Zhiyong <caizhiyong@huawei.com>");
> I tested this patch with several cases, it is ok.
> 

Can you summarize such cases? Or maybe better, just share them all :)
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition
  2013-11-09 11:43 ` Caizhiyong
@ 2013-11-11  3:06   ` Huang Shijie
  -1 siblings, 0 replies; 10+ messages in thread
From: Huang Shijie @ 2013-11-11  3:06 UTC (permalink / raw)
  To: Caizhiyong
  Cc: Andrew Morton, fengguang.wu, Brian Norris, Artem Bityutskiy,
	Randy Dunlap, linux-kernel, Karel Zak, linux-mtd,
	Shmulik Ladkani, Wanglin (Albert)

On Sat, Nov 09, 2013 at 11:43:06AM +0000, Caizhiyong wrote:
> From: Cai Zhiyong <caizhiyong@huawei.com>
> Date: Sat, 9 Nov 2013 17:54:12 +0800
>  
> @@ -143,5 +149,5 @@ MODULE_PARM_DESC(mtdparts, "Partitioning specification");
>  module_param(mtdparts, charp, 0);
>  
>  MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>");
> +MODULE_AUTHOR("Cai Zhiyong <caizhiyong@huawei.com>");
I tested this patch with several cases, it is ok.

But is it neccessary to change the author line?

thanks
Huang Shijie

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

* Re: [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition
@ 2013-11-11  3:06   ` Huang Shijie
  0 siblings, 0 replies; 10+ messages in thread
From: Huang Shijie @ 2013-11-11  3:06 UTC (permalink / raw)
  To: Caizhiyong
  Cc: fengguang.wu, Artem Bityutskiy, Wanglin (Albert),
	Randy Dunlap, linux-kernel, Karel Zak, linux-mtd,
	Shmulik Ladkani, Andrew Morton, Brian Norris

On Sat, Nov 09, 2013 at 11:43:06AM +0000, Caizhiyong wrote:
> From: Cai Zhiyong <caizhiyong@huawei.com>
> Date: Sat, 9 Nov 2013 17:54:12 +0800
>  
> @@ -143,5 +149,5 @@ MODULE_PARM_DESC(mtdparts, "Partitioning specification");
>  module_param(mtdparts, charp, 0);
>  
>  MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>");
> +MODULE_AUTHOR("Cai Zhiyong <caizhiyong@huawei.com>");
I tested this patch with several cases, it is ok.

But is it neccessary to change the author line?

thanks
Huang Shijie

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

* RE: [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition
  2013-11-11  3:06   ` Huang Shijie
@ 2013-11-11  3:08     ` Caizhiyong
  -1 siblings, 0 replies; 10+ messages in thread
From: Caizhiyong @ 2013-11-11  3:08 UTC (permalink / raw)
  To: Huang Shijie
  Cc: Andrew Morton, fengguang.wu, Brian Norris, Artem Bityutskiy,
	Randy Dunlap, linux-kernel, Karel Zak, linux-mtd,
	Shmulik Ladkani, Wanglin (Albert)

> On Sat, Nov 09, 2013 at 11:43:06AM +0000, Caizhiyong wrote:
> > From: Cai Zhiyong <caizhiyong@huawei.com>
> > Date: Sat, 9 Nov 2013 17:54:12 +0800
> >
> > @@ -143,5 +149,5 @@ MODULE_PARM_DESC(mtdparts, "Partitioning specification");
> >  module_param(mtdparts, charp, 0);
> >
> >  MODULE_LICENSE("GPL");
> > -MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>");
> > +MODULE_AUTHOR("Cai Zhiyong <caizhiyong@huawei.com>");
> I tested this patch with several cases, it is ok.

Thank you for test.

> 
> But is it neccessary to change the author line?

I rewrite this module, there may be some bugs or other problems, if I keep the original author,
I am afraid that someone care about this.

> 
> thanks
> Huang Shijie

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

* RE: [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition
@ 2013-11-11  3:08     ` Caizhiyong
  0 siblings, 0 replies; 10+ messages in thread
From: Caizhiyong @ 2013-11-11  3:08 UTC (permalink / raw)
  To: Huang Shijie
  Cc: fengguang.wu, Artem Bityutskiy, Wanglin (Albert),
	Randy Dunlap, linux-kernel, Karel Zak, linux-mtd,
	Shmulik Ladkani, Andrew Morton, Brian Norris

> On Sat, Nov 09, 2013 at 11:43:06AM +0000, Caizhiyong wrote:
> > From: Cai Zhiyong <caizhiyong@huawei.com>
> > Date: Sat, 9 Nov 2013 17:54:12 +0800
> >
> > @@ -143,5 +149,5 @@ MODULE_PARM_DESC(mtdparts, "Partitioning specification");
> >  module_param(mtdparts, charp, 0);
> >
> >  MODULE_LICENSE("GPL");
> > -MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>");
> > +MODULE_AUTHOR("Cai Zhiyong <caizhiyong@huawei.com>");
> I tested this patch with several cases, it is ok.

Thank you for test.

> 
> But is it neccessary to change the author line?

I rewrite this module, there may be some bugs or other problems, if I keep the original author,
I am afraid that someone care about this.

> 
> thanks
> Huang Shijie

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

* Re: [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition
  2013-11-10 18:09     ` Ezequiel Garcia
@ 2013-11-13  3:03       ` Huang Shijie
  -1 siblings, 0 replies; 10+ messages in thread
From: Huang Shijie @ 2013-11-13  3:03 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: Caizhiyong, fengguang.wu, Artem Bityutskiy, Wanglin (Albert),
	Randy Dunlap, linux-kernel, Karel Zak, linux-mtd,
	Shmulik Ladkani, Andrew Morton, Brian Norris

On Sun, Nov 10, 2013 at 03:09:02PM -0300, Ezequiel Garcia wrote:
> 
> Can you summarize such cases? Or maybe better, just share them all :)
I just test it with cases such as(my nand is just 1G):
   (1) mtdparts=gpmi-nand:16m(boot),16m(kernel),600m(dtb),600m(ok),-(rootfs)
   (2) mtdparts=gpmi-nand:16m(boot),16m(kernel),600m(ok),-(rootfs)
   (3) mtdparts=gpmi-nand:16m(boot),16m(kernel),600m(dtb),600m(ok),600m(ok2),-(rootfs)

thanks
Huang Shijie

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

* Re: [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition
@ 2013-11-13  3:03       ` Huang Shijie
  0 siblings, 0 replies; 10+ messages in thread
From: Huang Shijie @ 2013-11-13  3:03 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: Wanglin (Albert),
	Brian Norris, Artem Bityutskiy, Caizhiyong, Randy Dunlap,
	linux-kernel, Karel Zak, linux-mtd, Shmulik Ladkani,
	Andrew Morton, fengguang.wu

On Sun, Nov 10, 2013 at 03:09:02PM -0300, Ezequiel Garcia wrote:
> 
> Can you summarize such cases? Or maybe better, just share them all :)
I just test it with cases such as(my nand is just 1G):
   (1) mtdparts=gpmi-nand:16m(boot),16m(kernel),600m(dtb),600m(ok),-(rootfs)
   (2) mtdparts=gpmi-nand:16m(boot),16m(kernel),600m(ok),-(rootfs)
   (3) mtdparts=gpmi-nand:16m(boot),16m(kernel),600m(dtb),600m(ok),600m(ok2),-(rootfs)

thanks
Huang Shijie

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

end of thread, other threads:[~2013-11-12 14:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-09 11:43 [PATCH 2/2] mtd: cmdlinepart: support master name is not set when parser partition Caizhiyong
2013-11-09 11:43 ` Caizhiyong
2013-11-11  3:06 ` Huang Shijie
2013-11-11  3:06   ` Huang Shijie
2013-11-10 18:09   ` Ezequiel Garcia
2013-11-10 18:09     ` Ezequiel Garcia
2013-11-13  3:03     ` Huang Shijie
2013-11-13  3:03       ` Huang Shijie
2013-11-11  3:08   ` Caizhiyong
2013-11-11  3:08     ` Caizhiyong

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.