Skip to contentSkip to conversation

i2c-dev.h

DISCUSSION Mark D. Studebaker 5 participants 10 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

Kyosti took 173 lines out of i2c-dev.h in the main i2c branch because userspace shouldn't include kernel headers, and then merged that change into the lk2-4 branch too.

But I don't recall seeing any replacement.

Is there one?
Should we undo the changes so we have working userspace utilities again or should we create a userspace version of i2c-dev.h?

I'm not claiming the old i2c-dev.h was pretty but we need something.

#1 lore raw
Quoted 9 lines · Mark D. Studebaker

Kyosti took 173 lines out of i2c-dev.h in the main i2c branch because userspace shouldn't include kernel headers, and then merged that change into the lk2-4 branch too.

But I don't recall seeing any replacement.

Is there one?
Should we undo the changes so we have working userspace utilities again or should we create a userspace version of i2c-dev.h?

Create a userspace version, that includes the changes I made to it for the most recent 2.4 and 2.5 kernels :)

thanks,

greg k-h

#2 lore raw
In reply to Mark D. Studebaker
Quoted 4 lines · Philip Pokorny

So '- km' in the sensors.h comments must be Kyosti...

There has got to be some common header files between kernel and user space so that data structures and "magic" constants are shared.

No, two separate header files, both kept in sync. That's the way to do this today.

Quoted 2 lines

If user space can't include kernel headers, then the kernel will have to include a "user space" header.

Nope, see the many threads on the linux-kernel mailing list about this issue.

Quoted 2 lines

It would seem to me that the alternative of having two copies of the same data structures and constants would be worse.

Nope.

Quoted 1 line

When did this become such a big issue?

Always has been :)

Quoted 2 lines

Absolutely, either put the old code back or create another file with the common code that can be included one place or the other...

So does this mean that the drivers/i2c/* files in the 2.4 tree are out of date with the cvs versions? If so, I have some changes that are now in 2.4 that need to be put into the cvs tree...

Also, any reason not to update the in-tree 2.4 kernel versions?

thanks,

greg k-h

#3 lore raw
In reply to Mark D. Studebaker
Quoted 8 lines · Philip Pokorny
Quoted 7 lines · Greg KH
Quoted 4 lines · Philip Pokorny

So '- km' in the sensors.h comments must be Kyosti...

There has got to be some common header files between kernel and user space so that data structures and "magic" constants are shared.

Quoted 6 lines
Quoted 2 lines

No, two separate header files, both kept in sync. That's the way to do this today.

How are they kept in sync. Force of will? Without some automatic way to keep them in sync you've just exchanged one set of problems for another...

Right now, you are correct. Force of will is all we got :)

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

If user space can't include kernel headers, then the kernel will have to include a "user space" header.

Nope, see the many threads on the linux-kernel mailing list about this issue.

OK. So H Peter Anvin suggested something very like what I'm suggesting here:

Quoted 7 lines

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=aho5ql%249ja%241%40cesium.transmeta.com

Google doesn't seem to turn up much else on the linux.kernel mailing list other than "IOCTL's are bad" comments (and the variations that boil down to "BINARY interfaces are bad") I would view this as supporting my position that it's annoying (and has been for a long time), but not worse than the alternatives and not so annoying as to require fixing.

For 2.5/2.6 someone could step up to the plate and do the work right now. Otherwise this is going to be a 2.7 thing.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It would seem to me that the alternative of having two copies of the same data structures and constants would be worse.

Nope.

So we disagree...

Heh, I understand, but the only way that we are allowed to do this is to keep two copies. Well, you can have one in the cvs tree, and there will be one in the main kernel source tree.

And yes, ioctls are bad :)

thanks,

greg k-h

#4 lore raw
In reply to Mark D. Studebaker

I found the userspace version, Kyosti added all that was needed to kernel/include/i2c-dev.h in the sensors package.
So he didn't leave us hanging after all.
I'm fixing prog/eepromer/*.c and the Makefile to find that version.

Quoted 19 lines · Greg KH
Quoted 9 lines · Mark D. Studebaker

Kyosti took 173 lines out of i2c-dev.h in the main i2c branch because userspace shouldn't include kernel headers, and then merged that change into the lk2-4 branch too.

But I don't recall seeing any replacement.

Is there one?
Should we undo the changes so we have working userspace utilities again or should we create a userspace version of i2c-dev.h?

Create a userspace version, that includes the changes I made to it for the most recent 2.4 and 2.5 kernels :)

thanks,

greg k-h

#5 lore raw
In reply to Mark D. Studebaker

So '- km' in the sensors.h comments must be Kyosti...

There has got to be some common header files between kernel and user space so that data structures and "magic" constants are shared.

If user space can't include kernel headers, then the kernel will have to include a "user space" header.

It would seem to me that the alternative of having two copies of the same data structures and constants would be worse.

When did this become such a big issue?

Absolutely, either put the old code back or create another file with the common code that can be included one place or the other...

:v)

Quoted 12 lines · Mark D. Studebaker

Kyosti took 173 lines out of i2c-dev.h in the main i2c branch because userspace shouldn't include kernel headers, and then merged that change into the lk2-4 branch too.

But I don't recall seeing any replacement.

Is there one?
Should we undo the changes so we have working userspace utilities again or should we create a userspace version of i2c-dev.h?

I'm not claiming the old i2c-dev.h was pretty but we need something.

#6 lore raw
In reply to Mark D. Studebaker
Quoted 9 lines · Greg KH
Quoted 4 lines · Philip Pokorny

So '- km' in the sensors.h comments must be Kyosti...

There has got to be some common header files between kernel and user space so that data structures and "magic" constants are shared.

No, two separate header files, both kept in sync. That's the way to do this today.

How are they kept in sync. Force of will? Without some automatic way to keep them in sync you've just exchanged one set of problems for another...

Quoted 5 lines
Quoted 2 lines

If user space can't include kernel headers, then the kernel will have to include a "user space" header.

Nope, see the many threads on the linux-kernel mailing list about this issue.

OK. So H Peter Anvin suggested something very like what I'm suggesting here:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=aho5ql%249ja%241%40cesium.transmeta.com

Google doesn't seem to turn up much else on the linux.kernel mailing list other than "IOCTL's are bad" comments (and the variations that boil down to "BINARY interfaces are bad") I would view this as supporting my position that it's annoying (and has been for a long time), but not worse than the alternatives and not so annoying as to require fixing.

Quoted 4 lines
Quoted 2 lines

It would seem to me that the alternative of having two copies of the same data structures and constants would be worse.

Nope.

So we disagree...

:v)

Signature · 4 lines
Philip Pokorny, Director of Engineering
Tel: 415-358-2635   Fax: 415-358-2646   Toll Free: 888-PENGUIN
PENGUIN COMPUTING, INC.
www.penguincomputing.com
#7 lore raw
In reply to Mark D. Studebaker

Hi all,

Why is it that there are two different i2c-dev.h files, one in i2c and one in lm_sensors2? When installing i2c and lm_sensors2 in order, the version from lm_sensors2 will of course overwrite the one from i2c. This causes trouble to people using e.g. checkinstall to build packages from sources (because i2c and lm_sensors packages then conflict on that file).

It seems to me that the file that comes with i2c is meant for "internal" use only and should not be "exported" to any user-space include directory (and could maybe even be integrated into i2c-dev.c). Am I right?

Thanks.

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#8 lore raw
In reply to Mark D. Studebaker
Quoted 4 lines

they used to be one but got separated because of the rule "userspace programs should not include kernel headers". Perhaps the i2c (i.e. kernel) version shouldn't be installed under /usr/local/...

Agreed, will do.

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#9 lore raw
In reply to Mark D. Studebaker

they used to be one but got separated because of the rule
"userspace programs should not include kernel headers".
Perhaps the i2c (i.e. kernel) version shouldn't be installed under /usr/local/...

Quoted 16 lines · Jean Delvare

Hi all,

Why is it that there are two different i2c-dev.h files, one in i2c and one in lm_sensors2? When installing i2c and lm_sensors2 in order, the version from lm_sensors2 will of course overwrite the one from i2c. This causes trouble to people using e.g. checkinstall to build packages from sources (because i2c and lm_sensors packages then conflict on that file).

It seems to me that the file that comes with i2c is meant for "internal" use only and should not be "exported" to any user-space include directory (and could maybe even be integrated into i2c-dev.c). Am I right?

Thanks.