public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind@infradead.org>
To: apgmoorthy <moorthy.apg@samsung.com>
Cc: 'Kyungmin Park' <kmpark@infradead.org>,
	'David Woodhouse' <dwmw2@infradead.org>,
	linux-mtd@lists.infradead.org
Subject: RE: [ANNOUNCE] [PATCH] [MTD] Flex-OneNAND MTD Driver available.
Date: Mon, 20 Oct 2008 08:54:00 +0300	[thread overview]
Message-ID: <1224482040.4466.73.camel@sauron> (raw)
In-Reply-To: <000001c93271$5c6ab4c0$3dd66c6b@sisodomain.com>

> +/**
>   * onenand_get_density - [DEFAULT] Get OneNAND density
>   * @param dev_id	OneNAND device ID
>   *
> @@ -196,6 +280,7 @@ static int onenand_command(struct mtd_info *mtd, int
> cmd, loff_t addr, size_t le
>  {
>  	struct onenand_chip *this = mtd->priv;
>  	int value, block, page;
> +	unsigned slc = 0;
>  
>  	/* Address translation */
>  	switch (cmd) {
> @@ -207,15 +292,16 @@ static int onenand_command(struct mtd_info *mtd, int
> cmd, loff_t addr, size_t le
>  		page = -1;
>  		break;
>  
> +	case FLEXONENAND_CMD_PI_ACCESS:
>  	case ONENAND_CMD_ERASE:
>  	case ONENAND_CMD_BUFFERRAM:
>  	case ONENAND_CMD_OTP_ACCESS:
> -		block = (int) (addr >> this->erase_shift);
> +		block = onenand_get_block(mtd, addr, NULL);

Why do you make SLC slower by adding a function call it which it does
not need? Could you please make it in-line for SLC and a func for MLC.
IOW, I do not like that you make SLC degrade because of supporting MLC.

E.g., you may do it like this:

static inline onenand_get_block()
{
	if (SLC)
 		return addr >> this->erase_shift;
	else
		return flexonenand_get_block()
}

>  		page = -1;
>  		break;
>  
>  	default:
> -		block = (int) (addr >> this->erase_shift);
> +		block = onenand_get_block(mtd, addr, &slc);
>  		page = (int) (addr >> this->page_shift);
>  
>  		if (ONENAND_IS_2PLANE(this)) {
> @@ -227,6 +313,8 @@ static int onenand_command(struct mtd_info *mtd, int
> cmd, loff_t addr, size_t le
>  			page >>= 1;
>  		}
>  		page &= this->page_mask;
> +		if (FLEXONENAND(this) && slc)
> +			page &= (this->page_mask >> 1);

This is bad. Please, be consistent and use _one_ way to get the address.
Either a function or the if statement. Do not introduce mess by mixing
these approaches.

I tried to review the rest of the patch. But quite frankly, it is so
difficult to do, because you injected little pieces of

if (MLC) {
	do;
	various;
	stuff;
}

all over the place, and made the driver very difficult to follow. Could
you please work some more on the driver and try to improve the
readability? E.g., by making some functions to have 2 separate variants
- one for SLC, one for MLC. If you do not want to duplicate some code -
this is what fuctions exist for.

Also, the patch is line-wrapped. You should read this:
Documentation/SubmittingPatches

Thanks.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

  reply	other threads:[~2008-10-20  5:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 12:31 [ANNOUNCE] [PATCH] [MTD] Flex-OneNAND MTD Driver available AYYANARPONNUSAMY GANGHEYAMOORTHY
2008-09-22  7:11 ` Kyungmin Park
2008-09-24 12:35   ` apgmoorthy
2008-09-26  0:31     ` Kyungmin Park
2008-09-26  4:51       ` Artem Bityutskiy
2008-09-26  5:30         ` Kyungmin Park
2008-09-26  6:26           ` Artem Bityutskiy
2008-09-26  8:01         ` Amit Kumar Sharma
2008-09-26  8:19           ` Artem Bityutskiy
2008-09-29  9:28             ` apgmoorthy
2008-10-09 22:57               ` Kyungmin Park
     [not found]                 ` <1224331498.6770.1362.camel@macbook.infradead.org>
2008-10-20  5:04                   ` apgmoorthy
2008-10-20  5:54                     ` Artem Bityutskiy [this message]
2008-10-22  6:43                       ` apgmoorthy
2008-10-24 14:26                         ` Adrian Hunter
2008-11-03 10:32                           ` apgmoorthy
2008-11-05  8:52                             ` Adrian Hunter
2008-11-07 14:26                               ` Rohit
2008-11-10 15:20                                 ` Adrian Hunter
2008-11-11  3:31                                   ` Amit Kumar Sharma
2008-11-11  7:28                                     ` Adrian Hunter
2008-11-12  5:43                                   ` Rohit
2008-10-20 10:53                     ` David Woodhouse
2008-10-21  5:22                   ` apgmoorthy
2008-10-10  6:34               ` David Woodhouse
     [not found] <000001c92f46$18a67c70$3dd66c6b@sisodomain.com>
2008-10-16  4:28 ` Kyungmin Park
2008-10-20  3:01 ` Kyungmin Park

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=1224482040.4466.73.camel@sauron \
    --to=dedekind@infradead.org \
    --cc=dwmw2@infradead.org \
    --cc=kmpark@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=moorthy.apg@samsung.com \
    /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