RE: [PATCH 2/2] misc: add real functionopen/read/write/ioctl/close for moxa_serial_io driver

From: Joe Perches
Date: Mon Apr 25 2011 - 03:30:50 EST


On Mon, 2011-04-25 at 14:44 +0800, Jimmy Chen (éæé) wrote:
> From: Jimmy Chen <jimmy.chen@xxxxxxxx>
>
> Add real function and GPL license.
> Check with script/checkpatch.pl

Just some trivia:
There is a mechanism used to prefix logging messages.

> diff --git a/drivers/misc/moxa_serial_io.c b/drivers/misc/moxa_serial_io.c

You could add

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

before any #include

> +#include <linux/module.h>
> +#include <linux/kernel.h>
[]
> +static int __init io_init_module(void)
> +{
> + unsigned char val;
> + printk(KERN_INFO "initializing MOXA SERIAL IO module\n");

And convert all the printks to pr_<level>

pr_info("Initializing module\n");
> +
> + if (misc_register(&dio_miscdev) != 0) {
> + printk(KERN_INFO "Moxa serial io driver: Register misc fail !\n");

pr_err("misc_register failed\n");

[]
> + printk(KERN_INFO "Moxa V2100 serial io driver, version "
> + MOXA_SERIAL_IO_VERSION ", " "init OK\n");

pr_info("Initialized version %s\n", MOXA_SERIAL_IO_VERSION);

> +static void __exit io_cleanup_module(void)
> +{
> + printk("cleaning up module\n");

pr_info("Removed\n");


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