Skip to contentSkip to conversation

mtd: nand: print erase size on init

PATCH Applied Rafał Miłecki 4 participants 6 messages Oct 20, 2014 – Nov 26, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: nand: print erase size on init

It may be useful info, e.g. if someone wants to use ubinize.

---
 drivers/mtd/nand/nand_base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/nand_base.c +2 -2
index 5b5c627..5e9ffbe 100644
@@ -3765,9 +3765,9 @@ ident_done:
 		pr_info("%s %s\n", nand_manuf_ids[maf_idx].name,
 				type->name);
 
-	pr_info("%dMiB, %s, page size: %d, OOB size: %d\n",
+	pr_info("%d MiB, %s, erase size: %d KiB, page size: %d, OOB size: %d\n",
 		(int)(chip->chipsize >> 20), nand_is_slc(chip) ? "SLC" : "MLC",
-		mtd->writesize, mtd->oobsize);
+		mtd->erasesize >> 10, mtd->writesize, mtd->oobsize);
 	return type;
 }
 
Signature · 1 line
1.8.4.5
#1 lore raw
Quoted 14 lines · Rafał Miłecki

It may be useful info, e.g. if someone wants to use ubinize.

---
 drivers/mtd/nand/nand_base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/nand_base.c +0 -0
index 5b5c627..5e9ffbe 100644
@@ -3765,9 +3765,9 @@ ident_done:
 		pr_info("%s %s\n", nand_manuf_ids[maf_idx].name,

drivers/mtd/nand/nand_base.c ident_done: · line 3773

Quoted 10 lines
drivers/mtd/nand/nand_base.c +2 -2
 				type->name);
 
-	pr_info("%dMiB, %s, page size: %d, OOB size: %d\n",
+	pr_info("%d MiB, %s, erase size: %d KiB, page size: %d, OOB size: %d\n",
 		(int)(chip->chipsize >> 20), nand_is_slc(chip) ? "SLC" : "MLC",
-		mtd->writesize, mtd->oobsize);
+		mtd->erasesize >> 10, mtd->writesize, mtd->oobsize);
 	return type;
 }
 

Hm, this line is already way too long! I'd say we should try to make it shorter, instead of longer.

Moreover, you have a /proc and a /sysfs interface to retrieve the erasesize:

What's wrong with using any of the currently available interfaces:

$ cat /sys/class/mtd/mtd0/erasesize 
131072
$ cat /proc/mtd | grep mtd0 | awk '{print $3}'
00020000

Any reason why you want the info in the kernel log?

Signature · 2 lines
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar
#2 lore raw
Quoted 1 line · Ezequiel Garcia

Hm, this line is already way too long!

Can be split then.

Quoted 11 lines

Moreover, you have a /proc and a /sysfs interface to retrieve the erasesize:

What's wrong with using any of the currently available interfaces:

$ cat /sys/class/mtd/mtd0/erasesize 
131072
$ cat /proc/mtd | grep mtd0 | awk '{print $3}'
00020000

Any reason why you want the info in the kernel log?

When people ask for help and send their logs, it is very handy to have this information there.

#3 lore raw
Quoted 8 lines · Artem Bityutskiy
Quoted 7 lines · Ezequiel Garcia

Moreover, you have a /proc and a /sysfs interface to retrieve the erasesize:

What's wrong with using any of the currently available interfaces:

$ cat /sys/class/mtd/mtd0/erasesize
131072
Quoted 7 lines
Quoted 4 lines
$ cat /proc/mtd | grep mtd0 | awk '{print $3}'
00020000

Any reason why you want the info in the kernel log?

When people ask for help and send their logs, it is very handy to have this information there.

Oops, forgot to reply. There are two reasons for this:
1) It's easier to get erasesize from users/reporters when it simply appears in the boot log.
2) If user space breaks (e.g. because of wrong UBI image) we can't use "cat" to read the erasesize

Signature · 1 line
Rafał
#4 lore raw
Quoted 14 lines · Rafał Miłecki
Quoted 13 lines · Artem Bityutskiy
Quoted 11 lines · Ezequiel Garcia

Moreover, you have a /proc and a /sysfs interface to retrieve the erasesize:

What's wrong with using any of the currently available interfaces:

$ cat /sys/class/mtd/mtd0/erasesize
131072
$ cat /proc/mtd | grep mtd0 | awk '{print $3}'
00020000

Any reason why you want the info in the kernel log?

Quoted 9 lines
Quoted 2 lines

When people ask for help and send their logs, it is very handy to have this information there.

Oops, forgot to reply. There are two reasons for this:
1) It's easier to get erasesize from users/reporters when it simply appears in the boot log.
2) If user space breaks (e.g. because of wrong UBI image) we can't use "cat" to read the erasesize

Hm.. OK. Those sound like good reasons.

Signature · 2 lines
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar
Applied
#5 lore raw
Quoted 18 lines · Ezequiel Garcia
Quoted 17 lines · Rafał Miłecki
Quoted 15 lines · Artem Bityutskiy
Quoted 11 lines · Ezequiel Garcia

Moreover, you have a /proc and a /sysfs interface to retrieve the erasesize:

What's wrong with using any of the currently available interfaces:

$ cat /sys/class/mtd/mtd0/erasesize
131072
$ cat /proc/mtd | grep mtd0 | awk '{print $3}'
00020000

Any reason why you want the info in the kernel log?

When people ask for help and send their logs, it is very handy to have this information there.

Quoted 8 lines
Quoted 6 lines

Oops, forgot to reply. There are two reasons for this:
1) It's easier to get erasesize from users/reporters when it simply appears in the boot log.
2) If user space breaks (e.g. because of wrong UBI image) we can't use "cat" to read the erasesize

Hm.. OK. Those sound like good reasons.

Glad we can agree on this important issue :)

Pushed to l2-mtd.git.

Brian