Skip to contentSkip to conversation

simplefb: Fix build failure on Sparc

PATCH New Hans de Goede 2 participants 4 messages Jan 5, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 simplefb: Fix build failure on Sparc

of_platform_device_create is only defined when CONFIG_OF_ADDRESS is set, which is normally always the case when CONFIG_OF is defined, except on Sparc, so explicitly check for CONFIG_OF_ADDRESS rather then for CONFIG_OF.

---
 drivers/video/fbdev/simplefb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/simplefb.c +1 -1
index 92cac80..1085c04 100644
@@ -402,7 +402,7 @@ static int __init simplefb_init(void)
 	if (ret)
 		return ret;
 
-	if (IS_ENABLED(CONFIG_OF) && of_chosen) {
+	if (IS_ENABLED(CONFIG_OF_ADDRESS) && of_chosen) {
 		for_each_child_of_node(of_chosen, np) {
 			if (of_device_is_compatible(np, "simple-framebuffer"))
 				of_platform_device_create(np, NULL, NULL);
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 simplefb: Fix build failure on Sparc

Quoted 16 lines · Hans de Goede

of_platform_device_create is only defined when CONFIG_OF_ADDRESS is set, which is normally always the case when CONFIG_OF is defined, except on Sparc, so explicitly check for CONFIG_OF_ADDRESS rather then for CONFIG_OF.

---
 drivers/video/fbdev/simplefb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/simplefb.c +0 -0
index 92cac80..1085c04 100644

drivers/video/fbdev/simplefb.c static int __init simplefb_init(void) · line 408

Quoted 8 lines
drivers/video/fbdev/simplefb.c +1 -1
@@ -402,7 +402,7 @@ static int __init simplefb_init(void)
 	if (ret)
 		return ret;
 
-	if (IS_ENABLED(CONFIG_OF) && of_chosen) {
+	if (IS_ENABLED(CONFIG_OF_ADDRESS) && of_chosen) {
 		for_each_child_of_node(of_chosen, np) {
 			if (of_device_is_compatible(np, "simple-framebuffer"))
 				of_platform_device_create(np, NULL, NULL);

Doesn't this depend on the compiler optimizing the of_platform_device_create call away? Isn't that rather dangerous assumption?

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150105/2e912057/attachment.sig>

#2 lore raw

PATCH 1/1 simplefb: Fix build failure on Sparc

Hi,

Quoted 19 lines · Tomi Valkeinen
Quoted 18 lines · Hans de Goede

of_platform_device_create is only defined when CONFIG_OF_ADDRESS is set, which is normally always the case when CONFIG_OF is defined, except on Sparc, so explicitly check for CONFIG_OF_ADDRESS rather then for CONFIG_OF.

---
  drivers/video/fbdev/simplefb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/simplefb.c +0 -0
index 92cac80..1085c04 100644
@@ -402,7 +402,7 @@ static int __init simplefb_init(void)
  	if (ret)
  		return ret;
 
Quoted 9 lines

drivers/video/fbdev/simplefb.c static int __init simplefb_init(void) · line 408

Quoted 6 lines
drivers/video/fbdev/simplefb.c +1 -1
-	if (IS_ENABLED(CONFIG_OF) && of_chosen) {
+	if (IS_ENABLED(CONFIG_OF_ADDRESS) && of_chosen) {
  		for_each_child_of_node(of_chosen, np) {
  			if (of_device_is_compatible(np, "simple-framebuffer"))
  				of_platform_device_create(np, NULL, NULL);

Doesn't this depend on the compiler optimizing the of_platform_device_create call away?

Yes it does.

Quoted 1 line

Isn't that rather dangerous assumption?

The kernel relies on being build with optimization enabled in various places, this specific construction was suggested during review (by Grant Likely IIRC) I initially had an #ifdef here. Note that this construction is used in various places throughout the kernel and it seems to be used more and more often.

Regards,

Hans

#3 lore raw

PATCH 1/1 simplefb: Fix build failure on Sparc

Quoted 38 lines · Hans de Goede

Hi,

Quoted 21 lines · Tomi Valkeinen
Quoted 20 lines · Hans de Goede

of_platform_device_create is only defined when CONFIG_OF_ADDRESS is set, which is normally always the case when CONFIG_OF is defined, except on Sparc,
so explicitly check for CONFIG_OF_ADDRESS rather then for CONFIG_OF.

---
  drivers/video/fbdev/simplefb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/simplefb.c +0 -0
index 92cac80..1085c04 100644
@@ -402,7 +402,7 @@ static int __init simplefb_init(void)
      if (ret)
          return ret;
 
Quoted 9 lines

drivers/video/fbdev/simplefb.c static int __init simplefb_init(void) · line 408

Quoted 6 lines
drivers/video/fbdev/simplefb.c +1 -1
-    if (IS_ENABLED(CONFIG_OF) && of_chosen) {
+    if (IS_ENABLED(CONFIG_OF_ADDRESS) && of_chosen) {
          for_each_child_of_node(of_chosen, np) {
              if (of_device_is_compatible(np, "simple-framebuffer"))
                  of_platform_device_create(np, NULL, NULL);

Doesn't this depend on the compiler optimizing the of_platform_device_create call away?

Yes it does.

Quoted 1 line

Isn't that rather dangerous assumption?

Quoted 7 lines

The kernel relies on being build with optimization enabled in various places,
this specific construction was suggested during review (by Grant Likely IIRC)
I initially had an #ifdef here. Note that this construction is used in various
places throughout the kernel and it seems to be used more and more often.

Ok. Well, I can't say I'm very happy about that, but if that's the common accepted way, I'm fine. I'll queue this for fbdev fixes.

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150105/a924f697/attachment.sig>