[PATCH] 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.
Signed-off-by: Alexander Shirokov shirokovalexs@gmail.com --- doc/usage/cmd/mmc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/usage/cmd/mmc.rst b/doc/usage/cmd/mmc.rst index 55e3f9cf98..41005b18ef 100644 --- a/doc/usage/cmd/mmc.rst +++ b/doc/usage/cmd/mmc.rst @@ -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:

On Sun, 9 Apr 2023 at 07:01, Alexander Shirokov shirokovalexs@gmail.com wrote:
In the 'mmc write' command example, it writes 16 blocks (0x10). But the output contains 256 (0x100) blocks. This patch fixes the mismatch.
Signed-off-by: Alexander Shirokov shirokovalexs@gmail.com
doc/usage/cmd/mmc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/usage/cmd/mmc.rst b/doc/usage/cmd/mmc.rst index 55e3f9cf98..41005b18ef 100644 --- a/doc/usage/cmd/mmc.rst +++ b/doc/usage/cmd/mmc.rst @@ -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.
The partition list can be shown via 'mmc part' command:
2.40.0
Regards, Simon

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?

Hi Shirokov,
On Fri, 21 Apr 2023 at 22:48, Shirokov Alexander shirokovalexs@gmail.com wrote:
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?
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/20210720132940.1171011-13-s... [2] https://patchwork.ozlabs.org/project/uboot/patch/20210724150341.243074-13-sj...

Hi Shirokov,
On Fri, 21 Apr 2023 at 22:48, Shirokov Alexander shirokovalexs@gmail.com wrote:
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?
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/20210720132940.1171011-13-s... [2] https://patchwork.ozlabs.org/project/uboot/patch/20210724150341.243074-13-sj...
Thanks a lot, Simon
I prepared the patch without 0x prefix: http://patchwork.ozlabs.org/project/uboot/patch/20230425100030.22403-1-shiro...

In the 'mmc write' command example, it writes 16 blocks (0x10). But the output contains 256 (0x100) blocks. This patch fixes the mismatch.
Signed-off-by: Alexander Shirokov shirokovalexs@gmail.com --- doc/usage/cmd/mmc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/usage/cmd/mmc.rst b/doc/usage/cmd/mmc.rst index 55e3f9cf98..2ca1a5cf0c 100644 --- a/doc/usage/cmd/mmc.rst +++ b/doc/usage/cmd/mmc.rst @@ -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:

Hi Alexander,
On Tue, 25 Apr 2023 at 04:00, Alexander Shirokov shirokovalexs@gmail.com wrote:
In the 'mmc write' command example, it writes 16 blocks (0x10). But the output contains 256 (0x100) blocks. This patch fixes the mismatch.
Signed-off-by: Alexander Shirokov shirokovalexs@gmail.com
doc/usage/cmd/mmc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/usage/cmd/mmc.rst b/doc/usage/cmd/mmc.rst index 55e3f9cf98..2ca1a5cf0c 100644 --- a/doc/usage/cmd/mmc.rst +++ b/doc/usage/cmd/mmc.rst @@ -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?
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

On Tue, Apr 25, 2023 at 8:01 PM Simon Glass sjg@chromium.org wrote:
--- a/doc/usage/cmd/mmc.rst +++ b/doc/usage/cmd/mmc.rst @@ -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?
MMC write: dev # 0, block # 20480, count 256 ... 256 blocks
written: OK
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?

On 4/26/23 13:05, Shirokov Alexander wrote:
On Tue, Apr 25, 2023 at 8:01 PM Simon Glass sjg@chromium.org wrote:
--- a/doc/usage/cmd/mmc.rst +++ b/doc/usage/cmd/mmc.rst @@ -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?
MMC write: dev # 0, block # 20480, count 256 ... 256 blocks
written: OK
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

On Thu, Apr 27, 2023 at 7:24 AM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 4/26/23 13:05, Shirokov Alexander wrote:
On Tue, Apr 25, 2023 at 8:01 PM Simon Glass sjg@chromium.org wrote:
--- a/doc/usage/cmd/mmc.rst +++ b/doc/usage/cmd/mmc.rst @@ -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?
MMC write: dev # 0, block # 20480, count 256 ... 256 blocks
written: OK
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
Hello Heinrich, Thank you for your response. The new version of the patch is here: http://patchwork.ozlabs.org/project/uboot/patch/20230427101207.119814-1-shir...

Hi Shirokov,
On Wed, 26 Apr 2023 at 05:05, Shirokov Alexander shirokovalexs@gmail.com wrote:
On Tue, Apr 25, 2023 at 8:01 PM Simon Glass sjg@chromium.org wrote:
--- a/doc/usage/cmd/mmc.rst +++ b/doc/usage/cmd/mmc.rst @@ -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?
MMC write: dev # 0, block # 20480, count 256 ... 256 blocks
written: OK
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

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.
Signed-off-by: Alexander Shirokov shirokovalexs@gmail.com --- doc/usage/cmd/mmc.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/usage/cmd/mmc.rst b/doc/usage/cmd/mmc.rst index 55e3f9cf98..71a0303109 100644 --- a/doc/usage/cmd/mmc.rst +++ b/doc/usage/cmd/mmc.rst @@ -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:

On 4/27/23 12:12, Alexander Shirokov wrote:
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.
Signed-off-by: Alexander Shirokov shirokovalexs@gmail.com
doc/usage/cmd/mmc.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/usage/cmd/mmc.rst b/doc/usage/cmd/mmc.rst index 55e3f9cf98..71a0303109 100644 --- a/doc/usage/cmd/mmc.rst +++ b/doc/usage/cmd/mmc.rst @@ -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:
Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de
participants (4)
-
Alexander Shirokov
-
Heinrich Schuchardt
-
Shirokov Alexander
-
Simon Glass