Re: [PATCH 15/29] Staging: yaffs2: yaffs_mtdif2: Add files

From: Jesper Juhl
Date: Mon Nov 01 2010 - 15:15:55 EST


On Mon, 1 Nov 2010, Tracey Dent wrote:

> Adding files to yaffs2 directory.
>
> Signed-off-by: Tracey Dent <tdent48227@xxxxxxxxx>
> ---
> drivers/staging/yaffs2/yaffs_mtdif2.c | 256 +++++++++++++++++++++++++++++++++
> drivers/staging/yaffs2/yaffs_mtdif2.h | 29 ++++
> 2 files changed, 285 insertions(+), 0 deletions(-)
> create mode 100644 drivers/staging/yaffs2/yaffs_mtdif2.c
> create mode 100644 drivers/staging/yaffs2/yaffs_mtdif2.h
>
> diff --git a/drivers/staging/yaffs2/yaffs_mtdif2.c b/drivers/staging/yaffs2/yaffs_mtdif2.c
> new file mode 100644
> index 0000000..1c60a44
> --- /dev/null
> +++ b/drivers/staging/yaffs2/yaffs_mtdif2.c
...
> +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
> + ops.mode = MTD_OOB_AUTO;
> + ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size;
> + ops.len = dev->param.total_bytes_per_chunk;
> + ops.ooboffs = 0;
> + ops.datbuf = (__u8 *)data;
> + ops.oobbuf = (dev->param.inband_tags) ? NULL : packed_tags_ptr;
> + retval = mtd->write_oob(mtd, addr, &ops);
> +
> +#else
...
> +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
> + if (dev->param.inband_tags || (data && !tags))
> + retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk,
> + &dummy, data);
> + else if (tags) {
> + ops.mode = MTD_OOB_AUTO;
> + ops.ooblen = packed_tags_size;
> + ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size;
> + ops.ooboffs = 0;
> + ops.datbuf = data;
> + ops.oobbuf = yaffs_dev_to_lc(dev)->spare_buffer;
> + retval = mtd->read_oob(mtd, addr, &ops);
> + }
> +#else
...

If/when this code gets merged it will definitely be into a kernel with a
version greater than 2.6.17, so I believe you should just get rid of the
#ifdef and the code in the #else parts.

--
Jesper Juhl <jj@xxxxxxxxxxxxx> http://www.chaosbits.net/
Plain text mails only, please http://www.expita.com/nomime.html
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/