[PATCH 4/4] toshiba.h: hide a function prototypes behind __KERNEL__ macro

Previous thread: [PATCH 1/2] Input: xpad - fix memory leak by Namhyung Kim on Wednesday, December 1, 2010 - 8:04 am. (4 messages)

Next thread: Re: [PATCH] PM: Prevent dpm_prepare() from returning errors unnecessarily by Alan Stern on Wednesday, December 1, 2010 - 8:15 am. (2 messages)
From: Alexander Shishkin
Date: Wednesday, December 1, 2010 - 8:10 am

Hi,

These four patches contain trivial headers_check warnings in current kernel.
Two of them were obtained with a patch to headers_check [1] that slightly
improves its ability to detect exported function prototypes.

[1] http://marc.info/?l=linux-kernel&m=129113414531152&w=2

Regards,
--
Alex
--

From: Alexander Shishkin
Date: Wednesday, December 1, 2010 - 8:10 am

For headers that get exported to userland and make use of u32 style
type names, it is advised to include linux/types.h.

This fixes 5 headers_check warnings.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: David Airlie <airlied@linux.ie>
CC: Chris Wilson <chris@chris-wilson.co.uk>
CC: dri-devel@lists.freedesktop.org
CC: linux-kernel@vger.kernel.org
CC: intel-gfx@lists.freedesktop.org
---
 include/drm/drm_mode.h   |    2 ++
 include/drm/i915_drm.h   |    1 +
 include/drm/mga_drm.h    |    1 +
 include/drm/radeon_drm.h |    1 +
 include/drm/via_drm.h    |    1 +
 5 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 0fc7397..1678d7b 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -27,6 +27,8 @@
 #ifndef _DRM_MODE_H
 #define _DRM_MODE_H
 
+#include <linux/types.h>
+
 #define DRM_DISPLAY_INFO_LEN	32
 #define DRM_CONNECTOR_NAME_LEN	32
 #define DRM_DISPLAY_MODE_LEN	32
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 8c641bed..c07c043 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -27,6 +27,7 @@
 #ifndef _I915_DRM_H_
 #define _I915_DRM_H_
 
+#include <linux/types.h>
 #include "drm.h"
 
 /* Please note that modifications to all structs defined here are
diff --git a/include/drm/mga_drm.h b/include/drm/mga_drm.h
index c16097f..1107097 100644
--- a/include/drm/mga_drm.h
+++ b/include/drm/mga_drm.h
@@ -35,6 +35,7 @@
 #ifndef __MGA_DRM_H__
 #define __MGA_DRM_H__
 
+#include <linux/types.h>
 #include "drm.h"
 
 /* WARNING: If you change any of these defines, make sure to change the
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 10f8b53..78d9344 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -33,6 +33,7 @@
 #ifndef __RADEON_DRM_H__
 #define __RADEON_DRM_H__
 
+#include <linux/types.h>
 #include "drm.h"
 
 /* WARNING: If you change ...
From: Julien Cristau
Date: Wednesday, December 1, 2010 - 9:54 am

How many times does this need to be NAKed?  These headers are shared
with the BSDs, and they include drm.h which has the linux/types.h
include on linux already.

Cheers,
Julien
--

From: Alexander Shishkin
Date: Wednesday, December 1, 2010 - 10:37 am

One of the rules of including files that comes to mind is that one should
never rely on stuff being included from other headers but always explicitly
include those which are needed.
But if compatibility with other OS kernels is a valid reason to disregard
common coding practices, maybe at least it deserves a comment in those files?

But I really couldn't care less about these headers, so this is totally up
to you.

Regards,
--
Alex
--

From: Kristian Høgsberg
Date: Wednesday, December 1, 2010 - 10:54 am

I'll NAK it too, if that helps.

Kristian
--

From: Andrew Morton
Date: Wednesday, December 1, 2010 - 12:38 pm

On Wed, 1 Dec 2010 17:54:18 +0100

Until someone gets a clue and puts comments in there explaining this?
--

From: Dave Airlie
Date: Wednesday, December 1, 2010 - 12:55 pm

how about someone fixing the dumb scripts to understand that C header
includes aren't single level.

Like 10 people have posted this patch and not one has come back with a
fix for the app after I pointed it out, like really if people think
they can write C good enough to send kernel patches,
maybe they could put some more effort in and actually fix a real problem.

We should start hashing signed-off-by's so people can't get any glory from them.

Dave.
--

From: Randy Dunlap
Date: Wednesday, December 1, 2010 - 1:12 pm

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--

From: Alexander Shishkin
Date: Wednesday, December 1, 2010 - 8:10 am

Currently, 3 kernel function prototypes are present in a header
file exported to userland. This patch fixes it.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-kernel@vger.kernel.org
---
 include/linux/cramfs_fs.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/cramfs_fs.h b/include/linux/cramfs_fs.h
index 6fc2bed..0e7bf27 100644
--- a/include/linux/cramfs_fs.h
+++ b/include/linux/cramfs_fs.h
@@ -84,9 +84,11 @@ struct cramfs_super {
 				| CRAMFS_FLAG_WRONG_SIGNATURE \
 				| CRAMFS_FLAG_SHIFTED_ROOT_OFFSET )
 
+#ifdef __KERNEL__
 /* Uncompression interfaces to the underlying zlib */
 int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen);
 int cramfs_uncompress_init(void);
 void cramfs_uncompress_exit(void);
+#endif /* __KERNEL__ */
 
 #endif
-- 
1.7.2.1.45.gb66c2

--

From: Alexander Shishkin
Date: Wednesday, December 1, 2010 - 8:10 am

For headers that get exported to userland and make use of u32 style
type names, it is advised to include linux/types.h.

This fixes a headers_check warning.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: "James E.J. Bottomley" <James.Bottomley@suse.de>
CC: linux-scsi@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
 include/scsi/scsi_netlink.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 58ce8fe..5cb20cc 100644
--- a/include/scsi/scsi_netlink.h
+++ b/include/scsi/scsi_netlink.h
@@ -23,7 +23,7 @@
 #define SCSI_NETLINK_H
 
 #include <linux/netlink.h>
-
+#include <linux/types.h>
 
 /*
  * This file intended to be included by both kernel and user space
-- 
1.7.2.1.45.gb66c2

--

From: Alexander Shishkin
Date: Wednesday, December 1, 2010 - 8:10 am

Currently, tosh_smm() prototype is present in a header
file exported to userland. This patch fixes it.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Jonathan Buzzard <jonathan@buzzard.org.uk>
CC: tlinux-users@tce.toshiba-dme.co.jp
CC: linux-kernel@vger.kernel.org
---
 include/linux/toshiba.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/toshiba.h b/include/linux/toshiba.h
index 6a7c4ed..772dedb 100644
--- a/include/linux/toshiba.h
+++ b/include/linux/toshiba.h
@@ -33,6 +33,8 @@ typedef struct {
 	unsigned int edi __attribute__ ((packed));
 } SMMRegisters;
 
+#ifdef __KERNEL__
 int tosh_smm(SMMRegisters *regs);
+#endif /* __KERNEL__ */
 
 #endif
-- 
1.7.2.1.45.gb66c2

--

Previous thread: [PATCH 1/2] Input: xpad - fix memory leak by Namhyung Kim on Wednesday, December 1, 2010 - 8:04 am. (4 messages)

Next thread: Re: [PATCH] PM: Prevent dpm_prepare() from returning errors unnecessarily by Alan Stern on Wednesday, December 1, 2010 - 8:15 am. (2 messages)