mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 04:46:30 -04:00
wifi: rtw88: Un-embed dummy device
Embedding net_device into structures prohibits the usage of flexible arrays in the net_device structure. For more details, see the discussion at [1]. Un-embed the net_device from the private struct by converting it into a pointer. Then use the leverage the new alloc_netdev_dummy() helper to allocate and initialize dummy devices. [1] https://lore.kernel.org/all/20240229225910.79e224cf@kernel.org/ Tested with RTL8723DE and RTL8822CE. Signed-off-by: Breno Leitao <leitao@debian.org> Acked-by: Ping-Ke Shih <pkshih@realtek.com> Tested-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://msgid.link/20240425082910.2824393-1-leitao@debian.org
This commit is contained in:
committed by
Ping-Ke Shih
parent
4c9aa94a39
commit
d0bcb10e7b
@@ -1682,12 +1682,16 @@ static int rtw_pci_napi_poll(struct napi_struct *napi, int budget)
|
|||||||
return work_done;
|
return work_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtw_pci_napi_init(struct rtw_dev *rtwdev)
|
static int rtw_pci_napi_init(struct rtw_dev *rtwdev)
|
||||||
{
|
{
|
||||||
struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv;
|
struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv;
|
||||||
|
|
||||||
init_dummy_netdev(&rtwpci->netdev);
|
rtwpci->netdev = alloc_netdev_dummy(0);
|
||||||
netif_napi_add(&rtwpci->netdev, &rtwpci->napi, rtw_pci_napi_poll);
|
if (!rtwpci->netdev)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
netif_napi_add(rtwpci->netdev, &rtwpci->napi, rtw_pci_napi_poll);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtw_pci_napi_deinit(struct rtw_dev *rtwdev)
|
static void rtw_pci_napi_deinit(struct rtw_dev *rtwdev)
|
||||||
@@ -1696,6 +1700,7 @@ static void rtw_pci_napi_deinit(struct rtw_dev *rtwdev)
|
|||||||
|
|
||||||
rtw_pci_napi_stop(rtwdev);
|
rtw_pci_napi_stop(rtwdev);
|
||||||
netif_napi_del(&rtwpci->napi);
|
netif_napi_del(&rtwpci->napi);
|
||||||
|
free_netdev(rtwpci->netdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtw_pci_probe(struct pci_dev *pdev,
|
int rtw_pci_probe(struct pci_dev *pdev,
|
||||||
@@ -1745,7 +1750,11 @@ int rtw_pci_probe(struct pci_dev *pdev,
|
|||||||
goto err_pci_declaim;
|
goto err_pci_declaim;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtw_pci_napi_init(rtwdev);
|
ret = rtw_pci_napi_init(rtwdev);
|
||||||
|
if (ret) {
|
||||||
|
rtw_err(rtwdev, "failed to setup NAPI\n");
|
||||||
|
goto err_pci_declaim;
|
||||||
|
}
|
||||||
|
|
||||||
ret = rtw_chip_info_setup(rtwdev);
|
ret = rtw_chip_info_setup(rtwdev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ struct rtw_pci {
|
|||||||
bool running;
|
bool running;
|
||||||
|
|
||||||
/* napi structure */
|
/* napi structure */
|
||||||
struct net_device netdev;
|
struct net_device *netdev;
|
||||||
struct napi_struct napi;
|
struct napi_struct napi;
|
||||||
|
|
||||||
u16 rx_tag;
|
u16 rx_tag;
|
||||||
|
|||||||
Reference in New Issue
Block a user