[PATCH] [MTD] [NAND] Add OMAP2 / OMAP3 NAND driver
Artem Bityutskiy
dedekind at infradead.org
Fri Apr 24 04:13:34 EDT 2009
Few comments of stylistic nature are below.
On Mon, 2009-04-06 at 14:31 +0530, vimal singh wrote:
> +/*
> + * drivers/mtd/nand/omap2.c
Would it be possible to remove the above?
> +#define GPMC_IRQ_STATUS 0x18
> +#define GPMC_ECC_CONFIG 0x1F4
> +#define GPMC_ECC_CONTROL 0x1F8
> +#define GPMC_ECC_SIZE_CONFIG 0x1FC
> +#define GPMC_ECC1_RESULT 0x200
> +
> +#define DRIVER_NAME "omap2-nand"
Are you going to change driver name often? If not, do not
define this.
> +#define NAND_IO_SIZE SZ_4K
Confusing variable, can you please add a comment?
> +
> +#define NAND_WP_ON 1
> +#define NAND_WP_OFF 0
I think these defines should be killed.
> +#define TF(value) (value ? 1 : 0)\
Could this define be killed please?
> +
> +/*
> + * omap_nand_wp - This function enable or disable the Write Protect feature on
> + * NAND device
> + * @mtd: MTD device structure
> + * @mode: WP ON/OFF
> + */
Kerneldoc comments should start with /**
> +/*
> + * hardware specific access to control-lines
> + * NOTE: boards may use different bits for these!!
> + *
> + * ctrl:
> + * NAND_NCE: bit 0 - don't care
> + * NAND_CLE: bit 1 -> Command Latch
> + * NAND_ALE: bit 2 -> Address Latch
> + */
If you try to use kerneldoc comments, use them everywhere,
be consistent please.
Documentation/kernel-doc-nano-HOWTO.txt
Glance at all comments.
> +static int omap_verify_buf(struct mtd_info *mtd, const u_char * buf, int len)
> +{
> + struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
> + mtd);
It is less ugly to do:
struct omap_nand_info *info;
info = container_of(mtd, struct omap_nand_info, mtd);
> + u16 *p = (u16 *) buf;
> +
> + len >>= 1;
> +
> + while (len--) {
> +
> + if (*p++ != cpu_to_le16(readw(info->nand.IO_ADDR_R)))
> + return -EFAULT;
> + }
> +
> + return 0;
> +}
Very sparse code, too many blank lines...
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
More information about the linux-mtd
mailing list