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 @@ -409,19 +409,6 @@ void pwmchip_sysfs_export(struct pwm_chip *chip)
409
409
}
410
410
411
411
void pwmchip_sysfs_unexport (struct pwm_chip * chip )
412
- {
413
- struct device * parent ;
414
-
415
- parent = class_find_device (& pwm_class , NULL , chip ,
416
- pwmchip_sysfs_match );
417
- if (parent ) {
418
- /* for class_find_device() */
419
- put_device (parent );
420
- device_unregister (parent );
421
- }
422
- }
423
-
424
- void pwmchip_sysfs_unexport_children (struct pwm_chip * chip )
425
412
{
426
413
struct device * parent ;
427
414
unsigned int i ;
@@ -439,6 +426,7 @@ void pwmchip_sysfs_unexport_children(struct pwm_chip *chip)
439
426
}
440
427
441
428
put_device (parent );
429
+ device_unregister (parent );
442
430
}
443
431
444
432
static int __init pwm_sysfs_init (void )
Original file line number Diff line number Diff line change @@ -596,7 +596,6 @@ static inline void pwm_remove_table(struct pwm_lookup *table, size_t num)
596
596
#ifdef CONFIG_PWM_SYSFS
597
597
void pwmchip_sysfs_export (struct pwm_chip * chip );
598
598
void pwmchip_sysfs_unexport (struct pwm_chip * chip );
599
- void pwmchip_sysfs_unexport_children (struct pwm_chip * chip );
600
599
#else
601
600
static inline void pwmchip_sysfs_export (struct pwm_chip * chip )
602
601
{
@@ -605,10 +604,6 @@ static inline void pwmchip_sysfs_export(struct pwm_chip *chip)
605
604
static inline void pwmchip_sysfs_unexport (struct pwm_chip * chip )
606
605
{
607
606
}
608
-
609
- static inline void pwmchip_sysfs_unexport_children (struct pwm_chip * chip )
610
- {
611
- }
612
607
#endif /* CONFIG_PWM_SYSFS */
613
608
614
609
#endif /* __LINUX_PWM_H */
You can’t perform that action at this time.
0 commit comments