Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261754AbTILQXl (ORCPT ); Fri, 12 Sep 2003 12:23:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261755AbTILQXl (ORCPT ); Fri, 12 Sep 2003 12:23:41 -0400 Received: from mail.jlokier.co.uk ([81.29.64.88]:20370 "EHLO mail.jlokier.co.uk") by vger.kernel.org with ESMTP id S261754AbTILQXk (ORCPT ); Fri, 12 Sep 2003 12:23:40 -0400 Date: Fri, 12 Sep 2003 17:22:54 +0100 From: Jamie Lokier To: Anthony Dominic Truong Cc: linux-kernel@vger.kernel.org, willy@debian.org Subject: Re: Memory mapped IO vs Port IO Message-ID: <20030912162254.GA2719@mail.jlokier.co.uk> References: <20030911192550.7dfaf08c.ak@suse.de> <1063308053.4430.37.camel@huykhoi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1063308053.4430.37.camel@huykhoi> User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 973 Lines: 20 Anthony Dominic Truong wrote: > Wouldn't it be better if we set the IN and OUT function pointers to the > right functions during driver init. based on the setting of dev->mmio. > And throughout the driver, we just call the IN and OUT functions by > their pointers. Then we don't have to do if (dev->mmio) every time. > It's similar to the concept of virtual member function in C++. I think it would be faster to hide the "if (mmio)" part into an inline function which calls one or the other, given a resource cookie. Branch prediction will remove most of the cost of a conditional test, which is always the same in these drivers after all, but I don't think it's quite so good at predicting indirect function calls. -- Jamie - 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/