diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-12-18 23:13:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-18 23:13:35 -0500 |
commit | afdafff130142ef4d6478dcff6d9e879394fd348 (patch) | |
tree | 6acaaf4a7de181bad471100960515c7f842cfc40 | |
parent | 9c69fabe789b0eb468a0c7031ae7bb850760aea8 (diff) |
netxen: use module parameter correctly
Netxen driver is doing this bogus thing to create a control file.
This fails if device doesn't exist, and overall is a bad way to do
the module parameter. Rather than fix borked code, just rewrite.
Just using a writeable module parameter of 0/1 is the correct way
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 57 |
1 files changed, 3 insertions, 54 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index f4996846a234..6cae26a5bd67 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -57,7 +57,9 @@ static int use_msi = 1; | |||
57 | 57 | ||
58 | static int use_msi_x = 1; | 58 | static int use_msi_x = 1; |
59 | 59 | ||
60 | static unsigned long auto_fw_reset = AUTO_FW_RESET_ENABLED; | 60 | static int auto_fw_reset = AUTO_FW_RESET_ENABLED; |
61 | module_param(auto_fw_reset, int, 0644); | ||
62 | MODULE_PARM_DESC(auto_fw_reset,"Auto firmware reset (0=disabled, 1=enabled"); | ||
61 | 63 | ||
62 | static int __devinit netxen_nic_probe(struct pci_dev *pdev, | 64 | static int __devinit netxen_nic_probe(struct pci_dev *pdev, |
63 | const struct pci_device_id *ent); | 65 | const struct pci_device_id *ent); |
@@ -2534,42 +2536,6 @@ static struct bin_attribute bin_attr_mem = { | |||
2534 | .write = netxen_sysfs_write_mem, | 2536 | .write = netxen_sysfs_write_mem, |
2535 | }; | 2537 | }; |
2536 | 2538 | ||
2537 | #ifdef CONFIG_MODULES | ||
2538 | static ssize_t | ||
2539 | netxen_store_auto_fw_reset(struct module_attribute *mattr, | ||
2540 | struct module *mod, const char *buf, size_t count) | ||
2541 | |||
2542 | { | ||
2543 | unsigned long new; | ||
2544 | |||
2545 | if (strict_strtoul(buf, 16, &new)) | ||
2546 | return -EINVAL; | ||
2547 | |||
2548 | if ((new == AUTO_FW_RESET_ENABLED) || (new == AUTO_FW_RESET_DISABLED)) { | ||
2549 | auto_fw_reset = new; | ||
2550 | return count; | ||
2551 | } | ||
2552 | |||
2553 | return -EINVAL; | ||
2554 | } | ||
2555 | |||
2556 | static ssize_t | ||
2557 | netxen_show_auto_fw_reset(struct module_attribute *mattr, | ||
2558 | struct module *mod, char *buf) | ||
2559 | |||
2560 | { | ||
2561 | if (auto_fw_reset == AUTO_FW_RESET_ENABLED) | ||
2562 | return sprintf(buf, "enabled\n"); | ||
2563 | else | ||
2564 | return sprintf(buf, "disabled\n"); | ||
2565 | } | ||
2566 | |||
2567 | static struct module_attribute mod_attr_fw_reset = { | ||
2568 | .attr = {.name = "auto_fw_reset", .mode = (S_IRUGO | S_IWUSR)}, | ||
2569 | .show = netxen_show_auto_fw_reset, | ||
2570 | .store = netxen_store_auto_fw_reset, | ||
2571 | }; | ||
2572 | #endif | ||
2573 | 2539 | ||
2574 | static void | 2540 | static void |
2575 | netxen_create_sysfs_entries(struct netxen_adapter *adapter) | 2541 | netxen_create_sysfs_entries(struct netxen_adapter *adapter) |
@@ -2775,23 +2741,12 @@ static struct pci_driver netxen_driver = { | |||
2775 | 2741 | ||
2776 | static int __init netxen_init_module(void) | 2742 | static int __init netxen_init_module(void) |
2777 | { | 2743 | { |
2778 | #ifdef CONFIG_MODULES | ||
2779 | struct module *mod = THIS_MODULE; | ||
2780 | #endif | ||
2781 | |||
2782 | printk(KERN_INFO "%s\n", netxen_nic_driver_string); | 2744 | printk(KERN_INFO "%s\n", netxen_nic_driver_string); |
2783 | 2745 | ||
2784 | #ifdef CONFIG_INET | 2746 | #ifdef CONFIG_INET |
2785 | register_netdevice_notifier(&netxen_netdev_cb); | 2747 | register_netdevice_notifier(&netxen_netdev_cb); |
2786 | register_inetaddr_notifier(&netxen_inetaddr_cb); | 2748 | register_inetaddr_notifier(&netxen_inetaddr_cb); |
2787 | #endif | 2749 | #endif |
2788 | |||
2789 | #ifdef CONFIG_MODULES | ||
2790 | if (sysfs_create_file(&mod->mkobj.kobj, &mod_attr_fw_reset.attr)) | ||
2791 | printk(KERN_ERR "%s: Failed to create auto_fw_reset " | ||
2792 | "sysfs entry.", netxen_nic_driver_name); | ||
2793 | #endif | ||
2794 | |||
2795 | return pci_register_driver(&netxen_driver); | 2750 | return pci_register_driver(&netxen_driver); |
2796 | } | 2751 | } |
2797 | 2752 | ||
@@ -2799,12 +2754,6 @@ module_init(netxen_init_module); | |||
2799 | 2754 | ||
2800 | static void __exit netxen_exit_module(void) | 2755 | static void __exit netxen_exit_module(void) |
2801 | { | 2756 | { |
2802 | #ifdef CONFIG_MODULES | ||
2803 | struct module *mod = THIS_MODULE; | ||
2804 | |||
2805 | sysfs_remove_file(&mod->mkobj.kobj, &mod_attr_fw_reset.attr); | ||
2806 | #endif | ||
2807 | |||
2808 | pci_unregister_driver(&netxen_driver); | 2757 | pci_unregister_driver(&netxen_driver); |
2809 | 2758 | ||
2810 | #ifdef CONFIG_INET | 2759 | #ifdef CONFIG_INET |