Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269392AbUI3Sds (ORCPT ); Thu, 30 Sep 2004 14:33:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S269400AbUI3Sdr (ORCPT ); Thu, 30 Sep 2004 14:33:47 -0400 Received: from fw.osdl.org ([65.172.181.6]:22405 "EHLO mail.osdl.org") by vger.kernel.org with ESMTP id S269392AbUI3Sdn (ORCPT ); Thu, 30 Sep 2004 14:33:43 -0400 Date: Thu, 30 Sep 2004 11:33:28 -0700 (PDT) From: Linus Torvalds To: Jeff Garzik cc: Franz Pletz , Michal Rokos , Kernel Mailing List , Andrew Morton , Manfred Spraul , "David S. Miller" Subject: Re: [PATCH 2.6] Natsemi - remove compilation warnings In-Reply-To: <415C4EC5.4040603@pobox.com> Message-ID: References: <200409230958.31758.michal@rokos.info> <200409231618.56861.michal@rokos.info> <415C37D8.20203@t-online.de> <415C4EC5.4040603@pobox.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1611 Lines: 39 On Thu, 30 Sep 2004, Jeff Garzik wrote: > > > > +static inline void __iomem *ns_ioaddr(struct net_device *dev) > > +{ > > + return (void __iomem *) dev->base_addr; > > +} > > + > > hmmmm. Since dev->base_addr gets exported to userspace, I don't think > it's that quick/easy to change. Hmm? This maintains the _exact_ old semantics, ie we do exactly what it used to do before. The inline function doesn't save the value off anywhere, it's really just a nicer way to do a cast in _one_ place rather than all over the world. Also, it ends up resulting in just _one_ place that knows where to get the base address, instead of several places in pretty much every function in the whole driver ;-P > Wouldn't it be better to just phase out the base of dev->base_addr > completely? I tend to prefer adding a "void __iomem *regs" to struct > netdev_private, and ignore dev->base_addr completely. Yes. I didn't want to change actual behaviour in a driver that I can't even test, so I went for the semantically 100% equivalent cleanup patch instead that just changes the syntax and gets rid of the warnings. But that's the other advantage of the ns_ioaddr() accessor function: somebody who does have the hw can now phase out "base_addr", and just change that one one-liner function, and you can now get the base address from anywhere you like ;) Linus - 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/