2015-11-24 19:16:36

by Dmitry Krivenok

[permalink] [raw]
Subject: [PATCH 1/1] Remove unneeded "0x" when %pa formatting is used.

Do not use "0x" in front of %pa, %pap and %pad to avoid
duplicate "0x" in the output.

Signed-off-by: Dmitry V. Krivenok <[email protected]>
---
drivers/dma/at_hdmac_regs.h | 2 +-
drivers/i2c/busses/i2c-st.c | 2 +-
drivers/nvdimm/pmem.c | 2 +-
drivers/of/fdt.c | 2 +-
drivers/pci/host/pcie-iproc.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index 7f58f06..0474e4a 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -385,7 +385,7 @@ static void vdbg_dump_regs(struct at_dma_chan *atchan) {}
static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli)
{
dev_crit(chan2dev(&atchan->chan_common),
- " desc: s%pad d%pad ctrl0x%x:0x%x l0x%pad\n",
+ " desc: s%pad d%pad ctrl0x%x:0x%x l%pad\n",
&lli->saddr, &lli->daddr,
lli->ctrla, lli->ctrlb, &lli->dscr);
}
diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
index ea72dca..25020ec 100644
--- a/drivers/i2c/busses/i2c-st.c
+++ b/drivers/i2c/busses/i2c-st.c
@@ -822,7 +822,7 @@ static int st_i2c_probe(struct platform_device *pdev)

adap = &i2c_dev->adap;
i2c_set_adapdata(adap, i2c_dev);
- snprintf(adap->name, sizeof(adap->name), "ST I2C(0x%pa)", &res->start);
+ snprintf(adap->name, sizeof(adap->name), "ST I2C(%pa)", &res->start);
adap->owner = THIS_MODULE;
adap->timeout = 2 * HZ;
adap->retries = 0;
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 8ee7989..93396f4 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -135,7 +135,7 @@ static struct pmem_device *pmem_alloc(struct device *dev,

if (!devm_request_mem_region(dev, pmem->phys_addr, pmem->size,
dev_name(dev))) {
- dev_warn(dev, "could not reserve region [0x%pa:0x%zx]\n",
+ dev_warn(dev, "could not reserve region [%pa:0x%zx]\n",
&pmem->phys_addr, pmem->size);
return ERR_PTR(-EBUSY);
}
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d243029..1bbe3a9 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1041,7 +1041,7 @@ void __init __weak
early_init_dt_add_memory_arch(u64 base, u64 size)
int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
phys_addr_t size, bool nomap)
{
- pr_err("Reserved memory not supported, ignoring range 0x%pa - 0x%pa%s\n",
+ pr_err("Reserved memory not supported, ignoring range %pa - %pa%s\n",
&base, &size, nomap ? " (nomap)" : "");
return -ENOSYS;
}
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index eac719a..d1ad883 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -245,7 +245,7 @@ static int iproc_pcie_setup_ob(struct iproc_pcie
*pcie, u64 axi_addr,

if (size > max_size) {
dev_err(pcie->dev,
- "res size 0x%pap exceeds max supported size 0x%llx\n",
+ "res size %pap exceeds max supported size 0x%llx\n",
&size, max_size);
return -EINVAL;
}
--
2.6.2


2015-11-25 20:19:29

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 1/1] Remove unneeded "0x" when %pa formatting is used.

On Tue, Nov 24, 2015 at 9:16 PM, Dmitry Krivenok
<[email protected]> wrote:
> Do not use "0x" in front of %pa, %pap and %pad to avoid
> duplicate "0x" in the output.

First of all, please, split per subsystem / driver. Here seems one
file — one patch.
And one comment below.

>
> Signed-off-by: Dmitry V. Krivenok <[email protected]>
> ---
> drivers/dma/at_hdmac_regs.h | 2 +-
> drivers/i2c/busses/i2c-st.c | 2 +-
> drivers/nvdimm/pmem.c | 2 +-
> drivers/of/fdt.c | 2 +-
> drivers/pci/host/pcie-iproc.c | 2 +-
> 5 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
> index 7f58f06..0474e4a 100644
> --- a/drivers/dma/at_hdmac_regs.h
> +++ b/drivers/dma/at_hdmac_regs.h
> @@ -385,7 +385,7 @@ static void vdbg_dump_regs(struct at_dma_chan *atchan) {}
> static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli)
> {
> dev_crit(chan2dev(&atchan->chan_common),
> - " desc: s%pad d%pad ctrl0x%x:0x%x l0x%pad\n",
> + " desc: s%pad d%pad ctrl0x%x:0x%x l%pad\n",
> &lli->saddr, &lli->daddr,
> lli->ctrla, lli->ctrlb, &lli->dscr);
> }
> diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
> index ea72dca..25020ec 100644
> --- a/drivers/i2c/busses/i2c-st.c
> +++ b/drivers/i2c/busses/i2c-st.c
> @@ -822,7 +822,7 @@ static int st_i2c_probe(struct platform_device *pdev)
>
> adap = &i2c_dev->adap;
> i2c_set_adapdata(adap, i2c_dev);
> - snprintf(adap->name, sizeof(adap->name), "ST I2C(0x%pa)", &res->start);
> + snprintf(adap->name, sizeof(adap->name), "ST I2C(%pa)", &res->start);
> adap->owner = THIS_MODULE;
> adap->timeout = 2 * HZ;
> adap->retries = 0;
> diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
> index 8ee7989..93396f4 100644
> --- a/drivers/nvdimm/pmem.c
> +++ b/drivers/nvdimm/pmem.c
> @@ -135,7 +135,7 @@ static struct pmem_device *pmem_alloc(struct device *dev,
>
> if (!devm_request_mem_region(dev, pmem->phys_addr, pmem->size,
> dev_name(dev))) {
> - dev_warn(dev, "could not reserve region [0x%pa:0x%zx]\n",
> + dev_warn(dev, "could not reserve region [%pa:0x%zx]\n",
> &pmem->phys_addr, pmem->size);
> return ERR_PTR(-EBUSY);
> }
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index d243029..1bbe3a9 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1041,7 +1041,7 @@ void __init __weak
> early_init_dt_add_memory_arch(u64 base, u64 size)
> int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
> phys_addr_t size, bool nomap)
> {
> - pr_err("Reserved memory not supported, ignoring range 0x%pa - 0x%pa%s\n",
> + pr_err("Reserved memory not supported, ignoring range %pa - %pa%s\n",
> &base, &size, nomap ? " (nomap)" : "");
> return -ENOSYS;
> }
> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> index eac719a..d1ad883 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -245,7 +245,7 @@ static int iproc_pcie_setup_ob(struct iproc_pcie
> *pcie, u64 axi_addr,
>
> if (size > max_size) {
> dev_err(pcie->dev,
> - "res size 0x%pap exceeds max supported size 0x%llx\n",
> + "res size %pap exceeds max supported size 0x%llx\n",

%pa also works.

> &size, max_size);

--
With Best Regards,
Andy Shevchenko

2015-11-30 20:33:12

by Dmitry Krivenok

[permalink] [raw]
Subject: Re: [PATCH 1/1] Remove unneeded "0x" when %pa formatting is used.

> First of all, please, split per subsystem / driver. Here seems one
> file — one patch.

Sure, will do.

>> if (size > max_size) {
>> dev_err(pcie->dev,
>> - "res size 0x%pap exceeds max supported size 0x%llx\n",
>> + "res size %pap exceeds max supported size 0x%llx\n",
>
> %pa also works.
>

Yes, but AFAIK %pap and %pa are identical (see address_val() in lib/vsprintf.c),
so I'm not sure I understand your comment.

Did you mean that %pa should be used instead of %pap?
I see that %pa is used much more often than %pap, but I didn't find any
evidence that %pap is deprecated.

Thanks,
Dmitry

2015-12-13 01:13:48

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 1/1] Remove unneeded "0x" when %pa formatting is used.

On Mon, Nov 30, 2015 at 10:33 PM, Dmitry Krivenok
<[email protected]> wrote:
>>> if (size > max_size) {
>>> dev_err(pcie->dev,
>>> - "res size 0x%pap exceeds max supported size 0x%llx\n",
>>> + "res size %pap exceeds max supported size 0x%llx\n",
>>
>> %pa also works.
>>
>
> Yes, but AFAIK %pap and %pa are identical (see address_val() in lib/vsprintf.c),
> so I'm not sure I understand your comment.
>
> Did you mean that %pa should be used instead of %pap?
> I see that %pa is used much more often than %pap, but I didn't find any
> evidence that %pap is deprecated.

+Rasmus.

No, it's not, but it explicitly for phys_addr_t (it might be nice to
to have %par, for example for explicitly shown that is for
resource_size_t, Rasmus?).

For my opinion for resources better to use %pa for now, though %pap
will work as well.

--
With Best Regards,
Andy Shevchenko