File tree Expand file tree Collapse file tree 3 files changed +6
-23
lines changed Expand file tree Collapse file tree 3 files changed +6
-23
lines changed Original file line number Diff line number Diff line change @@ -311,10 +311,12 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip,
311311 if (IS_ENABLED (CONFIG_OF ))
312312 of_pwmchip_add (chip );
313313
314- pwmchip_sysfs_export (chip );
315-
316314out :
317315 mutex_unlock (& pwm_lock );
316+
317+ if (!ret )
318+ pwmchip_sysfs_export (chip );
319+
318320 return ret ;
319321}
320322EXPORT_SYMBOL_GPL (pwmchip_add_with_polarity );
@@ -348,7 +350,7 @@ int pwmchip_remove(struct pwm_chip *chip)
348350 unsigned int i ;
349351 int ret = 0 ;
350352
351- pwmchip_sysfs_unexport_children (chip );
353+ pwmchip_sysfs_unexport (chip );
352354
353355 mutex_lock (& pwm_lock );
354356
@@ -368,8 +370,6 @@ int pwmchip_remove(struct pwm_chip *chip)
368370
369371 free_pwms (chip );
370372
371- pwmchip_sysfs_unexport (chip );
372-
373373out :
374374 mutex_unlock (& pwm_lock );
375375 return ret ;
Original file line number Diff line number Diff line change @@ -397,19 +397,6 @@ void pwmchip_sysfs_export(struct pwm_chip *chip)
397397}
398398
399399void 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 )
413400{
414401 struct device * parent ;
415402 unsigned int i ;
@@ -427,6 +414,7 @@ void pwmchip_sysfs_unexport_children(struct pwm_chip *chip)
427414 }
428415
429416 put_device (parent );
417+ device_unregister (parent );
430418}
431419
432420static int __init pwm_sysfs_init (void )
Original file line number Diff line number Diff line change @@ -639,7 +639,6 @@ static inline void pwm_remove_table(struct pwm_lookup *table, size_t num)
639639#ifdef CONFIG_PWM_SYSFS
640640void pwmchip_sysfs_export (struct pwm_chip * chip );
641641void pwmchip_sysfs_unexport (struct pwm_chip * chip );
642- void pwmchip_sysfs_unexport_children (struct pwm_chip * chip );
643642#else
644643static inline void pwmchip_sysfs_export (struct pwm_chip * chip )
645644{
@@ -648,10 +647,6 @@ static inline void pwmchip_sysfs_export(struct pwm_chip *chip)
648647static inline void pwmchip_sysfs_unexport (struct pwm_chip * chip )
649648{
650649}
651-
652- static inline void pwmchip_sysfs_unexport_children (struct pwm_chip * chip )
653- {
654- }
655650#endif /* CONFIG_PWM_SYSFS */
656651
657652#endif /* __LINUX_PWM_H */
You can’t perform that action at this time.
0 commit comments