Commit 09ed8bfc authored by David Mosberger-Tang's avatar David Mosberger-Tang Committed by Kalle Valo

wilc1000: Rename workqueue from "WILC_wq" to "NETDEV-wq"

This follows normal Linux convention and is more useful since the new
name will make it apparent which network device the work-queue is for
(e.g., the name will be "wlan0-wq" for network device "wlan0").

hif_workqueue allocation has to move from
cfg80211.c:wilc_cfg80211_init() to netdev.c:wilc_netdev_ifc_init()
because the network device name is not known until after the netdev is
registered.  The move also makes sense because netdev.c is already
responsible for destroying the work queue when it is no longer needed.
Signed-off-by: default avatarDavid Mosberger-Tang <davidm@egauge.net>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20211209044411.3482259-5-davidm@egauge.net
parent 3cc23932
...@@ -1737,23 +1737,15 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type, ...@@ -1737,23 +1737,15 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
INIT_LIST_HEAD(&wl->rxq_head.list); INIT_LIST_HEAD(&wl->rxq_head.list);
INIT_LIST_HEAD(&wl->vif_list); INIT_LIST_HEAD(&wl->vif_list);
wl->hif_workqueue = create_singlethread_workqueue("WILC_wq");
if (!wl->hif_workqueue) {
ret = -ENOMEM;
goto free_cfg;
}
vif = wilc_netdev_ifc_init(wl, "wlan%d", WILC_STATION_MODE, vif = wilc_netdev_ifc_init(wl, "wlan%d", WILC_STATION_MODE,
NL80211_IFTYPE_STATION, false); NL80211_IFTYPE_STATION, false);
if (IS_ERR(vif)) { if (IS_ERR(vif)) {
ret = PTR_ERR(vif); ret = PTR_ERR(vif);
goto free_hq; goto free_cfg;
} }
return 0; return 0;
free_hq:
destroy_workqueue(wl->hif_workqueue);
free_cfg: free_cfg:
wilc_wlan_cfg_deinit(wl); wilc_wlan_cfg_deinit(wl);
......
...@@ -962,8 +962,15 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name, ...@@ -962,8 +962,15 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name,
ret = register_netdev(ndev); ret = register_netdev(ndev);
if (ret) { if (ret) {
free_netdev(ndev); ret = -EFAULT;
return ERR_PTR(-EFAULT); goto error;
}
wl->hif_workqueue = alloc_ordered_workqueue("%s-wq", WQ_MEM_RECLAIM,
ndev->name);
if (!wl->hif_workqueue) {
ret = -ENOMEM;
goto error;
} }
ndev->needs_free_netdev = true; ndev->needs_free_netdev = true;
...@@ -977,6 +984,10 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name, ...@@ -977,6 +984,10 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name,
synchronize_srcu(&wl->srcu); synchronize_srcu(&wl->srcu);
return vif; return vif;
error:
free_netdev(ndev);
return ERR_PTR(ret);
} }
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment