Re: [PATCH 2/2] drivers: platform: provide devm_platform_ioremap_resource_nocache()

From: Bartosz Golaszewski
Date: Sun Dec 29 2019 - 07:12:21 EST


niedz., 29 gru 2019 o 11:43 Yangtao Li <tiny.windzz@xxxxxxxxx> napisaÅ(a):
>
> Provide a nocache variant of devm_platform_ioremap_resource().
>
> Signed-off-by: Yangtao Li <tiny.windzz@xxxxxxxxx>
> ---
> .../driver-api/driver-model/devres.rst | 1 +
> drivers/base/platform.c | 19 +++++++++++++++++++
> include/linux/platform_device.h | 3 +++
> 3 files changed, 23 insertions(+)
>
> diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
> index af1b1b9e3a17..3b79a3207490 100644
> --- a/Documentation/driver-api/driver-model/devres.rst
> +++ b/Documentation/driver-api/driver-model/devres.rst
> @@ -320,6 +320,7 @@ IOMAP
> devm_ioremap_resource_nocache()
> devm_ioremap_resource_wc()
> devm_platform_ioremap_resource() : calls devm_ioremap_resource() for platform device
> + devm_platform_ioremap_resource_nocache()
> devm_platform_ioremap_resource_wc()
> devm_platform_ioremap_resource_byname()
> devm_iounmap()
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index cf6b6b722e5c..80f420b9b4d7 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -79,6 +79,25 @@ void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
> }
> EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource);
>
> +/**
> + * devm_platform_ioremap_resource_nocache - nocache variant of
> + * devm_platform_ioremap_resource()
> + *
> + * @pdev: platform device to use both for memory resource lookup as well as
> + * resource management
> + * @index: resource index
> + */
> +void __iomem *
> +devm_platform_ioremap_resource_nocache(struct platform_device *pdev,
> + unsigned int index)
> +{
> + struct resource *res;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, index);
> + return devm_ioremap_resource_nocache(&pdev->dev, res);
> +}
> +EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource_nocache);
> +
> /**
> * devm_platform_ioremap_resource_wc - write-combined variant of
> * devm_platform_ioremap_resource()
> diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
> index 276a03c24691..b803e670b1c5 100644
> --- a/include/linux/platform_device.h
> +++ b/include/linux/platform_device.h
> @@ -58,6 +58,9 @@ extern void __iomem *
> devm_platform_ioremap_resource(struct platform_device *pdev,
> unsigned int index);
> extern void __iomem *
> +devm_platform_ioremap_resource_nocache(struct platform_device *pdev,
> + unsigned int index);
> +extern void __iomem *
> devm_platform_ioremap_resource_wc(struct platform_device *pdev,
> unsigned int index);
> extern void __iomem *
> --
> 2.17.1
>

Please see my response to patch 1/2.

Bart