From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S264917AbUHaRJb (ORCPT ); Tue, 31 Aug 2004 13:09:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S265044AbUHaRJb (ORCPT ); Tue, 31 Aug 2004 13:09:31 -0400 Received: from imladris.demon.co.uk ([193.237.130.41]:62468 "EHLO phoenix.infradead.org") by vger.kernel.org with ESMTP id S264917AbUHaRBp (ORCPT ); Tue, 31 Aug 2004 13:01:45 -0400 Date: Tue, 31 Aug 2004 18:01:29 +0100 From: Christoph Hellwig To: Ian Romanick Cc: Dave Jones , Dave Airlie , linux-kernel@vger.kernel.org Subject: Re: [rfc][patch] DRM initial function table support. Message-ID: <20040831180129.A23112@infradead.org> Mail-Followup-To: Christoph Hellwig , Ian Romanick , Dave Jones , Dave Airlie , linux-kernel@vger.kernel.org References: <20040831152015.GC22978@redhat.com> <4134A22F.7000103@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <4134A22F.7000103@us.ibm.com>; from idr@us.ibm.com on Tue, Aug 31, 2004 at 09:07:11AM -0700 X-SRS-Rewrite: SMTP reverse-path rewritten from by phoenix.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 31, 2004 at 09:07:11AM -0700, Ian Romanick wrote: > I think the intention is to have default functions set in the > device-independent code and have the device-dependent code over-ride > them. Since the defaults may not always be NULL, doing a struct like > that wouldn't really work. I suppose we could have a struct and a > device-independent function that copies the non-NULL pointers from the > per-device struct. Would that be better? Don't copy them. Just put if (foo->ops->method1) foo->ops->method1(args); else generic_method1(args); in your code. It's an additional branch, but you avoid the indirect functioncalloverhead in exchange.