lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 5 Aug 2011 09:24:40 +0200
From:	Sam Ravnborg <sam@...nborg.org>
To:	Axel Lin <axel.lin@...il.com>
Cc:	linux-kernel@...r.kernel.org, Colin Cross <ccross@...roid.com>,
	John Bonesio <bones@...retlab.ca>,
	"Jean Delvare (PC drivers, core)" <khali@...ux-fr.org>,
	"Ben Dooks (embedded platforms)" <ben-linux@...ff.org>,
	Grant Likely <grant.likely@...retlab.ca>,
	linux-i2c@...r.kernel.org
Subject: Re: [PATCH] i2c: tegra: Add CONFIG_OF guards for device tree bits

On Fri, Aug 05, 2011 at 03:05:21PM +0800, Axel Lin wrote:
> The device tree bits need to be protected by CONFIG_OF guards.
> This patch fixes below build error with "make tegra_defconfig;make".
> 
>   CC      drivers/i2c/busses/i2c-tegra.o
> drivers/i2c/busses/i2c-tegra.c: In function 'tegra_i2c_probe':
> drivers/i2c/busses/i2c-tegra.c:615: error: implicit declaration of function 'of_get_property'
> drivers/i2c/busses/i2c-tegra.c:616: warning: assignment makes pointer from integer without a cast
> make[3]: *** [drivers/i2c/busses/i2c-tegra.o] Error 1
> make[2]: *** [drivers/i2c/busses] Error 2
> make[1]: *** [drivers/i2c] Error 2
> make: *** [drivers] Error 2
> 
> Signed-off-by: Axel Lin <axel.lin@...il.com>
> ---
>  drivers/i2c/busses/i2c-tegra.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 0c6e840..1bfe85e 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -548,7 +548,6 @@ static int tegra_i2c_probe(struct platform_device *pdev)
>  	struct resource *iomem;
>  	struct clk *clk;
>  	struct clk *i2c_clk;
> -	const unsigned int *prop;
>  	void *base;
>  	int irq;
>  	int ret = 0;
> @@ -611,11 +610,15 @@ static int tegra_i2c_probe(struct platform_device *pdev)
>  	if (pdata) {
>  		i2c_dev->bus_clk_rate = pdata->bus_clk_rate;
>  
> +#ifdef CONFIG_OF
>  	} else if (i2c_dev->dev->of_node) {    /* if there is a device tree node ... */
> +		const unsigned int *prop;
> +
>  		prop = of_get_property(i2c_dev->dev->of_node,
>  				"clock-frequency", NULL);
>  		if (prop)
>  			i2c_dev->bus_clk_rate = be32_to_cpup(prop);
> +#endif
>  	}
>  
>  	if (pdev->id == 3)

It would be better to add a dummy implementation of of_get_property() in of.h.
Thus we do not need the ifdeffery and all users benefits from this.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ