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 @@ -311,10 +311,12 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip,
311
311
if (IS_ENABLED (CONFIG_OF ))
312
312
of_pwmchip_add (chip );
313
313
314
- pwmchip_sysfs_export (chip );
315
-
316
314
out :
317
315
mutex_unlock (& pwm_lock );
316
+
317
+ if (!ret )
318
+ pwmchip_sysfs_export (chip );
319
+
318
320
return ret ;
319
321
}
320
322
EXPORT_SYMBOL_GPL (pwmchip_add_with_polarity );
@@ -348,7 +350,7 @@ int pwmchip_remove(struct pwm_chip *chip)
348
350
unsigned int i ;
349
351
int ret = 0 ;
350
352
351
- pwmchip_sysfs_unexport_children (chip );
353
+ pwmchip_sysfs_unexport (chip );
352
354
353
355
mutex_lock (& pwm_lock );
354
356
@@ -368,8 +370,6 @@ int pwmchip_remove(struct pwm_chip *chip)
368
370
369
371
free_pwms (chip );
370
372
371
- pwmchip_sysfs_unexport (chip );
372
-
373
373
out :
374
374
mutex_unlock (& pwm_lock );
375
375
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 @@ -639,7 +639,6 @@ static inline void pwm_remove_table(struct pwm_lookup *table, size_t num)
639
639
#ifdef CONFIG_PWM_SYSFS
640
640
void pwmchip_sysfs_export (struct pwm_chip * chip );
641
641
void pwmchip_sysfs_unexport (struct pwm_chip * chip );
642
- void pwmchip_sysfs_unexport_children (struct pwm_chip * chip );
643
642
#else
644
643
static inline void pwmchip_sysfs_export (struct pwm_chip * chip )
645
644
{
@@ -648,10 +647,6 @@ static inline void pwmchip_sysfs_export(struct pwm_chip *chip)
648
647
static inline void pwmchip_sysfs_unexport (struct pwm_chip * chip )
649
648
{
650
649
}
651
-
652
- static inline void pwmchip_sysfs_unexport_children (struct pwm_chip * chip )
653
- {
654
- }
655
650
#endif /* CONFIG_PWM_SYSFS */
656
651
657
652
#endif /* __LINUX_PWM_H */
You can’t perform that action at this time.
0 commit comments