diff mbox

[v1,1/4] m25p80: Fix debug messages.

Message ID ef1ea44a6c6f5d9846c3492006094044bbd805c3.1364961975.git.peter.crosthwaite@xilinx.com
State New
Headers show

Commit Message

Peter Crosthwaite April 3, 2013, 4:09 a.m. UTC
Some dodgy casts were making a mess of these msgs.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 hw/m25p80.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Comments

Edgar E. Iglesias April 3, 2013, 6:50 a.m. UTC | #1
On Wed, Apr 03, 2013 at 02:09:16PM +1000, Peter Crosthwaite wrote:
> Some dodgy casts were making a mess of these msgs.


Hi Peter

> 
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> 
>  hw/m25p80.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/m25p80.c b/hw/m25p80.c
> index 55e9d0d..34b476b 100644
> --- a/hw/m25p80.c
> +++ b/hw/m25p80.c
> @@ -538,15 +538,15 @@ static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx)
>      switch (s->state) {
>  
>      case STATE_PAGE_PROGRAM:
> -        DB_PRINT("page program cur_addr=%lx data=%x\n", s->cur_addr,
> -                 (uint8_t)tx);
> +        DB_PRINT("page program cur_addr=%lx data=%x\n", (unsigned)s->cur_addr,

Shouldn't this be using PRIx64 for cur_addr?


> +                 (unsigned)(uint8_t)tx);
>          flash_write8(s, s->cur_addr, (uint8_t)tx);
>          s->cur_addr++;
>          break;
>  
>      case STATE_READ:
>          r = s->storage[s->cur_addr];
> -        DB_PRINT("READ 0x%lx=%x\n", s->cur_addr, r);
> +        DB_PRINT("READ 0x%lx=%x\n", (unsigned)s->cur_addr, (unsigned)r);


same here.


>          s->cur_addr = (s->cur_addr + 1) % s->size;
>          break;
>  
> -- 
> 1.7.0.4
> 
>
Peter Crosthwaite April 7, 2013, 5:52 a.m. UTC | #2
Hi Edgar,

On Wed, Apr 3, 2013 at 4:50 PM, Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
> On Wed, Apr 03, 2013 at 02:09:16PM +1000, Peter Crosthwaite wrote:
>> Some dodgy casts were making a mess of these msgs.
>
>
> Hi Peter
>
>>
>> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>> ---
>>
>>  hw/m25p80.c |    6 +++---
>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/m25p80.c b/hw/m25p80.c
>> index 55e9d0d..34b476b 100644
>> --- a/hw/m25p80.c
>> +++ b/hw/m25p80.c
>> @@ -538,15 +538,15 @@ static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx)
>>      switch (s->state) {
>>
>>      case STATE_PAGE_PROGRAM:
>> -        DB_PRINT("page program cur_addr=%lx data=%x\n", s->cur_addr,
>> -                 (uint8_t)tx);
>> +        DB_PRINT("page program cur_addr=%lx data=%x\n", (unsigned)s->cur_addr,
>
> Shouldn't this be using PRIx64 for cur_addr?
>

Yes, fixed in v2. Also used PRIx8 for the uint8_ts around the place.

Regards,
Peter

>
>> +                 (unsigned)(uint8_t)tx);
>>          flash_write8(s, s->cur_addr, (uint8_t)tx);
>>          s->cur_addr++;
>>          break;
>>
>>      case STATE_READ:
>>          r = s->storage[s->cur_addr];
>> -        DB_PRINT("READ 0x%lx=%x\n", s->cur_addr, r);
>> +        DB_PRINT("READ 0x%lx=%x\n", (unsigned)s->cur_addr, (unsigned)r);
>
>
> same here.
>
>
>>          s->cur_addr = (s->cur_addr + 1) % s->size;
>>          break;
>>
>> --
>> 1.7.0.4
>>
>>
>
diff mbox

Patch

diff --git a/hw/m25p80.c b/hw/m25p80.c
index 55e9d0d..34b476b 100644
--- a/hw/m25p80.c
+++ b/hw/m25p80.c
@@ -538,15 +538,15 @@  static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx)
     switch (s->state) {
 
     case STATE_PAGE_PROGRAM:
-        DB_PRINT("page program cur_addr=%lx data=%x\n", s->cur_addr,
-                 (uint8_t)tx);
+        DB_PRINT("page program cur_addr=%lx data=%x\n", (unsigned)s->cur_addr,
+                 (unsigned)(uint8_t)tx);
         flash_write8(s, s->cur_addr, (uint8_t)tx);
         s->cur_addr++;
         break;
 
     case STATE_READ:
         r = s->storage[s->cur_addr];
-        DB_PRINT("READ 0x%lx=%x\n", s->cur_addr, r);
+        DB_PRINT("READ 0x%lx=%x\n", (unsigned)s->cur_addr, (unsigned)r);
         s->cur_addr = (s->cur_addr + 1) % s->size;
         break;