Skip to contentSkip to conversation

New include file for marking old style api files

PATCH In review Jiri Slaby 4 participants 7 messages Jul 28, 2005

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 New include file for marking old style api files

Hi.
Do you think, that this would be useful in the kernel tree? I have an idea to mark old drivers, which should I or somebody rewrite. For example drivers/isdn/hisax/gazel.c.

Signature · 3 lines
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      [email protected]      ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10
include/linux/oldapi.h new file +2 -0
new file mode 100644
@@ -0,0 +1,2 @@
+#warning This driver uses old style API and needs to be rewritten or removed \
+	from kernel
author
#1 lore raw

Jiri Slaby napsal(a):

Quoted 14 lines

Hi.
Do you think, that this would be useful in the kernel tree? I have an idea to mark old drivers, which should I or somebody rewrite. For example drivers/isdn/hisax/gazel.c.

------------------------------------------------------------------------

include/linux/oldapi.h new file +0 -0
new file mode 100644

include/linux/oldapi.h line 2

Quoted 2 lines
include/linux/oldapi.h new file +2 -0
@@ -0,0 +1,2 @@
+#warning This driver uses old style API and needs to be rewritten or removed \
+	from kernel

Maybe this would be better (license and comments added).

Signature · 3 lines
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      [email protected]      ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10
include/linux/oldapi.h new file +13 -0
new file mode 100644
@@ -0,0 +1,13 @@
+/**
+  * Include this file, if you think that the driver is old API styled
+  *
+  * Version:	1.0		28 Jul 2005	Initial version
+  *
+  * Author		Jiri Slaby <[email protected]>
+  *
+  * This software may be used and distributed according to the terms
+  * of the GNU General Public License, incorporated herein by reference.
+  */
+
+#warning This driver uses old style API and needs to be rewritten or removed \
+	from kernel
#2 lore raw
Quoted 6 lines · Jiri Slaby

Jiri Slaby napsal(a):

Quoted 4 lines

Hi.
Do you think, that this would be useful in the kernel tree? I have an idea to mark old drivers, which should I or somebody rewrite. For example drivers/isdn/hisax/gazel.c.

Anyway you could modify this so that people could indicate which "old" APIs are in use?

Just a thought...

John

Signature · 2 lines
John W. Linville
[email protected]
#3 lore raw
In reply to Jiri Slaby

include/linux/oldapi.h line 2

Quoted 10 lines · Jiri Slaby

Hi.
Do you think, that this would be useful in the kernel tree? I have an idea to mark old drivers, which should I or somebody rewrite. For example drivers/isdn/hisax/gazel.c.
...

include/linux/oldapi.h new file +2 -0
@@ -0,0 +1,2 @@
+#warning This driver uses old style API and needs to be rewritten or removed \
+	from kernel

What's wrong with __deprecated ?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
author
#4 lore raw

Adrian Bunk napsal(a):

Quoted 19 lines · Jiri Slaby
Quoted 12 lines

Hi.
Do you think, that this would be useful in the kernel tree? I have an idea to mark old drivers, which should I or somebody rewrite. For example drivers/isdn/hisax/gazel.c.
...

include/linux/oldapi.h line 2

Quoted 2 lines
include/linux/oldapi.h new file +2 -0
@@ -0,0 +1,2 @@
+#warning This driver uses old style API and needs to be rewritten or removed \
+	from kernel

What's wrong with __deprecated ?

Nothing, but this marks entire driver, not a function, that it uses. I.e. gazel doesn't emit any warning or so, I think; so for these cases.

Signature · 3 lines
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      [email protected]      ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10
#5 lore raw
Quoted 6 lines · Jiri Slaby

Adrian Bunk napsal(a):

Quoted 3 lines

What's wrong with __deprecated ?

Nothing, but this marks entire driver, not a function, that it uses. I.e. gazel doesn't emit any warning or so, I think; so for these cases.

So what's actually wrong with the gazel driver? I'm not an user or author of it.

When it's the use of old APIs, I indeed think that __deprecated is exactly what we want. If a driver is superseded by a different one (OSS vs. ALSA, eepro100 vs e100, ...), sticking a #warning or #error right into the driver (and not into an included header file) looks quite right to me.

MfG, JBG

Signature · 4 lines
Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
fuer einen Freien Staat voll Freier Buerger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
#6 lore raw
In reply to Jiri Slaby
Quoted 22 lines · Jiri Slaby

Adrian Bunk napsal(a):

Quoted 20 lines · Jiri Slaby
Quoted 14 lines

Hi.
Do you think, that this would be useful in the kernel tree? I have an idea to mark old drivers, which should I or somebody rewrite. For example drivers/isdn/hisax/gazel.c.
...

include/linux/oldapi.h new file +1 -0
@@ -0,0 +1,2 @@
+#warning This driver uses old style API and needs to be rewritten or 

removed \

include/linux/oldapi.h line 2

Quoted 1 line
include/linux/oldapi.h new file +1 -0
+	from kernel

What's wrong with __deprecated ?

Quoted 2 lines

Nothing, but this marks entire driver, not a function, that it uses. I.e. gazel doesn't emit any warning or so, I think; so for these cases.

Why do you require a header file for this?
Simply put the #warning in gazel.c .

If the API is scheduled for removal, you should put the #warning in the header file for the API.

If the API is old but is expected to stay for a longer time, simply do nothing. Artificially increasing the warnings during kernel compilation only makes it harder to find important warnings.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed