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]
Message-ID: <CAEExFWvd1Md-guT=wgZ1-G69r71KBn64k2yGh0Vqjh_-D8yGuQ@mail.gmail.com>
Date:   Sun, 29 Dec 2019 01:39:21 +0800
From:   Frank Lee <tiny.windzz@...il.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Srini Kandagatla <srinivas.kandagatla@...aro.org>,
        vz@...ia.com, khilman@...libre.com,
        Maxime Ripard <mripard@...nel.org>,
        Chen-Yu Tsai <wens@...e.org>,
        andriy.shevchenko@...ux.intel.com,
        Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
        mans@...sr.com, treding@...dia.com, suzuki.poulose@....com,
        bgolaszewski@...libre.com, tglx@...utronix.de
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        linux-amlogic@...ts.infradead.org
Subject: Re: [PATCH] drivers: add devm_platform_ioremap_resource_byname() helper

ping...

On Wed, Dec 11, 2019 at 4:31 AM Yangtao Li <tiny.windzz@...il.com> wrote:
>
> There are currently 300+ instances of using platform_get_resource_byname()
> and devm_ioremap_resource() together in the kernel tree.
>
> This patch wraps these two calls in a single helper.
>
> Signed-off-by: Yangtao Li <tiny.windzz@...il.com>
> ---
>  drivers/base/platform.c         | 22 +++++++++++++++++++++-
>  include/linux/platform_device.h |  3 +++
>  2 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index b6c6c7d97d5b..9c4f5e229600 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -60,6 +60,7 @@ struct resource *platform_get_resource(struct platform_device *dev,
>  }
>  EXPORT_SYMBOL_GPL(platform_get_resource);
>
> +#ifdef CONFIG_HAS_IOMEM
>  /**
>   * devm_platform_ioremap_resource - call devm_ioremap_resource() for a platform
>   *                                 device
> @@ -68,7 +69,7 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
>   *        resource management
>   * @index: resource index
>   */
> -#ifdef CONFIG_HAS_IOMEM
> +
>  void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
>                                              unsigned int index)
>  {
> @@ -78,6 +79,25 @@ void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
>         return devm_ioremap_resource(&pdev->dev, res);
>  }
>  EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource);
> +
> +/**
> + * devm_platform_ioremap_resource_byname - call devm_ioremap_resource() for
> + *                                        a platform device
> + *
> + * @pdev: platform device to use both for memory resource lookup as well as
> + *        resource managemend
> + * @name: resource name
> + */
> +void __iomem *
> +devm_platform_ioremap_resource_byname(struct platform_device *pdev,
> +                                     const char *name)
> +{
> +       struct resource *res;
> +
> +       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
> +       return devm_ioremap_resource(&pdev->dev, res);
> +}
> +EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource_byname);
>  #endif /* CONFIG_HAS_IOMEM */
>
>  static int __platform_get_irq(struct platform_device *dev, unsigned int num)
> diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
> index 1b5cec067533..24ff5da9c532 100644
> --- a/include/linux/platform_device.h
> +++ b/include/linux/platform_device.h
> @@ -63,6 +63,9 @@ extern int platform_irq_count(struct platform_device *);
>  extern struct resource *platform_get_resource_byname(struct platform_device *,
>                                                      unsigned int,
>                                                      const char *);
> +extern void __iomem *
> +devm_platform_ioremap_resource_byname(struct platform_device *pdev,
> +                                     const char *name);
>  extern int platform_get_irq_byname(struct platform_device *, const char *);
>  extern int platform_add_devices(struct platform_device **, int);
>
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ