Re: [PATCH 2/5] ocxl: Clean up printf formats

From: Joe Perches
Date: Fri Mar 01 2019 - 20:13:16 EST


On Wed, 2019-02-27 at 15:57 +1100, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@xxxxxxxxxxx>
>
> Use %# instead of using a literal '0x'

<shrug> I think it's better not to change this unless
the compilation unit already uses a mix of styles.

Overall, the kernel uses "0x%<hex type>" over "%#<hex type>"
by ~8:1

$ git grep -P '0x%\d*[hl]*x' | wc -l
27654
$ git grep -P '%#\d*[hl]*x' | wc -l
3454

> diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c
[]
> @@ -178,9 +178,9 @@ static int read_dvsec_vendor(struct pci_dev *dev)
> pci_read_config_dword(dev, pos + OCXL_DVSEC_VENDOR_DLX_VERS, &dlx);
>
> dev_dbg(&dev->dev, "Vendor specific DVSEC:\n");
> - dev_dbg(&dev->dev, " CFG version = 0x%x\n", cfg);
> - dev_dbg(&dev->dev, " TLX version = 0x%x\n", tlx);
> - dev_dbg(&dev->dev, " DLX version = 0x%x\n", dlx);
> + dev_dbg(&dev->dev, " CFG version = %#x\n", cfg);
> + dev_dbg(&dev->dev, " TLX version = %#x\n", tlx);
> + dev_dbg(&dev->dev, " DLX version = %#x\n", dlx);
[...]