Re: [PATCH 10/10] soc: qcom: convert to devm_platform_ioremap_resource

From: Marc Zyngier
Date: Sun Dec 15 2019 - 05:48:45 EST


On Sat, 14 Dec 2019 17:54:47 +0000
Yangtao Li <tiny.windzz@xxxxxxxxx> wrote:

> Use devm_platform_ioremap_resource() to simplify code.
>
> Signed-off-by: Yangtao Li <tiny.windzz@xxxxxxxxx>
> ---
> drivers/soc/qcom/llcc-qcom.c | 7 +------
> drivers/soc/qcom/qcom-geni-se.c | 4 +---
> drivers/soc/qcom/qcom_aoss.c | 4 +---
> drivers/soc/qcom/qcom_gsbi.c | 5 +----
> drivers/soc/qcom/spm.c | 4 +---
> 5 files changed, 5 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
> index 429b5a60a1ba..99e19df76889 100644
> --- a/drivers/soc/qcom/llcc-qcom.c
> +++ b/drivers/soc/qcom/llcc-qcom.c
> @@ -387,7 +387,6 @@ static int qcom_llcc_remove(struct platform_device *pdev)
> static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev,
> const char *name)
> {
> - struct resource *res;
> void __iomem *base;
> struct regmap_config llcc_regmap_config = {
> .reg_bits = 32,
> @@ -396,11 +395,7 @@ static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev,
> .fast_io = true,
> };
>
> - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
> - if (!res)
> - return ERR_PTR(-ENODEV);
> -
> - base = devm_ioremap_resource(&pdev->dev, res);
> + base = devm_platform_ioremap_resource(pdev, 0);

What guarantees do you have that entry 0 matches name?

I find these changes pointless: they don't add much to the readability
or maintainability of the code, and instead introduce creative bugs.

M.
--
Jazz is not dead. It just smells funny...