From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from caramon.arm.linux.org.uk ([217.147.92.249]:27149 "EHLO caramon.arm.linux.org.uk") by vger.kernel.org with ESMTP id S936836AbWLDN32 (ORCPT ); Mon, 4 Dec 2006 08:29:28 -0500 Date: Mon, 4 Dec 2006 13:29:16 +0000 From: Russell King Subject: Re: [RFC] timers, pointers to functions and type safety Message-ID: <20061204132916.GA24634@flint.arm.linux.org.uk> References: <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> <29346.1165237409@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29346.1165237409@redhat.com> Sender: linux-arch-owner@vger.kernel.org To: David Howells Cc: Pavel Machek , Roman Zippel , Al Viro , Thomas Gleixner , Matthew Wilcox , Linus Torvalds , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org List-ID: On Mon, Dec 04, 2006 at 01:03:29PM +0000, David Howells wrote: > 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. -- Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: