[i2c] [PATCH] i2c-s3c2410.c: Fix build warning

Jean Delvare khali at linux-fr.org
Sat May 5 21:58:37 CEST 2007


Hi Arnaud,

On Sat, 05 May 2007 16:02:20 +0200, Arnaud Patard (Rtp) wrote:
> 
> Fix for the following build warning :
>   CC      drivers/i2c/busses/i2c-s3c2410.o drivers/i2c/busses/i2c-s3c2410.c: In function 's3c24xx_i2c_probe':
>   drivers/i2c/busses/i2c-s3c2410.c:839: warning: format '%ld' expects type 'long int', but argument 4 has type 'resource_size_t'
> 
> Signed-off-by: Arnaud Patard <arnaud.patard at rtp-net.org>

> ---
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index 556f244..674ca30 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -836,7 +836,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
>  
>  	i2c->irq = res;
>  		
> -	dev_dbg(&pdev->dev, "irq resource %p (%ld)\n", res, res->start);
> +	dev_dbg(&pdev->dev, "irq resource %p (%zd)\n", res, res->start);
>  
>  	ret = i2c_add_adapter(&i2c->adap);
>  	if (ret < 0) {

I'm not sure this is the right fix. resource_size_t might be either u32
or u64 depending on CONFIG_RESOURCES_64BIT, so I suspect that you are
clearing the warning in one case but adding it in the other. As a
matter of fact, I couldn't find any other example in the kernel tree of
%zd, %zu or %zx being used to print a resource boundary.

So I think that it would be better to keep %ld and cast res->start to
an unsigned long. Ben, what do you think?

-- 
Jean Delvare



More information about the i2c mailing list