mtd/drivers/mtd cmdlinepart.c,1.5,1.6

Dave Neuer dneuer at infradead.org
Fri Nov 15 20:37:42 EST 2002


Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv28620/mtd/drivers/mtd

Modified Files:
	cmdlinepart.c 
Log Message:
remove some unneccessary (and bad) parts of my previous patch, and make parse_cmdline_partitions() handle a NULL mtd_id

Index: cmdlinepart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/cmdlinepart.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cmdlinepart.c	6 Nov 2002 22:40:04 -0000	1.5
+++ cmdlinepart.c	16 Nov 2002 01:37:39 -0000	1.6
@@ -92,11 +92,6 @@
 	else
 	{
 		size = memparse(s, &s);
-		if (!size)
-		{
-			printk(KERN_ERR ERRP "couldn't parse number from input string\n");
-			return 0;
-		}
 		if (size < PAGE_SIZE)
 		{
 			printk(KERN_ERR ERRP "partition size too small (%lx)\n", size);
@@ -112,17 +107,13 @@
 	{
                 s++;
                 offset = memparse(s, &s);
-		if (!offset)
-		{
-			printk(KERN_ERR ERRP "couldn't parse number from input string\n");
-			return 0;
-		}
         }
         /* now look for name */
 	if (*s == '(')
 	{
 		delim = ')';
 	}
+		
 	if (delim)
 	{
 		char *p;
@@ -297,7 +288,8 @@
  * Main function to be called from the MTD mapping driver/device to
  * obtain the partitioning information. At this point the command line
  * arguments will actually be parsed and turned to struct mtd_partition
- * information.
+ * information. It returns partitions for the requested mtd device, or
+ * the first one in the chain if a NULL mtd_id is passed in.
  */
 int parse_cmdline_partitions(struct mtd_info *master, 
                              struct mtd_partition **pparts,
@@ -307,7 +299,7 @@
 	int i;
 	struct cmdline_mtd_partition *part;
 
-	if (!cmdline)
+	if(!cmdline)
 		return -EINVAL;
 
 	/* parse command line */
@@ -316,7 +308,7 @@
 
 	for(part = partitions; part; part = part->next)
 	{
-		if (!strcmp(part->mtd_id, mtd_id))
+		if ((!mtd_id) || (!strcmp(part->mtd_id, mtd_id)))
 		{
 			for(i = 0, offset = 0; i < part->num_parts; i++)
 			{
@@ -330,7 +322,7 @@
 				{
 					printk(KERN_WARNING ERRP 
 					       "%s: partitioning exceeds flash size, truncating\n",
-					       mtd_id);
+					       part->mtd_id);
 					part->parts[i].size = master->size - offset;
 					part->num_parts = i;
 				}





More information about the linux-mtd-cvs mailing list