[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <464018F2.7050409@goop.org>
Date: Mon, 07 May 2007 23:30:10 -0700
From: Jeremy Fitzhardinge <jeremy@...p.org>
To: Rusty Russell <rusty@...tcorp.com.au>
CC: Christoph Hellwig <hch@...radead.org>, Andi Kleen <ak@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
virtualization@...ts.osdl.org, lkml <linux-kernel@...r.kernel.org>,
Chris Wright <chrisw@...s-sol.org>,
Ian Pratt <ian.pratt@...source.com>,
Christian Limpach <Christian.Limpach@...cam.ac.uk>,
netdev@...r.kernel.org, Jeff Garzik <jeff@...zik.org>,
Stephen Hemminger <shemminge@...ux-foundation.org>,
Herbert Xu <herbert@...dor.apana.org.au>
Subject: Re: [patch 25/29] xen: Add the Xen virtual network device driver.
Rusty Russell wrote:
> Looks good, you can slightly improve it to be the model use of new
> module_param types by calling your functions param_set_rx_mode and
> param_get_rx_mode, then simply using "module_param(rx_mode, rx_mode,
> 0400)"
>
Cute. I tried it out, but it doesn't yield an obvious improvement:
diff -r 83d67449bff4 drivers/net/xen-netfront.c
--- a/drivers/net/xen-netfront.c Mon May 07 18:44:11 2007 -0700
+++ b/drivers/net/xen-netfront.c Mon May 07 22:58:36 2007 -0700
@@ -67,13 +67,16 @@ struct netfront_cb {
* For fully-virtualised guests there is no option - copying must be used.
* For paravirtualised guests, flipping is the default.
*/
-static enum rx_mode {
+typedef enum rx_mode {
RX_COPY = 0,
RX_FLIP = 1,
-} rx_mode = RX_FLIP;
-MODULE_PARM_DESC(rx_mode, "How to get packets from card: \"copy\" or \"flip\"");
-
-static int set_rx_mode(const char *val, struct kernel_param *kp)
+} rx_mode_t;
+
+static enum rx_mode rx_mode = RX_FLIP;
+
+#define param_check_rx_mode_t(name, p) __param_check(name, p, rx_mode_t)
+
+static int param_set_rx_mode_t(const char *val, struct kernel_param *kp)
{
enum rx_mode *rxmp = kp->arg;
int ret = 0;
@@ -88,14 +91,15 @@ static int set_rx_mode(const char *val,
return ret;
}
-static int get_rx_mode(char *buffer, struct kernel_param *kp)
+static int param_get_rx_mode_t(char *buffer, struct kernel_param *kp)
{
enum rx_mode *rxmp = kp->arg;
return sprintf(buffer, "%s", *rxmp == RX_COPY ? "copy" : "flip");
}
-module_param_call(rx_mode, set_rx_mode, get_rx_mode, &rx_mode, 0400);
+MODULE_PARM_DESC(rx_mode, "How to get packets from card: \"copy\" or \"flip\"");
+module_param(rx_mode, rx_mode_t, 0400);
#define RX_COPY_THRESHOLD 256
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists