Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936837AbWLDN3d (ORCPT ); Mon, 4 Dec 2006 08:29:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S936834AbWLDN3d (ORCPT ); Mon, 4 Dec 2006 08:29:33 -0500 Received: from caramon.arm.linux.org.uk ([217.147.92.249]:27661 "EHLO caramon.arm.linux.org.uk") by vger.kernel.org with ESMTP id S936837AbWLDN3c (ORCPT ); Mon, 4 Dec 2006 08:29:32 -0500 Date: Mon, 4 Dec 2006 13:29:16 +0000 From: Russell King 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 Subject: Re: [RFC] timers, pointers to functions and type safety Message-ID: <20061204132916.GA24634@flint.arm.linux.org.uk> Mail-Followup-To: David Howells , Pavel Machek , Roman Zippel , Al Viro , Thomas Gleixner , Matthew Wilcox , Linus Torvalds , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org 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> User-Agent: Mutt/1.4.2.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1377 Lines: 48 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: - 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/