diff mbox series

[v2,2/2] xen/arm: domain_build: Fix format specifiers in map_{dt_}irq_to_domain()

Message ID 20230511130218.22606-3-michal.orzel@amd.com (mailing list archive)
State New, archived
Headers show
Series xen/arm: domain_build: map_{dt_}irq_to_domain() fixes | expand

Commit Message

Michal Orzel May 11, 2023, 1:02 p.m. UTC
IRQ is of unsigned type so %u should be used. When printing domain id,
%pd should be the correct format to maintain the consistency.

Also, wherever possible, reduce the number of splitted lines for printk().

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
Changes in v2:
 - split the v1 patch so that the format specifiers are handled separately
 - also fix map_irq_to_domain()
---
 xen/arch/arm/domain_build.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

Comments

Andrew Cooper May 11, 2023, 1:21 p.m. UTC | #1
On 11/05/2023 2:02 pm, Michal Orzel wrote:
> IRQ is of unsigned type so %u should be used. When printing domain id,
> %pd should be the correct format to maintain the consistency.
>
> Also, wherever possible, reduce the number of splitted lines for printk().

Very minor grammar note.  Just "split" here.

~Andrew
Ayan Kumar Halder May 11, 2023, 3:23 p.m. UTC | #2
On 11/05/2023 14:02, Michal Orzel wrote:
> IRQ is of unsigned type so %u should be used. When printing domain id,
> %pd should be the correct format to maintain the consistency.
>
> Also, wherever possible, reduce the number of splitted lines for printk().
>
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
> ---
> Changes in v2:
>   - split the v1 patch so that the format specifiers are handled separately
>   - also fix map_irq_to_domain()
> ---
>   xen/arch/arm/domain_build.c | 14 +++++---------
>   1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 9dee1bb8f21c..71f307a572e9 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -2265,8 +2265,7 @@ int __init map_irq_to_domain(struct domain *d, unsigned int irq,
>       res = irq_permit_access(d, irq);
>       if ( res )
>       {
> -        printk(XENLOG_ERR "Unable to permit to dom%u access to IRQ %u\n",
> -               d->domain_id, irq);
> +        printk(XENLOG_ERR "Unable to permit to %pd access to IRQ %u\n", d, irq);
>           return res;
>       }
>   
> @@ -2282,8 +2281,7 @@ int __init map_irq_to_domain(struct domain *d, unsigned int irq,
>           res = route_irq_to_guest(d, irq, irq, devname);
>           if ( res < 0 )
>           {
> -            printk(XENLOG_ERR "Unable to map IRQ%"PRId32" to dom%d\n",
> -                   irq, d->domain_id);
> +            printk(XENLOG_ERR "Unable to map IRQ%u to %pd\n", irq, d);
>               return res;
>           }
>       }
> @@ -2303,8 +2301,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
>   
>       if ( irq < NR_LOCAL_IRQS )
>       {
> -        printk(XENLOG_ERR "%s: IRQ%"PRId32" is not a SPI\n",
> -               dt_node_name(dev), irq);
> +        printk(XENLOG_ERR "%s: IRQ%u is not a SPI\n", dt_node_name(dev), irq);
>           return -EINVAL;
>       }
>   
> @@ -2312,9 +2309,8 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
>       res = irq_set_spi_type(irq, dt_irq->type);
>       if ( res )
>       {
> -        printk(XENLOG_ERR
> -               "%s: Unable to setup IRQ%"PRId32" to dom%d\n",
> -               dt_node_name(dev), irq, d->domain_id);
> +        printk(XENLOG_ERR "%s: Unable to setup IRQ%u to %pd\n",
> +               dt_node_name(dev), irq, d);
>           return res;
>       }
>
Henry Wang May 12, 2023, 2:23 a.m. UTC | #3
Hi Michal,

> -----Original Message-----
> Subject: [PATCH v2 2/2] xen/arm: domain_build: Fix format specifiers in
> map_{dt_}irq_to_domain()
> 
> IRQ is of unsigned type so %u should be used. When printing domain id,
> %pd should be the correct format to maintain the consistency.
> 
> Also, wherever possible, reduce the number of splitted lines for printk().
> 
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>

Reviewed-by: Henry Wang <Henry.Wang@arm.com>

Kind regards,
Henry
Julien Grall May 15, 2023, 9:04 a.m. UTC | #4
Hi Michal,

On 11/05/2023 14:02, Michal Orzel wrote:
> IRQ is of unsigned type so %u should be used. When printing domain id,
> %pd should be the correct format to maintain the consistency.
> 
> Also, wherever possible, reduce the number of splitted lines for printk().

Reviewed-by: Julien Grall <jgrall@amazon.com>

I will fix the typo pointed out by Andrew whilst committing the series.

Cheers,

> 
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
> ---
> Changes in v2:
>   - split the v1 patch so that the format specifiers are handled separately
>   - also fix map_irq_to_domain()
> ---
>   xen/arch/arm/domain_build.c | 14 +++++---------
>   1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 9dee1bb8f21c..71f307a572e9 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -2265,8 +2265,7 @@ int __init map_irq_to_domain(struct domain *d, unsigned int irq,
>       res = irq_permit_access(d, irq);
>       if ( res )
>       {
> -        printk(XENLOG_ERR "Unable to permit to dom%u access to IRQ %u\n",
> -               d->domain_id, irq);
> +        printk(XENLOG_ERR "Unable to permit to %pd access to IRQ %u\n", d, irq);
>           return res;
>       }
>   
> @@ -2282,8 +2281,7 @@ int __init map_irq_to_domain(struct domain *d, unsigned int irq,
>           res = route_irq_to_guest(d, irq, irq, devname);
>           if ( res < 0 )
>           {
> -            printk(XENLOG_ERR "Unable to map IRQ%"PRId32" to dom%d\n",
> -                   irq, d->domain_id);
> +            printk(XENLOG_ERR "Unable to map IRQ%u to %pd\n", irq, d);
>               return res;
>           }
>       }
> @@ -2303,8 +2301,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
>   
>       if ( irq < NR_LOCAL_IRQS )
>       {
> -        printk(XENLOG_ERR "%s: IRQ%"PRId32" is not a SPI\n",
> -               dt_node_name(dev), irq);
> +        printk(XENLOG_ERR "%s: IRQ%u is not a SPI\n", dt_node_name(dev), irq);
>           return -EINVAL;
>       }
>   
> @@ -2312,9 +2309,8 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
>       res = irq_set_spi_type(irq, dt_irq->type);
>       if ( res )
>       {
> -        printk(XENLOG_ERR
> -               "%s: Unable to setup IRQ%"PRId32" to dom%d\n",
> -               dt_node_name(dev), irq, d->domain_id);
> +        printk(XENLOG_ERR "%s: Unable to setup IRQ%u to %pd\n",
> +               dt_node_name(dev), irq, d);
>           return res;
>       }
>
diff mbox series

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 9dee1bb8f21c..71f307a572e9 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2265,8 +2265,7 @@  int __init map_irq_to_domain(struct domain *d, unsigned int irq,
     res = irq_permit_access(d, irq);
     if ( res )
     {
-        printk(XENLOG_ERR "Unable to permit to dom%u access to IRQ %u\n",
-               d->domain_id, irq);
+        printk(XENLOG_ERR "Unable to permit to %pd access to IRQ %u\n", d, irq);
         return res;
     }
 
@@ -2282,8 +2281,7 @@  int __init map_irq_to_domain(struct domain *d, unsigned int irq,
         res = route_irq_to_guest(d, irq, irq, devname);
         if ( res < 0 )
         {
-            printk(XENLOG_ERR "Unable to map IRQ%"PRId32" to dom%d\n",
-                   irq, d->domain_id);
+            printk(XENLOG_ERR "Unable to map IRQ%u to %pd\n", irq, d);
             return res;
         }
     }
@@ -2303,8 +2301,7 @@  static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 
     if ( irq < NR_LOCAL_IRQS )
     {
-        printk(XENLOG_ERR "%s: IRQ%"PRId32" is not a SPI\n",
-               dt_node_name(dev), irq);
+        printk(XENLOG_ERR "%s: IRQ%u is not a SPI\n", dt_node_name(dev), irq);
         return -EINVAL;
     }
 
@@ -2312,9 +2309,8 @@  static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
     res = irq_set_spi_type(irq, dt_irq->type);
     if ( res )
     {
-        printk(XENLOG_ERR
-               "%s: Unable to setup IRQ%"PRId32" to dom%d\n",
-               dt_node_name(dev), irq, d->domain_id);
+        printk(XENLOG_ERR "%s: Unable to setup IRQ%u to %pd\n",
+               dt_node_name(dev), irq, d);
         return res;
     }