lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 5 Feb 2024 20:01:17 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Markus Elfring <Markus.Elfring@....de>
Cc: linux-mediatek@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org, 
	linux-pm@...r.kernel.org, kernel-janitors@...r.kernel.org, 
	Angelo Gioacchino Del Regno <angelogioacchino.delregno@...labora.com>, 
	Heiko Stübner <heiko@...ech.de>, 
	Jernej Skrabec <jernej.skrabec@...il.com>, Matthias Brugger <matthias.bgg@...il.com>, 
	Rob Herring <robh@...nel.org>, Ulf Hansson <ulf.hansson@...aro.org>, 
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] pmdomain: mediatek: Use devm_platform_get_and_ioremap_resource()
 in init_scp()

Hi Markus,

On Mon, Feb 5, 2024 at 6:28 PM Markus Elfring <Markus.Elfring@....de> wrote:
> >> +++ b/drivers/pmdomain/mediatek/mtk-scpsys.c
> >> @@ -441,8 +441,7 @@ static struct scp *init_scp(struct platform_device *pdev,
> >>
> >>         scp->dev = &pdev->dev;
> >>
> >> -       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >> -       scp->base = devm_ioremap_resource(&pdev->dev, res);
> >> +       scp->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> >
> > Given res is further unused, please use devm_platform_ioremap_resource()
> > instead, and remove the local variable res.
>
> I got another idea after looking at the implementation of the function
> “devm_platform_get_and_ioremap_resource” once more.
> https://elixir.bootlin.com/linux/v6.8-rc3/source/drivers/base/platform.c#L87
>
> It seems that it is supported to pass a null pointer for the last parameter
> (while this possibility is not mentioned in the interface description so far).
> How do you think about to benefit from such a design option any more
> (instead of the determination of a corresponding platform device)?

Yes, you can pass a NULL pointer as the last parameter.
And as this is very common, the wrapper devm_platform_ioremap_resource()
exists.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68korg

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ