]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath9k: ahb: do ioremap resource in one step
authorRosen Penev <rosenp@gmail.com>
Mon, 21 Apr 2025 04:00:44 +0000 (21:00 -0700)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Fri, 16 May 2025 17:34:16 +0000 (10:34 -0700)
Simplifies probe slightly and adds extra error codes.

Switching from devm_ioremap to the platform variant ends up calling
devm_request_mem_region, which reserves the memory region for the
various wmacs. Per board, there is only one wmac and after some fairly
thorough analysis, there are no overlapping memory regions between wmacs
and other devices on the ahb.

Tested on a TP-Link Archer C7v2.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://patch.msgid.link/20250421040044.44887-1-rosenp@gmail.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath9k/ahb.c

index d4805e02b92704d4a7e1c697db25b47486c2236a..49b7ab26c477285fcfd219065734ec71b0e1269b 100644 (file)
@@ -74,7 +74,6 @@ static int ath_ahb_probe(struct platform_device *pdev)
        void __iomem *mem;
        struct ath_softc *sc;
        struct ieee80211_hw *hw;
-       struct resource *res;
        const struct platform_device_id *id = platform_get_device_id(pdev);
        int irq;
        int ret = 0;
@@ -86,16 +85,10 @@ static int ath_ahb_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (res == NULL) {
-               dev_err(&pdev->dev, "no memory resource found\n");
-               return -ENXIO;
-       }
-
-       mem = devm_ioremap(&pdev->dev, res->start, resource_size(res));
-       if (mem == NULL) {
+       mem = devm_platform_ioremap_resource(pdev, 0);
+       if (IS_ERR(mem)) {
                dev_err(&pdev->dev, "ioremap failed\n");
-               return -ENOMEM;
+               return PTR_ERR(mem);
        }
 
        irq = platform_get_irq(pdev, 0);