public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Guillaume LECERF <glecerf@gmail.com>
Cc: Anatolij Gustschin <agust@denx.de>, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] Simplify write buffer size calculation by using mtd->writebufsize.
Date: Fri, 11 Feb 2011 17:55:07 +0200	[thread overview]
Message-ID: <1297439707.2760.65.camel@localhost> (raw)
In-Reply-To: <20110211155302.25154.10206.stgit@dev.siriade.com>

On Fri, 2011-02-11 at 16:53 +0100, Guillaume LECERF wrote:
> This patch applies on top of "[PATCH 2/2] mtd: cfi: fix writebufsize initialization" by Anatolij Gustschin <agust@denx.de>.
> 
> 
> Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
> ---
>  drivers/mtd/chips/cfi_cmdset_0001.c |   13 ++++++-------
>  drivers/mtd/chips/cfi_cmdset_0002.c |    3 +--
>  drivers/mtd/chips/cfi_cmdset_0020.c |   16 ++++++++--------
>  3 files changed, 15 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
> index 178f87b..7d6a752 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0001.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0001.c
> @@ -1643,23 +1643,23 @@ static int cfi_intelext_write_words (struct mtd_info *mtd, loff_t to , size_t le
>  }
>  
> 
> -static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
> +static int __xipram do_write_buffer(struct mtd_info *mtd, struct flchip *chip,
>  				    unsigned long adr, const struct kvec **pvec,
>  				    unsigned long *pvec_seek, int len)
>  {
> +	struct map_info *map = mtd->priv;
>  	struct cfi_private *cfi = map->fldrv_priv;
>  	map_word status, write_cmd, datum;
>  	unsigned long cmd_adr;
> -	int ret, wbufsize, word_gap, words;
> +	int ret, word_gap, words;
>  	const struct kvec *vec;
>  	unsigned long vec_seek;
>  	unsigned long initial_adr;
>  	int initial_len = len;
>  
> -	wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
>  	adr += chip->start;
>  	initial_adr = adr;
> -	cmd_adr = adr & ~(wbufsize-1);
> +	cmd_adr = adr & ~(mtd->writebufsize - 1);

It feels like bad layering when drivers use fields like
'mtd->writesize'. I know we do this all over the place, but I think
drivers should not really rely on the contents of the "mtd->" object and
has all the needed data in private objects.

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

      reply	other threads:[~2011-02-11 15:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-11 15:53 [PATCH] Simplify write buffer size calculation by using mtd->writebufsize Guillaume LECERF
2011-02-11 15:55 ` Artem Bityutskiy [this message]

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=1297439707.2760.65.camel@localhost \
    --to=dedekind1@gmail.com \
    --cc=agust@denx.de \
    --cc=glecerf@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /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