All of lore.kernel.org
 help / color / mirror / Atom feed
From: js@convergence.de (Johannes Stezenbach)
To: sensors@stimpy.netroedge.com
Cc: Greg KH <greg@kroah.com>, linux-kernel@vger.kernel.org
Subject: 2.6.0-test11: i2c-dev.h for userspace
Date: Thu, 19 May 2005 06:24:29 +0000	[thread overview]
Message-ID: <20031212145652.GA30747@convergence.de> (raw)

Hi,

I had some trouble compiling a userspace application
which uses the I2C device interface (the DirectFB
Matrox driver). Apparently some stuff has been removed
from i2c-dev.h, and Documentation/i2c/dev-interface is
out of date. I'm using Debian unstable (where glibc is
built with kernel 2.6 headers).

The patch below puts back some "#if __KERNEL__" conditionals
so i2c.h can be included without errors in userspace progams.

Regards,
Johannes



--- linux-2.6.0-test11-bk8/include/linux/i2c.h.orig	2003-12-12 15:19:12.000000000 +0100
+++ linux-2.6.0-test11-bk8/include/linux/i2c.h	2003-12-12 15:19:37.000000000 +0100
@@ -28,21 +28,26 @@
 #ifndef _LINUX_I2C_H
 #define _LINUX_I2C_H
 
+#ifdef __KERNEL__
 #include <linux/module.h>
-#include <linux/types.h>
-#include <linux/i2c-id.h>
 #include <linux/device.h>	/* for struct device */
 #include <asm/semaphore.h>
+#endif
+#include <linux/types.h>
+#include <linux/i2c-id.h>
 
 /* --- General options ------------------------------------------------	*/
 
 struct i2c_msg;
+union i2c_smbus_data;
+
+#ifdef __KERNEL__
+
 struct i2c_algorithm;
 struct i2c_adapter;
 struct i2c_client;
 struct i2c_driver;
 struct i2c_client_address_data;
-union i2c_smbus_data;
 
 /*
  * The master routines are the ones normally used to transmit data to devices
@@ -384,6 +389,7 @@
 
 /* Return 1 if adapter supports everything we need, 0 if not. */
 extern int i2c_check_functionality (struct i2c_adapter *adap, u32 func);
+#endif /* #if __KERNEL__ */
 
 /*
  * I2C Message - used for pure i2c transaction, also from /dev interface
@@ -530,6 +536,8 @@
 				/* written byte (except address)	*/
 #define I2C_MDELAY	0x0706	/* millisec delay between written bytes */
 
+
+#ifdef __KERNEL__
 /* ----- I2C-DEV: char device interface stuff ------------------------- */
 
 #define I2C_MAJOR	89		/* Device major number		*/
@@ -605,5 +613,6 @@
 	set_current_state(TASK_INTERRUPTIBLE);
 	schedule_timeout(timeout);
 }
+#endif /* #if __KERNEL__ */
 
 #endif /* _LINUX_I2C_H */
--- linux-2.6.0-test11-bk8/include/linux/i2c-dev.h.orig	2003-12-12 15:19:17.000000000 +0100
+++ linux-2.6.0-test11-bk8/include/linux/i2c-dev.h	2003-12-12 15:19:37.000000000 +0100
@@ -25,6 +25,7 @@
 #define _LINUX_I2C_DEV_H
 
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /* Some IOCTL commands are defined in <linux/i2c.h> */
 /* Note: 10-bit addresses are NOT supported! */

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Stezenbach <js@convergence.de>
To: sensors@stimpy.netroedge.com
Cc: Greg KH <greg@kroah.com>, linux-kernel@vger.kernel.org
Subject: 2.6.0-test11: i2c-dev.h for userspace
Date: Fri, 12 Dec 2003 15:56:52 +0100	[thread overview]
Message-ID: <20031212145652.GA30747@convergence.de> (raw)

Hi,

I had some trouble compiling a userspace application
which uses the I2C device interface (the DirectFB
Matrox driver). Apparently some stuff has been removed
from i2c-dev.h, and Documentation/i2c/dev-interface is
out of date. I'm using Debian unstable (where glibc is
built with kernel 2.6 headers).

The patch below puts back some "#if __KERNEL__" conditionals
so i2c.h can be included without errors in userspace progams.

Regards,
Johannes



--- linux-2.6.0-test11-bk8/include/linux/i2c.h.orig	2003-12-12 15:19:12.000000000 +0100
+++ linux-2.6.0-test11-bk8/include/linux/i2c.h	2003-12-12 15:19:37.000000000 +0100
@@ -28,21 +28,26 @@
 #ifndef _LINUX_I2C_H
 #define _LINUX_I2C_H
 
+#ifdef __KERNEL__
 #include <linux/module.h>
-#include <linux/types.h>
-#include <linux/i2c-id.h>
 #include <linux/device.h>	/* for struct device */
 #include <asm/semaphore.h>
+#endif
+#include <linux/types.h>
+#include <linux/i2c-id.h>
 
 /* --- General options ------------------------------------------------	*/
 
 struct i2c_msg;
+union i2c_smbus_data;
+
+#ifdef __KERNEL__
+
 struct i2c_algorithm;
 struct i2c_adapter;
 struct i2c_client;
 struct i2c_driver;
 struct i2c_client_address_data;
-union i2c_smbus_data;
 
 /*
  * The master routines are the ones normally used to transmit data to devices
@@ -384,6 +389,7 @@
 
 /* Return 1 if adapter supports everything we need, 0 if not. */
 extern int i2c_check_functionality (struct i2c_adapter *adap, u32 func);
+#endif /* #if __KERNEL__ */
 
 /*
  * I2C Message - used for pure i2c transaction, also from /dev interface
@@ -530,6 +536,8 @@
 				/* written byte (except address)	*/
 #define I2C_MDELAY	0x0706	/* millisec delay between written bytes */
 
+
+#ifdef __KERNEL__
 /* ----- I2C-DEV: char device interface stuff ------------------------- */
 
 #define I2C_MAJOR	89		/* Device major number		*/
@@ -605,5 +613,6 @@
 	set_current_state(TASK_INTERRUPTIBLE);
 	schedule_timeout(timeout);
 }
+#endif /* #if __KERNEL__ */
 
 #endif /* _LINUX_I2C_H */
--- linux-2.6.0-test11-bk8/include/linux/i2c-dev.h.orig	2003-12-12 15:19:17.000000000 +0100
+++ linux-2.6.0-test11-bk8/include/linux/i2c-dev.h	2003-12-12 15:19:37.000000000 +0100
@@ -25,6 +25,7 @@
 #define _LINUX_I2C_DEV_H
 
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /* Some IOCTL commands are defined in <linux/i2c.h> */
 /* Note: 10-bit addresses are NOT supported! */

             reply	other threads:[~2005-05-19  6:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-12 14:56 Johannes Stezenbach [this message]
2005-05-19  6:24 ` 2.6.0-test11: i2c-dev.h for userspace Johannes Stezenbach
2003-12-12 17:56 ` Greg KH
2005-05-19  6:24   ` Greg KH
2003-12-12 18:53   ` Johannes Stezenbach
2005-05-19  6:24     ` Johannes Stezenbach
2003-12-12 19:01     ` Greg KH
2005-05-19  6:24       ` Greg KH
2003-12-12 19:21       ` Johannes Stezenbach
2005-05-19  6:24         ` Johannes Stezenbach
2003-12-12 19:45         ` Greg KH
2005-05-19  6:24           ` Greg KH
2003-12-14  1:57       ` bill davidsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031212145652.GA30747@convergence.de \
    --to=js@convergence.de \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sensors@stimpy.netroedge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.