From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Fri, 13 Jul 2012 12:50:49 +0200 Subject: [U-Boot] [PATCH 1/2] NET: NE2000: Cleanup IO accessors In-Reply-To: References: <1323565772-4498-1-git-send-email-marek.vasut@gmail.com> <201112162136.38003.marek.vasut@gmail.com> Message-ID: <201207131250.50047.marek.vasut@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Joe Hershberger, > Hi Marek, > > On Fri, Dec 16, 2011 at 2:36 PM, Marek Vasut wrote: > >> On Friday 16 December 2011 13:13:33 Marek Vasut wrote: > >> > On Friday 16 December 2011 12:33:53 Mike Frysinger wrote: > >> > > rename ISA_OFFSET to CONFIG_NE2000_IO_OFFSET, then move the "2" to > >> > > CONFIG_NE2000_IO_STRIDE, and move them both to the board config > >> > > header. then you get one unified set: > >> > > > >> > > #define DP_IN(_b_, _o_, _d_) \ > >> > > > >> > > (_d_) = readw((void *)((_b_) + ((_o_) * CONFIG_NE2000_IO_STRIDE) + > >> > > \ > >> > > > >> > > CONFIG_NE2000_IO_OFFSET)); > >> > > > >> > > etc... > >> > > > >> > > if you really wanted to clean up the driver, the DP_XXX funcs would > >> > > get turned into C code as static inline helpers, and the base + > >> > > register offset would get turned into a C struct. > >> > > >> > Ok, so if you had two different piece of hardware that had different > >> > NE2000_IO_OFFSET and STRIDE, running the same u-boot, how'd you handle > >> > it ? > >> > >> do you actually have this issue ? there are plenty of theoretical > >> situations like this which would break a significant number (majority?) > >> of drivers in the tree. so unless this is a real case, i'd ignore it > >> for now and stick with what optimizes away to no overhead. > > > > Sadly, I almost do. Not now of course, but eventually, I'll be there :-( > > Are you planning to improve this patch? No, I'll eventually rework this one alongside the whole DM crap. > I think at the very least you should have a compile option to enable > this "functional interface" presumably behind a macro, but every user > of NE2000 should not have to pay the price. However, like Mike > suggested, you should only add this complexity if you actually have > this problem on a board. > > Thanks, > -Joe Best regards, Marek Vasut