Re: [RFC][PATCH 2.6.19 1/6] cleanup for netconsole

From: Matt Mackall
Date: Tue Dec 12 2006 - 13:20:15 EST


On Tue, Dec 12, 2006 at 03:28:17PM +0900, Keiichi KII wrote:
> From: Keiichi KII <k-keiichi@xxxxxxxxxxxxx>
>
> This patch contains the following cleanups.
> - add __init for initialization functions(option_setup() and init_netconsole()).
> - define name of magic number.
>
> Signed-off-by: Keiichi KII <k-keiichi@xxxxxxxxxxxxx>
> ---
> --- linux-2.6.19/drivers/net/netconsole.c 2006-12-06 14:37:06.985584500 +0900
> +++ enhanced-netconsole/drivers/net/netconsole.c.cleanup 2006-12-06
> 14:34:52.561183500 +0900
> @@ -50,8 +50,14 @@ MODULE_AUTHOR("Maintainer: Matt Mackall
> MODULE_DESCRIPTION("Console driver for network interfaces");
> MODULE_LICENSE("GPL");
>
> -static char config[256];
> -module_param_string(netconsole, config, 256, 0);
> +enum {
> + MAX_PRINT_CHUNK = 1000,
> + MAX_CONFIG_LENGTH = 256,
> +};

Converting defines to anonymous enums is generally not considered a net
improvement around here. It doesn't provide any improvement in type safety.

>
> static void write_msg(struct console *con, const char *msg, unsigned int len)
> {
> @@ -75,14 +80,12 @@ static void write_msg(struct console *co
> return;
>
> local_irq_save(flags);
> -
> for(left = len; left; ) {
> frag = min(left, MAX_PRINT_CHUNK);
> netpoll_send_udp(&np, msg, frag);
> msg += frag;
> left -= frag;
> }
> -
> local_irq_restore(flags);
> }

It's not a good idea to mix unrelated changes in, especially if
they're gratuitous formatting changes.

> +static int __init init_netconsole(void)
> {
> if(strlen(config))
> option_setup(config);

I seem to recall there was a reason for not marking that __init. It
may no longer apply.

--
Mathematics is the supreme nostalgia of our time.
-
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/