[PATCH v3 2/5] ocxl: Clean up printf formats
Joe Perches
joe at perches.com
Thu Mar 21 04:24:41 AEDT 2019
On Wed, 2019-03-20 at 16:34 +1100, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair at d-silva.org>
>
> Use %# instead of using a literal '0x'
I do not suggest this as reasonable.
There are 10's of thousands of uses of 0x%x in the kernel
and converting them to save a byte seems unnecessary.
$ git grep -P '0x%[\*\d\.]*[xX]' | wc -l
26120
And the %#x style is by far the lesser used form
$ git grep -P '%#[\*\d\.]*[xX]' | wc -l
2726
Also, the sized form of %#[size]x is frequently misused
where the size does not account for the initial 0x output.
> 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);
etc...
More information about the Linuxppc-dev
mailing list