Skip to content

Commit

Permalink
wifi: ath9k: use devm for request_irq()
Browse files Browse the repository at this point in the history
Avoids having to manually call free_irq(). Simplifies code slightly.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20240731210243.7467-1-rosenp@gmail.com
  • Loading branch information
Rosen Penev authored and Kalle Valo committed Aug 7, 2024
1 parent 3f66f26 commit 92da4ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 2 additions & 5 deletions drivers/net/wireless/ath/ath9k/ahb.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static int ath_ahb_probe(struct platform_device *pdev)
sc->mem = mem;
sc->irq = irq;

ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc);
ret = devm_request_irq(&pdev->dev, irq, ath_isr, IRQF_SHARED, "ath9k", sc);
if (ret) {
dev_err(&pdev->dev, "request_irq failed\n");
goto err_free_hw;
Expand All @@ -127,7 +127,7 @@ static int ath_ahb_probe(struct platform_device *pdev)
ret = ath9k_init_device(id->driver_data, sc, &ath_ahb_bus_ops);
if (ret) {
dev_err(&pdev->dev, "failed to initialize device\n");
goto err_irq;
goto err_free_hw;
}

ah = sc->sc_ah;
Expand All @@ -137,8 +137,6 @@ static int ath_ahb_probe(struct platform_device *pdev)

return 0;

err_irq:
free_irq(irq, sc);
err_free_hw:
ieee80211_free_hw(hw);
return ret;
Expand All @@ -152,7 +150,6 @@ static void ath_ahb_remove(struct platform_device *pdev)
struct ath_softc *sc = hw->priv;

ath9k_deinit_device(sc);
free_irq(sc->irq, sc);
ieee80211_free_hw(sc->hw);
}
}
Expand Down
9 changes: 3 additions & 6 deletions drivers/net/wireless/ath/ath9k/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,9 +965,9 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
}

if (!msi_enabled)
ret = request_irq(pdev->irq, ath_isr, IRQF_SHARED, "ath9k", sc);
ret = devm_request_irq(&pdev->dev, pdev->irq, ath_isr, IRQF_SHARED, "ath9k", sc);
else
ret = request_irq(pdev->irq, ath_isr, 0, "ath9k", sc);
ret = devm_request_irq(&pdev->dev, pdev->irq, ath_isr, 0, "ath9k", sc);

if (ret) {
dev_err(&pdev->dev, "request_irq failed\n");
Expand All @@ -979,7 +979,7 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ret = ath9k_init_device(id->device, sc, &ath_pci_bus_ops);
if (ret) {
dev_err(&pdev->dev, "Failed to initialize device\n");
goto err_init;
goto err_irq;
}

sc->sc_ah->msi_enabled = msi_enabled;
Expand All @@ -991,8 +991,6 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)

return 0;

err_init:
free_irq(sc->irq, sc);
err_irq:
ieee80211_free_hw(hw);
return ret;
Expand All @@ -1006,7 +1004,6 @@ static void ath_pci_remove(struct pci_dev *pdev)
if (!is_ath9k_unloaded)
sc->sc_ah->ah_flags |= AH_UNPLUGGED;
ath9k_deinit_device(sc);
free_irq(sc->irq, sc);
ieee80211_free_hw(sc->hw);
}

Expand Down

0 comments on commit 92da4ce

Please sign in to comment.