diff mbox

[PATCHv2] i2c: i2c-imx: Fix format warning for dev_dbg

Message ID 1407296708-12563-1-git-send-email-Li.Xiubo@freescale.com
State Accepted
Headers show

Commit Message

Xiubo Li Aug. 6, 2014, 3:45 a.m. UTC
drivers/i2c/busses/i2c-imx.c: In function i2c_imx_probe()
drivers/i2c/busses/i2c-imx.c:689:2: warning: format 0x%x expects argument
of type unsigned int, but argument 4 has type resource_size_t [-Wformat=]
  dev_dbg(&i2c_imx->adapter.dev, "device resources from 0x%x to 0x%x\n",
  ^
drivers/i2c/busses/i2c-imx.c:689:2: warning: format 0x%x expects argument
of type unsigned int, but argument 5 has type resource_size_t [-Wformat=]

drivers/i2c/busses/i2c-imx.c:691:2: warning: format %d expects argument
of type int, but argument 4 has type resource_size_t [-Wformat=]
  dev_dbg(&i2c_imx->adapter.dev, "allocated %d bytes at 0x%x\n",
  ^
drivers/i2c/busses/i2c-imx.c:691:2: warning: format 0x%x expects argument
of type unsigned int, but argument 5 has type resource_size_t [-Wformat=]

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---

Change in v2:
- Follow Joe Perches's advice.





 drivers/i2c/busses/i2c-imx.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Jingoo Han Aug. 6, 2014, 4:23 a.m. UTC | #1
On Wednesday, August 06, 2014 12:45 PM, Xiubo Li wrote:

The subject of the commit looks too general.
How about the following?

i2c: i2c-imx: Use printf extension %pR for struct resource

Best regards,
Jingoo Han

> 
> drivers/i2c/busses/i2c-imx.c: In function i2c_imx_probe()
> drivers/i2c/busses/i2c-imx.c:689:2: warning: format 0x%x expects argument
> of type unsigned int, but argument 4 has type resource_size_t [-Wformat=]
>   dev_dbg(&i2c_imx->adapter.dev, "device resources from 0x%x to 0x%x\n",
>   ^
> drivers/i2c/busses/i2c-imx.c:689:2: warning: format 0x%x expects argument
> of type unsigned int, but argument 5 has type resource_size_t [-Wformat=]
> 
> drivers/i2c/busses/i2c-imx.c:691:2: warning: format %d expects argument
> of type int, but argument 4 has type resource_size_t [-Wformat=]
>   dev_dbg(&i2c_imx->adapter.dev, "allocated %d bytes at 0x%x\n",
>   ^
> drivers/i2c/busses/i2c-imx.c:691:2: warning: format 0x%x expects argument
> of type unsigned int, but argument 5 has type resource_size_t [-Wformat=]
> 
> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> ---
> 
> Change in v2:
> - Follow Joe Perches's advice.
> 
> 
> 
> 
> 
>  drivers/i2c/busses/i2c-imx.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 1d7efa3..b8a9543 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -686,10 +686,7 @@ static int i2c_imx_probe(struct platform_device *pdev)
>  	clk_disable_unprepare(i2c_imx->clk);
> 
>  	dev_dbg(&i2c_imx->adapter.dev, "claimed irq %d\n", irq);
> -	dev_dbg(&i2c_imx->adapter.dev, "device resources from 0x%x to 0x%x\n",
> -		res->start, res->end);
> -	dev_dbg(&i2c_imx->adapter.dev, "allocated %d bytes at 0x%x\n",
> -		resource_size(res), res->start);
> +	dev_dbg(&i2c_imx->adapter.dev, "device resources: %pR\n", res);
>  	dev_dbg(&i2c_imx->adapter.dev, "adapter name: \"%s\"\n",
>  		i2c_imx->adapter.name);
>  	dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
> --
> 1.8.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Xiubo Li Aug. 6, 2014, 5:09 a.m. UTC | #2
Hi Jingoo,

Thanks for your advice.

This patch is mainly resolving the warning issue. And some
thing like : 'i2c: i2c-imx: Fix format warning for dev_db'
Could be more obvious.

I think adding 'printf extension %pR for struct resource'
to the commit comment will better.

BRs
Xiubo
 



> -----Original Message-----
> From: Jingoo Han [mailto:jg1.han@samsung.com]
> Sent: Wednesday, August 06, 2014 12:24 PM
> To: Xiubo Li-B47053
> Cc: wsa@the-dreams.de; linux-i2c@vger.kernel.org; joe@perches.com;
> s.hauer@pengutronix.de; u.kleine-koenig@pengutronix.de; linux-
> kernel@vger.kernel.org; Lu Jingchang-B35083; 'Jingoo Han'
> Subject: Re: [PATCHv2] i2c: i2c-imx: Fix format warning for dev_dbg
> 
> On Wednesday, August 06, 2014 12:45 PM, Xiubo Li wrote:
> 
> The subject of the commit looks too general.
> How about the following?
> 
> i2c: i2c-imx: Use printf extension %pR for struct resource
> 
> Best regards,
> Jingoo Han
> 
> >
> > drivers/i2c/busses/i2c-imx.c: In function i2c_imx_probe()
> > drivers/i2c/busses/i2c-imx.c:689:2: warning: format 0x%x expects argument
> > of type unsigned int, but argument 4 has type resource_size_t [-Wformat=]
> >   dev_dbg(&i2c_imx->adapter.dev, "device resources from 0x%x to 0x%x\n",
> >   ^
> > drivers/i2c/busses/i2c-imx.c:689:2: warning: format 0x%x expects argument
> > of type unsigned int, but argument 5 has type resource_size_t [-Wformat=]
> >
> > drivers/i2c/busses/i2c-imx.c:691:2: warning: format %d expects argument
> > of type int, but argument 4 has type resource_size_t [-Wformat=]
> >   dev_dbg(&i2c_imx->adapter.dev, "allocated %d bytes at 0x%x\n",
> >   ^
> > drivers/i2c/busses/i2c-imx.c:691:2: warning: format 0x%x expects argument
> > of type unsigned int, but argument 5 has type resource_size_t [-Wformat=]
> >
> > Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> > ---
> >
> > Change in v2:
> > - Follow Joe Perches's advice.
> >
> >
> >
> >
> >
> >  drivers/i2c/busses/i2c-imx.c | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> > index 1d7efa3..b8a9543 100644
> > --- a/drivers/i2c/busses/i2c-imx.c
> > +++ b/drivers/i2c/busses/i2c-imx.c
> > @@ -686,10 +686,7 @@ static int i2c_imx_probe(struct platform_device *pdev)
> >  	clk_disable_unprepare(i2c_imx->clk);
> >
> >  	dev_dbg(&i2c_imx->adapter.dev, "claimed irq %d\n", irq);
> > -	dev_dbg(&i2c_imx->adapter.dev, "device resources from 0x%x to 0x%x\n",
> > -		res->start, res->end);
> > -	dev_dbg(&i2c_imx->adapter.dev, "allocated %d bytes at 0x%x\n",
> > -		resource_size(res), res->start);
> > +	dev_dbg(&i2c_imx->adapter.dev, "device resources: %pR\n", res);
> >  	dev_dbg(&i2c_imx->adapter.dev, "adapter name: \"%s\"\n",
> >  		i2c_imx->adapter.name);
> >  	dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
> > --
> > 1.8.5

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Aug. 6, 2014, 7 p.m. UTC | #3
On Wed, Aug 06, 2014 at 11:45:08AM +0800, Xiubo Li wrote:
> drivers/i2c/busses/i2c-imx.c: In function i2c_imx_probe()
> drivers/i2c/busses/i2c-imx.c:689:2: warning: format 0x%x expects argument
> of type unsigned int, but argument 4 has type resource_size_t [-Wformat=]
>   dev_dbg(&i2c_imx->adapter.dev, "device resources from 0x%x to 0x%x\n",
>   ^
> drivers/i2c/busses/i2c-imx.c:689:2: warning: format 0x%x expects argument
> of type unsigned int, but argument 5 has type resource_size_t [-Wformat=]
> 
> drivers/i2c/busses/i2c-imx.c:691:2: warning: format %d expects argument
> of type int, but argument 4 has type resource_size_t [-Wformat=]
>   dev_dbg(&i2c_imx->adapter.dev, "allocated %d bytes at 0x%x\n",
>   ^
> drivers/i2c/busses/i2c-imx.c:691:2: warning: format 0x%x expects argument
> of type unsigned int, but argument 5 has type resource_size_t [-Wformat=]
> 
> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>

Applied to for-next, thanks!
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 1d7efa3..b8a9543 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -686,10 +686,7 @@  static int i2c_imx_probe(struct platform_device *pdev)
 	clk_disable_unprepare(i2c_imx->clk);
 
 	dev_dbg(&i2c_imx->adapter.dev, "claimed irq %d\n", irq);
-	dev_dbg(&i2c_imx->adapter.dev, "device resources from 0x%x to 0x%x\n",
-		res->start, res->end);
-	dev_dbg(&i2c_imx->adapter.dev, "allocated %d bytes at 0x%x\n",
-		resource_size(res), res->start);
+	dev_dbg(&i2c_imx->adapter.dev, "device resources: %pR\n", res);
 	dev_dbg(&i2c_imx->adapter.dev, "adapter name: \"%s\"\n",
 		i2c_imx->adapter.name);
 	dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");