Re: [PATCH V4] mtd: Add DiskOnChip G3 support

From: Artem Bityutskiy
Date: Thu Sep 22 2011 - 10:42:42 EST


Could you please re-base your driver on top of my l2 tree and fix
warnings 0 I get the following:

CC [M] drivers/mtd/devices/docg3.o
drivers/mtd/devices/docg3.c: In function âdoc_readâ:
drivers/mtd/devices/docg3.c:556:2: warning: format â%uâ expects argument of type âunsigned intâ, but argument 5 has type âsize_tâ [-Wformat]
drivers/mtd/devices/docg3.c: In function âdoc_read_oobâ:
drivers/mtd/devices/docg3.c:652:2: warning: format â%dâ expects argument of type âintâ, but argument 6 has type âsize_tâ [-Wformat]
drivers/mtd/devices/docg3.c:657:7: error: âMTD_OOB_PLACEâ undeclared (first use in this function)
drivers/mtd/devices/docg3.c:657:7: note: each undeclared identifier is reported only once for each function it appears in
drivers/mtd/devices/docg3.c: In function âflashcontrol_openâ:
drivers/mtd/devices/docg3.c:793:1: warning: passing argument 2 of âsingle_openâ from incompatible pointer type [enabled by default]
include/linux/seq_file.h:120:5: note: expected âint (*)(struct seq_file *, void *)â but argument is of type âssize_t (*)(struct seq_file *, void *)â
drivers/mtd/devices/docg3.c: In function âasic_mode_openâ:
drivers/mtd/devices/docg3.c:827:1: warning: passing argument 2 of âsingle_openâ from incompatible pointer type [enabled by default]
include/linux/seq_file.h:120:5: note: expected âint (*)(struct seq_file *, void *)â but argument is of type âssize_t (*)(struct seq_file *, void *)â
drivers/mtd/devices/docg3.c: In function âdevice_id_openâ:
drivers/mtd/devices/docg3.c:838:1: warning: passing argument 2 of âsingle_openâ from incompatible pointer type [enabled by default]
include/linux/seq_file.h:120:5: note: expected âint (*)(struct seq_file *, void *)â but argument is of type âssize_t (*)(struct seq_file *, void *)â
drivers/mtd/devices/docg3.c: In function âprotection_openâ:
drivers/mtd/devices/docg3.c:892:1: warning: passing argument 2 of âsingle_openâ from incompatible pointer type [enabled by default]
include/linux/seq_file.h:120:5: note: expected âint (*)(struct seq_file *, void *)â but argument is of type âssize_t (*)(struct seq_file *, void *)â
drivers/mtd/devices/docg3.c: In function âdocg3_probeâ:
drivers/mtd/devices/docg3.c:1015:3: warning: format â%xâ expects argument of type âunsigned intâ, but argument 3 has type âresource_size_tâ [-Wformat]
drivers/mtd/devices/docg3.c:1021:3: warning: format â%xâ expects argument of type âunsigned intâ, but argument 3 has type âresource_size_tâ [-Wformat]
drivers/mtd/devices/docg3.c:1039:3: error: implicit declaration of function âparse_mtd_partitionsâ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

BTW, the next step I'd do is to try to compile it with sparse, so you
could test this driver with sparse: Documentation/sparse.txt

Thanks!

On Wed, 2011-09-21 at 21:27 +0200, Robert Jarzmik wrote:
> +#define doc_readb(reg) \
> + __raw_readb(docg3->base + (reg));
> +#define doc_writeb(value, reg) \
> +do { \
> + doc_vdbg("Write %02x to register %04x\n", (value), (reg)); \
> + __raw_writeb((value), docg3->base + (reg)); \
> +} while (0)
> +#define doc_readw(reg) \
> + __raw_readw(docg3->base + (reg));
> +#define doc_writew(value, reg) \
> +do { \
> + doc_vdbg("Write %04x to register %04x\n", (value), (reg)); \
> + __raw_writew((value), docg3->base + (reg)); \
> +} while (0)
> +
> +#define doc_flashCommand(cmd) \
> +do { \
> + doc_dbg("doc_flashCommand: %02x " #cmd "\n", DoC_Cmd_##cmd); \
> + doc_writeb(DoC_Cmd_##cmd, DoC_FlashCommand); \
> +} while (0)
> +
> +#define doc_flashSequence(seq) \
> +do { \
> + doc_dbg("doc_flashSequence: %02x " #seq "\n", DoC_Seq_##seq); \
> + doc_writeb(DoC_Seq_##seq, DoC_FlashSequence); \
> +} while (0)
> +
> +#define doc_flashAddress(addr) \
> +do { \
> + doc_dbg("doc_flashAddress: %02x\n", (addr)); \
> + doc_writeb((addr), DoC_FlashAddress); \
> +} while (0)

Could you please turn these macros into 'static inline' function - this
is one of the modern patterns of kernel programming - we try to use
functions for better type checking.

--
Best Regards,
Artem Bityutskiy

--
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/