Skip to contentSkip to conversation

mmc: sdhci-tegra: Add #ifdef CONFIG_OF guard for of_find_property

PATCH In review Axel Lin 5 participants 5 messages Oct 3, 2011 – Oct 4, 2011

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 mmc: sdhci-tegra: Add #ifdef CONFIG_OF guard for of_find_property

I got below build error with "make tegra_defconfig;make"
Add #ifdef CONFIG_OF guard for of_find_property to fix below build error:

CC drivers/mmc/host/sdhci-tegra.o
drivers/mmc/host/sdhci-tegra.c: In function 'sdhci_tegra_dt_parse_pdata':
drivers/mmc/host/sdhci-tegra.c:157: error: implicit declaration of function 'of_find_property' make[3]: *** [drivers/mmc/host/sdhci-tegra.o] Error 1
make[2]: *** [drivers/mmc/host] Error 2
make[1]: *** [drivers/mmc] Error 2
make: *** [drivers] Error 2

---
I got the build error on linux-next (20110930).
Axel

 drivers/mmc/host/sdhci-tegra.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/mmc/host/sdhci-tegra.c +3 -0
index 67176afc..3883602 100644
@@ -154,8 +154,11 @@ static struct tegra_sdhci_platform_data * __devinit sdhci_tegra_dt_parse_pdata(
 	plat->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
 	plat->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
 	plat->power_gpio = of_get_named_gpio(np, "power-gpios", 0);
+
+#ifdef CONFIG_OF
 	if (of_find_property(np, "support-8bit", NULL))
 		plat->is_8bit = 1;
+#endif
 
 	return plat;
 }
Signature · 1 line
1.7.4.1
#1 lore raw

Hi Axel,

Quoted 24 lines · Axel Lin

I got below build error with "make tegra_defconfig;make"
Add #ifdef CONFIG_OF guard for of_find_property to fix below build error:

CC drivers/mmc/host/sdhci-tegra.o
drivers/mmc/host/sdhci-tegra.c: In function 'sdhci_tegra_dt_parse_pdata':
drivers/mmc/host/sdhci-tegra.c:157: error: implicit declaration of function 'of_find_property' make[3]: *** [drivers/mmc/host/sdhci-tegra.o] Error 1
make[2]: *** [drivers/mmc/host] Error 2
make[1]: *** [drivers/mmc] Error 2
make: *** [drivers] Error 2

---
I got the build error on linux-next (20110930).
Axel

 drivers/mmc/host/sdhci-tegra.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/mmc/host/sdhci-tegra.c +0 -0
index 67176afc..3883602 100644

drivers/mmc/host/sdhci-tegra.c static struct tegra_sdhci_platform_data * __devinit sdhci_tegra_dt_parse_pdata( · line 161

Quoted 8 lines
drivers/mmc/host/sdhci-tegra.c +3 -0
@@ -154,8 +154,11 @@ static struct tegra_sdhci_platform_data * __devinit sdhci_tegra_dt_parse_pdata(
 	plat->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
 	plat->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
 	plat->power_gpio = of_get_named_gpio(np, "power-gpios", 0);
+
+#ifdef CONFIG_OF
 	if (of_find_property(np, "support-8bit", NULL))
 		plat->is_8bit = 1;
+#endif

Shouldn't we add a stub for the of_find_property() method to include/linux/of.h instead of adding more ifdefs?
Or may be use of_get_property() method instead?

Quoted 3 lines
drivers/mmc/host/sdhci-tegra.c +0 -0
 	return plat;
 }
Signature · 2 lines
Regards,
Igor.
#2 lore raw

Igor Grinberg wrote at Monday, October 03, 2011 2:32 AM:

Quoted 9 lines

Hi Axel,

Quoted 6 lines · Axel Lin

I got below build error with "make tegra_defconfig;make"
Add #ifdef CONFIG_OF guard for of_find_property to fix below build error:

CC drivers/mmc/host/sdhci-tegra.o
drivers/mmc/host/sdhci-tegra.c: In function 'sdhci_tegra_dt_parse_pdata':
drivers/mmc/host/sdhci-tegra.c:157: error: implicit declaration of function 'of_find_property'

...

Quoted 1 line
Quoted 1 line
drivers/mmc/host/sdhci-tegra.c +0 -0

...

Quoted 5 lines
Quoted 5 lines
drivers/mmc/host/sdhci-tegra.c +1 -0
@@ -154,8 +154,11 @@ static struct tegra_sdhci_platform_data * __devinit sdhci_tegra_dt_parse_pdata(
 	plat->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
 	plat->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
 	plat->power_gpio = of_get_named_gpio(np, "power-gpios", 0);
+
Quoted 8 lines

drivers/mmc/host/sdhci-tegra.c static struct tegra_sdhci_platform_data * __devinit sdhci_tegra_dt_parse_pdata( · line 161

Quoted 4 lines
drivers/mmc/host/sdhci-tegra.c +2 -0
+#ifdef CONFIG_OF
 	if (of_find_property(np, "support-8bit", NULL))
 		plat->is_8bit = 1;
+#endif

Shouldn't we add a stub for the of_find_property() method to include/linux/of.h instead of adding more ifdefs?
Or may be use of_get_property() method instead?

I submitted a patch to add a stub of_find_property a little while back. Per https://lkml.org/lkml/2011/9/22/301, Grant applied it already. I'm not sure why it hasn't shown up in linux-next, since Grant's repo wasn't affected by the kernel.org downtime.

Sorry for the breakage.

Signature · 1 line
nvpublic
#3 lore raw
Quoted 27 lines · Stephen Warren

Igor Grinberg wrote at Monday, October 03, 2011 2:32 AM:

Quoted 9 lines

Hi Axel,

Quoted 6 lines · Axel Lin

I got below build error with "make tegra_defconfig;make"
Add #ifdef CONFIG_OF guard for of_find_property to fix below build error:

CC drivers/mmc/host/sdhci-tegra.o
drivers/mmc/host/sdhci-tegra.c: In function 'sdhci_tegra_dt_parse_pdata':
drivers/mmc/host/sdhci-tegra.c:157: error: implicit declaration of function 'of_find_property'

...

Quoted 1 line
Quoted 1 line
drivers/mmc/host/sdhci-tegra.c +0 -0

...

Quoted 5 lines
Quoted 5 lines
drivers/mmc/host/sdhci-tegra.c +1 -0
@@ -154,8 +154,11 @@ static struct tegra_sdhci_platform_data * __devinit sdhci_tegra_dt_parse_pdata(
 	plat->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
 	plat->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
 	plat->power_gpio = of_get_named_gpio(np, "power-gpios", 0);
+
Quoted 8 lines

drivers/mmc/host/sdhci-tegra.c static struct tegra_sdhci_platform_data * __devinit sdhci_tegra_dt_parse_pdata( · line 161

Quoted 4 lines
drivers/mmc/host/sdhci-tegra.c +2 -0
+#ifdef CONFIG_OF
 	if (of_find_property(np, "support-8bit", NULL))
 		plat->is_8bit = 1;
+#endif

Shouldn't we add a stub for the of_find_property() method to include/linux/of.h instead of adding more ifdefs?
Or may be use of_get_property() method instead?

Quoted 6 lines

I submitted a patch to add a stub of_find_property a little while back. Per https://lkml.org/lkml/2011/9/22/301, Grant applied it already. I'm not sure why it hasn't shown up in linux-next, since Grant's repo wasn't affected by the kernel.org downtime.

Sorry for the breakage.

That's because I forgot to push out the tree. :-( Sorry. I've just fixed it now.

g.

#4 lore raw
In reply to Axel Lin
Quoted 25 lines · Axel Lin

I got below build error with "make tegra_defconfig;make"
Add #ifdef CONFIG_OF guard for of_find_property to fix below build error:

CC drivers/mmc/host/sdhci-tegra.o
drivers/mmc/host/sdhci-tegra.c: In function 'sdhci_tegra_dt_parse_pdata':
drivers/mmc/host/sdhci-tegra.c:157: error: implicit declaration of function 'of_find_property' make[3]: *** [drivers/mmc/host/sdhci-tegra.o] Error 1
make[2]: *** [drivers/mmc/host] Error 2
make[1]: *** [drivers/mmc] Error 2
make: *** [drivers] Error 2

---
I got the build error on linux-next (20110930).
Axel

 drivers/mmc/host/sdhci-tegra.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/mmc/host/sdhci-tegra.c +0 -0
index 67176afc..3883602 100644

drivers/mmc/host/sdhci-tegra.c static struct tegra_sdhci_platform_data * __devinit sdhci_tegra_dt_parse_pdata( · line 161

Quoted 8 lines
drivers/mmc/host/sdhci-tegra.c +3 -0
@@ -154,8 +154,11 @@ static struct tegra_sdhci_platform_data * __devinit sdhci_tegra_dt_parse_pdata(
 	plat->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
 	plat->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
 	plat->power_gpio = of_get_named_gpio(np, "power-gpios", 0);
+
+#ifdef CONFIG_OF
 	if (of_find_property(np, "support-8bit", NULL))
 		plat->is_8bit = 1;
+#endif

I think this type of build error is going to be very common when CONFIG_OF is not defined. Wouldn't it be better to fix the issue in the <linux/of.h> header? It looks like some of the of_* calls are already handled properly in that header.

Regards,
Hartley