File tree Expand file tree Collapse file tree 3 files changed +25
-31
lines changed Expand file tree Collapse file tree 3 files changed +25
-31
lines changed Original file line number Diff line number Diff line change @@ -873,7 +873,7 @@ int xe_device_probe(struct xe_device *xe)
873
873
874
874
err = xe_display_init (xe );
875
875
if (err )
876
- goto err_fini_oa ;
876
+ return err ;
877
877
878
878
err = xe_pxp_init (xe );
879
879
if (err )
@@ -905,9 +905,6 @@ int xe_device_probe(struct xe_device *xe)
905
905
err_fini_display :
906
906
xe_display_driver_remove (xe );
907
907
908
- err_fini_oa :
909
- xe_oa_fini (xe );
910
-
911
908
return err ;
912
909
}
913
910
@@ -980,8 +977,6 @@ void xe_device_remove(struct xe_device *xe)
980
977
981
978
xe_device_remove_display (xe );
982
979
983
- xe_oa_fini (xe );
984
-
985
980
xe_heci_gsc_fini (xe );
986
981
987
982
xe_device_call_remove_actions (xe );
Original file line number Diff line number Diff line change @@ -2641,6 +2641,27 @@ static void xe_oa_init_supported_formats(struct xe_oa *oa)
2641
2641
}
2642
2642
}
2643
2643
2644
+ static int destroy_config (int id , void * p , void * data )
2645
+ {
2646
+ xe_oa_config_put (p );
2647
+
2648
+ return 0 ;
2649
+ }
2650
+
2651
+ static void xe_oa_fini (void * arg )
2652
+ {
2653
+ struct xe_device * xe = arg ;
2654
+ struct xe_oa * oa = & xe -> oa ;
2655
+
2656
+ if (!oa -> xe )
2657
+ return ;
2658
+
2659
+ idr_for_each (& oa -> metrics_idr , destroy_config , oa );
2660
+ idr_destroy (& oa -> metrics_idr );
2661
+
2662
+ oa -> xe = NULL ;
2663
+ }
2664
+
2644
2665
/**
2645
2666
* xe_oa_init - OA initialization during device probe
2646
2667
* @xe: @xe_device
@@ -2672,31 +2693,10 @@ int xe_oa_init(struct xe_device *xe)
2672
2693
}
2673
2694
2674
2695
xe_oa_init_supported_formats (oa );
2675
- return 0 ;
2676
- exit :
2677
- oa -> xe = NULL ;
2678
- return ret ;
2679
- }
2680
2696
2681
- static int destroy_config (int id , void * p , void * data )
2682
- {
2683
- xe_oa_config_put (p );
2684
- return 0 ;
2685
- }
2686
-
2687
- /**
2688
- * xe_oa_fini - OA de-initialization during device remove
2689
- * @xe: @xe_device
2690
- */
2691
- void xe_oa_fini (struct xe_device * xe )
2692
- {
2693
- struct xe_oa * oa = & xe -> oa ;
2694
-
2695
- if (!oa -> xe )
2696
- return ;
2697
-
2698
- idr_for_each (& oa -> metrics_idr , destroy_config , oa );
2699
- idr_destroy (& oa -> metrics_idr );
2697
+ return devm_add_action_or_reset (xe -> drm .dev , xe_oa_fini , xe );
2700
2698
2699
+ exit :
2701
2700
oa -> xe = NULL ;
2701
+ return ret ;
2702
2702
}
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ struct xe_gt;
15
15
struct xe_hw_engine ;
16
16
17
17
int xe_oa_init (struct xe_device * xe );
18
- void xe_oa_fini (struct xe_device * xe );
19
18
void xe_oa_register (struct xe_device * xe );
20
19
void xe_oa_unregister (struct xe_device * xe );
21
20
int xe_oa_stream_open_ioctl (struct drm_device * dev , u64 data , struct drm_file * file );
You can’t perform that action at this time.
0 commit comments