From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V3 05/13] i2c: Create common default i2c_set_bus_num() function
Date: Mon, 10 Oct 2011 13:51:30 -0400 [thread overview]
Message-ID: <201110101351.31460.vapier@gentoo.org> (raw)
In-Reply-To: <4E930FDB.2000202@denx.de>
On Monday 10 October 2011 11:31:39 Stefano Babic wrote:
> On 10/10/2011 05:19 PM, Mike Frysinger wrote:
> > On Monday 10 October 2011 06:50:12 Stefano Babic wrote:
> >> +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,
i believe we have two standards. i'm not sure which gets used more, or if
it's just a wash. i think it makes sense to have an accessible default func
if it does something useful, but not if it's just a stub.
in the __def/weak style above, unless people use --gc-sections when linking (i
think we've got many people doing this now, but not all), you end up with dead
code in the binary. in the code i proposed, the func gets discarded both when
using --gc-sections and when not.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111010/836d1287/attachment.pgp
next prev parent reply other threads:[~2011-10-10 17:51 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-08 16:35 [U-Boot] switch to generic PMIC driver for i.MX boards Stefano Babic
2011-10-08 16:35 ` [U-Boot] [PATCH 01/13] MX5: vision2: use new pmic driver Stefano Babic
2011-10-08 16:35 ` [U-Boot] [PATCH 02/13] RTC: Switch mc13783 to generic pmic code Stefano Babic
2011-10-08 16:35 ` [U-Boot] [PATCH 03/13] MX3: qong: use new pmic driver Stefano Babic
2011-10-08 16:36 ` [U-Boot] [PATCH V2 04/13] MX5: efikamx/efikasb: " Stefano Babic
2011-10-08 16:57 ` Marek Vasut
2011-10-08 16:36 ` [U-Boot] [PATCH 05/13] I2c: add missing i2c_set_bus_num to mxc_i2c Stefano Babic
2011-10-10 8:50 ` Heiko Schocher
2011-10-10 9:30 ` Stefano Babic
2011-10-08 16:36 ` [U-Boot] [PATCH V2 06/13] misc: pmic: addI2C support to pmic_fsl driver Stefano Babic
2011-10-08 16:36 ` [U-Boot] [PATCH 07/13] MX35: mx35pdk: use new pmic driver Stefano Babic
2011-10-08 16:36 ` [U-Boot] [PATCH V2 08/13] MX5: mx51evk: " Stefano Babic
2011-10-08 16:36 ` [U-Boot] [PATCH V2 09/13] MX5: mx53evk: " Stefano Babic
2011-10-08 16:36 ` [U-Boot] [PATCH 10/13] MX31: mx31_litekit: " Stefano Babic
2011-10-08 16:36 ` [U-Boot] [PATCH 11/13] MX31: mx31ads: " Stefano Babic
2011-10-08 16:36 ` [U-Boot] [PATCH 12/13] MX31: mx31pdk: " Stefano Babic
2011-10-08 16:36 ` [U-Boot] [PATCH 13/13] misc: pmic: drop old Freescale's " Stefano Babic
2011-10-19 13:23 ` Helmut Raiger
2011-10-19 15:39 ` Stefano Babic
2011-10-19 16:48 ` [U-Boot] [PATCH] misc: pmic: fix regression in pmic_fsl.c (SPI) Helmut Raiger
2011-10-19 17:15 ` Stefano Babic
2011-10-20 6:41 ` Helmut Raiger
2011-10-20 6:28 ` [U-Boot] [PATCH V2] " Helmut Raiger
2011-10-20 6:34 ` [U-Boot] [Resend PATCH " Helmut Raiger
2011-10-20 7:31 ` Stefano Babic
2011-10-24 7:48 ` Stefano Babic
2011-10-10 9:35 ` [U-Boot] [PATCH V2 05/13] i2c: Create common default i2c_set_bus_num() function Stefano Babic
2011-10-10 10:33 ` Heiko Schocher
2011-10-10 17:53 ` Tabi Timur-B04825
2011-10-10 18:26 ` Mike Frysinger
2011-10-10 18:29 ` Timur Tabi
2011-10-11 7:33 ` Stefano Babic
2011-10-11 5:37 ` Heiko Schocher
2011-10-11 5:48 ` Wolfgang Denk
2011-10-11 5:51 ` Aaron Williams
2011-10-11 5:52 ` Heiko Schocher
2011-10-10 10:50 ` [U-Boot] [PATCH V3 " Stefano Babic
2011-10-10 15:19 ` Mike Frysinger
2011-10-10 15:31 ` Stefano Babic
2011-10-10 17:51 ` Mike Frysinger [this message]
2011-10-11 17:30 ` Stefano Babic
2011-10-11 17:46 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201110101351.31460.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox