static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
static int e1000_notify_reboot(struct notifier_block *, unsigned long event, void *ptr);
+static int e1000_notify_netdev(struct notifier_block *, unsigned long event, void *ptr);
static int e1000_suspend(struct pci_dev *pdev, uint32_t state);
#ifdef CONFIG_PM
static int e1000_resume(struct pci_dev *pdev);
#endif
-struct notifier_block e1000_notifier = {
+struct notifier_block e1000_notifier_reboot = {
.notifier_call = e1000_notify_reboot,
.next = NULL,
.priority = 0
};
+struct notifier_block e1000_notifier_netdev = {
+ .notifier_call = e1000_notify_netdev,
+ .next = NULL,
+ .priority = 0
+};
+
/* Exported from other modules */
extern void e1000_check_options(struct e1000_adapter *adapter);
printk(KERN_INFO "%s\n", e1000_copyright);
ret = pci_module_init(&e1000_driver);
- if(ret >= 0)
- register_reboot_notifier(&e1000_notifier);
+ if(ret >= 0) {
+ register_reboot_notifier(&e1000_notifier_reboot);
+ register_netdevice_notifier(&e1000_notifier_netdev);
+ }
return ret;
}
static void __exit
e1000_exit_module(void)
{
- unregister_reboot_notifier(&e1000_notifier);
+ unregister_reboot_notifier(&e1000_notifier_reboot);
+ unregister_netdevice_notifier(&e1000_notifier_netdev);
pci_unregister_driver(&e1000_driver);
}
(void (*)(void *))e1000_tx_timeout_task, netdev);
register_netdev(netdev);
+ memcpy(adapter->ifname, netdev->name, IFNAMSIZ);
+ adapter->ifname[IFNAMSIZ-1] = 0;
/* we're going to reset, so assume we have no link for now */
return NOTIFY_DONE;
}
+static int
+e1000_notify_netdev(struct notifier_block *nb, unsigned long event, void *p)
+{
+ struct e1000_adapter *adapter;
+ struct net_device *netdev = p;
+ if(netdev == NULL)
+ return NOTIFY_DONE;
+
+ switch(event) {
+ case NETDEV_CHANGENAME:
+ if(netdev->open == e1000_open) {
+ adapter = netdev->priv;
+ /* rename the proc nodes the easy way */
+ e1000_proc_dev_free(adapter);
+ memcpy(adapter->ifname, netdev->name, IFNAMSIZ);
+ adapter->ifname[IFNAMSIZ-1] = 0;
+ e1000_proc_dev_setup(adapter);
+ }
+ break;
+ }
+ return NOTIFY_DONE;
+}
+
static int
e1000_suspend(struct pci_dev *pdev, uint32_t state)
{
return e1000_proc_read(page, start, off, count, eof);
}
-static void __devexit
+static void
e1000_proc_dirs_free(char *name, struct list_head *proc_list_head)
{
struct proc_dir_entry *intel_proc_dir, *proc_dir;
}
-static int __devinit
+static int
e1000_proc_singles_create(struct proc_dir_entry *parent,
struct list_head *proc_list_head)
{
return 1;
}
-static void __devinit
+static void
e1000_proc_dirs_create(void *data, char *name,
struct list_head *proc_list_head)
{
info_entry->data = proc_list_head;
}
-static void __devinit
+static void
e1000_proc_list_add(struct list_head *proc_list_head, char *tag,
void *data, size_t len,
char *(*func)(void *, size_t, char *))
list_add_tail(&new->list, proc_list_head);
}
-static void __devexit
+static void
e1000_proc_list_free(struct list_head *proc_list_head)
{
struct proc_list *elem;
#define LIST_ADD_H(T,D) LIST_ADD_F((T), (D), e1000_proc_hex)
#define LIST_ADD_U(T,D) LIST_ADD_F((T), (D), e1000_proc_unsigned)
-static void __devinit
+static void
e1000_proc_list_setup(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
}
LIST_ADD_U("IRQ", &adapter->pdev->irq);
- LIST_ADD_S("System_Device_Name", adapter->netdev->name);
+ LIST_ADD_S("System_Device_Name", adapter->ifname);
LIST_ADD_F("Current_HWaddr",
adapter->netdev->dev_addr, e1000_proc_hwaddr);
LIST_ADD_F("Permanent_HWaddr",
* @adapter: board private structure
*/
-void __devinit
+void
e1000_proc_dev_setup(struct e1000_adapter *adapter)
{
e1000_proc_list_setup(adapter);
e1000_proc_dirs_create(adapter,
- adapter->netdev->name,
+ adapter->ifname,
&adapter->proc_list_head);
}
* @adapter: board private structure
*/
-void __devexit
+void
e1000_proc_dev_free(struct e1000_adapter *adapter)
{
- e1000_proc_dirs_free(adapter->netdev->name, &adapter->proc_list_head);
+ e1000_proc_dirs_free(adapter->ifname, &adapter->proc_list_head);
e1000_proc_list_free(&adapter->proc_list_head);
}
#else /* CONFIG_PROC_FS */
-void __devinit e1000_proc_dev_setup(struct e1000_adapter *adapter) {}
-void __devexit e1000_proc_dev_free(struct e1000_adapter *adapter) {}
+void e1000_proc_dev_setup(struct e1000_adapter *adapter) {}
+void e1000_proc_dev_free(struct e1000_adapter *adapter) {}
#endif /* CONFIG_PROC_FS */