From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Mon, 10 Oct 2011 17:31:39 +0200 Subject: [U-Boot] [PATCH V3 05/13] i2c: Create common default i2c_set_bus_num() function In-Reply-To: <201110101119.48636.vapier@gentoo.org> References: <1318091769-30979-1-git-send-email-sbabic@denx.de> <1318243812-22928-1-git-send-email-sbabic@denx.de> <201110101119.48636.vapier@gentoo.org> Message-ID: <4E930FDB.2000202@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 10/10/2011 05:19 PM, Mike Frysinger wrote: > On Monday 10 October 2011 06:50:12 Stefano Babic wrote: Hi Mike, >> +int __def_i2c_set_bus_num(unsigned int bus) >> +{ >> + return 0; >> +} >> +int i2c_set_bus_num(unsigned int) >> + __attribute__((weak, alias("__def_i2c_set_bus_num"))); > > any reason this can't just be: > __weak int i2c_set_bus_num(unsigned int bus) > { > return 0; > } > > i can understand having a default func when it actually does something, but i > don't see much value in a stub that returns 0 It seems to me that this is the commonly used style in u-boot. The same happens for the i2c_init_board, some lines before, and in a lot of other modules: void __def_i2c_init_board(void) { return; } void i2c_init_board(void) __attribute__((weak, alias("__def_i2c_init_board"))); Simply grepping in u-boot code, the default function is defined even if it does nothing, Regards, Stefano -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================