I tried to port two of my older modules from 2.0 to 2.4. After changing some
prototypes and stuff, the first one seems to work ok, except every time I
run a program on it, the usecount is incremented by one. I have one
MOD_INC_USE_COUNT in the open- and one MOD_DEC_USE_COUNT in the
release-function. That always worked. I used GET_USE_COUNT to print the
usecount and it is always 2 when open is called, and thus 3 when release is
called. My MOD_DEC_USE_COUNT decrements it to 2, something after that
decrements it to one. But that is still too much, of course.
When the module is opened and another program tries to open it, open returns
-EBUSY without incrementing the usecount. But what happens is this: open is
called with usecount=5 (again incremented by 2) and leaves it at 4 after it
returned the error.
Can anybody tell me what is changing my usecount here? Other modules
(smc-ultra, sensors, lm75 etc.) seem to work correctly, so probably it's
something with my module but I really can't find it.
I am usig modutils 2.3.11, kernel 2.4.0-test5, glibc 2.1.3, gcc 2.95.2,
binutils 2.9.5, the module is compiled with:
gcc -O2 -Wall -DMODULE -D__KERNEL__ -D__SMP__ -I/usr/src/linux/include
-fomit-frame-pointer -c devicenet.c
Thanks in advance