All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd: blk: Use LBAFD in the common block command
@ 2017-08-22  4:53 Bin Meng
  2017-08-22  6:41 ` Lothar Waßmann
  0 siblings, 1 reply; 3+ messages in thread
From: Bin Meng @ 2017-08-22  4:53 UTC (permalink / raw)
  To: u-boot

There are already two macros LBAF and LBAFU to aid formatted print
with lbaint_t variables. Now let's add another one LBAFD and use it
in the common block command codes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 cmd/blk_common.c | 10 ++++------
 include/blk.h    |  1 +
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/cmd/blk_common.c b/cmd/blk_common.c
index 86c75e7..2626eef 100644
--- a/cmd/blk_common.c
+++ b/cmd/blk_common.c
@@ -68,9 +68,8 @@ int blk_common_cmd(int argc, char * const argv[], enum if_type if_type,
 			ulong cnt = simple_strtoul(argv[4], NULL, 16);
 			ulong n;
 
-			printf("\n%s read: device %d block # %lld, count %ld ... ",
-			       if_name, *cur_devnump, (unsigned long long)blk,
-			       cnt);
+			printf("\n%s read: device %d block # "LBAFD", count %ld ... ",
+			       if_name, *cur_devnump, blk, cnt);
 
 			n = blk_read_devnum(if_type, *cur_devnump, blk, cnt,
 					    (ulong *)addr);
@@ -84,9 +83,8 @@ int blk_common_cmd(int argc, char * const argv[], enum if_type if_type,
 			ulong cnt = simple_strtoul(argv[4], NULL, 16);
 			ulong n;
 
-			printf("\n%s write: device %d block # %lld, count %ld ... ",
-			       if_name, *cur_devnump, (unsigned long long)blk,
-			       cnt);
+			printf("\n%s write: device %d block # "LBAFD", count %ld ... ",
+			       if_name, *cur_devnump, blk, cnt);
 
 			n = blk_write_devnum(if_type, *cur_devnump, blk, cnt,
 					     (ulong *)addr);
diff --git a/include/blk.h b/include/blk.h
index a106f9c..9a3e6106 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -17,6 +17,7 @@ typedef ulong lbaint_t;
 #endif
 #define LBAF "%" LBAFlength "x"
 #define LBAFU "%" LBAFlength "u"
+#define LBAFD "%" LBAFlength "d"
 
 /* Interface types: */
 enum if_type {
-- 
2.9.2

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

* [U-Boot] [PATCH] cmd: blk: Use LBAFD in the common block command
  2017-08-22  4:53 [U-Boot] [PATCH] cmd: blk: Use LBAFD in the common block command Bin Meng
@ 2017-08-22  6:41 ` Lothar Waßmann
  2017-08-22  7:15   ` Bin Meng
  0 siblings, 1 reply; 3+ messages in thread
From: Lothar Waßmann @ 2017-08-22  6:41 UTC (permalink / raw)
  To: u-boot

Hi,

On Mon, 21 Aug 2017 21:53:41 -0700 Bin Meng wrote:
> There are already two macros LBAF and LBAFU to aid formatted print
> with lbaint_t variables. Now let's add another one LBAFD and use it
> in the common block command codes.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  cmd/blk_common.c | 10 ++++------
>  include/blk.h    |  1 +
>  2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/cmd/blk_common.c b/cmd/blk_common.c
> index 86c75e7..2626eef 100644
> --- a/cmd/blk_common.c
> +++ b/cmd/blk_common.c
> @@ -68,9 +68,8 @@ int blk_common_cmd(int argc, char * const argv[], enum if_type if_type,
>  			ulong cnt = simple_strtoul(argv[4], NULL, 16);
>  			ulong n;
>  
> -			printf("\n%s read: device %d block # %lld, count %ld ... ",
> -			       if_name, *cur_devnump, (unsigned long long)blk,
> -			       cnt);
> +			printf("\n%s read: device %d block # "LBAFD", count %ld ... ",
> +			       if_name, *cur_devnump, blk, cnt);
>  
>  			n = blk_read_devnum(if_type, *cur_devnump, blk, cnt,
>  					    (ulong *)addr);
> @@ -84,9 +83,8 @@ int blk_common_cmd(int argc, char * const argv[], enum if_type if_type,
>  			ulong cnt = simple_strtoul(argv[4], NULL, 16);
>  			ulong n;
>  
> -			printf("\n%s write: device %d block # %lld, count %ld ... ",
> -			       if_name, *cur_devnump, (unsigned long long)blk,
> -			       cnt);
> +			printf("\n%s write: device %d block # "LBAFD", count %ld ... ",
> +			       if_name, *cur_devnump, blk, cnt);
>  
>  			n = blk_write_devnum(if_type, *cur_devnump, blk, cnt,
>  					     (ulong *)addr);
>
Are there devices that have valid negative block numbers?
Otherwise using LBAFU would be fine here.


Lothar Waßmann

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

* [U-Boot] [PATCH] cmd: blk: Use LBAFD in the common block command
  2017-08-22  6:41 ` Lothar Waßmann
@ 2017-08-22  7:15   ` Bin Meng
  0 siblings, 0 replies; 3+ messages in thread
From: Bin Meng @ 2017-08-22  7:15 UTC (permalink / raw)
  To: u-boot

Hi Lothar,

On Tue, Aug 22, 2017 at 2:41 PM, Lothar Waßmann <LW@karo-electronics.de> wrote:
> Hi,
>
> On Mon, 21 Aug 2017 21:53:41 -0700 Bin Meng wrote:
>> There are already two macros LBAF and LBAFU to aid formatted print
>> with lbaint_t variables. Now let's add another one LBAFD and use it
>> in the common block command codes.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  cmd/blk_common.c | 10 ++++------
>>  include/blk.h    |  1 +
>>  2 files changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/cmd/blk_common.c b/cmd/blk_common.c
>> index 86c75e7..2626eef 100644
>> --- a/cmd/blk_common.c
>> +++ b/cmd/blk_common.c
>> @@ -68,9 +68,8 @@ int blk_common_cmd(int argc, char * const argv[], enum if_type if_type,
>>                       ulong cnt = simple_strtoul(argv[4], NULL, 16);
>>                       ulong n;
>>
>> -                     printf("\n%s read: device %d block # %lld, count %ld ... ",
>> -                            if_name, *cur_devnump, (unsigned long long)blk,
>> -                            cnt);
>> +                     printf("\n%s read: device %d block # "LBAFD", count %ld ... ",
>> +                            if_name, *cur_devnump, blk, cnt);
>>
>>                       n = blk_read_devnum(if_type, *cur_devnump, blk, cnt,
>>                                           (ulong *)addr);
>> @@ -84,9 +83,8 @@ int blk_common_cmd(int argc, char * const argv[], enum if_type if_type,
>>                       ulong cnt = simple_strtoul(argv[4], NULL, 16);
>>                       ulong n;
>>
>> -                     printf("\n%s write: device %d block # %lld, count %ld ... ",
>> -                            if_name, *cur_devnump, (unsigned long long)blk,
>> -                            cnt);
>> +                     printf("\n%s write: device %d block # "LBAFD", count %ld ... ",
>> +                            if_name, *cur_devnump, blk, cnt);
>>
>>                       n = blk_write_devnum(if_type, *cur_devnump, blk, cnt,
>>                                            (ulong *)addr);
>>
> Are there devices that have valid negative block numbers?
> Otherwise using LBAFU would be fine here.

Makes sense. Will do in v2.

Regards,
Bin

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

end of thread, other threads:[~2017-08-22  7:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22  4:53 [U-Boot] [PATCH] cmd: blk: Use LBAFD in the common block command Bin Meng
2017-08-22  6:41 ` Lothar Waßmann
2017-08-22  7:15   ` Bin Meng

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.