Skip to content

Commit

Permalink
Pinctrl/spear: plgpio: don't call prepare/unprepare
Browse files Browse the repository at this point in the history
SPEAr SoC's don't do anything in clk_prepare() of plgpio driver,
so there is no need to call this routine multiple times. Just
call it once at probe.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Viresh Kumar authored and Linus Walleij committed Nov 15, 2012
1 parent 9804049 commit f92bc45
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions drivers/pinctrl/spear/pinctrl-plgpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static int plgpio_request(struct gpio_chip *chip, unsigned offset)
return ret;

if (!IS_ERR(plgpio->clk)) {
ret = clk_prepare_enable(plgpio->clk);
ret = clk_enable(plgpio->clk);
if (ret)
goto err0;
}
Expand Down Expand Up @@ -244,7 +244,7 @@ static int plgpio_request(struct gpio_chip *chip, unsigned offset)

err1:
if (!IS_ERR(plgpio->clk))
clk_disable_unprepare(plgpio->clk);
clk_disable(plgpio->clk);
err0:
pinctrl_free_gpio(gpio);
return ret;
Expand Down Expand Up @@ -275,7 +275,7 @@ static void plgpio_free(struct gpio_chip *chip, unsigned offset)

disable_clk:
if (!IS_ERR(plgpio->clk))
clk_disable_unprepare(plgpio->clk);
clk_disable(plgpio->clk);

pinctrl_free_gpio(gpio);
}
Expand Down Expand Up @@ -584,10 +584,18 @@ static int __devinit plgpio_probe(struct platform_device *pdev)
plgpio->chip.dev = &pdev->dev;
plgpio->chip.owner = THIS_MODULE;

if (!IS_ERR(plgpio->clk)) {
ret = clk_prepare(plgpio->clk);
if (ret) {
dev_err(&pdev->dev, "clk prepare failed\n");
return ret;
}
}

ret = gpiochip_add(&plgpio->chip);
if (ret) {
dev_err(&pdev->dev, "unable to add gpio chip\n");
return ret;
goto unprepare_clk;
}

irq = platform_get_irq(pdev, 0);
Expand Down Expand Up @@ -629,6 +637,9 @@ static int __devinit plgpio_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Remove gpiochip\n");
if (gpiochip_remove(&plgpio->chip))
dev_err(&pdev->dev, "unable to remove gpiochip\n");
unprepare_clk:
if (!IS_ERR(plgpio->clk))
clk_unprepare(plgpio->clk);

return ret;
}
Expand Down

0 comments on commit f92bc45

Please sign in to comment.