[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200612021147.40505.arnd@arndb.de>
Date: Sat, 2 Dec 2006 11:47:38 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Al Viro <viro@....linux.org.uk>
Cc: Linus Torvalds <torvalds@...l.org>, linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org, gcc@....gnu.org
Subject: Re: [RFC] timers, pointers to functions and type safety
On Friday 01 December 2006 18:21, Al Viro wrote:
> There is a tempting
> possibility to do that gradually, with all intermediates still in working
> state, provided that on all platforms currently supported by the kernel
> unsigned long and void * are indeed passed the same way (again, only for
> current kernel targets and existing gcc versions). Namely, we could
> * introduce SETUP_TIMER variant with cast to void (*)(unsigned long)
> * switch to its use, converting callback instances to take pointers
> at the same time. That would be done in reasonably sized groups.
> * once it's over, flip ->function to void (*)(void *), ->data to
> void * and update SETUP_TIMER accordingly; deal with remaining few instances
> of ->function.
Another alternative might be to define an intermediate version of
timer_list that avoids adding new macros, like
struct timer_list {
struct list_head entry;
unsigned long expires;
void (*function)(union { unsigned long l; void *p; }
__attribute__((transparent_union)));
union {
unsigned long data __deprecated;
void *obj;
};
struct tvec_t_base_s *base;
};
Unfortunately, this relies more on gcc specific behavior than we
may want, and it makes it possible to abuse in new ways, like defining
a function to take an unsigned long argument, but passing the data
as void *obj.
Arnd <><
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists