mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 01:04:08 +08:00
pwm: jz4740: Use devm_clk_get()
Using the managed version of clk_get() makes the code a bit shorter and the error paths less complicated. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
078c6ac1bd
commit
0dc1135fdf
@ -165,13 +165,12 @@ static const struct pwm_ops jz4740_pwm_ops = {
|
|||||||
static int jz4740_pwm_probe(struct platform_device *pdev)
|
static int jz4740_pwm_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct jz4740_pwm_chip *jz4740;
|
struct jz4740_pwm_chip *jz4740;
|
||||||
int ret;
|
|
||||||
|
|
||||||
jz4740 = devm_kzalloc(&pdev->dev, sizeof(*jz4740), GFP_KERNEL);
|
jz4740 = devm_kzalloc(&pdev->dev, sizeof(*jz4740), GFP_KERNEL);
|
||||||
if (!jz4740)
|
if (!jz4740)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
jz4740->clk = clk_get(&pdev->dev, "ext");
|
jz4740->clk = devm_clk_get(&pdev->dev, "ext");
|
||||||
if (IS_ERR(jz4740->clk))
|
if (IS_ERR(jz4740->clk))
|
||||||
return PTR_ERR(jz4740->clk);
|
return PTR_ERR(jz4740->clk);
|
||||||
|
|
||||||
@ -180,29 +179,16 @@ static int jz4740_pwm_probe(struct platform_device *pdev)
|
|||||||
jz4740->chip.npwm = NUM_PWM;
|
jz4740->chip.npwm = NUM_PWM;
|
||||||
jz4740->chip.base = -1;
|
jz4740->chip.base = -1;
|
||||||
|
|
||||||
ret = pwmchip_add(&jz4740->chip);
|
|
||||||
if (ret < 0) {
|
|
||||||
clk_put(jz4740->clk);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
platform_set_drvdata(pdev, jz4740);
|
platform_set_drvdata(pdev, jz4740);
|
||||||
|
|
||||||
return 0;
|
return pwmchip_add(&jz4740->chip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jz4740_pwm_remove(struct platform_device *pdev)
|
static int jz4740_pwm_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct jz4740_pwm_chip *jz4740 = platform_get_drvdata(pdev);
|
struct jz4740_pwm_chip *jz4740 = platform_get_drvdata(pdev);
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = pwmchip_remove(&jz4740->chip);
|
return pwmchip_remove(&jz4740->chip);
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
clk_put(jz4740->clk);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct platform_driver jz4740_pwm_driver = {
|
static struct platform_driver jz4740_pwm_driver = {
|
||||||
|
Loading…
Reference in New Issue
Block a user