Skip to contentSkip to conversation

doc:fix typo in 'mmc write' example

PATCH Superseded Alexander Shirokov 3 participants 13 messages Apr 9, 2023 – Apr 28, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc:fix typo in 'mmc write' example

In the 'mmc write' command example, it writes 16 blocks (0x10). But the output contains 256 (0x100) blocks. This patch fixes the mismatch.

---
 doc/usage/cmd/mmc.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/usage/cmd/mmc.rst +1 -1
index 55e3f9cf98..41005b18ef 100644
@@ -216,7 +216,7 @@ The raw data can be read/written via 'mmc read/write' command:
     => mmc read 0x40000000 0x5000 0x100
     MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
 
-    => mmc write 0x40000000 0x5000 0x10
+    => mmc write 0x40000000 0x5000 0x100
     MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK
 
 The partition list can be shown via 'mmc part' command:
Signature · 1 line
2.40.0
#1 lore raw
Quoted 14 lines · Alexander Shirokov

In the 'mmc write' command example, it writes 16 blocks (0x10). But the output contains 256 (0x100) blocks. This patch fixes the mismatch.

---
 doc/usage/cmd/mmc.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/usage/cmd/mmc.rst +0 -0
index 55e3f9cf98..41005b18ef 100644

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc read/write' command: · line 220

Quoted 6 lines
doc/usage/cmd/mmc.rst +1 -1
@@ -216,7 +216,7 @@ The raw data can be read/written via 'mmc read/write' command:
     => mmc read 0x40000000 0x5000 0x100
     MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
 
-    => mmc write 0x40000000 0x5000 0x10
+    => mmc write 0x40000000 0x5000 0x100
     MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK

Could we drop the 0x as well? Those are not needed and may confuse people.

Quoted 5 lines
doc/usage/cmd/mmc.rst +0 -1
 The partition list can be shown via 'mmc part' command:
--

2.40.0

Regards,
Simon

#2 lore raw

Hello Simon,

Thanks for your answer.Using 0x explicitly shows that we are working with HEX.
But without the prefix, it looks like a decimal number. And it's more confusing
when the number of blocks looks like a decimal but is interpreted as HEX.

Here is an example:

    mmc write 0x40000000 0x5000 16
    MMC write: dev # 1, block # 20480, count 22 ... 22 blocks written: OK

This looks better. If we know that all number is HEX by default

    mmc write 40000000 5000 16

Do we have to use something like this?

#3 lore raw

Hi Shirokov,

Quoted 9 lines · Shirokov Alexander

Hello Simon,

Thanks for your answer.Using 0x explicitly shows that we are working with HEX. But without the prefix, it looks like a decimal number. And it's more confusing when the number of blocks looks like a decimal but is interpreted as HEX.

Here is an example:

Quoted 7 lines
    mmc write 0x40000000 0x5000 16
    MMC write: dev # 1, block # 20480, count 22 ... 22 blocks written: OK

This looks better. If we know that all number is HEX by default

    mmc write 40000000 5000 16

Do we have to use something like this?

The convention in U-Boot is to use hex, since it is a bootloader. So when you add 0x prefixes it confuses people into thinking that otherwise it would be decimal.

BTW we did discuss adding a decimal prefix but they did not get much support at the time.

Regards,
Simon

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

#4 lore raw
Quoted 30 lines

Hi Shirokov,

Quoted 4 lines · Shirokov Alexander

Hello Simon,

Thanks for your answer.Using 0x explicitly shows that we are working

with HEX.

Quoted 1 line

But without the prefix, it looks like a decimal number. And it's more

confusing

Quoted 11 lines

when the number of blocks looks like a decimal but is interpreted as HEX.

Here is an example:

    mmc write 0x40000000 0x5000 16
    MMC write: dev # 1, block # 20480, count 22 ... 22 blocks written: OK

This looks better. If we know that all number is HEX by default

    mmc write 40000000 5000 16

Do we have to use something like this?

The convention in U-Boot is to use hex, since it is a bootloader. So when you add 0x prefixes it confuses people into thinking that otherwise it would be decimal.

BTW we did discuss adding a decimal prefix but they did not get much support at the time.

Quoted 8 lines

Regards,
Simon

[1]
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2]
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Thanks a lot, Simon

I prepared the patch without 0x prefix:
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Signature · 2 lines
Regards,
Alexander
#5 lore raw

PATCH v2 1/1 cosmetic:fix typo in 'mmc write' example

In reply to Alexander Shirokov

In the 'mmc write' command example, it writes 16 blocks (0x10). But the output contains 256 (0x100) blocks. This patch fixes the mismatch.

---
 doc/usage/cmd/mmc.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/usage/cmd/mmc.rst +1 -1
index 55e3f9cf98..2ca1a5cf0c 100644
@@ -216,7 +216,7 @@ The raw data can be read/written via 'mmc read/write' command:
     => mmc read 0x40000000 0x5000 0x100
     MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
 
-    => mmc write 0x40000000 0x5000 0x10
+    => mmc write 0x40000000 0x5000 100
     MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK
 
 The partition list can be shown via 'mmc part' command:
Signature · 1 line
2.40.0
#6 lore raw

Re: [PATCH v2] cosmetic:fix typo in 'mmc write' example

Hi Alexander,

Quoted 14 lines · Alexander Shirokov

In the 'mmc write' command example, it writes 16 blocks (0x10). But the output contains 256 (0x100) blocks. This patch fixes the mismatch.

---
 doc/usage/cmd/mmc.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/usage/cmd/mmc.rst +0 -0
index 55e3f9cf98..2ca1a5cf0c 100644

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc read/write' command: · line 219

Quoted 5 lines
doc/usage/cmd/mmc.rst +1 -1
@@ -216,7 +216,7 @@ The raw data can be read/written via 'mmc read/write' command:
     => mmc read 0x40000000 0x5000 0x100
     MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
 
-    => mmc write 0x40000000 0x5000 0x10
+    => mmc write 0x40000000 0x5000 100

Drop the other 0x things too?

Quoted 6 lines
doc/usage/cmd/mmc.rst +0 -1
     MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK
 
 The partition list can be shown via 'mmc part' command:
--

2.40.0

Regards,
Simon

#7 lore raw

Re: [PATCH v2] cosmetic:fix typo in 'mmc write' example

Quoted 10 lines · Simon Glass

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc

Quoted 3 lines
doc/usage/cmd/mmc.rst +0 -0
@@ -216,7 +216,7 @@ The raw data can be read/written via 'mmc

read/write' command:

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc read/write' command: · line 219

Quoted 5 lines
doc/usage/cmd/mmc.rst +1 -1
     => mmc read 0x40000000 0x5000 0x100
     MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
 
-    => mmc write 0x40000000 0x5000 0x10
+    => mmc write 0x40000000 0x5000 100
Quoted 9 lines

Drop the other 0x things too?

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc · line 220

Quoted 1 line
doc/usage/cmd/mmc.rst +0 -0
     MMC write: dev # 0, block # 20480, count 256 ... 256 blocks

written: OK

Quoted 1 line

Regards,
Simon

Hi Simon,
Sure. I'll do that. But one clarification before. Should I change 0x only in "mmc write" line or change "mmc read" too, to keep the example consistent?

Signature · 2 lines
Regards,
Alexander
#8 lore raw

Re: [PATCH v2] cosmetic:fix typo in 'mmc write' example

Quoted 18 lines · Shirokov Alexander
Quoted 16 lines · Simon Glass

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc

Quoted 3 lines
doc/usage/cmd/mmc.rst +0 -0
@@ -216,7 +216,7 @@ The raw data can be read/written via 'mmc

read/write' command:

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc read/write' command: · line 219

Quoted 5 lines
doc/usage/cmd/mmc.rst +1 -1
      => mmc read 0x40000000 0x5000 0x100
      MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
 
-    => mmc write 0x40000000 0x5000 0x10
+    => mmc write 0x40000000 0x5000 100

Drop the other 0x things too?

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc · line 220

Quoted 1 line
doc/usage/cmd/mmc.rst +0 -0
      MMC write: dev # 0, block # 20480, count 256 ... 256 blocks

written: OK

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

Regards,
Simon

Hi Simon,
Sure. I'll do that. But one clarification before. Should I change 0x only in "mmc write" line or change "mmc read" too, to keep the example consistent?

Please, keep the document consistent. do_mmc_read() uses hextoul(). So it is safe to remove the 0x prefixes in the mmc read example too.

Best regards

Heinrich

Best regards

Heinrich

#9 lore raw

Re: [PATCH v2] cosmetic:fix typo in 'mmc write' example

Quoted 34 lines · Heinrich Schuchardt
Quoted 8 lines · Shirokov Alexander
Quoted 6 lines · Simon Glass

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc

Quoted 3 lines
doc/usage/cmd/mmc.rst +0 -0
@@ -216,7 +216,7 @@ The raw data can be read/written via 'mmc

read/write' command:

Quoted 2 lines
doc/usage/cmd/mmc.rst +0 -0
      => mmc read 0x40000000 0x5000 0x100
      MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read:

OK

Quoted 10 lines
Quoted 10 lines

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc read/write' command: · line 219

Quoted 3 lines
doc/usage/cmd/mmc.rst +1 -1
-    => mmc write 0x40000000 0x5000 0x10
+    => mmc write 0x40000000 0x5000 100

Drop the other 0x things too?

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc · line 219

Quoted 1 line
doc/usage/cmd/mmc.rst +0 -0
      MMC write: dev # 0, block # 20480, count 256 ... 256 blocks

written: OK

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

Regards,
Simon

Hi Simon,
Sure. I'll do that. But one clarification before. Should I change 0x

only in

Quoted 1 line

"mmc write" line or change "mmc read" too, to keep the example

consistent?

Quoted 1 line

Please, keep the document consistent. do_mmc_read() uses hextoul(). So it is safe to remove the 0x prefixes in the mmc read example too.

Quoted 8 lines

Best regards

Heinrich

Best regards

Heinrich

Hello Heinrich,
Thank you for your response. The new version of the patch is here:
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Signature · 2 lines
Regards,
Alexander
#10 lore raw

Re: [PATCH v2] cosmetic:fix typo in 'mmc write' example

In reply to Shirokov Alexander

Hi Shirokov,

Quoted 19 lines · Shirokov Alexander
Quoted 16 lines · Simon Glass

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc

Quoted 3 lines
doc/usage/cmd/mmc.rst +0 -0
@@ -216,7 +216,7 @@ The raw data can be read/written via 'mmc

read/write' command:

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc read/write' command: · line 219

Quoted 5 lines
doc/usage/cmd/mmc.rst +1 -1
     => mmc read 0x40000000 0x5000 0x100
     MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
 
-    => mmc write 0x40000000 0x5000 0x10
+    => mmc write 0x40000000 0x5000 100

Drop the other 0x things too?

doc/usage/cmd/mmc.rst The raw data can be read/written via 'mmc · line 220

Quoted 1 line
doc/usage/cmd/mmc.rst +0 -0
     MMC write: dev # 0, block # 20480, count 256 ... 256 blocks

written: OK

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

Regards,
Simon

Hi Simon,
Sure. I'll do that. But one clarification before. Should I change 0x only in "mmc write" line or change "mmc read" too, to keep the example consistent?

Well, you may as well do both. The best approach would be to send two patches, one which drops the 0x and the second which fixes the bug.

Regards,
Simon

#11 lore raw

PATCH v3 1/1 doc:mmc:drop 0x prefixes in read/write examples

In reply to Alexander Shirokov

The patch drops 0x prefixes because all numbers are interpreted as HEX by default.

Also, it fixes the mismatch between input arguments and output at 'mmc write' example. Now it's 256 (0x100) blocks.

---
 doc/usage/cmd/mmc.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
doc/usage/cmd/mmc.rst +2 -2
index 55e3f9cf98..71a0303109 100644
@@ -213,10 +213,10 @@ The 'mmc info' command displays device's capabilities:
 The raw data can be read/written via 'mmc read/write' command:
 ::
 
-    => mmc read 0x40000000 0x5000 0x100
+    => mmc read 40000000 5000 100
     MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
 
-    => mmc write 0x40000000 0x5000 0x10
+    => mmc write 40000000 5000 100
     MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK
 
 The partition list can be shown via 'mmc part' command:
Signature · 1 line
2.40.1
Reviewed-by on v3 1/1
#12 lore raw

Re: [PATCH v3] doc:mmc:drop 0x prefixes in read/write examples

Quoted 18 lines · Alexander Shirokov

The patch drops 0x prefixes because all numbers are interpreted as HEX by default.

Also, it fixes the mismatch between input arguments and output at 'mmc write' example. Now it's 256 (0x100) blocks.

---
  doc/usage/cmd/mmc.rst | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
doc/usage/cmd/mmc.rst +0 -0
index 55e3f9cf98..71a0303109 100644
@@ -213,10 +213,10 @@ The 'mmc info' command displays device's capabilities:
  The raw data can be read/written via 'mmc read/write' command:
  ::

doc/usage/cmd/mmc.rst The 'mmc info' command displays device's capabilities: · line 222

Quoted 10 lines
doc/usage/cmd/mmc.rst +2 -2
 
-    => mmc read 0x40000000 0x5000 0x100
+    => mmc read 40000000 5000 100
      MMC read: dev # 0, block # 20480, count 256 ... 256 blocks read: OK
 
-    => mmc write 0x40000000 0x5000 0x10
+    => mmc write 40000000 5000 100
      MMC write: dev # 0, block # 20480, count 256 ... 256 blocks written: OK
 
  The partition list can be shown via 'mmc part' command: