File tree 3 files changed +6
-23
lines changed
3 files changed +6
-23
lines changed Original file line number Diff line number Diff line change @@ -302,10 +302,12 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip,
302
302
if (IS_ENABLED (CONFIG_OF ))
303
303
of_pwmchip_add (chip );
304
304
305
- pwmchip_sysfs_export (chip );
306
-
307
305
out :
308
306
mutex_unlock (& pwm_lock );
307
+
308
+ if (!ret )
309
+ pwmchip_sysfs_export (chip );
310
+
309
311
return ret ;
310
312
}
311
313
EXPORT_SYMBOL_GPL (pwmchip_add_with_polarity );
@@ -339,7 +341,7 @@ int pwmchip_remove(struct pwm_chip *chip)
339
341
unsigned int i ;
340
342
int ret = 0 ;
341
343
342
- pwmchip_sysfs_unexport_children (chip );
344
+ pwmchip_sysfs_unexport (chip );
343
345
344
346
mutex_lock (& pwm_lock );
345
347
@@ -359,8 +361,6 @@ int pwmchip_remove(struct pwm_chip *chip)
359
361
360
362
free_pwms (chip );
361
363
362
- pwmchip_sysfs_unexport (chip );
363
-
364
364
out :
365
365
mutex_unlock (& pwm_lock );
366
366
return ret ;
Original file line number Diff line number Diff line change @@ -397,19 +397,6 @@ void pwmchip_sysfs_export(struct pwm_chip *chip)
397
397
}
398
398
399
399
void pwmchip_sysfs_unexport (struct pwm_chip * chip )
400
- {
401
- struct device * parent ;
402
-
403
- parent = class_find_device (& pwm_class , NULL , chip ,
404
- pwmchip_sysfs_match );
405
- if (parent ) {
406
- /* for class_find_device() */
407
- put_device (parent );
408
- device_unregister (parent );
409
- }
410
- }
411
-
412
- void pwmchip_sysfs_unexport_children (struct pwm_chip * chip )
413
400
{
414
401
struct device * parent ;
415
402
unsigned int i ;
@@ -427,6 +414,7 @@ void pwmchip_sysfs_unexport_children(struct pwm_chip *chip)
427
414
}
428
415
429
416
put_device (parent );
417
+ device_unregister (parent );
430
418
}
431
419
432
420
static int __init pwm_sysfs_init (void )
Original file line number Diff line number Diff line change @@ -641,7 +641,6 @@ static inline void pwm_remove_table(struct pwm_lookup *table, size_t num)
641
641
#ifdef CONFIG_PWM_SYSFS
642
642
void pwmchip_sysfs_export (struct pwm_chip * chip );
643
643
void pwmchip_sysfs_unexport (struct pwm_chip * chip );
644
- void pwmchip_sysfs_unexport_children (struct pwm_chip * chip );
645
644
#else
646
645
static inline void pwmchip_sysfs_export (struct pwm_chip * chip )
647
646
{
@@ -650,10 +649,6 @@ static inline void pwmchip_sysfs_export(struct pwm_chip *chip)
650
649
static inline void pwmchip_sysfs_unexport (struct pwm_chip * chip )
651
650
{
652
651
}
653
-
654
- static inline void pwmchip_sysfs_unexport_children (struct pwm_chip * chip )
655
- {
656
- }
657
652
#endif /* CONFIG_PWM_SYSFS */
658
653
659
654
#endif /* __LINUX_PWM_H */
You can’t perform that action at this time.
0 commit comments