@@ -473,39 +473,29 @@ clk_multiple_parents_mux_test_init(struct kunit *test)
473
473
& clk_dummy_rate_ops ,
474
474
0 );
475
475
ctx -> parents_ctx [0 ].rate = DUMMY_CLOCK_RATE_1 ;
476
- ret = clk_hw_register ( NULL , & ctx -> parents_ctx [0 ].hw );
476
+ ret = clk_hw_register_kunit ( test , NULL , & ctx -> parents_ctx [0 ].hw );
477
477
if (ret )
478
478
return ret ;
479
479
480
480
ctx -> parents_ctx [1 ].hw .init = CLK_HW_INIT_NO_PARENT ("parent-1" ,
481
481
& clk_dummy_rate_ops ,
482
482
0 );
483
483
ctx -> parents_ctx [1 ].rate = DUMMY_CLOCK_RATE_2 ;
484
- ret = clk_hw_register ( NULL , & ctx -> parents_ctx [1 ].hw );
484
+ ret = clk_hw_register_kunit ( test , NULL , & ctx -> parents_ctx [1 ].hw );
485
485
if (ret )
486
486
return ret ;
487
487
488
488
ctx -> current_parent = 0 ;
489
489
ctx -> hw .init = CLK_HW_INIT_PARENTS ("test-mux" , parents ,
490
490
& clk_multiple_parents_mux_ops ,
491
491
CLK_SET_RATE_PARENT );
492
- ret = clk_hw_register ( NULL , & ctx -> hw );
492
+ ret = clk_hw_register_kunit ( test , NULL , & ctx -> hw );
493
493
if (ret )
494
494
return ret ;
495
495
496
496
return 0 ;
497
497
}
498
498
499
- static void
500
- clk_multiple_parents_mux_test_exit (struct kunit * test )
501
- {
502
- struct clk_multiple_parent_ctx * ctx = test -> priv ;
503
-
504
- clk_hw_unregister (& ctx -> hw );
505
- clk_hw_unregister (& ctx -> parents_ctx [0 ].hw );
506
- clk_hw_unregister (& ctx -> parents_ctx [1 ].hw );
507
- }
508
-
509
499
/*
510
500
* Test that for a clock with multiple parents, clk_get_parent()
511
501
* actually returns the current one.
@@ -561,18 +551,18 @@ clk_test_multiple_parents_mux_set_range_set_parent_get_rate(struct kunit *test)
561
551
{
562
552
struct clk_multiple_parent_ctx * ctx = test -> priv ;
563
553
struct clk_hw * hw = & ctx -> hw ;
564
- struct clk * clk = clk_hw_get_clk ( hw , NULL );
554
+ struct clk * clk = clk_hw_get_clk_kunit ( test , hw , NULL );
565
555
struct clk * parent1 , * parent2 ;
566
556
unsigned long rate ;
567
557
int ret ;
568
558
569
559
kunit_skip (test , "This needs to be fixed in the core." );
570
560
571
- parent1 = clk_hw_get_clk ( & ctx -> parents_ctx [0 ].hw , NULL );
561
+ parent1 = clk_hw_get_clk_kunit ( test , & ctx -> parents_ctx [0 ].hw , NULL );
572
562
KUNIT_ASSERT_NOT_ERR_OR_NULL (test , parent1 );
573
563
KUNIT_ASSERT_TRUE (test , clk_is_match (clk_get_parent (clk ), parent1 ));
574
564
575
- parent2 = clk_hw_get_clk ( & ctx -> parents_ctx [1 ].hw , NULL );
565
+ parent2 = clk_hw_get_clk_kunit ( test , & ctx -> parents_ctx [1 ].hw , NULL );
576
566
KUNIT_ASSERT_NOT_ERR_OR_NULL (test , parent2 );
577
567
578
568
ret = clk_set_rate (parent1 , DUMMY_CLOCK_RATE_1 );
@@ -593,10 +583,6 @@ clk_test_multiple_parents_mux_set_range_set_parent_get_rate(struct kunit *test)
593
583
KUNIT_ASSERT_GT (test , rate , 0 );
594
584
KUNIT_EXPECT_GE (test , rate , DUMMY_CLOCK_RATE_1 - 1000 );
595
585
KUNIT_EXPECT_LE (test , rate , DUMMY_CLOCK_RATE_1 + 1000 );
596
-
597
- clk_put (parent2 );
598
- clk_put (parent1 );
599
- clk_put (clk );
600
586
}
601
587
602
588
static struct kunit_case clk_multiple_parents_mux_test_cases [] = {
@@ -617,7 +603,6 @@ static struct kunit_suite
617
603
clk_multiple_parents_mux_test_suite = {
618
604
.name = "clk-multiple-parents-mux-test" ,
619
605
.init = clk_multiple_parents_mux_test_init ,
620
- .exit = clk_multiple_parents_mux_test_exit ,
621
606
.test_cases = clk_multiple_parents_mux_test_cases ,
622
607
};
623
608
@@ -637,29 +622,20 @@ clk_orphan_transparent_multiple_parent_mux_test_init(struct kunit *test)
637
622
& clk_dummy_rate_ops ,
638
623
0 );
639
624
ctx -> parents_ctx [1 ].rate = DUMMY_CLOCK_INIT_RATE ;
640
- ret = clk_hw_register ( NULL , & ctx -> parents_ctx [1 ].hw );
625
+ ret = clk_hw_register_kunit ( test , NULL , & ctx -> parents_ctx [1 ].hw );
641
626
if (ret )
642
627
return ret ;
643
628
644
629
ctx -> hw .init = CLK_HW_INIT_PARENTS ("test-orphan-mux" , parents ,
645
630
& clk_multiple_parents_mux_ops ,
646
631
CLK_SET_RATE_PARENT );
647
- ret = clk_hw_register ( NULL , & ctx -> hw );
632
+ ret = clk_hw_register_kunit ( test , NULL , & ctx -> hw );
648
633
if (ret )
649
634
return ret ;
650
635
651
636
return 0 ;
652
637
}
653
638
654
- static void
655
- clk_orphan_transparent_multiple_parent_mux_test_exit (struct kunit * test )
656
- {
657
- struct clk_multiple_parent_ctx * ctx = test -> priv ;
658
-
659
- clk_hw_unregister (& ctx -> hw );
660
- clk_hw_unregister (& ctx -> parents_ctx [1 ].hw );
661
- }
662
-
663
639
/*
664
640
* Test that, for a mux whose current parent hasn't been registered yet and is
665
641
* thus orphan, clk_get_parent() will return NULL.
@@ -912,7 +888,7 @@ clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate(st
912
888
{
913
889
struct clk_multiple_parent_ctx * ctx = test -> priv ;
914
890
struct clk_hw * hw = & ctx -> hw ;
915
- struct clk * clk = clk_hw_get_clk ( hw , NULL );
891
+ struct clk * clk = clk_hw_get_clk_kunit ( test , hw , NULL );
916
892
struct clk * parent ;
917
893
unsigned long rate ;
918
894
int ret ;
@@ -921,7 +897,7 @@ clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate(st
921
897
922
898
clk_hw_set_rate_range (hw , DUMMY_CLOCK_RATE_1 , DUMMY_CLOCK_RATE_2 );
923
899
924
- parent = clk_hw_get_clk ( & ctx -> parents_ctx [1 ].hw , NULL );
900
+ parent = clk_hw_get_clk_kunit ( test , & ctx -> parents_ctx [1 ].hw , NULL );
925
901
KUNIT_ASSERT_NOT_ERR_OR_NULL (test , parent );
926
902
927
903
ret = clk_set_parent (clk , parent );
@@ -931,9 +907,6 @@ clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate(st
931
907
KUNIT_ASSERT_GT (test , rate , 0 );
932
908
KUNIT_EXPECT_GE (test , rate , DUMMY_CLOCK_RATE_1 );
933
909
KUNIT_EXPECT_LE (test , rate , DUMMY_CLOCK_RATE_2 );
934
-
935
- clk_put (parent );
936
- clk_put (clk );
937
910
}
938
911
939
912
static struct kunit_case clk_orphan_transparent_multiple_parent_mux_test_cases [] = {
@@ -961,7 +934,6 @@ static struct kunit_case clk_orphan_transparent_multiple_parent_mux_test_cases[]
961
934
static struct kunit_suite clk_orphan_transparent_multiple_parent_mux_test_suite = {
962
935
.name = "clk-orphan-transparent-multiple-parent-mux-test" ,
963
936
.init = clk_orphan_transparent_multiple_parent_mux_test_init ,
964
- .exit = clk_orphan_transparent_multiple_parent_mux_test_exit ,
965
937
.test_cases = clk_orphan_transparent_multiple_parent_mux_test_cases ,
966
938
};
967
939
@@ -986,15 +958,15 @@ static int clk_single_parent_mux_test_init(struct kunit *test)
986
958
& clk_dummy_rate_ops ,
987
959
0 );
988
960
989
- ret = clk_hw_register ( NULL , & ctx -> parent_ctx .hw );
961
+ ret = clk_hw_register_kunit ( test , NULL , & ctx -> parent_ctx .hw );
990
962
if (ret )
991
963
return ret ;
992
964
993
965
ctx -> hw .init = CLK_HW_INIT ("test-clk" , "parent-clk" ,
994
966
& clk_dummy_single_parent_ops ,
995
967
CLK_SET_RATE_PARENT );
996
968
997
- ret = clk_hw_register ( NULL , & ctx -> hw );
969
+ ret = clk_hw_register_kunit ( test , NULL , & ctx -> hw );
998
970
if (ret )
999
971
return ret ;
1000
972
@@ -1060,7 +1032,7 @@ clk_test_single_parent_mux_set_range_disjoint_child_last(struct kunit *test)
1060
1032
{
1061
1033
struct clk_single_parent_ctx * ctx = test -> priv ;
1062
1034
struct clk_hw * hw = & ctx -> hw ;
1063
- struct clk * clk = clk_hw_get_clk ( hw , NULL );
1035
+ struct clk * clk = clk_hw_get_clk_kunit ( test , hw , NULL );
1064
1036
struct clk * parent ;
1065
1037
int ret ;
1066
1038
@@ -1074,8 +1046,6 @@ clk_test_single_parent_mux_set_range_disjoint_child_last(struct kunit *test)
1074
1046
1075
1047
ret = clk_set_rate_range (clk , 3000 , 4000 );
1076
1048
KUNIT_EXPECT_LT (test , ret , 0 );
1077
-
1078
- clk_put (clk );
1079
1049
}
1080
1050
1081
1051
/*
@@ -1092,7 +1062,7 @@ clk_test_single_parent_mux_set_range_disjoint_parent_last(struct kunit *test)
1092
1062
{
1093
1063
struct clk_single_parent_ctx * ctx = test -> priv ;
1094
1064
struct clk_hw * hw = & ctx -> hw ;
1095
- struct clk * clk = clk_hw_get_clk ( hw , NULL );
1065
+ struct clk * clk = clk_hw_get_clk_kunit ( test , hw , NULL );
1096
1066
struct clk * parent ;
1097
1067
int ret ;
1098
1068
@@ -1106,8 +1076,6 @@ clk_test_single_parent_mux_set_range_disjoint_parent_last(struct kunit *test)
1106
1076
1107
1077
ret = clk_set_rate_range (parent , 3000 , 4000 );
1108
1078
KUNIT_EXPECT_LT (test , ret , 0 );
1109
-
1110
- clk_put (clk );
1111
1079
}
1112
1080
1113
1081
/*
@@ -1238,7 +1206,6 @@ static struct kunit_suite
1238
1206
clk_single_parent_mux_test_suite = {
1239
1207
.name = "clk-single-parent-mux-test" ,
1240
1208
.init = clk_single_parent_mux_test_init ,
1241
- .exit = clk_single_parent_mux_test_exit ,
1242
1209
.test_cases = clk_single_parent_mux_test_cases ,
1243
1210
};
1244
1211
0 commit comments