public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] use CFI-Flash and board depended driver together
Date: Thu, 30 Nov 2006 08:22:59 -0600	[thread overview]
Message-ID: <456EE943.3010003@freescale.com> (raw)
In-Reply-To: <ekmh4q$svl$1@sea.gmane.org>

Jens Scharsig wrote:

> +#ifdef CFG_FLASH_BOARD_DRIVER
> +#define flash_print_info cfi_flash_print_info
> +#define flash_erase cfi_flash_erase
> +#define write_buff  cfi_write_buff
> +#define flash_real_protect cfi_flash_real_protect
> +#endif

Ugh, I really dislike code like this.  I know Wolfgang has the final say 
on these things, but I would rather you did something else.  For 
instance, if CFG_FLASH_BOARD_DRIVER is not defined, then the cfi_xxx 
functions are defined here.  Otherwise, they are declared as externs and 
they need to be defined in the board file.  Like this:

#ifdef CFG_FLASH_BOARD_DRIVER
extern ... cfi_flash_print_info(...);
extern ... cfi_flash_erase(...);
extern ... cfi_write_buff(...);
extern ... cfi_flash_real_protect(...);
#else
... cfi_flash_print_info(...)
{
	// original cfi_flash_print_info code here
}

// and so on

#endif


> +#ifdef CFG_FLASH_BOARD_DRIVER
> +		size += flash_info[i].size = board_flash_get_size (bank_base[i], i);
> +#else
>  		size += flash_info[i].size = flash_get_size (bank_base[i], i);
> +#endif

You could do the same thing here.  Rename flash_get_size() to 
cfi_flash_get_size() and treat it like the other cfi_xxx functions above.

  reply	other threads:[~2006-11-30 14:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-30 12:00 [U-Boot-Users] [PATCH] use CFI-Flash and board depended driver together Jens Scharsig
2006-11-30 14:22 ` Timur Tabi [this message]
2006-11-30 14:52   ` Jens Scharsig
2006-11-30 17:24     ` Timur Tabi
2006-12-01  7:09       ` Jens Scharsig
2006-11-30 21:35 ` Tolunay Orkun
2006-12-05  0:55   ` Tolunay Orkun
2006-12-05  0:56   ` Tolunay Orkun
  -- strict thread matches above, loose matches on Subject: below --
2006-12-05 11:30 Yotam Admon
2006-12-05 22:54 ` Matvejchikov Ilya
2006-12-06 16:57   ` Tolunay Orkun

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=456EE943.3010003@freescale.com \
    --to=timur@freescale.com \
    --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