lkml.org 
[lkml]   [2006]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC] timers, pointers to functions and type safety
Date
Russell King <rmk+lkml@arm.linux.org.uk> wrote:

> I assume you wanted to delete "data" ?

Yes.

> Your premise is two timer_lists which use one common handler.
>
> struct foo {
> struct timer_list timer1;
> strucr timer_list timer2;
> };

That's not what I was thinking of. I was thinking of something much simpler:

struct foo {
struct timer_list timer;
};

...
struct foo *a = kmalloc(sizeof(struct foo), GFP_KERNEL);
a->timer.fn = do_foo_timer;
...
struct foo *b = kmalloc(sizeof(struct foo), GFP_KERNEL);
b->timer.fn = do_foo_timer;
...
struct foo *c = kmalloc(sizeof(struct foo), GFP_KERNEL);
c->timer.fn = do_foo_timer;
...
struct foo *d = kmalloc(sizeof(struct foo), GFP_KERNEL);
d->timer.fn = do_foo_timer;
...

You've now got four copies of struct timer_list, but only one handler.

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

\
 
 \ /
  Last update: 2006-12-04 14:07    [W:0.280 / U:1.080 seconds]
©2003-2014 Jasper Spaans. Advertise on this site