* [PATCHv2] wifi: ath9k: ahb: do ioremap resource in one step
@ 2025-04-21 4:00 Rosen Penev
2025-04-22 12:35 ` Toke Høiland-Jørgensen
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Rosen Penev @ 2025-04-21 4:00 UTC (permalink / raw)
To: linux-wireless; +Cc: Toke Høiland-Jørgensen, open list
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>
---
v2: remove wrong devm irq conversion.
drivers/net/wireless/ath/ath9k/ahb.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c
index d4805e02b927..49b7ab26c477 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -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);
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCHv2] wifi: ath9k: ahb: do ioremap resource in one step
2025-04-21 4:00 [PATCHv2] wifi: ath9k: ahb: do ioremap resource in one step Rosen Penev
@ 2025-04-22 12:35 ` Toke Høiland-Jørgensen
2025-04-22 21:34 ` Rosen Penev
2025-05-02 9:29 ` Toke Høiland-Jørgensen
2025-05-16 17:40 ` Jeff Johnson
2 siblings, 1 reply; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2025-04-22 12:35 UTC (permalink / raw)
To: Rosen Penev, linux-wireless; +Cc: open list
Rosen Penev <rosenp@gmail.com> writes:
> 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>
> ---
> v2: remove wrong devm irq conversion.
> drivers/net/wireless/ath/ath9k/ahb.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
Is there any benefit from this other than code simplification? Because,
TBH, I'm not sure saving 7 lines of code is worth the risk of changing
something we know works already...
-Toke
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv2] wifi: ath9k: ahb: do ioremap resource in one step
2025-04-22 12:35 ` Toke Høiland-Jørgensen
@ 2025-04-22 21:34 ` Rosen Penev
2025-05-01 16:20 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 6+ messages in thread
From: Rosen Penev @ 2025-04-22 21:34 UTC (permalink / raw)
To: Toke Høiland-Jørgensen; +Cc: linux-wireless, open list
On Tue, Apr 22, 2025 at 5:35 AM Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>
> Rosen Penev <rosenp@gmail.com> writes:
>
> > 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>
> > ---
> > v2: remove wrong devm irq conversion.
> > drivers/net/wireless/ath/ath9k/ahb.c | 13 +++----------
> > 1 file changed, 3 insertions(+), 10 deletions(-)
>
> Is there any benefit from this other than code simplification? Because,
> TBH, I'm not sure saving 7 lines of code is worth the risk of changing
> something we know works already...
It's the same API calls fundamentally. This change has already been
done treewide across various drivers.
>
> -Toke
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv2] wifi: ath9k: ahb: do ioremap resource in one step
2025-04-22 21:34 ` Rosen Penev
@ 2025-05-01 16:20 ` Toke Høiland-Jørgensen
0 siblings, 0 replies; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2025-05-01 16:20 UTC (permalink / raw)
To: Rosen Penev; +Cc: linux-wireless, open list
Rosen Penev <rosenp@gmail.com> writes:
> On Tue, Apr 22, 2025 at 5:35 AM Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>>
>> Rosen Penev <rosenp@gmail.com> writes:
>>
>> > 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>
>> > ---
>> > v2: remove wrong devm irq conversion.
>> > drivers/net/wireless/ath/ath9k/ahb.c | 13 +++----------
>> > 1 file changed, 3 insertions(+), 10 deletions(-)
>>
>> Is there any benefit from this other than code simplification? Because,
>> TBH, I'm not sure saving 7 lines of code is worth the risk of changing
>> something we know works already...
> It's the same API calls fundamentally. This change has already been
> done treewide across various drivers.
Hmm, alright, let's give it a shot...
-Toke
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv2] wifi: ath9k: ahb: do ioremap resource in one step
2025-04-21 4:00 [PATCHv2] wifi: ath9k: ahb: do ioremap resource in one step Rosen Penev
2025-04-22 12:35 ` Toke Høiland-Jørgensen
@ 2025-05-02 9:29 ` Toke Høiland-Jørgensen
2025-05-16 17:40 ` Jeff Johnson
2 siblings, 0 replies; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2025-05-02 9:29 UTC (permalink / raw)
To: Rosen Penev, linux-wireless; +Cc: open list
Rosen Penev <rosenp@gmail.com> writes:
> 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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv2] wifi: ath9k: ahb: do ioremap resource in one step
2025-04-21 4:00 [PATCHv2] wifi: ath9k: ahb: do ioremap resource in one step Rosen Penev
2025-04-22 12:35 ` Toke Høiland-Jørgensen
2025-05-02 9:29 ` Toke Høiland-Jørgensen
@ 2025-05-16 17:40 ` Jeff Johnson
2 siblings, 0 replies; 6+ messages in thread
From: Jeff Johnson @ 2025-05-16 17:40 UTC (permalink / raw)
To: linux-wireless, Rosen Penev
Cc: Toke Høiland-Jørgensen, linux-kernel
On Sun, 20 Apr 2025 21:00:44 -0700, Rosen Penev wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] wifi: ath9k: ahb: do ioremap resource in one step
commit: b4206774fe8231187e5863ff861160db77d4960b
Best regards,
--
Jeff Johnson <jeff.johnson@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-05-16 17:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-21 4:00 [PATCHv2] wifi: ath9k: ahb: do ioremap resource in one step Rosen Penev
2025-04-22 12:35 ` Toke Høiland-Jørgensen
2025-04-22 21:34 ` Rosen Penev
2025-05-01 16:20 ` Toke Høiland-Jørgensen
2025-05-02 9:29 ` Toke Høiland-Jørgensen
2025-05-16 17:40 ` Jeff Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).