public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] M18 flash (Sibley) support (attempt 2)
Date: Tue, 29 Apr 2008 14:43:17 +0200	[thread overview]
Message-ID: <200804291443.17219.sr@denx.de> (raw)
In-Reply-To: <E1JqokH-000IQ6-00.vasiliy-leonenko-mail-ru@f128.mail.ru>

On Tuesday 29 April 2008, Vasiliy Leoenenko wrote:
> The first patch (support of long commands):

I like the idea of splitting this patch up in two separate patches/emails. But 
please provide a descriptive subject and a short description that can will be 
added to the git repository as commit text for each patch. And don't forget 
your Signed-off-by line.

Please take a look at other patches on the list how this should be done. Best 
would be if you could use the git tools to create (and send) the patches.

Thanks.

Some further remarks below:

> ===================================================
> diff -aupNr a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
> --- a/drivers/mtd/cfi_flash.c	2008-04-21 02:39:38.000000000 +0400
> +++ b/drivers/mtd/cfi_flash.c	2008-04-29 15:57:51.000000000 +0400
> @@ -298,17 +298,29 @@ static inline void flash_unmap(flash_inf
>  /*-----------------------------------------------------------------------
>   * make a proper sized command based on the port and chip widths
>   */
> -static void flash_make_cmd (flash_info_t * info, uchar cmd, void *cmdbuf)
> +static void flash_make_cmd (flash_info_t * info, ulong cmd, void *cmdbuf)
>  {
>  	int i;
> +	int cpofft;
>  	uchar *cp = (uchar *) cmdbuf;
> +	uchar cp_val;
>
>  #if defined(__LITTLE_ENDIAN) || defined(CFG_WRITE_SWAPPED_DATA)
> -	for (i = info->portwidth; i > 0; i--)
> +	for (i = sizeof(cfiword_t); i > 0; i--)
> +	{

+	for (i = sizeof(cfiword_t); i > 0; i--) {

The code down below has some coding style issues too. Please 

> +		cpofft=(i-1);

+		cpofft = i - 1;

The code down below has some coding style issues too. Please try to be more 
careful here.

And the resulting code looks like this:

#if defined(__LITTLE_ENDIAN) || defined(CFG_WRITE_SWAPPED_DATA)
	for (i = sizeof(cfiword_t); i > 0; i--)
	{
		cpofft=(i-1);
#else
	for (i = 1; i <= sizeof(cfiword_t); i++)
	{
		cpofft=(sizeof(cfiword_t)-i);
#endif
		if( cpofft%info->chipwidth >= sizeof(ulong) || cpofft>=info->portwidth)
			cp_val = 0x00;
		else
			cp_val = *((uchar*)&cmd + cpofft%info->chipwidth);
			
		cp[i-1] = cp_val;		
	}


Apart from the coding-style issues, this is getting quite complex and unclear. 
At least to me. Are you sure that this can't be written differently to make 
it easier to understand? 

Thanks.

Best regards,
Stefan

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

  reply	other threads:[~2008-04-29 12:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28 11:29 [U-Boot-Users] [PATCH] M18 flash (Sibley) support (attempt 2) Vasiliy Leoenenko
2007-09-28 14:47 ` Wolfgang Denk
2007-09-28 15:47   ` Alexey Korolev
2007-09-28 16:40     ` Wolfgang Denk
2008-04-21  7:02 ` Stefan Roese
2008-04-23  9:42   ` Vasiliy Leoenenko
2008-04-25  6:35     ` Stefan Roese
2008-04-29 12:14       ` Vasiliy Leoenenko
2008-04-29 13:02         ` Jean-Christophe PLAGNIOL-VILLARD
2008-04-29 12:15       ` Vasiliy Leoenenko
2008-04-29 12:43         ` Stefan Roese [this message]
2008-04-29 13:43         ` Wolfgang Denk
2008-04-29 14:39           ` Vasiliy Leoenenko
2008-04-29 14:40           ` Vasiliy Leoenenko
2008-04-29 15:03             ` Anatolij Gustschin
2008-05-07 17:23               ` Vasiliy Leoenenko
2008-05-07 17:24               ` Vasiliy Leoenenko
2008-06-03 19:07                 ` Stefan Roese
2008-05-07 17:25               ` Vasiliy Leoenenko
2008-06-03 19:07                 ` Stefan Roese
2008-05-07 18:05               ` Vasiliy Leoenenko
2008-05-12  9:36                 ` Vasiliy Leonenko
2008-05-13  5:42                   ` Stefan Roese
2008-04-29 14:40           ` Vasiliy Leoenenko
2008-04-29 12:16       ` Vasiliy Leoenenko

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=200804291443.17219.sr@denx.de \
    --to=sr@denx.de \
    --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