Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936803AbWLDNEz (ORCPT ); Mon, 4 Dec 2006 08:04:55 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S936804AbWLDNEy (ORCPT ); Mon, 4 Dec 2006 08:04:54 -0500 Received: from mx1.redhat.com ([66.187.233.31]:38835 "EHLO mx1.redhat.com") by vger.kernel.org with ESMTP id S936803AbWLDNEw (ORCPT ); Mon, 4 Dec 2006 08:04:52 -0500 From: David Howells In-Reply-To: <20061204121618.GB17507@flint.arm.linux.org.uk> References: <20061204121618.GB17507@flint.arm.linux.org.uk> <20061201172149.GC3078@ftp.linux.org.uk> <1165084076.24604.56.camel@localhost.localdomain> <20061202184035.GL3078@ftp.linux.org.uk> <200612022243.58348.zippel@linux-m68k.org> <20061202215941.GN3078@ftp.linux.org.uk> <20061202224018.GO3078@ftp.linux.org.uk> <20061203102108.GA1724@elf.ucw.cz> <26864.1165230869@redhat.com> To: Russell King Cc: David Howells , Pavel Machek , Roman Zippel , Al Viro , Thomas Gleixner , Matthew Wilcox , Linus Torvalds , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC] timers, pointers to functions and type safety X-Mailer: MH-E 8.0; nmh 1.1; GNU Emacs 22.0.50 Date: Mon, 04 Dec 2006 13:03:29 +0000 Message-ID: <29346.1165237409@redhat.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1077 Lines: 42 Russell King 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/