* (no subject)
@ 2005-08-06 2:36 James C. Georgas
2005-08-06 2:52 ` Inclusion order patch James C. Georgas
0 siblings, 1 reply; 3+ messages in thread
From: James C. Georgas @ 2005-08-06 2:36 UTC (permalink / raw)
To: linux-kernel; +Cc: Alan Cox
This patch lets this header stand alone, since I can never remember
which other headers to include, or in which order.
The three #include lines define the types: kobject, list_head and dev_t,
which are used in the cdev structure.
The forward declaration of struct inode is to quiet the following
compiler warning when including only cdev.h in my file:
include/linux/cdev.h:30: warning: its scope is only this definition or
declaration, which is probably not what you want
I'm not sure, but I think it's saying that I'm declaring a new struct,
which will not be the same as the real struct inode if it is #included
later, because of the scope rules.
(oh yeah, this is my first patch to the list; did I get the format
right?)
BEGIN PATCH:
diff -Nru linux-2.6.12.4/include/linux/cdev.h linux/include/linux/cdev.h
--- linux-2.6.12.4/include/linux/cdev.h 2005-08-05 03:04:37.000000000
-0400
+++ linux/include/linux/cdev.h 2005-08-05 21:41:39.000000000 -0400
@@ -2,6 +2,12 @@
#define _LINUX_CDEV_H
#ifdef __KERNEL__
+#include <linux/kobject.h>
+#include <linux/list.h>
+#include <linux/types.h>
+
+struct inode;
+
struct cdev {
struct kobject kobj;
struct module *owner;
--
James C. Georgas <jgeorgas@rogers.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Inclusion order patch
2005-08-06 2:36 James C. Georgas
@ 2005-08-06 2:52 ` James C. Georgas
2005-08-08 7:18 ` Jan Engelhardt
0 siblings, 1 reply; 3+ messages in thread
From: James C. Georgas @ 2005-08-06 2:52 UTC (permalink / raw)
To: linux-kernel; +Cc: Alan Cox
Excuse me for reposting this. I forgot the subject line. hehe.
This patch lets this header stand alone, since I can never remember
which other headers to include, or in which order.
The three #include lines define the types: kobject, list_head and dev_t,
which are used in the cdev structure.
The forward declaration of struct inode is to quiet the following
compiler warning when including only cdev.h in my file:
include/linux/cdev.h:30: warning: `struct inode' declared inside parameter list
include/linux/cdev.h:30: warning: its scope is only this definition or
declaration, which is probably not what you want
I'm not sure, but I think it's saying that I'm declaring a new struct,
which will not be the same as the real struct inode if it is #included
later, because of the scope rules.
(oh yeah, this is my first patch to the list; did I get the format
right?)
BEGIN PATCH:
diff -Nru linux-2.6.12.4/include/linux/cdev.h linux/include/linux/cdev.h
--- linux-2.6.12.4/include/linux/cdev.h 2005-08-05 03:04:37.000000000
-0400
+++ linux/include/linux/cdev.h 2005-08-05 21:41:39.000000000 -0400
@@ -2,6 +2,12 @@
#define _LINUX_CDEV_H
#ifdef __KERNEL__
+#include <linux/kobject.h>
+#include <linux/list.h>
+#include <linux/types.h>
+
+struct inode;
+
struct cdev {
struct kobject kobj;
struct module *owner;
--
James C. Georgas <jgeorgas@rogers.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inclusion order patch
2005-08-06 2:52 ` Inclusion order patch James C. Georgas
@ 2005-08-08 7:18 ` Jan Engelhardt
0 siblings, 0 replies; 3+ messages in thread
From: Jan Engelhardt @ 2005-08-08 7:18 UTC (permalink / raw)
To: James C. Georgas; +Cc: linux-kernel, Alan Cox
>This patch lets this header stand alone, since I can never remember
>which other headers to include, or in which order.
I have seen the same in a lot of other places. For some self-baked patch, I
added <linux/security.h> to the front of includes and promptly got flooded
with warnings.
IMO, every H (and every C) file should have all the includes that are
necessary to get at enums, structs, etc. even if other H files do this.
I'd volunteer to do this. What's LKMLs and the big guys' opinion?
>@@ -2,6 +2,12 @@
> #define _LINUX_CDEV_H
> #ifdef __KERNEL__
>
>+#include <linux/kobject.h>
>+#include <linux/list.h>
>+#include <linux/types.h>
>+
>+struct inode;
+ struct module;
>+
> struct cdev {
> struct kobject kobj;
> struct module *owner;
Jan Engelhardt
--
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-08-08 7:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-06 2:36 James C. Georgas
2005-08-06 2:52 ` Inclusion order patch James C. Georgas
2005-08-08 7:18 ` Jan Engelhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).