@@ -214,6 +214,7 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
214
214
struct device * dev = & pdev -> dev ;
215
215
struct device_node * np = dev -> of_node ;
216
216
struct xilinx_timer_priv * priv ;
217
+ struct pwm_chip * chip ;
217
218
struct xilinx_pwm_device * xilinx_pwm ;
218
219
u32 pwm_cells , one_timer , width ;
219
220
void __iomem * regs ;
@@ -228,8 +229,9 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
228
229
xilinx_pwm = devm_kzalloc (dev , sizeof (* xilinx_pwm ), GFP_KERNEL );
229
230
if (!xilinx_pwm )
230
231
return - ENOMEM ;
231
- platform_set_drvdata (pdev , xilinx_pwm );
232
232
priv = & xilinx_pwm -> priv ;
233
+ chip = & xilinx_pwm -> chip ;
234
+ platform_set_drvdata (pdev , chip );
233
235
234
236
regs = devm_platform_ioremap_resource (pdev , 0 );
235
237
if (IS_ERR (regs ))
@@ -278,10 +280,10 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
278
280
return dev_err_probe (dev , ret , "Clock enable failed\n" );
279
281
clk_rate_exclusive_get (priv -> clk );
280
282
281
- xilinx_pwm -> chip . dev = dev ;
282
- xilinx_pwm -> chip . ops = & xilinx_pwm_ops ;
283
- xilinx_pwm -> chip . npwm = 1 ;
284
- ret = pwmchip_add (& xilinx_pwm -> chip );
283
+ chip -> dev = dev ;
284
+ chip -> ops = & xilinx_pwm_ops ;
285
+ chip -> npwm = 1 ;
286
+ ret = pwmchip_add (chip );
285
287
if (ret ) {
286
288
clk_rate_exclusive_put (priv -> clk );
287
289
clk_disable_unprepare (priv -> clk );
@@ -293,11 +295,12 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
293
295
294
296
static void xilinx_pwm_remove (struct platform_device * pdev )
295
297
{
296
- struct xilinx_pwm_device * xilinx_pwm = platform_get_drvdata (pdev );
298
+ struct pwm_chip * chip = platform_get_drvdata (pdev );
299
+ struct xilinx_timer_priv * priv = xilinx_pwm_chip_to_priv (chip );
297
300
298
- pwmchip_remove (& xilinx_pwm -> chip );
299
- clk_rate_exclusive_put (xilinx_pwm -> priv . clk );
300
- clk_disable_unprepare (xilinx_pwm -> priv . clk );
301
+ pwmchip_remove (chip );
302
+ clk_rate_exclusive_put (priv -> clk );
303
+ clk_disable_unprepare (priv -> clk );
301
304
}
302
305
303
306
static const struct of_device_id xilinx_pwm_of_match [] = {
0 commit comments