diff mbox series

hw/xen: Don't use '#' flag of printf format

Message ID 20201104133709.3326630-1-zhangxinhao1@huawei.com (mailing list archive)
State New
Headers show
Series hw/xen: Don't use '#' flag of printf format | expand

Commit Message

Xinhao Zhang Nov. 4, 2020, 1:37 p.m. UTC
Fix code style. Don't use '#' flag of printf format ('%#') in
format strings, use '0x' prefix instead

Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com>
Signed-off-by: Kai Deng <dengkai1@huawei.com>
---
 hw/xen/xen_pt.c             | 10 +++++-----
 hw/xen/xen_pt_config_init.c |  6 +++---
 hw/xen/xen_pt_msi.c         | 16 ++++++++--------
 3 files changed, 16 insertions(+), 16 deletions(-)

Comments

Anthony PERARD Nov. 5, 2020, 3:49 p.m. UTC | #1
On Wed, Nov 04, 2020 at 09:37:09PM +0800, Xinhao Zhang wrote:
> Fix code style. Don't use '#' flag of printf format ('%#') in
> format strings, use '0x' prefix instead
> 
> Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com>
> Signed-off-by: Kai Deng <dengkai1@huawei.com>

Acked-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,
Laurent Vivier Dec. 13, 2020, 4:01 p.m. UTC | #2
Le 04/11/2020 à 14:37, Xinhao Zhang a écrit :
> Fix code style. Don't use '#' flag of printf format ('%#') in
> format strings, use '0x' prefix instead
> 
> Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com>
> Signed-off-by: Kai Deng <dengkai1@huawei.com>
> ---
>  hw/xen/xen_pt.c             | 10 +++++-----
>  hw/xen/xen_pt_config_init.c |  6 +++---
>  hw/xen/xen_pt_msi.c         | 16 ++++++++--------
>  3 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
> index 6d359ee486..a5f3dd590c 100644
> --- a/hw/xen/xen_pt.c
> +++ b/hw/xen/xen_pt.c
> @@ -489,7 +489,7 @@ static int xen_pt_register_regions(XenPCIPassthroughState *s, uint16_t *cmd)
>          pci_register_bar(&s->dev, i, type, &s->bar[i]);
>  
>          XEN_PT_LOG(&s->dev, "IO region %i registered (size=0x%08"PRIx64
> -                   " base_addr=0x%08"PRIx64" type: %#x)\n",
> +                   " base_addr=0x%08"PRIx64" type: 0x%x)\n",
>                     i, r->size, r->base_addr, type);
>      }
>  
> @@ -578,7 +578,7 @@ static void xen_pt_check_bar_overlap(PCIBus *bus, PCIDevice *d, void *opaque)
>          if (ranges_overlap(arg->addr, arg->size, r->addr, r->size)) {
>              XEN_PT_WARN(&s->dev,
>                          "Overlapped to device [%02x:%02x.%d] Region: %i"
> -                        " (addr: %#"FMT_PCIBUS", len: %#"FMT_PCIBUS")\n",
> +                        " (addr: 0x%"FMT_PCIBUS", len: 0x%"FMT_PCIBUS")\n",
>                          pci_bus_num(bus), PCI_SLOT(d->devfn),
>                          PCI_FUNC(d->devfn), i, r->addr, r->size);
>              arg->rc = true;
> @@ -618,8 +618,8 @@ static void xen_pt_region_update(XenPCIPassthroughState *s,
>      pci_for_each_device(pci_get_bus(d), pci_dev_bus_num(d),
>                          xen_pt_check_bar_overlap, &args);
>      if (args.rc) {
> -        XEN_PT_WARN(d, "Region: %d (addr: %#"FMT_PCIBUS
> -                    ", len: %#"FMT_PCIBUS") is overlapped.\n",
> +        XEN_PT_WARN(d, "Region: %d (addr: 0x%"FMT_PCIBUS
> +                    ", len: 0x%"FMT_PCIBUS") is overlapped.\n",
>                      bar, sec->offset_within_address_space,
>                      int128_get64(sec->size));
>      }
> @@ -786,7 +786,7 @@ static void xen_pt_realize(PCIDevice *d, Error **errp)
>  
>      /* register real device */
>      XEN_PT_LOG(d, "Assigning real physical device %02x:%02x.%d"
> -               " to devfn %#x\n",
> +               " to devfn 0x%x\n",
>                 s->hostaddr.bus, s->hostaddr.slot, s->hostaddr.function,
>                 s->dev.devfn);
>  
> diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c
> index c8724cc7c8..c5c4e943a8 100644
> --- a/hw/xen/xen_pt_config_init.c
> +++ b/hw/xen/xen_pt_config_init.c
> @@ -1622,7 +1622,7 @@ static int xen_pt_pcie_size_init(XenPCIPassthroughState *s,
>          case PCI_EXP_TYPE_PCIE_BRIDGE:
>          case PCI_EXP_TYPE_RC_EC:
>          default:
> -            XEN_PT_ERR(d, "Unsupported device/port type %#x.\n", type);
> +            XEN_PT_ERR(d, "Unsupported device/port type 0x%x.\n", type);
>              return -1;
>          }
>      }
> @@ -1645,11 +1645,11 @@ static int xen_pt_pcie_size_init(XenPCIPassthroughState *s,
>          case PCI_EXP_TYPE_PCIE_BRIDGE:
>          case PCI_EXP_TYPE_RC_EC:
>          default:
> -            XEN_PT_ERR(d, "Unsupported device/port type %#x.\n", type);
> +            XEN_PT_ERR(d, "Unsupported device/port type 0x%x.\n", type);
>              return -1;
>          }
>      } else {
> -        XEN_PT_ERR(d, "Unsupported capability version %#x.\n", version);
> +        XEN_PT_ERR(d, "Unsupported capability version 0x%x.\n", version);
>          return -1;
>      }
>  
> diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
> index fb4b887b92..b71563f98a 100644
> --- a/hw/xen/xen_pt_msi.c
> +++ b/hw/xen/xen_pt_msi.c
> @@ -123,7 +123,7 @@ static int msi_msix_setup(XenPCIPassthroughState *s,
>              *ppirq = XEN_PT_UNASSIGNED_PIRQ;
>          } else {
>              XEN_PT_LOG(&s->dev, "requested pirq %d for MSI%s"
> -                       " (vec: %#x, entry: %#x)\n",
> +                       " (vec: 0x%x, entry: 0x%x)\n",
>                         *ppirq, is_msix ? "-X" : "", gvec, msix_entry);
>          }
>      }
> @@ -142,7 +142,7 @@ static int msi_msix_setup(XenPCIPassthroughState *s,
>                                       msix_entry, table_base);
>          if (rc) {
>              XEN_PT_ERR(&s->dev,
> -                       "Mapping of MSI%s (err: %i, vec: %#x, entry %#x)\n",
> +                       "Mapping of MSI%s (err: %i, vec: 0x%x, entry 0x%x)\n",
>                         is_msix ? "-X" : "", errno, gvec, msix_entry);
>              return rc;
>          }
> @@ -165,8 +165,8 @@ static int msi_msix_update(XenPCIPassthroughState *s,
>      int rc = 0;
>      uint64_t table_addr = 0;
>  
> -    XEN_PT_LOG(d, "Updating MSI%s with pirq %d gvec %#x gflags %#x"
> -               " (entry: %#x)\n",
> +    XEN_PT_LOG(d, "Updating MSI%s with pirq %d gvec 0x%x gflags 0x%x"
> +               " (entry: 0x%x)\n",
>                 is_msix ? "-X" : "", pirq, gvec, gflags, msix_entry);
>  
>      if (is_msix) {
> @@ -208,11 +208,11 @@ static int msi_msix_disable(XenPCIPassthroughState *s,
>      }
>  
>      if (is_binded) {
> -        XEN_PT_LOG(d, "Unbind MSI%s with pirq %d, gvec %#x\n",
> +        XEN_PT_LOG(d, "Unbind MSI%s with pirq %d, gvec 0x%x\n",
>                     is_msix ? "-X" : "", pirq, gvec);
>          rc = xc_domain_unbind_msi_irq(xen_xc, xen_domid, gvec, pirq, gflags);
>          if (rc) {
> -            XEN_PT_ERR(d, "Unbinding of MSI%s failed. (err: %d, pirq: %d, gvec: %#x)\n",
> +            XEN_PT_ERR(d, "Unbinding of MSI%s failed. (err: %d, pirq: %d, gvec: 0x%x)\n",
>                         is_msix ? "-X" : "", errno, pirq, gvec);
>              return rc;
>          }
> @@ -539,7 +539,7 @@ int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base)
>      }
>  
>      if (id != PCI_CAP_ID_MSIX) {
> -        XEN_PT_ERR(d, "Invalid id %#x base %#x\n", id, base);
> +        XEN_PT_ERR(d, "Invalid id 0x%x base 0x%x\n", id, base);
>          return -1;
>      }
>  
> @@ -582,7 +582,7 @@ int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base)
>          XEN_PT_ERR(d, "Can't open /dev/mem: %s\n", strerror(errno));
>          goto error_out;
>      }
> -    XEN_PT_LOG(d, "table_off = %#x, total_entries = %d\n",
> +    XEN_PT_LOG(d, "table_off = 0x%x, total_entries = %d\n",
>                 table_off, total_entries);
>      msix->table_offset_adjust = table_off & 0x0fff;
>      msix->phys_iomem_base =
> 

Applied to my trivial-patches branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index 6d359ee486..a5f3dd590c 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -489,7 +489,7 @@  static int xen_pt_register_regions(XenPCIPassthroughState *s, uint16_t *cmd)
         pci_register_bar(&s->dev, i, type, &s->bar[i]);
 
         XEN_PT_LOG(&s->dev, "IO region %i registered (size=0x%08"PRIx64
-                   " base_addr=0x%08"PRIx64" type: %#x)\n",
+                   " base_addr=0x%08"PRIx64" type: 0x%x)\n",
                    i, r->size, r->base_addr, type);
     }
 
@@ -578,7 +578,7 @@  static void xen_pt_check_bar_overlap(PCIBus *bus, PCIDevice *d, void *opaque)
         if (ranges_overlap(arg->addr, arg->size, r->addr, r->size)) {
             XEN_PT_WARN(&s->dev,
                         "Overlapped to device [%02x:%02x.%d] Region: %i"
-                        " (addr: %#"FMT_PCIBUS", len: %#"FMT_PCIBUS")\n",
+                        " (addr: 0x%"FMT_PCIBUS", len: 0x%"FMT_PCIBUS")\n",
                         pci_bus_num(bus), PCI_SLOT(d->devfn),
                         PCI_FUNC(d->devfn), i, r->addr, r->size);
             arg->rc = true;
@@ -618,8 +618,8 @@  static void xen_pt_region_update(XenPCIPassthroughState *s,
     pci_for_each_device(pci_get_bus(d), pci_dev_bus_num(d),
                         xen_pt_check_bar_overlap, &args);
     if (args.rc) {
-        XEN_PT_WARN(d, "Region: %d (addr: %#"FMT_PCIBUS
-                    ", len: %#"FMT_PCIBUS") is overlapped.\n",
+        XEN_PT_WARN(d, "Region: %d (addr: 0x%"FMT_PCIBUS
+                    ", len: 0x%"FMT_PCIBUS") is overlapped.\n",
                     bar, sec->offset_within_address_space,
                     int128_get64(sec->size));
     }
@@ -786,7 +786,7 @@  static void xen_pt_realize(PCIDevice *d, Error **errp)
 
     /* register real device */
     XEN_PT_LOG(d, "Assigning real physical device %02x:%02x.%d"
-               " to devfn %#x\n",
+               " to devfn 0x%x\n",
                s->hostaddr.bus, s->hostaddr.slot, s->hostaddr.function,
                s->dev.devfn);
 
diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c
index c8724cc7c8..c5c4e943a8 100644
--- a/hw/xen/xen_pt_config_init.c
+++ b/hw/xen/xen_pt_config_init.c
@@ -1622,7 +1622,7 @@  static int xen_pt_pcie_size_init(XenPCIPassthroughState *s,
         case PCI_EXP_TYPE_PCIE_BRIDGE:
         case PCI_EXP_TYPE_RC_EC:
         default:
-            XEN_PT_ERR(d, "Unsupported device/port type %#x.\n", type);
+            XEN_PT_ERR(d, "Unsupported device/port type 0x%x.\n", type);
             return -1;
         }
     }
@@ -1645,11 +1645,11 @@  static int xen_pt_pcie_size_init(XenPCIPassthroughState *s,
         case PCI_EXP_TYPE_PCIE_BRIDGE:
         case PCI_EXP_TYPE_RC_EC:
         default:
-            XEN_PT_ERR(d, "Unsupported device/port type %#x.\n", type);
+            XEN_PT_ERR(d, "Unsupported device/port type 0x%x.\n", type);
             return -1;
         }
     } else {
-        XEN_PT_ERR(d, "Unsupported capability version %#x.\n", version);
+        XEN_PT_ERR(d, "Unsupported capability version 0x%x.\n", version);
         return -1;
     }
 
diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
index fb4b887b92..b71563f98a 100644
--- a/hw/xen/xen_pt_msi.c
+++ b/hw/xen/xen_pt_msi.c
@@ -123,7 +123,7 @@  static int msi_msix_setup(XenPCIPassthroughState *s,
             *ppirq = XEN_PT_UNASSIGNED_PIRQ;
         } else {
             XEN_PT_LOG(&s->dev, "requested pirq %d for MSI%s"
-                       " (vec: %#x, entry: %#x)\n",
+                       " (vec: 0x%x, entry: 0x%x)\n",
                        *ppirq, is_msix ? "-X" : "", gvec, msix_entry);
         }
     }
@@ -142,7 +142,7 @@  static int msi_msix_setup(XenPCIPassthroughState *s,
                                      msix_entry, table_base);
         if (rc) {
             XEN_PT_ERR(&s->dev,
-                       "Mapping of MSI%s (err: %i, vec: %#x, entry %#x)\n",
+                       "Mapping of MSI%s (err: %i, vec: 0x%x, entry 0x%x)\n",
                        is_msix ? "-X" : "", errno, gvec, msix_entry);
             return rc;
         }
@@ -165,8 +165,8 @@  static int msi_msix_update(XenPCIPassthroughState *s,
     int rc = 0;
     uint64_t table_addr = 0;
 
-    XEN_PT_LOG(d, "Updating MSI%s with pirq %d gvec %#x gflags %#x"
-               " (entry: %#x)\n",
+    XEN_PT_LOG(d, "Updating MSI%s with pirq %d gvec 0x%x gflags 0x%x"
+               " (entry: 0x%x)\n",
                is_msix ? "-X" : "", pirq, gvec, gflags, msix_entry);
 
     if (is_msix) {
@@ -208,11 +208,11 @@  static int msi_msix_disable(XenPCIPassthroughState *s,
     }
 
     if (is_binded) {
-        XEN_PT_LOG(d, "Unbind MSI%s with pirq %d, gvec %#x\n",
+        XEN_PT_LOG(d, "Unbind MSI%s with pirq %d, gvec 0x%x\n",
                    is_msix ? "-X" : "", pirq, gvec);
         rc = xc_domain_unbind_msi_irq(xen_xc, xen_domid, gvec, pirq, gflags);
         if (rc) {
-            XEN_PT_ERR(d, "Unbinding of MSI%s failed. (err: %d, pirq: %d, gvec: %#x)\n",
+            XEN_PT_ERR(d, "Unbinding of MSI%s failed. (err: %d, pirq: %d, gvec: 0x%x)\n",
                        is_msix ? "-X" : "", errno, pirq, gvec);
             return rc;
         }
@@ -539,7 +539,7 @@  int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base)
     }
 
     if (id != PCI_CAP_ID_MSIX) {
-        XEN_PT_ERR(d, "Invalid id %#x base %#x\n", id, base);
+        XEN_PT_ERR(d, "Invalid id 0x%x base 0x%x\n", id, base);
         return -1;
     }
 
@@ -582,7 +582,7 @@  int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base)
         XEN_PT_ERR(d, "Can't open /dev/mem: %s\n", strerror(errno));
         goto error_out;
     }
-    XEN_PT_LOG(d, "table_off = %#x, total_entries = %d\n",
+    XEN_PT_LOG(d, "table_off = 0x%x, total_entries = %d\n",
                table_off, total_entries);
     msix->table_offset_adjust = table_off & 0x0fff;
     msix->phys_iomem_base =