diff options
4 files changed, 56 insertions, 1 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c index 2a11c1eefd8f..7f45e9908582 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c | |||
| @@ -23,8 +23,17 @@ MODULE_VERSION(AQ_CFG_DRV_VERSION); | |||
| 23 | MODULE_AUTHOR(AQ_CFG_DRV_AUTHOR); | 23 | MODULE_AUTHOR(AQ_CFG_DRV_AUTHOR); |
| 24 | MODULE_DESCRIPTION(AQ_CFG_DRV_DESC); | 24 | MODULE_DESCRIPTION(AQ_CFG_DRV_DESC); |
| 25 | 25 | ||
| 26 | const char aq_ndev_driver_name[] = AQ_CFG_DRV_NAME; | ||
| 27 | |||
| 26 | static const struct net_device_ops aq_ndev_ops; | 28 | static const struct net_device_ops aq_ndev_ops; |
| 27 | 29 | ||
| 30 | static struct workqueue_struct *aq_ndev_wq; | ||
| 31 | |||
| 32 | void aq_ndev_schedule_work(struct work_struct *work) | ||
| 33 | { | ||
| 34 | queue_work(aq_ndev_wq, work); | ||
| 35 | } | ||
| 36 | |||
| 28 | struct net_device *aq_ndev_alloc(void) | 37 | struct net_device *aq_ndev_alloc(void) |
| 29 | { | 38 | { |
| 30 | struct net_device *ndev = NULL; | 39 | struct net_device *ndev = NULL; |
| @@ -209,3 +218,35 @@ static const struct net_device_ops aq_ndev_ops = { | |||
| 209 | .ndo_vlan_rx_add_vid = aq_ndo_vlan_rx_add_vid, | 218 | .ndo_vlan_rx_add_vid = aq_ndo_vlan_rx_add_vid, |
| 210 | .ndo_vlan_rx_kill_vid = aq_ndo_vlan_rx_kill_vid, | 219 | .ndo_vlan_rx_kill_vid = aq_ndo_vlan_rx_kill_vid, |
| 211 | }; | 220 | }; |
| 221 | |||
| 222 | static int __init aq_ndev_init_module(void) | ||
| 223 | { | ||
| 224 | int ret; | ||
| 225 | |||
| 226 | aq_ndev_wq = create_singlethread_workqueue(aq_ndev_driver_name); | ||
| 227 | if (!aq_ndev_wq) { | ||
| 228 | pr_err("Failed to create workqueue\n"); | ||
| 229 | return -ENOMEM; | ||
| 230 | } | ||
| 231 | |||
| 232 | ret = aq_pci_func_register_driver(); | ||
| 233 | if (ret) { | ||
| 234 | destroy_workqueue(aq_ndev_wq); | ||
| 235 | return ret; | ||
| 236 | } | ||
| 237 | |||
| 238 | return 0; | ||
| 239 | } | ||
| 240 | |||
| 241 | static void __exit aq_ndev_exit_module(void) | ||
| 242 | { | ||
| 243 | aq_pci_func_unregister_driver(); | ||
| 244 | |||
| 245 | if (aq_ndev_wq) { | ||
| 246 | destroy_workqueue(aq_ndev_wq); | ||
| 247 | aq_ndev_wq = NULL; | ||
| 248 | } | ||
| 249 | } | ||
| 250 | |||
| 251 | module_init(aq_ndev_init_module); | ||
| 252 | module_exit(aq_ndev_exit_module); | ||
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.h b/drivers/net/ethernet/aquantia/atlantic/aq_main.h index ce92152eb43e..5448b82fb7ea 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.h | |||
| @@ -13,7 +13,9 @@ | |||
| 13 | #define AQ_MAIN_H | 13 | #define AQ_MAIN_H |
| 14 | 14 | ||
| 15 | #include "aq_common.h" | 15 | #include "aq_common.h" |
| 16 | #include "aq_nic.h" | ||
| 16 | 17 | ||
| 18 | void aq_ndev_schedule_work(struct work_struct *work); | ||
| 17 | struct net_device *aq_ndev_alloc(void); | 19 | struct net_device *aq_ndev_alloc(void); |
| 18 | 20 | ||
| 19 | #endif /* AQ_MAIN_H */ | 21 | #endif /* AQ_MAIN_H */ |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c index 533a78deefee..eec49e6e95ab 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | |||
| @@ -368,4 +368,13 @@ static struct pci_driver aq_pci_ops = { | |||
| 368 | .shutdown = aq_pci_shutdown, | 368 | .shutdown = aq_pci_shutdown, |
| 369 | }; | 369 | }; |
| 370 | 370 | ||
| 371 | module_pci_driver(aq_pci_ops); | 371 | int aq_pci_func_register_driver(void) |
| 372 | { | ||
| 373 | return pci_register_driver(&aq_pci_ops); | ||
| 374 | } | ||
| 375 | |||
| 376 | void aq_pci_func_unregister_driver(void) | ||
| 377 | { | ||
| 378 | pci_unregister_driver(&aq_pci_ops); | ||
| 379 | } | ||
| 380 | |||
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h index aeee67bf69fa..799c5e0d653b 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h | |||
| @@ -29,4 +29,7 @@ int aq_pci_func_alloc_irq(struct aq_nic_s *self, unsigned int i, | |||
| 29 | void aq_pci_func_free_irqs(struct aq_nic_s *self); | 29 | void aq_pci_func_free_irqs(struct aq_nic_s *self); |
| 30 | unsigned int aq_pci_func_get_irq_type(struct aq_nic_s *self); | 30 | unsigned int aq_pci_func_get_irq_type(struct aq_nic_s *self); |
| 31 | 31 | ||
| 32 | int aq_pci_func_register_driver(void); | ||
| 33 | void aq_pci_func_unregister_driver(void); | ||
| 34 | |||
| 32 | #endif /* AQ_PCI_FUNC_H */ | 35 | #endif /* AQ_PCI_FUNC_H */ |
