public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/6] cmd_nvedit.c: allow board-specific code before/after saving the environment
Date: Mon, 14 May 2012 01:20:44 -0400	[thread overview]
Message-ID: <201205140120.45712.vapier@gentoo.org> (raw)
In-Reply-To: <1336170092-22538-5-git-send-email-timur@freescale.com>

On Friday 04 May 2012 18:21:31 Timur Tabi wrote:
> Introduce board_start_saveenv() and board_finish_saveenv(), two "weak"
> functions that are called before and after saving the environment.  This
> allows for board-specific functions that "prepare" the board for saving
> the environment.  This is useful if, for some reason, the non-volatile
> storage is normally unavailable (e.g. blocked via a mux).

all these board hooks are paper-cutting us to death with unused bloat

> --- a/common/cmd_nvedit.c
> +++ b/common/cmd_nvedit.c
> 
>  #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
> +
> +static int __board_start_saveenv(void)
> +{
> +	return 0;
> +}
> +int board_start_saveenv(void) __attribute__((weak,
> alias("__board_start_saveenv"))); +
> +static void __board_finish_saveenv(void)
> +{
> +}
> +void board_finish_saveenv(void) __attribute__((weak,
> alias("__board_finish_saveenv"))); +
>  int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  {
> +	int ret;
> +
>  	printf("Saving Environment to %s...\n", env_name_spec);
> 
> -	return saveenv() ? 1 : 0;
> +	ret = board_start_saveenv();
> +	if (ret)
> +		return 0;
> +
> +	ret = saveenv() ? 1 : 0;
> +
> +	board_finish_saveenv();
> +
> +	return ret;
>  }

this is less bloat:
int board_start_saveenv(void) __attribute__((weak, alias("saveenv")));

int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	printf("Saving Environment to %s...\n", env_name_spec);
	return board_saveenv() ? 1 : 0;
}
-------------- 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/20120514/5fd0154f/attachment.pgp>

  reply	other threads:[~2012-05-14  5:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-04 22:21 [U-Boot] [PATCH 1/6] powerpc/85xx: minor clean-ups to the P2020DS board header file Timur Tabi
2012-05-04 22:21 ` [U-Boot] [PATCH 2/6] powerpc/85xx: fdt_set_phy_handle() should return an error code Timur Tabi
2012-05-04 22:21 ` [U-Boot] [PATCH 3/6] powerpc/85xx: clean up P1022DS board configuration header file Timur Tabi
2012-05-04 22:21 ` [U-Boot] [PATCH 4/6] lib/powerpc: addrmap_phys_to_virt() should return a pointer Timur Tabi
2012-05-04 22:21 ` [U-Boot] [PATCH 5/6] cmd_nvedit.c: allow board-specific code before/after saving the environment Timur Tabi
2012-05-14  5:20   ` Mike Frysinger [this message]
2012-05-14 16:10     ` Timur Tabi
2012-05-15  5:14       ` Mike Frysinger
2012-05-17 22:18       ` Wolfgang Denk
2012-05-17 22:35         ` Timur Tabi
2012-05-18  2:46           ` Mike Frysinger
2012-05-18 11:28           ` Wolfgang Denk
2012-05-18 15:58             ` Timur Tabi
2012-05-18 16:02               ` Jeroen Hofstee
2012-05-18 18:24                 ` Wolfgang Denk
2012-05-18 18:23               ` Wolfgang Denk
2012-05-18 18:29               ` Fabio Estevam
2012-05-17 22:48         ` Scott Wood
2012-05-17 22:53           ` Timur Tabi
2012-05-18  2:14             ` Scott Wood
2012-05-18  2:21               ` Tabi Timur-B04825
2012-05-18  2:30                 ` Scott Wood
2012-05-18 16:00                   ` Timur Tabi
2012-05-18 16:13                     ` Scott Wood
2012-05-18 16:17                       ` Timur Tabi
2012-05-18 16:29                         ` Scott Wood
2012-05-18 17:08                           ` Timur Tabi
2012-05-18 17:21                             ` Scott Wood
2012-05-18 18:13                               ` McClintock Matthew-B29882
2012-05-18 18:28                           ` Wolfgang Denk
2012-05-17 21:18     ` Timur Tabi
2012-05-04 22:21 ` [U-Boot] [PATCH 6/6] powerpc/85xx: p1022ds: use the saveenv board preparation functions Timur Tabi

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=201205140120.45712.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