Skip to content

Commit 1d772e2

Browse files
Jean Delvaregregkh
authored andcommitted
[PATCH] I2C: Clarify the usage of i2c-dev.h
Upon suggestion by Nils Roeder, here is an update to the i2c documentation to clarify which header files user-space applications relying on the i2c-dev interface should include. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent a68e2f4 commit 1d772e2

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎Documentation/i2c/dev-interface‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ C example
1414
=========
1515

1616
So let's say you want to access an i2c adapter from a C program. The
17-
first thing to do is `#include <linux/i2c.h>" and "#include <linux/i2c-dev.h>.
18-
Yes, I know, you should never include kernel header files, but until glibc
19-
knows about i2c, there is not much choice.
17+
first thing to do is "#include <linux/i2c-dev.h>". Please note that
18+
there are two files named "i2c-dev.h" out there, one is distributed
19+
with the Linux kernel and is meant to be included from kernel
20+
driver code, the other one is distributed with lm_sensors and is
21+
meant to be included from user-space programs. You obviously want
22+
the second one here.
2023

2124
Now, you have to decide which adapter you want to access. You should
2225
inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned
@@ -78,7 +81,7 @@ Full interface description
7881
==========================
7982

8083
The following IOCTLs are defined and fully supported
81-
(see also i2c-dev.h and i2c.h):
84+
(see also i2c-dev.h):
8285

8386
ioctl(file,I2C_SLAVE,long addr)
8487
Change slave address. The address is passed in the 7 lower bits of the

0 commit comments

Comments
 (0)