File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 45
45
#define STATUS_ALL_UPDATE 0x0F
46
46
47
47
struct vt8500_chip {
48
- struct pwm_chip chip ;
49
48
void __iomem * base ;
50
49
struct clk * clk ;
51
50
};
52
51
53
- #define to_vt8500_chip (chip ) container_of(chip, struct vt8500_chip, chip)
52
+ static inline struct vt8500_chip * to_vt8500_chip (struct pwm_chip * chip )
53
+ {
54
+ return pwmchip_get_drvdata (chip );
55
+ }
54
56
55
57
#define msecs_to_loops (t ) (loops_per_jiffy / 1000 * HZ * t)
56
58
static inline void vt8500_pwm_busy_wait (struct pwm_chip * chip , int nr , u8 bitmask )
@@ -240,14 +242,12 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
240
242
if (!np )
241
243
return dev_err_probe (& pdev -> dev , - EINVAL , "invalid devicetree node\n" );
242
244
243
- vt8500 = devm_kzalloc (& pdev -> dev , sizeof (* vt8500 ), GFP_KERNEL );
244
- if (vt8500 == NULL )
245
- return - ENOMEM ;
245
+ chip = devm_pwmchip_alloc (& pdev -> dev , VT8500_NR_PWMS , sizeof (* vt8500 ));
246
+ if (IS_ERR (chip ))
247
+ return PTR_ERR (chip );
248
+ vt8500 = to_vt8500_chip (chip );
246
249
247
- chip = & vt8500 -> chip ;
248
- chip -> dev = & pdev -> dev ;
249
250
chip -> ops = & vt8500_pwm_ops ;
250
- chip -> npwm = VT8500_NR_PWMS ;
251
251
252
252
vt8500 -> clk = devm_clk_get_prepared (& pdev -> dev , NULL );
253
253
if (IS_ERR (vt8500 -> clk ))
You can’t perform that action at this time.
0 commit comments