public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* A question about nand_read()
@ 2008-11-19  0:43 Patrick Turley
  2008-11-21 16:44 ` Patrick Turley
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Turley @ 2008-11-19  0:43 UTC (permalink / raw)
  To: linux-mtd

My tree is up-to-date as I'm writing this message.

I'm looking at nand_read() in nand_base.c, starting at line 1175, quoted  
here for your convenience:


static int nand_read(struct mtd_info *mtd, loff_t from, size_t len,
                      size_t *retlen, uint8_t *buf)
{
         struct nand_chip *chip = mtd->priv;
         int ret;

         /* Do not allow reads past end of device */
         if ((from + len) > mtd->size)
                 return -EINVAL;
         if (!len)
                 return 0;

         nand_get_device(chip, mtd, FL_READING);

         chip->ops.len = len;
         chip->ops.datbuf = buf;
         chip->ops.oobbuf = NULL;

         ret = nand_do_read_ops(mtd, from, &chip->ops);

         *retlen = chip->ops.retlen;

         nand_release_device(mtd);

         return ret;
}


In particular, I'm looking at the preparation to call nand_do_read_ops(),  
where the chip->ops structure is filled in.

Here's a small excerpt from nand_do_read_ops() that concerns me:


     /* Now read the page into the buffer */
     if (unlikely(ops->mode == MTD_OOB_RAW))
             ret = chip->ecc.read_page_raw(mtd, chip, bufpoi);
     else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob)
             ret = chip->ecc.read_subpage(mtd, chip, col, bytes, bufpoi);
     else
             ret = chip->ecc.read_page(mtd, chip, bufpoi);
     if (ret < 0)
             break;


Note that nand_do_read_ops() will look at the mode field of the ops  
structure, but this field hasn't been set by nand_read().

On the face of it, this looks like a bug. Is there something I don't know  
that makes this not a bug? For example, is the value in the mode field  
intended to persist across operations?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-11-24 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-19  0:43 A question about nand_read() Patrick Turley
2008-11-21 16:44 ` Patrick Turley
2008-11-24  9:53   ` Adrian Hunter
2008-11-24 16:35     ` Patrick Turley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox