treewide: remove platform_get_resoruce

Easier to just use devm_platform_ioremap_resource.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16701
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Rosen Penev 2024-09-26 16:36:35 -07:00 committed by Hauke Mehrtens
parent 7ad9988287
commit 19bd5436c7
10 changed files with 16 additions and 38 deletions

View File

@ -1359,7 +1359,6 @@ static const struct nand_controller_ops ar934x_nfc_controller_ops = {
static int ar934x_nfc_probe(struct platform_device *pdev) static int ar934x_nfc_probe(struct platform_device *pdev)
{ {
struct ar934x_nfc *nfc; struct ar934x_nfc *nfc;
struct resource *res;
struct mtd_info *mtd; struct mtd_info *mtd;
struct nand_chip *nand; struct nand_chip *nand;
int ret; int ret;
@ -1367,19 +1366,13 @@ static int ar934x_nfc_probe(struct platform_device *pdev)
pdev->dev.dma_mask = &ar934x_nfc_dma_mask; pdev->dev.dma_mask = &ar934x_nfc_dma_mask;
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "failed to get I/O memory\n");
return -EINVAL;
}
nfc = devm_kzalloc(&pdev->dev, sizeof(struct ar934x_nfc), GFP_KERNEL); nfc = devm_kzalloc(&pdev->dev, sizeof(struct ar934x_nfc), GFP_KERNEL);
if (!nfc) { if (!nfc) {
dev_err(&pdev->dev, "failed to allocate driver data\n"); dev_err(&pdev->dev, "failed to allocate driver data\n");
return -ENOMEM; return -ENOMEM;
} }
nfc->base = devm_ioremap_resource(&pdev->dev, res); nfc->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(nfc->base)) { if (IS_ERR(nfc->base)) {
dev_err(&pdev->dev, "failed to remap I/O memory\n"); dev_err(&pdev->dev, "failed to remap I/O memory\n");
return PTR_ERR(nfc->base); return PTR_ERR(nfc->base);

View File

@ -23,7 +23,7 @@ Subject: SoC: add qualcomm syscon
+obj-$(CONFIG_QCOM_TCSR) += qcom_tcsr.o +obj-$(CONFIG_QCOM_TCSR) += qcom_tcsr.o
--- /dev/null --- /dev/null
+++ b/drivers/soc/qcom/qcom_tcsr.c +++ b/drivers/soc/qcom/qcom_tcsr.c
@@ -0,0 +1,98 @@ @@ -0,0 +1,96 @@
+/* +/*
+ * Copyright (c) 2014, The Linux foundation. All rights reserved. + * Copyright (c) 2014, The Linux foundation. All rights reserved.
+ * + *
@ -57,13 +57,11 @@ Subject: SoC: add qualcomm syscon
+ +
+static int tcsr_probe(struct platform_device *pdev) +static int tcsr_probe(struct platform_device *pdev)
+{ +{
+ struct resource *res;
+ const struct device_node *node = pdev->dev.of_node; + const struct device_node *node = pdev->dev.of_node;
+ void __iomem *base; + void __iomem *base;
+ u32 val; + u32 val;
+ +
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_platform_ioremap_resource(pdev, 0);
+ base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(base)) + if (IS_ERR(base))
+ return PTR_ERR(base); + return PTR_ERR(base);
+ +

View File

@ -28,7 +28,7 @@ Subject: SoC: add qualcomm syscon
depends on ARCH_QCOM || COMPILE_TEST depends on ARCH_QCOM || COMPILE_TEST
--- /dev/null --- /dev/null
+++ b/drivers/soc/qcom/qcom_tcsr.c +++ b/drivers/soc/qcom/qcom_tcsr.c
@@ -0,0 +1,64 @@ @@ -0,0 +1,62 @@
+/* +/*
+ * Copyright (c) 2014, The Linux foundation. All rights reserved. + * Copyright (c) 2014, The Linux foundation. All rights reserved.
+ * + *
@ -54,13 +54,11 @@ Subject: SoC: add qualcomm syscon
+ +
+static int tcsr_probe(struct platform_device *pdev) +static int tcsr_probe(struct platform_device *pdev)
+{ +{
+ struct resource *res;
+ const struct device_node *node = pdev->dev.of_node; + const struct device_node *node = pdev->dev.of_node;
+ void __iomem *base; + void __iomem *base;
+ u32 val; + u32 val;
+ +
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_platform_ioremap_resource(pdev, 0);
+ base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(base)) + if (IS_ERR(base))
+ return PTR_ERR(base); + return PTR_ERR(base);
+ +

View File

@ -47,7 +47,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
obj-$(CONFIG_I2C_MESON) += i2c-meson.o obj-$(CONFIG_I2C_MESON) += i2c-meson.o
--- /dev/null --- /dev/null
+++ b/drivers/i2c/busses/i2c-lantiq.c +++ b/drivers/i2c/busses/i2c-lantiq.c
@@ -0,0 +1,747 @@ @@ -0,0 +1,746 @@
+ +
+/* +/*
+ * Lantiq I2C bus adapter + * Lantiq I2C bus adapter
@ -625,14 +625,13 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ struct device_node *node = pdev->dev.of_node; + struct device_node *node = pdev->dev.of_node;
+ struct ltq_i2c *priv; + struct ltq_i2c *priv;
+ struct i2c_adapter *adap; + struct i2c_adapter *adap;
+ struct resource *mmres, irqres[4]; + struct resource irqres[4];
+ int ret = 0; + int ret = 0;
+ +
+ dev_dbg(&pdev->dev, "probing\n"); + dev_dbg(&pdev->dev, "probing\n");
+ +
+ mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ ret = of_irq_to_resource_table(node, irqres, 4); + ret = of_irq_to_resource_table(node, irqres, 4);
+ if (!mmres || (ret != 4)) { + if (ret != 4) {
+ dev_err(&pdev->dev, "no resources\n"); + dev_err(&pdev->dev, "no resources\n");
+ return -ENODEV; + return -ENODEV;
+ } + }
@ -661,7 +660,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ init_completion(&priv->cmd_complete); + init_completion(&priv->cmd_complete);
+ mutex_init(&priv->mutex); + mutex_init(&priv->mutex);
+ +
+ priv->membase = devm_ioremap_resource(&pdev->dev, mmres); + priv->membase = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(priv->membase)) + if (IS_ERR(priv->membase))
+ return PTR_ERR(priv->membase); + return PTR_ERR(priv->membase);
+ +

View File

@ -2204,7 +2204,6 @@ static void msdc_init_gpd_bd(struct msdc_host *host, struct msdc_dma *dma)
static int msdc_drv_probe(struct platform_device *pdev) static int msdc_drv_probe(struct platform_device *pdev)
{ {
struct resource *res;
__iomem void *base; __iomem void *base;
struct mmc_host *mmc; struct mmc_host *mmc;
struct msdc_host *host; struct msdc_host *host;
@ -2227,8 +2226,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
if (!mmc) if (!mmc)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_platform_ioremap_resource(pdev, 0);
base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base)) { if (IS_ERR(base)) {
ret = PTR_ERR(base); ret = PTR_ERR(base);
goto host_free; goto host_free;

View File

@ -1292,8 +1292,7 @@ static int mt7621_nfc_probe(struct platform_device *pdev)
if (IS_ERR(nfc->nfi_regs)) if (IS_ERR(nfc->nfi_regs))
return PTR_ERR(nfc->nfi_regs); return PTR_ERR(nfc->nfi_regs);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ecc"); nfc->ecc_regs = devm_platform_ioremap_resource_byname(pdev, "ecc");
nfc->ecc_regs = devm_ioremap_resource(dev, res);
if (IS_ERR(nfc->ecc_regs)) if (IS_ERR(nfc->ecc_regs))
return PTR_ERR(nfc->ecc_regs); return PTR_ERR(nfc->ecc_regs);

View File

@ -1387,7 +1387,6 @@ static const struct switch_dev_ops esw_ops = {
static int esw_probe(struct platform_device *pdev) static int esw_probe(struct platform_device *pdev)
{ {
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
const __be32 *port_map, *port_disable, *reg_init; const __be32 *port_map, *port_disable, *reg_init;
struct rt305x_esw *esw; struct rt305x_esw *esw;
@ -1398,7 +1397,7 @@ static int esw_probe(struct platform_device *pdev)
esw->dev = &pdev->dev; esw->dev = &pdev->dev;
esw->irq = irq_of_parse_and_map(np, 0); esw->irq = irq_of_parse_and_map(np, 0);
esw->base = devm_ioremap_resource(&pdev->dev, res); esw->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(esw->base)) if (IS_ERR(esw->base))
return PTR_ERR(esw->base); return PTR_ERR(esw->base);

View File

@ -259,14 +259,13 @@ int mtk_gsw_init(struct fe_priv *priv)
static int mt7620_gsw_probe(struct platform_device *pdev) static int mt7620_gsw_probe(struct platform_device *pdev)
{ {
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct mt7620_gsw *gsw; struct mt7620_gsw *gsw;
gsw = devm_kzalloc(&pdev->dev, sizeof(struct mt7620_gsw), GFP_KERNEL); gsw = devm_kzalloc(&pdev->dev, sizeof(struct mt7620_gsw), GFP_KERNEL);
if (!gsw) if (!gsw)
return -ENOMEM; return -ENOMEM;
gsw->base = devm_ioremap_resource(&pdev->dev, res); gsw->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(gsw->base)) if (IS_ERR(gsw->base))
return PTR_ERR(gsw->base); return PTR_ERR(gsw->base);

View File

@ -2256,7 +2256,7 @@
+#endif /* _EIP93_DES_H_ */ +#endif /* _EIP93_DES_H_ */
--- /dev/null --- /dev/null
+++ b/drivers/crypto/mtk-eip93/eip93-main.c +++ b/drivers/crypto/mtk-eip93/eip93-main.c
@@ -0,0 +1,467 @@ @@ -0,0 +1,465 @@
+// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0
+/* +/*
+ * Copyright (C) 2019 - 2021 + * Copyright (C) 2019 - 2021
@ -2636,7 +2636,6 @@
+{ +{
+ struct device *dev = &pdev->dev; + struct device *dev = &pdev->dev;
+ struct mtk_device *mtk; + struct mtk_device *mtk;
+ struct resource *res;
+ int err; + int err;
+ +
+ mtk = devm_kzalloc(dev, sizeof(*mtk), GFP_KERNEL); + mtk = devm_kzalloc(dev, sizeof(*mtk), GFP_KERNEL);
@ -2646,8 +2645,7 @@
+ mtk->dev = dev; + mtk->dev = dev;
+ platform_set_drvdata(pdev, mtk); + platform_set_drvdata(pdev, mtk);
+ +
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + mtk->base = devm_platform_ioremap_resource(pdev, 0);
+ mtk->base = devm_ioremap_resource(&pdev->dev, res);
+ +
+ if (IS_ERR(mtk->base)) + if (IS_ERR(mtk->base))
+ return PTR_ERR(mtk->base); + return PTR_ERR(mtk->base);

View File

@ -336,7 +336,6 @@ struct i2c_adapter_quirks rtl9300_i2c_quirks = {
static int rtl9300_i2c_probe(struct platform_device *pdev) static int rtl9300_i2c_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct rtl9300_i2c *i2c; struct rtl9300_i2c *i2c;
struct i2c_adapter *adap; struct i2c_adapter *adap;
struct i2c_drv_data *drv_data; struct i2c_drv_data *drv_data;
@ -351,15 +350,13 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
drv_data = (struct i2c_drv_data *) device_get_match_data(&pdev->dev); drv_data = (struct i2c_drv_data *) device_get_match_data(&pdev->dev);
i2c = devm_kzalloc(&pdev->dev, sizeof(struct rtl9300_i2c), GFP_KERNEL); i2c = devm_kzalloc(&pdev->dev, sizeof(struct rtl9300_i2c), GFP_KERNEL);
if (!i2c) if (!i2c)
return -ENOMEM; return -ENOMEM;
i2c->base = devm_ioremap_resource(&pdev->dev, res); i2c->base = devm_platform_ioremap_resource(pdev, 0);
i2c->mst2_offset = drv_data->mst2_offset; i2c->mst2_offset = drv_data->mst2_offset;
if (IS_ERR(i2c->base)) if (IS_ERR(i2c->base))
return PTR_ERR(i2c->base); return PTR_ERR(i2c->base);