pinctrl/u300: use managed resources
This converts the U300 pin controller to use managed resources (devm_*) for it's memory region. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
585583f54f
commit
b36bdc5911
|
@ -663,8 +663,6 @@ static const struct pinctrl_pin_desc u300_pads[] = {
|
||||||
struct u300_pmx {
|
struct u300_pmx {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct pinctrl_dev *pctl;
|
struct pinctrl_dev *pctl;
|
||||||
u32 phybase;
|
|
||||||
u32 physize;
|
|
||||||
void __iomem *virtbase;
|
void __iomem *virtbase;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1110,7 +1108,6 @@ static int __devinit u300_pmx_probe(struct platform_device *pdev)
|
||||||
struct u300_pmx *upmx;
|
struct u300_pmx *upmx;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
struct gpio_chip *gpio_chip = dev_get_platdata(&pdev->dev);
|
struct gpio_chip *gpio_chip = dev_get_platdata(&pdev->dev);
|
||||||
int ret;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Create state holders etc for this driver */
|
/* Create state holders etc for this driver */
|
||||||
|
@ -1123,26 +1120,15 @@ static int __devinit u300_pmx_probe(struct platform_device *pdev)
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (!res)
|
if (!res)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
upmx->phybase = res->start;
|
|
||||||
upmx->physize = resource_size(res);
|
|
||||||
|
|
||||||
if (request_mem_region(upmx->phybase, upmx->physize,
|
upmx->virtbase = devm_request_and_ioremap(&pdev->dev, res);
|
||||||
DRIVER_NAME) == NULL) {
|
if (!upmx->virtbase)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out_no_memregion;
|
|
||||||
}
|
|
||||||
|
|
||||||
upmx->virtbase = ioremap(upmx->phybase, upmx->physize);
|
|
||||||
if (!upmx->virtbase) {
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto out_no_remap;
|
|
||||||
}
|
|
||||||
|
|
||||||
upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx);
|
upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx);
|
||||||
if (!upmx->pctl) {
|
if (!upmx->pctl) {
|
||||||
dev_err(&pdev->dev, "could not register U300 pinmux driver\n");
|
dev_err(&pdev->dev, "could not register U300 pinmux driver\n");
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto out_no_pmx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We will handle a range of GPIO pins */
|
/* We will handle a range of GPIO pins */
|
||||||
|
@ -1156,14 +1142,6 @@ static int __devinit u300_pmx_probe(struct platform_device *pdev)
|
||||||
dev_info(&pdev->dev, "initialized U300 pin control driver\n");
|
dev_info(&pdev->dev, "initialized U300 pin control driver\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_no_pmx:
|
|
||||||
iounmap(upmx->virtbase);
|
|
||||||
out_no_remap:
|
|
||||||
platform_set_drvdata(pdev, NULL);
|
|
||||||
out_no_memregion:
|
|
||||||
release_mem_region(upmx->phybase, upmx->physize);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __devexit u300_pmx_remove(struct platform_device *pdev)
|
static int __devexit u300_pmx_remove(struct platform_device *pdev)
|
||||||
|
@ -1171,8 +1149,6 @@ static int __devexit u300_pmx_remove(struct platform_device *pdev)
|
||||||
struct u300_pmx *upmx = platform_get_drvdata(pdev);
|
struct u300_pmx *upmx = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
pinctrl_unregister(upmx->pctl);
|
pinctrl_unregister(upmx->pctl);
|
||||||
iounmap(upmx->virtbase);
|
|
||||||
release_mem_region(upmx->phybase, upmx->physize);
|
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue