lkml.org 
[lkml]   [2000]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: GET_USE_COUNT(THIS_MODULE) and i810_rng driver.
On Thu, 5 Oct 2000, Tigran Aivazian wrote:
> I tried to compile Jeff's i810_rng driver statically and I can't because
> of a construct like this:
>
> if (GET_USE_COUNT(THIS_MODULE) > 0)
> MOD_DEC_USE_COUNT;
> if (GET_USE_COUNT(THIS_MODULE) == 0)
> rng_hw_enabled = 0;
>
> A similar thing is used by other drivers but always inside #ifdef
> MODULE. The problem here is that if MODULE is not defined then THIS_MODULE
> is just NULL and GET_USE_COUNT(NULL) is not a very wise thing to be used
> in expressions :)
>
> Any ideas what should one do? To enclose the driver's code inside #ifdef
> MODULE (and check all other drivers) or to provide a magic version of
> GET_USE_COUNT() that will be suitable for static case? E.g. 1? Is 1 good
> enough?

FWIW, i810_rng -used- to use an internal variable for 'use_count', and
maintained MOD_{INC,DEC}_USE_COUNT off of that. I decided to get clever
and do the above, thinking that module.h was completely ok for the
non-modular case.

GET_USE_COUNT breaks the build on Alpha (hence the #ifdef). Further,
for this driver at least, it depends on a -working- module count for
all cases, returning 1 would not be sufficient.

prumpf has since sent me a fix patch which goes back to manually
maintaining the use_count for the static case, and that is the solution
I'm going with...

Jeff





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.028 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site