Skip to contentSkip to conversation

nubus.h: extern's make no sense in userspace

PATCH In review Jaswinder Singh Rajput 4 participants 5 messages Jan 13, 2009 – Jan 14, 2009 Nubus

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nubus.h: extern's make no sense in userspace

Impact: cleanup, Impact: fix 3 make headers_check warnings:

usr/include/linux/nubus.h:298: extern's make no sense in userspace usr/include/linux/nubus.h:300: extern's make no sense in userspace usr/include/linux/nubus.h:304: extern's make no sense in userspace

Also moved nubus_scan_bus() in __KERNEL__

Also removed obsolete get_nubus_list()

---
 include/linux/nubus.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/nubus.h +2 -1
index bd31554..9f54a23 100644
@@ -297,6 +297,7 @@ struct nubus_dev {
 	struct nubus_board* board;
 };
 
+#ifdef __KERNEL__
 /* This is all NuBus devices (used to find devices later on) */
 extern struct nubus_dev* nubus_devices;
 /* This is all NuBus cards */
@@ -305,7 +306,7 @@ extern struct nubus_board* nubus_boards;
 /* Generic NuBus interface functions, modelled after the PCI interface */
 void nubus_scan_bus(void);
 extern void nubus_proc_init(void);
-int get_nubus_list(char *buf);
+#endif /* __KERNEL__ */
 int nubus_proc_attach_device(struct nubus_dev *dev);
 int nubus_proc_detach_device(struct nubus_dev *dev);
 /* If we need more precision we can add some more of these */
Signature · 1 line
1.5.6.6
#1 lore raw
Quoted 28 lines · Jaswinder Singh Rajput

Impact: cleanup, Impact: fix 3 make headers_check warnings:

usr/include/linux/nubus.h:298: extern's make no sense in userspace usr/include/linux/nubus.h:300: extern's make no sense in userspace usr/include/linux/nubus.h:304: extern's make no sense in userspace

Also moved nubus_scan_bus() in __KERNEL__

Also removed obsolete get_nubus_list()

---
 include/linux/nubus.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/nubus.h +1 -0
index bd31554..9f54a23 100644
@@ -297,6 +297,7 @@ struct nubus_dev {
 	struct nubus_board* board;
 };
 
+#ifdef __KERNEL__
 /* This is all NuBus devices (used to find devices later on) */
 extern struct nubus_dev* nubus_devices;
 /* This is all NuBus cards */

include/linux/nubus.h extern struct nubus_board* nubus_boards; · line 310

Quoted 6 lines
include/linux/nubus.h +1 -1
@@ -305,7 +306,7 @@ extern struct nubus_board* nubus_boards;
 /* Generic NuBus interface functions, modelled after the PCI interface */
 void nubus_scan_bus(void);
 extern void nubus_proc_init(void);
-int get_nubus_list(char *buf);
+#endif /* __KERNEL__ */
 int nubus_proc_attach_device(struct nubus_dev *dev);

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

include/linux/nubus.h extern struct nubus_board* nubus_boards; · line 311

Quoted 1 line
include/linux/nubus.h +0 -0
 int nubus_proc_detach_device(struct nubus_dev *dev);

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

include/linux/nubus.h extern struct nubus_board* nubus_boards; · line 312

Quoted 1 line
include/linux/nubus.h +0 -0
 /* If we need more precision we can add some more of these */

What about these? They (unfortunately) lack the "extern" keyword, but they're still external declarations, and "make headers_check' doesn't notice them?

BTW, is there a way to tell gcc to warn about externs not marked "extern", so we can fix all of them?

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010

#2 lore raw
Quoted 37 lines · Geert Uytterhoeven
Quoted 28 lines · Jaswinder Singh Rajput

Impact: cleanup, Impact: fix 3 make headers_check warnings:

usr/include/linux/nubus.h:298: extern's make no sense in userspace usr/include/linux/nubus.h:300: extern's make no sense in userspace usr/include/linux/nubus.h:304: extern's make no sense in userspace

Also moved nubus_scan_bus() in __KERNEL__

Also removed obsolete get_nubus_list()

---
 include/linux/nubus.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/nubus.h +1 -0
index bd31554..9f54a23 100644
@@ -297,6 +297,7 @@ struct nubus_dev {
 	struct nubus_board* board;
 };
 
+#ifdef __KERNEL__
 /* This is all NuBus devices (used to find devices later on) */
 extern struct nubus_dev* nubus_devices;
 /* This is all NuBus cards */

include/linux/nubus.h extern struct nubus_board* nubus_boards; · line 310

Quoted 6 lines
include/linux/nubus.h +1 -1
@@ -305,7 +306,7 @@ extern struct nubus_board* nubus_boards;
 /* Generic NuBus interface functions, modelled after the PCI interface */
 void nubus_scan_bus(void);
 extern void nubus_proc_init(void);
-int get_nubus_list(char *buf);
+#endif /* __KERNEL__ */
 int nubus_proc_attach_device(struct nubus_dev *dev);

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

include/linux/nubus.h extern struct nubus_board* nubus_boards; · line 311

Quoted 1 line
include/linux/nubus.h +0 -0
 int nubus_proc_detach_device(struct nubus_dev *dev);
Quoted 8 lines

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

include/linux/nubus.h extern struct nubus_board* nubus_boards; · line 312

Quoted 1 line
include/linux/nubus.h +0 -0
 /* If we need more precision we can add some more of these */

What about these? They (unfortunately) lack the "extern" keyword, but they're still external declarations, and "make headers_check' doesn't notice them?

BTW, is there a way to tell gcc to warn about externs not marked "extern", so we can fix all of them?

I had a look at this file, there's the small patch that just wraps the whole section of function declarations with ifdef __KERNEL, or the larger patch that does the wrapping _and_ adds the missing externs to make it obvious.

But I'm not sure that there is agreement regarding adding the externs too.

What do people think?

Harvey

#3 lore raw
Quoted 47 lines · Harvey Harrison
Quoted 37 lines · Geert Uytterhoeven
Quoted 28 lines · Jaswinder Singh Rajput

Impact: cleanup, Impact: fix 3 make headers_check warnings:

usr/include/linux/nubus.h:298: extern's make no sense in userspace usr/include/linux/nubus.h:300: extern's make no sense in userspace usr/include/linux/nubus.h:304: extern's make no sense in userspace

Also moved nubus_scan_bus() in __KERNEL__

Also removed obsolete get_nubus_list()

---
 include/linux/nubus.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/nubus.h +1 -0
index bd31554..9f54a23 100644
@@ -297,6 +297,7 @@ struct nubus_dev {
 	struct nubus_board* board;
 };
 
+#ifdef __KERNEL__
 /* This is all NuBus devices (used to find devices later on) */
 extern struct nubus_dev* nubus_devices;
 /* This is all NuBus cards */

include/linux/nubus.h extern struct nubus_board* nubus_boards; · line 310

Quoted 6 lines
include/linux/nubus.h +1 -1
@@ -305,7 +306,7 @@ extern struct nubus_board* nubus_boards;
 /* Generic NuBus interface functions, modelled after the PCI interface */
 void nubus_scan_bus(void);
 extern void nubus_proc_init(void);
-int get_nubus_list(char *buf);
+#endif /* __KERNEL__ */
 int nubus_proc_attach_device(struct nubus_dev *dev);

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

include/linux/nubus.h extern struct nubus_board* nubus_boards; · line 311

Quoted 1 line
include/linux/nubus.h +0 -0
 int nubus_proc_detach_device(struct nubus_dev *dev);
Quoted 8 lines

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

include/linux/nubus.h extern struct nubus_board* nubus_boards; · line 312

Quoted 1 line
include/linux/nubus.h +0 -0
 /* If we need more precision we can add some more of these */

What about these? They (unfortunately) lack the "extern" keyword, but they're still external declarations, and "make headers_check' doesn't notice them?

BTW, is there a way to tell gcc to warn about externs not marked "extern", so we can fix all of them?

Quoted 7 lines

I had a look at this file, there's the small patch that just wraps the whole section of function declarations with ifdef __KERNEL, or the larger patch that does the wrapping _and_ adds the missing externs to make it obvious.

But I'm not sure that there is agreement regarding adding the externs too.

What do people think?

The general consensus is to add externs for new prototypes. So if _and only if_ you are anyway touching this file in that area then I would say - add the externs. But just adding externs are not (yet) worth a patch alone.

Sam

#4 lore raw
Quoted 6 lines · Sam Ravnborg
Quoted 5 lines · Harvey Harrison

I had a look at this file, there's the small patch that just wraps the whole section of function declarations with ifdef __KERNEL, or the larger patch that does the wrapping _and_ adds the missing externs to make it obvious.

Quoted 9 lines
Quoted 3 lines

But I'm not sure that there is agreement regarding adding the externs too.

What do people think?

The general consensus is to add externs for new prototypes. So if _and only if_ you are anyway touching this file in that area then I would say - add the externs. But just adding externs are not (yet) worth a patch alone.

Agreed about just adding externs not being worth it, but as part of auditing this file for userspace inclusion I'll send the patch that adds the externs as well as the ifdef __KERNEL__ bits.

Harvey