* [PATCH 2.6] Update to module_params() in 3c59x.c
@ 2004-12-30 14:40 Maciej Soltysiak
2005-01-03 0:44 ` Randy.Dunlap
0 siblings, 1 reply; 3+ messages in thread
From: Maciej Soltysiak @ 2004-12-30 14:40 UTC (permalink / raw)
To: linux-net; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4606 bytes --]
Hi!
This patch:
1) updates the 3c59x.c driver to use module_param() stuff.
2) kills a strange character somewhere at the bottom of the patch
I hope it is right, it is my first glance at module_param() :-)
3c59x.c | 67 +++++++++++++++++++++++++++++++---------------------------------
1 files changed, 33 insertions(+), 34 deletions(-)
Oh, in order to use the module_param() macros i had to move the variable
before module_param.
Signed-off-by: Maciej Soltysiak <solt2@dns.toxicfilms.tv>
Please review and hopefully apply.
Regars,
Maciej
diff -ru linux.orig/drivers/net/3c59x.c linux/drivers/net/3c59x.c
--- linux.orig/drivers/net/3c59x.c 2004-12-30 15:27:40.000000000 +0100
+++ linux/drivers/net/3c59x.c 2004-12-30 14:33:29.000000000 +0100
@@ -240,6 +240,7 @@
#include <linux/config.h>
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/timer.h>
@@ -269,6 +270,23 @@
#include <linux/delay.h>
+/* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
+/* Option count limit only -- unlimited interfaces are supported. */
+#define MAX_UNITS 8
+static int options[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1,};
+static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static int hw_checksums[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static int flow_ctrl[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static int enable_wol[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static int global_options = -1;
+static int global_full_duplex = -1;
+static int global_enable_wol = -1;
+
+/* #define dev_alloc_skb dev_alloc_skb_debug */
+
+/* Variables to work-around the Compaq PCI BIOS32 problem. */
+static int compaq_ioaddr, compaq_irq, compaq_device_id = 0x5900;
+static struct net_device *compaq_net_device;
static char version[] __devinitdata =
DRV_NAME ": Donald Becker and others. www.scyld.com/network/vortex.html\n";
@@ -279,21 +297,21 @@
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
-MODULE_PARM(debug, "i");
-MODULE_PARM(global_options, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(global_full_duplex, "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(hw_checksums, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(flow_ctrl, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(global_enable_wol, "i");
-MODULE_PARM(enable_wol, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(compaq_ioaddr, "i");
-MODULE_PARM(compaq_irq, "i");
-MODULE_PARM(compaq_device_id, "i");
-MODULE_PARM(watchdog, "i");
+module_param(debug, int, 0);
+module_param(global_options, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param(global_full_duplex, int, 0);
+module_param_array(full_duplex, int, NULL, 0);
+module_param_array(hw_checksums, int, NULL, 0);
+module_param_array(flow_ctrl, int, NULL, 0);
+module_param(global_enable_wol, int, 0);
+module_param_array(enable_wol, int, NULL, 0);
+module_param(rx_copybreak, int, 0);
+module_param(max_interrupt_work, int, 0);
+module_param(compaq_ioaddr, int, 0);
+module_param(compaq_irq, int, 0);
+module_param(compaq_device_id, int, 0);
+module_param(watchdog, int, 0);
MODULE_PARM_DESC(debug, "3c59x debug level (0-6)");
MODULE_PARM_DESC(options, "3c59x: Bits 0-3: media type, bit 4: bus mastering, bit 9: full duplex");
MODULE_PARM_DESC(global_options, "3c59x: same as options, but applies to all NICs if options is unset");
@@ -910,25 +928,6 @@
static struct ethtool_ops vortex_ethtool_ops;
static void set_8021q_mode(struct net_device *dev, int enable);
-\f
-/* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
-/* Option count limit only -- unlimited interfaces are supported. */
-#define MAX_UNITS 8
-static int options[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1,};
-static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int hw_checksums[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int flow_ctrl[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int enable_wol[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int global_options = -1;
-static int global_full_duplex = -1;
-static int global_enable_wol = -1;
-
-/* #define dev_alloc_skb dev_alloc_skb_debug */
-
-/* Variables to work-around the Compaq PCI BIOS32 problem. */
-static int compaq_ioaddr, compaq_irq, compaq_device_id = 0x5900;
-static struct net_device *compaq_net_device;
-
static int vortex_cards_found;
#ifdef CONFIG_NET_POLL_CONTROLLER
[-- Attachment #2: 3c59x.c.diff --]
[-- Type: application/octet-stream, Size: 4051 bytes --]
diff -ru linux.orig/drivers/net/3c59x.c linux/drivers/net/3c59x.c
--- linux.orig/drivers/net/3c59x.c 2004-12-30 15:27:40.000000000 +0100
+++ linux/drivers/net/3c59x.c 2004-12-30 14:33:29.000000000 +0100
@@ -240,6 +240,7 @@
#include <linux/config.h>
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/timer.h>
@@ -269,6 +270,23 @@
#include <linux/delay.h>
+/* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
+/* Option count limit only -- unlimited interfaces are supported. */
+#define MAX_UNITS 8
+static int options[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1,};
+static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static int hw_checksums[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static int flow_ctrl[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static int enable_wol[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static int global_options = -1;
+static int global_full_duplex = -1;
+static int global_enable_wol = -1;
+
+/* #define dev_alloc_skb dev_alloc_skb_debug */
+
+/* Variables to work-around the Compaq PCI BIOS32 problem. */
+static int compaq_ioaddr, compaq_irq, compaq_device_id = 0x5900;
+static struct net_device *compaq_net_device;
static char version[] __devinitdata =
DRV_NAME ": Donald Becker and others. www.scyld.com/network/vortex.html\n";
@@ -279,21 +297,21 @@
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
-MODULE_PARM(debug, "i");
-MODULE_PARM(global_options, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(global_full_duplex, "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(hw_checksums, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(flow_ctrl, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(global_enable_wol, "i");
-MODULE_PARM(enable_wol, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(compaq_ioaddr, "i");
-MODULE_PARM(compaq_irq, "i");
-MODULE_PARM(compaq_device_id, "i");
-MODULE_PARM(watchdog, "i");
+module_param(debug, int, 0);
+module_param(global_options, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param(global_full_duplex, int, 0);
+module_param_array(full_duplex, int, NULL, 0);
+module_param_array(hw_checksums, int, NULL, 0);
+module_param_array(flow_ctrl, int, NULL, 0);
+module_param(global_enable_wol, int, 0);
+module_param_array(enable_wol, int, NULL, 0);
+module_param(rx_copybreak, int, 0);
+module_param(max_interrupt_work, int, 0);
+module_param(compaq_ioaddr, int, 0);
+module_param(compaq_irq, int, 0);
+module_param(compaq_device_id, int, 0);
+module_param(watchdog, int, 0);
MODULE_PARM_DESC(debug, "3c59x debug level (0-6)");
MODULE_PARM_DESC(options, "3c59x: Bits 0-3: media type, bit 4: bus mastering, bit 9: full duplex");
MODULE_PARM_DESC(global_options, "3c59x: same as options, but applies to all NICs if options is unset");
@@ -910,25 +928,6 @@
static struct ethtool_ops vortex_ethtool_ops;
static void set_8021q_mode(struct net_device *dev, int enable);
-\f
-/* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
-/* Option count limit only -- unlimited interfaces are supported. */
-#define MAX_UNITS 8
-static int options[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1,};
-static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int hw_checksums[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int flow_ctrl[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int enable_wol[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int global_options = -1;
-static int global_full_duplex = -1;
-static int global_enable_wol = -1;
-
-/* #define dev_alloc_skb dev_alloc_skb_debug */
-
-/* Variables to work-around the Compaq PCI BIOS32 problem. */
-static int compaq_ioaddr, compaq_irq, compaq_device_id = 0x5900;
-static struct net_device *compaq_net_device;
-
static int vortex_cards_found;
#ifdef CONFIG_NET_POLL_CONTROLLER
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2.6] Update to module_params() in 3c59x.c
2004-12-30 14:40 [PATCH 2.6] Update to module_params() in 3c59x.c Maciej Soltysiak
@ 2005-01-03 0:44 ` Randy.Dunlap
2005-01-03 1:23 ` Re[2]: " Maciej Soltysiak
0 siblings, 1 reply; 3+ messages in thread
From: Randy.Dunlap @ 2005-01-03 0:44 UTC (permalink / raw)
To: Maciej Soltysiak; +Cc: linux-net, linux-kernel
Maciej Soltysiak wrote:
> Hi!
>
> This patch:
> 1) updates the 3c59x.c driver to use module_param() stuff.
> 2) kills a strange character somewhere at the bottom of the patch
>
> I hope it is right, it is my first glance at module_param() :-)
>
> 3c59x.c | 67 +++++++++++++++++++++++++++++++---------------------------------
> 1 files changed, 33 insertions(+), 34 deletions(-)
>
> Oh, in order to use the module_param() macros i had to move the variable
> before module_param.
>
> Signed-off-by: Maciej Soltysiak <solt2@dns.toxicfilms.tv>
>
> Please review and hopefully apply.
> Regars,
> Maciej
Looks pretty good, a couple of minor comments below.
> diff -ru linux.orig/drivers/net/3c59x.c linux/drivers/net/3c59x.c
> --- linux.orig/drivers/net/3c59x.c 2004-12-30 15:27:40.000000000 +0100
> +++ linux/drivers/net/3c59x.c 2004-12-30 14:33:29.000000000 +0100
> @@ -240,6 +240,7 @@
>
> #include <linux/config.h>
> #include <linux/module.h>
> +#include <linux/moduleparam.h>
module.h #includes moduleparam.h already so this isn't needed.
> @@ -279,21 +297,21 @@
>
> -MODULE_PARM(debug, "i");
> +module_param(debug, int, 0);
I would make the 3rd parameter (permissions) be 0644 so that it can
be changed after the module is loaded (run-time debug flag changing).
---
~Randy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re[2]: [PATCH 2.6] Update to module_params() in 3c59x.c
2005-01-03 0:44 ` Randy.Dunlap
@ 2005-01-03 1:23 ` Maciej Soltysiak
0 siblings, 0 replies; 3+ messages in thread
From: Maciej Soltysiak @ 2005-01-03 1:23 UTC (permalink / raw)
To: linux-net, linux-kernel
Hello Randy,
Monday, January 3, 2005, 1:44:54 AM, you wrote:
> Looks pretty good, a couple of minor comments below.
Thanks for your hints.
I noticed that this and similar work has been done by the
kernel janitors in 2.6.10-kj1.
I guess I should try to stick with them with patches like these.
Regards,
Maciej
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-01-03 1:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-30 14:40 [PATCH 2.6] Update to module_params() in 3c59x.c Maciej Soltysiak
2005-01-03 0:44 ` Randy.Dunlap
2005-01-03 1:23 ` Re[2]: " Maciej Soltysiak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).