All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V4] mtd: Add DiskOnChip G3 support
Date: Thu, 22 Sep 2011 17:45:21 +0300	[thread overview]
Message-ID: <1316702729.4849.114.camel@sauron> (raw)
In-Reply-To: <1316633266-21312-1-git-send-email-robert.jarzmik@free.fr>

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

WARNING: multiple messages have this Message-ID (diff)
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: dwmw2@infradead.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V4] mtd: Add DiskOnChip G3 support
Date: Thu, 22 Sep 2011 17:45:21 +0300	[thread overview]
Message-ID: <1316702729.4849.114.camel@sauron> (raw)
In-Reply-To: <1316633266-21312-1-git-send-email-robert.jarzmik@free.fr>

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


  reply	other threads:[~2011-09-22 14:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21 19:27 [PATCH V4] mtd: Add DiskOnChip G3 support Robert Jarzmik
2011-09-21 19:27 ` Robert Jarzmik
2011-09-22 14:45 ` Artem Bityutskiy [this message]
2011-09-22 14:45   ` Artem Bityutskiy
2011-09-22 17:42   ` Robert Jarzmik
2011-09-22 17:42     ` Robert Jarzmik
2011-09-27 13:39     ` Arnd Bergmann
2011-09-27 13:39       ` Arnd Bergmann
2011-09-27 17:51       ` Robert Jarzmik
2011-09-27 17:51         ` Robert Jarzmik
2011-09-28 12:45         ` Arnd Bergmann
2011-09-28 12:45           ` Arnd Bergmann
2011-10-01 12:19           ` Robert Jarzmik
2011-10-01 12:19             ` Robert Jarzmik
2011-10-01 15:02             ` Arnd Bergmann
2011-10-01 15:02               ` Arnd Bergmann
2011-09-23 19:14   ` [PATCH V5] " Robert Jarzmik
2011-09-23 19:14     ` Robert Jarzmik
2011-09-27 12:58     ` Artem Bityutskiy
2011-09-27 12:58       ` Artem Bityutskiy

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=1316702729.4849.114.camel@sauron \
    --to=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=robert.jarzmik@free.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.