diff mbox

[1/3] hdata: Don't use printf

Message ID 20170515082050.304-1-oohall@gmail.com
State Accepted
Headers show

Commit Message

Oliver O'Halloran May 15, 2017, 8:20 a.m. UTC
Using printf() here results in the output going into the stdout stream
when running the hdata_to_dt test. This results in an invalid dtb output
so lets not do that.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 hdata/iohub.c | 3 ++-
 hdata/paca.c  | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Vasant Hegde May 16, 2017, 4:50 a.m. UTC | #1
On 05/15/2017 01:50 PM, Oliver O'Halloran wrote:
> Using printf() here results in the output going into the stdout stream
> when running the hdata_to_dt test. This results in an invalid dtb output
> so lets not do that.
>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  hdata/iohub.c | 3 ++-
>  hdata/paca.c  | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/hdata/iohub.c b/hdata/iohub.c
> index 0e7ef65f9101..c0b9bf802efb 100644
> --- a/hdata/iohub.c
> +++ b/hdata/iohub.c
> @@ -380,7 +380,8 @@ static struct dt_node *io_add_p9(const struct cechub_io_hub *hub,
>  		return NULL;
>  	}
>
> -	printf("IOHUB: PHB4 active bridge mask %x\n", (u32) hub->fab_br0_pdt);
> +	prlog(PR_DEBUG, "IOHUB: PHB4 active bridge mask %x\n",
> +		(u32) hub->fab_br0_pdt);
>
>  	/* Create PBCQs */
>  	io_add_phb4(hub, sp_iohubs, xscom, 0, 1, 0);
> diff --git a/hdata/paca.c b/hdata/paca.c
> index 1938d4affbeb..eaad0d4de432 100644
> --- a/hdata/paca.c
> +++ b/hdata/paca.c
> @@ -49,7 +49,7 @@ static struct dt_node *add_cpu_node(struct dt_node *cpus,
>  	no = be32_to_cpu(id->process_interrupt_line);
>
>  	ve_flags = be32_to_cpu(id->verify_exists_flags);
> -	printf("CPU[%i]: PIR=%i RES=%i %s %s(%u threads)\n",
> +	prlog(PR_INFO, "CPU[%i]: PIR=%i RES=%i %s %s(%u threads)\n",
>  	       paca_index(paca), be32_to_cpu(id->pir), no,
>  	       ve_flags & CPU_ID_PACA_RESERVED
>  	       ? "**RESERVED**" : cpu_state(ve_flags),
> @@ -251,7 +251,7 @@ static bool __paca_parse(void)
>  			okay = false;
>  		}
>
> -		printf("CPU[%i]: PIR=%i RES=%i %s\n",
> +		prlog(PR_INFO, "CPU[%i]: PIR=%i RES=%i %s\n",

May be we should make it as PR_DEBUG. But PACA is deprecated anyway.  So doesn't 
make much difference.  Otherwise patch looks good to me.

  Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>

-Vasant
Oliver O'Halloran May 16, 2017, 5:36 a.m. UTC | #2
On Tue, May 16, 2017 at 2:50 PM, Vasant Hegde
<hegdevasant@linux.vnet.ibm.com> wrote:
> On 05/15/2017 01:50 PM, Oliver O'Halloran wrote:
>>
>> Using printf() here results in the output going into the stdout stream
>> when running the hdata_to_dt test. This results in an invalid dtb output
>> so lets not do that.
>>
>> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
>> ---
>>  hdata/iohub.c | 3 ++-
>>  hdata/paca.c  | 4 ++--
>>  2 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/hdata/iohub.c b/hdata/iohub.c
>> index 0e7ef65f9101..c0b9bf802efb 100644
>> --- a/hdata/iohub.c
>> +++ b/hdata/iohub.c
>> @@ -380,7 +380,8 @@ static struct dt_node *io_add_p9(const struct
>> cechub_io_hub *hub,
>>                 return NULL;
>>         }
>>
>> -       printf("IOHUB: PHB4 active bridge mask %x\n", (u32)
>> hub->fab_br0_pdt);
>> +       prlog(PR_DEBUG, "IOHUB: PHB4 active bridge mask %x\n",
>> +               (u32) hub->fab_br0_pdt);
>>
>>         /* Create PBCQs */
>>         io_add_phb4(hub, sp_iohubs, xscom, 0, 1, 0);
>> diff --git a/hdata/paca.c b/hdata/paca.c
>> index 1938d4affbeb..eaad0d4de432 100644
>> --- a/hdata/paca.c
>> +++ b/hdata/paca.c
>> @@ -49,7 +49,7 @@ static struct dt_node *add_cpu_node(struct dt_node
>> *cpus,
>>         no = be32_to_cpu(id->process_interrupt_line);
>>
>>         ve_flags = be32_to_cpu(id->verify_exists_flags);
>> -       printf("CPU[%i]: PIR=%i RES=%i %s %s(%u threads)\n",
>> +       prlog(PR_INFO, "CPU[%i]: PIR=%i RES=%i %s %s(%u threads)\n",
>>                paca_index(paca), be32_to_cpu(id->pir), no,
>>                ve_flags & CPU_ID_PACA_RESERVED
>>                ? "**RESERVED**" : cpu_state(ve_flags),
>> @@ -251,7 +251,7 @@ static bool __paca_parse(void)
>>                         okay = false;
>>                 }
>>
>> -               printf("CPU[%i]: PIR=%i RES=%i %s\n",
>> +               prlog(PR_INFO, "CPU[%i]: PIR=%i RES=%i %s\n",
>
>
> May be we should make it as PR_DEBUG. But PACA is deprecated anyway.  So
> doesn't make much difference.  Otherwise patch looks good to me.

Using the named constants would be better, but it would required
pulling skiboot.h into stubs.c and I'm not keen to spend more time
fighting with header files. Patches welcome! ;)

>
>  Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>
> -Vasant
>
Stewart Smith May 16, 2017, 7:09 a.m. UTC | #3
Oliver O'Halloran <oohall@gmail.com> writes:
> Using printf() here results in the output going into the stdout stream
> when running the hdata_to_dt test. This results in an invalid dtb output
> so lets not do that.
>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Series merged to master as of 30df6f03141efdf9d60c983ce3e7ef2403f904c2
diff mbox

Patch

diff --git a/hdata/iohub.c b/hdata/iohub.c
index 0e7ef65f9101..c0b9bf802efb 100644
--- a/hdata/iohub.c
+++ b/hdata/iohub.c
@@ -380,7 +380,8 @@  static struct dt_node *io_add_p9(const struct cechub_io_hub *hub,
 		return NULL;
 	}
 
-	printf("IOHUB: PHB4 active bridge mask %x\n", (u32) hub->fab_br0_pdt);
+	prlog(PR_DEBUG, "IOHUB: PHB4 active bridge mask %x\n",
+		(u32) hub->fab_br0_pdt);
 
 	/* Create PBCQs */
 	io_add_phb4(hub, sp_iohubs, xscom, 0, 1, 0);
diff --git a/hdata/paca.c b/hdata/paca.c
index 1938d4affbeb..eaad0d4de432 100644
--- a/hdata/paca.c
+++ b/hdata/paca.c
@@ -49,7 +49,7 @@  static struct dt_node *add_cpu_node(struct dt_node *cpus,
 	no = be32_to_cpu(id->process_interrupt_line);
 
 	ve_flags = be32_to_cpu(id->verify_exists_flags);
-	printf("CPU[%i]: PIR=%i RES=%i %s %s(%u threads)\n",
+	prlog(PR_INFO, "CPU[%i]: PIR=%i RES=%i %s %s(%u threads)\n",
 	       paca_index(paca), be32_to_cpu(id->pir), no,
 	       ve_flags & CPU_ID_PACA_RESERVED
 	       ? "**RESERVED**" : cpu_state(ve_flags),
@@ -251,7 +251,7 @@  static bool __paca_parse(void)
 			okay = false;
 		}
 
-		printf("CPU[%i]: PIR=%i RES=%i %s\n",
+		prlog(PR_INFO, "CPU[%i]: PIR=%i RES=%i %s\n",
 		       paca_index(paca), be32_to_cpu(id->pir),
 		       be32_to_cpu(id->process_interrupt_line),
 		       okay ? "OK" : "UNAVAILABLE");