Re: [PATCHv3 net-next] net: modernize ioremap in probe
From: Russell King (Oracle)
Date: Tue Nov 19 2024 - 18:40:39 EST
On Tue, Nov 19, 2024 at 09:39:16PM +0100, Niklas Söderlund wrote:
> On 2024-11-17 15:07:53 -0800, Rosen Penev wrote:
> > devm_platform_ioremap_resource_byname has no res parameter, which is a
> > problem as there's this lovely line below it.
> >
> > ndev->base_addr = res->start;
>
> I see, maybe we can refactor that too? I see not all drivers set
> base_addr, and some even set it to the remapped memory returned by
> devm_platform_ioremap_resource_byname() or such.
base_addr carries with it an issue that setting it on every driver is
likely not a good idea.
Namely, that it's "unsigned long", it's reported to userspace, and
on PAE systems, unsigned long is 32-bit but the device address may
be >32-bit.
I haven't checked the user APIs, whether that restricts it to 32-bit
on 32-bit systems.
In any case, whether base_addr is set or not is probably best left
as-is and not have some "we must always / never set base_addr" rule
applied to it.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!