pinctrl: use devm_platform_ioremap_resource() to simplify code

devm_platform_ioremap_resource() internally have platform_get_resource()
and devm_ioremap_resource() in it. So instead of calling them separately
use devm_platform_ioremap_resource() directly.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20191104142654.39256-1-yuehaibing@huawei.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
YueHaibing 2019-11-04 22:26:54 +08:00 коммит произвёл Linus Walleij
Родитель 6e4f3db8df
Коммит 4b024225c4
31 изменённых файлов: 40 добавлений и 105 удалений

Просмотреть файл

@ -915,7 +915,6 @@ static int owl_gpio_init(struct owl_pinctrl *pctrl)
int owl_pinctrl_probe(struct platform_device *pdev, int owl_pinctrl_probe(struct platform_device *pdev,
struct owl_pinctrl_soc_data *soc_data) struct owl_pinctrl_soc_data *soc_data)
{ {
struct resource *res;
struct owl_pinctrl *pctrl; struct owl_pinctrl *pctrl;
int ret, i; int ret, i;
@ -923,8 +922,7 @@ int owl_pinctrl_probe(struct platform_device *pdev,
if (!pctrl) if (!pctrl)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pctrl->base = devm_platform_ioremap_resource(pdev, 0);
pctrl->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pctrl->base)) if (IS_ERR(pctrl->base))
return PTR_ERR(pctrl->base); return PTR_ERR(pctrl->base);

Просмотреть файл

@ -1400,12 +1400,10 @@ static struct pinctrl_desc bcm281xx_pinctrl_desc = {
static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev) static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev)
{ {
struct bcm281xx_pinctrl_data *pdata = &bcm281xx_pinctrl; struct bcm281xx_pinctrl_data *pdata = &bcm281xx_pinctrl;
struct resource *res;
struct pinctrl_dev *pctl; struct pinctrl_dev *pctl;
/* So far We can assume there is only 1 bank of registers */ /* So far We can assume there is only 1 bank of registers */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pdata->reg_base = devm_platform_ioremap_resource(pdev, 0);
pdata->reg_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pdata->reg_base)) { if (IS_ERR(pdata->reg_base)) {
dev_err(&pdev->dev, "Failed to ioremap MEM resource\n"); dev_err(&pdev->dev, "Failed to ioremap MEM resource\n");
return -ENODEV; return -ENODEV;

Просмотреть файл

@ -940,7 +940,6 @@ static int cygnus_mux_log_init(struct cygnus_pinctrl *pinctrl)
static int cygnus_pinmux_probe(struct platform_device *pdev) static int cygnus_pinmux_probe(struct platform_device *pdev)
{ {
struct cygnus_pinctrl *pinctrl; struct cygnus_pinctrl *pinctrl;
struct resource *res;
int i, ret; int i, ret;
struct pinctrl_pin_desc *pins; struct pinctrl_pin_desc *pins;
unsigned num_pins = ARRAY_SIZE(cygnus_pins); unsigned num_pins = ARRAY_SIZE(cygnus_pins);
@ -953,15 +952,13 @@ static int cygnus_pinmux_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pinctrl); platform_set_drvdata(pdev, pinctrl);
spin_lock_init(&pinctrl->lock); spin_lock_init(&pinctrl->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pinctrl->base0 = devm_platform_ioremap_resource(pdev, 0);
pinctrl->base0 = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pinctrl->base0)) { if (IS_ERR(pinctrl->base0)) {
dev_err(&pdev->dev, "unable to map I/O space\n"); dev_err(&pdev->dev, "unable to map I/O space\n");
return PTR_ERR(pinctrl->base0); return PTR_ERR(pinctrl->base0);
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); pinctrl->base1 = devm_platform_ioremap_resource(pdev, 1);
pinctrl->base1 = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pinctrl->base1)) { if (IS_ERR(pinctrl->base1)) {
dev_err(&pdev->dev, "unable to map I/O space\n"); dev_err(&pdev->dev, "unable to map I/O space\n");
return PTR_ERR(pinctrl->base1); return PTR_ERR(pinctrl->base1);

Просмотреть файл

@ -803,8 +803,7 @@ static int iproc_gpio_probe(struct platform_device *pdev)
chip->dev = dev; chip->dev = dev;
platform_set_drvdata(pdev, chip); platform_set_drvdata(pdev, chip);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); chip->base = devm_platform_ioremap_resource(pdev, 0);
chip->base = devm_ioremap_resource(dev, res);
if (IS_ERR(chip->base)) { if (IS_ERR(chip->base)) {
dev_err(dev, "unable to map I/O memory\n"); dev_err(dev, "unable to map I/O memory\n");
return PTR_ERR(chip->base); return PTR_ERR(chip->base);

Просмотреть файл

@ -1042,8 +1042,7 @@ static int ns2_pinmux_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pinctrl); platform_set_drvdata(pdev, pinctrl);
spin_lock_init(&pinctrl->lock); spin_lock_init(&pinctrl->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pinctrl->base0 = devm_platform_ioremap_resource(pdev, 0);
pinctrl->base0 = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pinctrl->base0)) if (IS_ERR(pinctrl->base0))
return PTR_ERR(pinctrl->base0); return PTR_ERR(pinctrl->base0);
@ -1057,8 +1056,7 @@ static int ns2_pinmux_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 2); pinctrl->pinconf_base = devm_platform_ioremap_resource(pdev, 2);
pinctrl->pinconf_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pinctrl->pinconf_base)) if (IS_ERR(pinctrl->pinconf_base))
return PTR_ERR(pinctrl->pinconf_base); return PTR_ERR(pinctrl->pinconf_base);

Просмотреть файл

@ -571,8 +571,7 @@ static int nsp_pinmux_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pinctrl); platform_set_drvdata(pdev, pinctrl);
spin_lock_init(&pinctrl->lock); spin_lock_init(&pinctrl->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pinctrl->base0 = devm_platform_ioremap_resource(pdev, 0);
pinctrl->base0 = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pinctrl->base0)) if (IS_ERR(pinctrl->base0))
return PTR_ERR(pinctrl->base0); return PTR_ERR(pinctrl->base0);
@ -586,8 +585,7 @@ static int nsp_pinmux_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 2); pinctrl->base2 = devm_platform_ioremap_resource(pdev, 2);
pinctrl->base2 = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pinctrl->base2)) if (IS_ERR(pinctrl->base2))
return PTR_ERR(pinctrl->base2); return PTR_ERR(pinctrl->base2);

Просмотреть файл

@ -936,7 +936,6 @@ static void artpec6_pmx_reset(struct artpec6_pmx *pmx)
static int artpec6_pmx_probe(struct platform_device *pdev) static int artpec6_pmx_probe(struct platform_device *pdev)
{ {
struct artpec6_pmx *pmx; struct artpec6_pmx *pmx;
struct resource *res;
pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL); pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
if (!pmx) if (!pmx)
@ -944,8 +943,7 @@ static int artpec6_pmx_probe(struct platform_device *pdev)
pmx->dev = &pdev->dev; pmx->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pmx->base = devm_platform_ioremap_resource(pdev, 0);
pmx->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pmx->base)) if (IS_ERR(pmx->base))
return PTR_ERR(pmx->base); return PTR_ERR(pmx->base);

Просмотреть файл

@ -1017,8 +1017,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
atmel_pioctrl->nbanks = atmel_pioctrl_data->nbanks; atmel_pioctrl->nbanks = atmel_pioctrl_data->nbanks;
atmel_pioctrl->npins = atmel_pioctrl->nbanks * ATMEL_PIO_NPINS_PER_BANK; atmel_pioctrl->npins = atmel_pioctrl->nbanks * ATMEL_PIO_NPINS_PER_BANK;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); atmel_pioctrl->reg_base = devm_platform_ioremap_resource(pdev, 0);
atmel_pioctrl->reg_base = devm_ioremap_resource(dev, res);
if (IS_ERR(atmel_pioctrl->reg_base)) if (IS_ERR(atmel_pioctrl->reg_base))
return -EINVAL; return -EINVAL;

Просмотреть файл

@ -1811,7 +1811,6 @@ static const struct of_device_id at91_gpio_of_match[] = {
static int at91_gpio_probe(struct platform_device *pdev) static int at91_gpio_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct resource *res;
struct at91_gpio_chip *at91_chip = NULL; struct at91_gpio_chip *at91_chip = NULL;
struct gpio_chip *chip; struct gpio_chip *chip;
struct pinctrl_gpio_range *range; struct pinctrl_gpio_range *range;
@ -1839,8 +1838,7 @@ static int at91_gpio_probe(struct platform_device *pdev)
goto err; goto err;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); at91_chip->regbase = devm_platform_ioremap_resource(pdev, 0);
at91_chip->regbase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(at91_chip->regbase)) { if (IS_ERR(at91_chip->regbase)) {
ret = PTR_ERR(at91_chip->regbase); ret = PTR_ERR(at91_chip->regbase);
goto err; goto err;

Просмотреть файл

@ -1308,15 +1308,13 @@ static struct pinctrl_desc bm1880_desc = {
static int bm1880_pinctrl_probe(struct platform_device *pdev) static int bm1880_pinctrl_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct bm1880_pinctrl *pctrl; struct bm1880_pinctrl *pctrl;
pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL);
if (!pctrl) if (!pctrl)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pctrl->base = devm_platform_ioremap_resource(pdev, 0);
pctrl->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pctrl->base)) if (IS_ERR(pctrl->base))
return PTR_ERR(pctrl->base); return PTR_ERR(pctrl->base);

Просмотреть файл

@ -615,7 +615,6 @@ static struct coh901_pinpair coh901_pintable[] = {
static int __init u300_gpio_probe(struct platform_device *pdev) static int __init u300_gpio_probe(struct platform_device *pdev)
{ {
struct u300_gpio *gpio; struct u300_gpio *gpio;
struct resource *memres;
struct gpio_irq_chip *girq; struct gpio_irq_chip *girq;
int err = 0; int err = 0;
int portno; int portno;
@ -633,8 +632,7 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
gpio->chip.base = 0; gpio->chip.base = 0;
gpio->dev = &pdev->dev; gpio->dev = &pdev->dev;
memres = platform_get_resource(pdev, IORESOURCE_MEM, 0); gpio->base = devm_platform_ioremap_resource(pdev, 0);
gpio->base = devm_ioremap_resource(&pdev->dev, memres);
if (IS_ERR(gpio->base)) if (IS_ERR(gpio->base))
return PTR_ERR(gpio->base); return PTR_ERR(gpio->base);

Просмотреть файл

@ -146,14 +146,12 @@ static int da850_pupd_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct da850_pupd_data *data; struct da850_pupd_data *data;
struct resource *res;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); data->base = devm_platform_ioremap_resource(pdev, 0);
data->base = devm_ioremap_resource(dev, res);
if (IS_ERR(data->base)) { if (IS_ERR(data->base)) {
dev_err(dev, "Could not map resource\n"); dev_err(dev, "Could not map resource\n");
return PTR_ERR(data->base); return PTR_ERR(data->base);

Просмотреть файл

@ -270,7 +270,6 @@ static int dc_gpiochip_add(struct dc_pinmap *pmap, struct device_node *np)
static int dc_pinctrl_probe(struct platform_device *pdev) static int dc_pinctrl_probe(struct platform_device *pdev)
{ {
struct dc_pinmap *pmap; struct dc_pinmap *pmap;
struct resource *r;
struct pinctrl_pin_desc *pins; struct pinctrl_pin_desc *pins;
struct pinctrl_desc *pctl_desc; struct pinctrl_desc *pctl_desc;
char *pin_names; char *pin_names;
@ -281,8 +280,7 @@ static int dc_pinctrl_probe(struct platform_device *pdev)
if (!pmap) if (!pmap)
return -ENOMEM; return -ENOMEM;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); pmap->regs = devm_platform_ioremap_resource(pdev, 0);
pmap->regs = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(pmap->regs)) if (IS_ERR(pmap->regs))
return PTR_ERR(pmap->regs); return PTR_ERR(pmap->regs);

Просмотреть файл

@ -1324,15 +1324,13 @@ static int lpc18xx_create_group_func_map(struct device *dev,
static int lpc18xx_scu_probe(struct platform_device *pdev) static int lpc18xx_scu_probe(struct platform_device *pdev)
{ {
struct lpc18xx_scu_data *scu; struct lpc18xx_scu_data *scu;
struct resource *res;
int ret; int ret;
scu = devm_kzalloc(&pdev->dev, sizeof(*scu), GFP_KERNEL); scu = devm_kzalloc(&pdev->dev, sizeof(*scu), GFP_KERNEL);
if (!scu) if (!scu)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); scu->base = devm_platform_ioremap_resource(pdev, 0);
scu->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(scu->base)) if (IS_ERR(scu->base))
return PTR_ERR(scu->base); return PTR_ERR(scu->base);

Просмотреть файл

@ -1196,7 +1196,6 @@ static int oxnas_gpio_probe(struct platform_device *pdev)
struct oxnas_gpio_bank *bank; struct oxnas_gpio_bank *bank;
unsigned int id, ngpios; unsigned int id, ngpios;
int irq, ret; int irq, ret;
struct resource *res;
struct gpio_irq_chip *girq; struct gpio_irq_chip *girq;
if (of_parse_phandle_with_fixed_args(np, "gpio-ranges", if (of_parse_phandle_with_fixed_args(np, "gpio-ranges",
@ -1220,8 +1219,7 @@ static int oxnas_gpio_probe(struct platform_device *pdev)
bank = &oxnas_gpio_banks[id]; bank = &oxnas_gpio_banks[id];
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); bank->reg_base = devm_platform_ioremap_resource(pdev, 0);
bank->reg_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(bank->reg_base)) if (IS_ERR(bank->reg_base))
return PTR_ERR(bank->reg_base); return PTR_ERR(bank->reg_base);

Просмотреть файл

@ -2202,7 +2202,6 @@ static int pic32_gpio_probe(struct platform_device *pdev)
struct pic32_gpio_bank *bank; struct pic32_gpio_bank *bank;
u32 id; u32 id;
int irq, ret; int irq, ret;
struct resource *res;
struct gpio_irq_chip *girq; struct gpio_irq_chip *girq;
if (of_property_read_u32(np, "microchip,gpio-bank", &id)) { if (of_property_read_u32(np, "microchip,gpio-bank", &id)) {
@ -2217,8 +2216,7 @@ static int pic32_gpio_probe(struct platform_device *pdev)
bank = &pic32_gpio_banks[id]; bank = &pic32_gpio_banks[id];
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); bank->reg_base = devm_platform_ioremap_resource(pdev, 0);
bank->reg_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(bank->reg_base)) if (IS_ERR(bank->reg_base))
return PTR_ERR(bank->reg_base); return PTR_ERR(bank->reg_base);

Просмотреть файл

@ -1435,7 +1435,6 @@ static const struct of_device_id pistachio_pinctrl_of_match[] = {
static int pistachio_pinctrl_probe(struct platform_device *pdev) static int pistachio_pinctrl_probe(struct platform_device *pdev)
{ {
struct pistachio_pinctrl *pctl; struct pistachio_pinctrl *pctl;
struct resource *res;
pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
if (!pctl) if (!pctl)
@ -1443,8 +1442,7 @@ static int pistachio_pinctrl_probe(struct platform_device *pdev)
pctl->dev = &pdev->dev; pctl->dev = &pdev->dev;
dev_set_drvdata(&pdev->dev, pctl); dev_set_drvdata(&pdev->dev, pctl);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pctl->base = devm_platform_ioremap_resource(pdev, 0);
pctl->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pctl->base)) if (IS_ERR(pctl->base))
return PTR_ERR(pctl->base); return PTR_ERR(pctl->base);

Просмотреть файл

@ -462,7 +462,6 @@ static const struct pinmux_ops rza2_pinmux_ops = {
static int rza2_pinctrl_probe(struct platform_device *pdev) static int rza2_pinctrl_probe(struct platform_device *pdev)
{ {
struct rza2_pinctrl_priv *priv; struct rza2_pinctrl_priv *priv;
struct resource *res;
int ret; int ret;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@ -471,8 +470,7 @@ static int rza2_pinctrl_probe(struct platform_device *pdev)
priv->dev = &pdev->dev; priv->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_platform_ioremap_resource(pdev, 0);
priv->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->base)) if (IS_ERR(priv->base))
return PTR_ERR(priv->base); return PTR_ERR(priv->base);

Просмотреть файл

@ -747,7 +747,6 @@ static struct pinctrl_desc tb10x_pindesc = {
static int tb10x_pinctrl_probe(struct platform_device *pdev) static int tb10x_pinctrl_probe(struct platform_device *pdev)
{ {
int ret = -EINVAL; int ret = -EINVAL;
struct resource *mem;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *of_node = dev->of_node; struct device_node *of_node = dev->of_node;
struct device_node *child; struct device_node *child;
@ -768,8 +767,7 @@ static int tb10x_pinctrl_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, state); platform_set_drvdata(pdev, state);
mutex_init(&state->mutex); mutex_init(&state->mutex);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); state->base = devm_platform_ioremap_resource(pdev, 0);
state->base = devm_ioremap_resource(dev, mem);
if (IS_ERR(state->base)) { if (IS_ERR(state->base)) {
ret = PTR_ERR(state->base); ret = PTR_ERR(state->base);
goto fail; goto fail;

Просмотреть файл

@ -1055,7 +1055,6 @@ static struct pinctrl_desc u300_pmx_desc = {
static int u300_pmx_probe(struct platform_device *pdev) static int u300_pmx_probe(struct platform_device *pdev)
{ {
struct u300_pmx *upmx; struct u300_pmx *upmx;
struct resource *res;
/* Create state holders etc for this driver */ /* Create state holders etc for this driver */
upmx = devm_kzalloc(&pdev->dev, sizeof(*upmx), GFP_KERNEL); upmx = devm_kzalloc(&pdev->dev, sizeof(*upmx), GFP_KERNEL);
@ -1064,8 +1063,7 @@ static int u300_pmx_probe(struct platform_device *pdev)
upmx->dev = &pdev->dev; upmx->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); upmx->virtbase = devm_platform_ioremap_resource(pdev, 0);
upmx->virtbase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(upmx->virtbase)) if (IS_ERR(upmx->virtbase))
return PTR_ERR(upmx->virtbase); return PTR_ERR(upmx->virtbase);

Просмотреть файл

@ -1705,12 +1705,10 @@ static int pinmux_xway_probe(struct platform_device *pdev)
{ {
const struct of_device_id *match; const struct of_device_id *match;
const struct pinctrl_xway_soc *xway_soc; const struct pinctrl_xway_soc *xway_soc;
struct resource *res;
int ret, i; int ret, i;
/* get and remap our register range */ /* get and remap our register range */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); xway_info.membase[0] = devm_platform_ioremap_resource(pdev, 0);
xway_info.membase[0] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(xway_info.membase[0])) if (IS_ERR(xway_info.membase[0]))
return PTR_ERR(xway_info.membase[0]); return PTR_ERR(xway_info.membase[0]);

Просмотреть файл

@ -216,25 +216,20 @@ static int pxa25x_pinctrl_probe(struct platform_device *pdev)
void __iomem *base_af[8]; void __iomem *base_af[8];
void __iomem *base_dir[4]; void __iomem *base_dir[4];
void __iomem *base_sleep[4]; void __iomem *base_sleep[4];
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base_af[0] = devm_platform_ioremap_resource(pdev, 0);
base_af[0] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base_af[0])) if (IS_ERR(base_af[0]))
return PTR_ERR(base_af[0]); return PTR_ERR(base_af[0]);
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); base_dir[0] = devm_platform_ioremap_resource(pdev, 1);
base_dir[0] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base_dir[0])) if (IS_ERR(base_dir[0]))
return PTR_ERR(base_dir[0]); return PTR_ERR(base_dir[0]);
res = platform_get_resource(pdev, IORESOURCE_MEM, 2); base_dir[3] = devm_platform_ioremap_resource(pdev, 2);
base_dir[3] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base_dir[3])) if (IS_ERR(base_dir[3]))
return PTR_ERR(base_dir[3]); return PTR_ERR(base_dir[3]);
res = platform_get_resource(pdev, IORESOURCE_MEM, 3); base_sleep[0] = devm_platform_ioremap_resource(pdev, 3);
base_sleep[0] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base_sleep[0])) if (IS_ERR(base_sleep[0]))
return PTR_ERR(base_sleep[0]); return PTR_ERR(base_sleep[0]);

Просмотреть файл

@ -508,25 +508,20 @@ static int pxa27x_pinctrl_probe(struct platform_device *pdev)
void __iomem *base_af[8]; void __iomem *base_af[8];
void __iomem *base_dir[4]; void __iomem *base_dir[4];
void __iomem *base_sleep[4]; void __iomem *base_sleep[4];
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base_af[0] = devm_platform_ioremap_resource(pdev, 0);
base_af[0] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base_af[0])) if (IS_ERR(base_af[0]))
return PTR_ERR(base_af[0]); return PTR_ERR(base_af[0]);
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); base_dir[0] = devm_platform_ioremap_resource(pdev, 1);
base_dir[0] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base_dir[0])) if (IS_ERR(base_dir[0]))
return PTR_ERR(base_dir[0]); return PTR_ERR(base_dir[0]);
res = platform_get_resource(pdev, IORESOURCE_MEM, 2); base_dir[3] = devm_platform_ioremap_resource(pdev, 2);
base_dir[3] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base_dir[3])) if (IS_ERR(base_dir[3]))
return PTR_ERR(base_dir[3]); return PTR_ERR(base_dir[3]);
res = platform_get_resource(pdev, IORESOURCE_MEM, 3); base_sleep[0] = devm_platform_ioremap_resource(pdev, 3);
base_sleep[0] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base_sleep[0])) if (IS_ERR(base_sleep[0]))
return PTR_ERR(base_sleep[0]); return PTR_ERR(base_sleep[0]);

Просмотреть файл

@ -1150,8 +1150,7 @@ int msm_pinctrl_probe(struct platform_device *pdev,
return PTR_ERR(pctrl->regs[i]); return PTR_ERR(pctrl->regs[i]);
} }
} else { } else {
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pctrl->regs[0] = devm_platform_ioremap_resource(pdev, 0);
pctrl->regs[0] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pctrl->regs[0])) if (IS_ERR(pctrl->regs[0]))
return PTR_ERR(pctrl->regs[0]); return PTR_ERR(pctrl->regs[0]);
} }

Просмотреть файл

@ -515,15 +515,13 @@ end:
static int plgpio_probe(struct platform_device *pdev) static int plgpio_probe(struct platform_device *pdev)
{ {
struct plgpio *plgpio; struct plgpio *plgpio;
struct resource *res;
int ret, irq; int ret, irq;
plgpio = devm_kzalloc(&pdev->dev, sizeof(*plgpio), GFP_KERNEL); plgpio = devm_kzalloc(&pdev->dev, sizeof(*plgpio), GFP_KERNEL);
if (!plgpio) if (!plgpio)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); plgpio->base = devm_platform_ioremap_resource(pdev, 0);
plgpio->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(plgpio->base)) if (IS_ERR(plgpio->base))
return PTR_ERR(plgpio->base); return PTR_ERR(plgpio->base);

Просмотреть файл

@ -358,7 +358,6 @@ int spear_pinctrl_probe(struct platform_device *pdev,
struct spear_pinctrl_machdata *machdata) struct spear_pinctrl_machdata *machdata)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct resource *res;
struct spear_pmx *pmx; struct spear_pmx *pmx;
if (!machdata) if (!machdata)
@ -368,8 +367,7 @@ int spear_pinctrl_probe(struct platform_device *pdev,
if (!pmx) if (!pmx)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pmx->vbase = devm_platform_ioremap_resource(pdev, 0);
pmx->vbase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pmx->vbase)) if (IS_ERR(pmx->vbase))
return PTR_ERR(pmx->vbase); return PTR_ERR(pmx->vbase);

Просмотреть файл

@ -1385,7 +1385,6 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
struct pinctrl_pin_desc *pins; struct pinctrl_pin_desc *pins;
struct sunxi_pinctrl *pctl; struct sunxi_pinctrl *pctl;
struct pinmux_ops *pmxops; struct pinmux_ops *pmxops;
struct resource *res;
int i, ret, last_pin, pin_idx; int i, ret, last_pin, pin_idx;
struct clk *clk; struct clk *clk;
@ -1396,8 +1395,7 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
raw_spin_lock_init(&pctl->lock); raw_spin_lock_init(&pctl->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pctl->membase = devm_platform_ioremap_resource(pdev, 0);
pctl->membase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pctl->membase)) if (IS_ERR(pctl->membase))
return PTR_ERR(pctl->membase); return PTR_ERR(pctl->membase);

Просмотреть файл

@ -873,7 +873,6 @@ int tegra_xusb_padctl_legacy_probe(struct platform_device *pdev)
{ {
struct tegra_xusb_padctl *padctl; struct tegra_xusb_padctl *padctl;
const struct of_device_id *match; const struct of_device_id *match;
struct resource *res;
struct phy *phy; struct phy *phy;
int err; int err;
@ -894,8 +893,7 @@ int tegra_xusb_padctl_legacy_probe(struct platform_device *pdev)
match = of_match_node(tegra_xusb_padctl_of_match, pdev->dev.of_node); match = of_match_node(tegra_xusb_padctl_of_match, pdev->dev.of_node);
padctl->soc = match->data; padctl->soc = match->data;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); padctl->regs = devm_platform_ioremap_resource(pdev, 0);
padctl->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(padctl->regs)) if (IS_ERR(padctl->regs))
return PTR_ERR(padctl->regs); return PTR_ERR(padctl->regs);

Просмотреть файл

@ -781,8 +781,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
return -ENOMEM; return -ENOMEM;
for (i = 0; i < pmx->nbanks; i++) { for (i = 0; i < pmx->nbanks; i++) {
res = platform_get_resource(pdev, IORESOURCE_MEM, i); pmx->regs[i] = devm_platform_ioremap_resource(pdev, i);
pmx->regs[i] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pmx->regs[i])) if (IS_ERR(pmx->regs[i]))
return PTR_ERR(pmx->regs[i]); return PTR_ERR(pmx->regs[i]);
} }

Просмотреть файл

@ -553,10 +553,8 @@ int wmt_pinctrl_probe(struct platform_device *pdev,
struct wmt_pinctrl_data *data) struct wmt_pinctrl_data *data)
{ {
int err; int err;
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); data->base = devm_platform_ioremap_resource(pdev, 0);
data->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(data->base)) if (IS_ERR(data->base))
return PTR_ERR(data->base); return PTR_ERR(data->base);

Просмотреть файл

@ -387,7 +387,6 @@ int zx_pinctrl_init(struct platform_device *pdev,
struct pinctrl_desc *pctldesc; struct pinctrl_desc *pctldesc;
struct zx_pinctrl *zpctl; struct zx_pinctrl *zpctl;
struct device_node *np; struct device_node *np;
struct resource *res;
int ret; int ret;
zpctl = devm_kzalloc(&pdev->dev, sizeof(*zpctl), GFP_KERNEL); zpctl = devm_kzalloc(&pdev->dev, sizeof(*zpctl), GFP_KERNEL);
@ -396,8 +395,7 @@ int zx_pinctrl_init(struct platform_device *pdev,
spin_lock_init(&zpctl->lock); spin_lock_init(&zpctl->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); zpctl->base = devm_platform_ioremap_resource(pdev, 0);
zpctl->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(zpctl->base)) if (IS_ERR(zpctl->base))
return PTR_ERR(zpctl->base); return PTR_ERR(zpctl->base);