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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 23 Mar 2020 13:44:15 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Dejin Zheng <zhengdejin5@...il.com>
Cc:     Greg KH <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Minas Harutyunyan <hminas@...opsys.com>,
        Mathias Nyman <mathias.nyman@...el.com>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Arnd Bergmann <arnd@...db.de>,
        Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Thierry Reding <treding@...dia.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        "Winkler, Tomas" <tomas.winkler@...el.com>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
        USB list <linux-usb@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 1/5] drivers: provide devm_platform_get_and_ioremap_resource()

Hi Dejin,

On Sun, Mar 15, 2020 at 3:05 PM Dejin Zheng <zhengdejin5@...il.com> wrote:
> Since commit "drivers: provide devm_platform_ioremap_resource()",
> it was wrap platform_get_resource() and devm_ioremap_resource() as
> single helper devm_platform_ioremap_resource(). but now, many drivers
> still used platform_get_resource() and devm_ioremap_resource()
> together in the kernel tree. The reason can not be replaced is they
> still need use the resource variables obtained by platform_get_resource().
> so provide this helper.
>
> Suggested-by: Geert Uytterhoeven <geert@...ux-m68k.org>
> Suggested-by: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
> Signed-off-by: Dejin Zheng <zhengdejin5@...il.com>

Thanks for your patch!

> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -62,6 +62,28 @@ struct resource *platform_get_resource(struct platform_device *dev,
>  EXPORT_SYMBOL_GPL(platform_get_resource);
>
>  #ifdef CONFIG_HAS_IOMEM
> +/**
> + * devm_platform_get_and_ioremap_resource - call devm_ioremap_resource() for a
> + *                                         platform device and get resource
> + *
> + * @pdev: platform device to use both for memory resource lookup as well as
> + *        resource management
> + * @index: resource index
> + * @res: get the resource

Optional output parameter to store a pointer to the obtained resource.

With the above changed:

Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>

> + */
> +void __iomem *
> +devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
> +                               unsigned int index, struct resource **res)
> +{
> +       struct resource *r;
> +
> +       r = platform_get_resource(pdev, IORESOURCE_MEM, index);
> +       if (res)
> +               *res = r;
> +       return devm_ioremap_resource(&pdev->dev, r);
> +}
> +EXPORT_SYMBOL_GPL(devm_platform_get_and_ioremap_resource);

Gr{oetje,eeting}s,

                        Geert

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

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