From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Wed, 01 Sep 2010 12:13:37 -0700 Subject: [U-Boot] [PATCH NET 2/2] Net: clarify board/cpu_eth_init calls In-Reply-To: <201009011304.53715.vapier@gentoo.org> References: <1283321104-953-1-git-send-email-biggerbadderben@gmail.com> <1283321104-953-2-git-send-email-biggerbadderben@gmail.com> <201009011304.53715.vapier@gentoo.org> Message-ID: <4C7EA5E1.1040105@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 Hi Mike, On 9/1/2010 10:04 AM, Mike Frysinger wrote: > On Wednesday, September 01, 2010 02:05:04 Ben Warren wrote: >> + if (board_eth_init != __def_eth_init) { >> + } else if (cpu_eth_init != __def_eth_init) { > i'm not sure these changes are useful. the resolution of the symbols happens > at link time, so it isnt like gcc will be able to optimize away the default. > > if anything, it'd make more sense to declare the functions as external/weak, > and then check that the pointer is not NULL. that'd save on the overhead of > having uncalled stub functions that merely return 0 in the final linked image. > -mike This did work as I hoped on my PPC eval board, but maybe not globally. I remember that initially, with the functions defined as weak but with no body, check for NULL didn't work. I've never tried declaring them as external, though. thanks, Ben