aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-jz4740.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pwm/pwm-jz4740.c')
-rw-r--r--drivers/pwm/pwm-jz4740.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index 0a2ede3c3932..9c46209e1d02 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -165,13 +165,12 @@ static const struct pwm_ops jz4740_pwm_ops = {
165static int jz4740_pwm_probe(struct platform_device *pdev) 165static int jz4740_pwm_probe(struct platform_device *pdev)
166{ 166{
167 struct jz4740_pwm_chip *jz4740; 167 struct jz4740_pwm_chip *jz4740;
168 int ret;
169 168
170 jz4740 = devm_kzalloc(&pdev->dev, sizeof(*jz4740), GFP_KERNEL); 169 jz4740 = devm_kzalloc(&pdev->dev, sizeof(*jz4740), GFP_KERNEL);
171 if (!jz4740) 170 if (!jz4740)
172 return -ENOMEM; 171 return -ENOMEM;
173 172
174 jz4740->clk = clk_get(NULL, "ext"); 173 jz4740->clk = devm_clk_get(&pdev->dev, "ext");
175 if (IS_ERR(jz4740->clk)) 174 if (IS_ERR(jz4740->clk))
176 return PTR_ERR(jz4740->clk); 175 return PTR_ERR(jz4740->clk);
177 176
@@ -180,29 +179,16 @@ static int jz4740_pwm_probe(struct platform_device *pdev)
180 jz4740->chip.npwm = NUM_PWM; 179 jz4740->chip.npwm = NUM_PWM;
181 jz4740->chip.base = -1; 180 jz4740->chip.base = -1;
182 181
183 ret = pwmchip_add(&jz4740->chip);
184 if (ret < 0) {
185 clk_put(jz4740->clk);
186 return ret;
187 }
188
189 platform_set_drvdata(pdev, jz4740); 182 platform_set_drvdata(pdev, jz4740);
190 183
191 return 0; 184 return pwmchip_add(&jz4740->chip);
192} 185}
193 186
194static int jz4740_pwm_remove(struct platform_device *pdev) 187static int jz4740_pwm_remove(struct platform_device *pdev)
195{ 188{
196 struct jz4740_pwm_chip *jz4740 = platform_get_drvdata(pdev); 189 struct jz4740_pwm_chip *jz4740 = platform_get_drvdata(pdev);
197 int ret;
198
199 ret = pwmchip_remove(&jz4740->chip);
200 if (ret < 0)
201 return ret;
202 190
203 clk_put(jz4740->clk); 191 return pwmchip_remove(&jz4740->chip);
204
205 return 0;
206} 192}
207 193
208static struct platform_driver jz4740_pwm_driver = { 194static struct platform_driver jz4740_pwm_driver = {