@@ -161,30 +161,6 @@ struct vc5_driver_data {
161
161
struct vc5_hw_data clk_out [VC5_MAX_CLK_OUT_NUM ];
162
162
};
163
163
164
- static const char * const vc5_mux_names [] = {
165
- "mux"
166
- };
167
-
168
- static const char * const vc5_dbl_names [] = {
169
- "dbl"
170
- };
171
-
172
- static const char * const vc5_pfd_names [] = {
173
- "pfd"
174
- };
175
-
176
- static const char * const vc5_pll_names [] = {
177
- "pll"
178
- };
179
-
180
- static const char * const vc5_fod_names [] = {
181
- "fod0" , "fod1" , "fod2" , "fod3" ,
182
- };
183
-
184
- static const char * const vc5_clk_out_names [] = {
185
- "out0_sel_i2cb" , "out1" , "out2" , "out3" , "out4" ,
186
- };
187
-
188
164
/*
189
165
* VersaClock5 i2c regmap
190
166
*/
@@ -692,8 +668,7 @@ static int vc5_map_index_to_output(const enum vc5_model model,
692
668
693
669
static const struct of_device_id clk_vc5_of_match [];
694
670
695
- static int vc5_probe (struct i2c_client * client ,
696
- const struct i2c_device_id * id )
671
+ static int vc5_probe (struct i2c_client * client , const struct i2c_device_id * id )
697
672
{
698
673
struct vc5_driver_data * vc5 ;
699
674
struct clk_init_data init ;
@@ -742,20 +717,21 @@ static int vc5_probe(struct i2c_client *client,
742
717
if (!IS_ERR (vc5 -> pin_clkin )) {
743
718
vc5 -> clk_mux_ins |= VC5_MUX_IN_CLKIN ;
744
719
parent_names [init .num_parents ++ ] =
745
- __clk_get_name (vc5 -> pin_clkin );
720
+ __clk_get_name (vc5 -> pin_clkin );
746
721
}
747
722
748
723
if (!init .num_parents ) {
749
724
dev_err (& client -> dev , "no input clock specified!\n" );
750
725
return - EINVAL ;
751
726
}
752
727
753
- init .name = vc5_mux_names [ 0 ] ;
728
+ init .name = kasprintf ( GFP_KERNEL , "%pOFn.mux" , client -> dev . of_node ) ;
754
729
init .ops = & vc5_mux_ops ;
755
730
init .flags = 0 ;
756
731
init .parent_names = parent_names ;
757
732
vc5 -> clk_mux .init = & init ;
758
733
ret = devm_clk_hw_register (& client -> dev , & vc5 -> clk_mux );
734
+ kfree (init .name ); /* clock framework made a copy of the name */
759
735
if (ret ) {
760
736
dev_err (& client -> dev , "unable to register %s\n" , init .name );
761
737
goto err_clk ;
@@ -764,13 +740,16 @@ static int vc5_probe(struct i2c_client *client,
764
740
if (vc5 -> chip_info -> flags & VC5_HAS_PFD_FREQ_DBL ) {
765
741
/* Register frequency doubler */
766
742
memset (& init , 0 , sizeof (init ));
767
- init .name = vc5_dbl_names [0 ];
743
+ init .name = kasprintf (GFP_KERNEL , "%pOFn.dbl" ,
744
+ client -> dev .of_node );
768
745
init .ops = & vc5_dbl_ops ;
769
746
init .flags = CLK_SET_RATE_PARENT ;
770
- init .parent_names = vc5_mux_names ;
747
+ init .parent_names = parent_names ;
748
+ parent_names [0 ] = clk_hw_get_name (& vc5 -> clk_mux );
771
749
init .num_parents = 1 ;
772
750
vc5 -> clk_mul .init = & init ;
773
751
ret = devm_clk_hw_register (& client -> dev , & vc5 -> clk_mul );
752
+ kfree (init .name ); /* clock framework made a copy of the name */
774
753
if (ret ) {
775
754
dev_err (& client -> dev , "unable to register %s\n" ,
776
755
init .name );
@@ -780,32 +759,36 @@ static int vc5_probe(struct i2c_client *client,
780
759
781
760
/* Register PFD */
782
761
memset (& init , 0 , sizeof (init ));
783
- init .name = vc5_pfd_names [ 0 ] ;
762
+ init .name = kasprintf ( GFP_KERNEL , "%pOFn.pfd" , client -> dev . of_node ) ;
784
763
init .ops = & vc5_pfd_ops ;
785
764
init .flags = CLK_SET_RATE_PARENT ;
765
+ init .parent_names = parent_names ;
786
766
if (vc5 -> chip_info -> flags & VC5_HAS_PFD_FREQ_DBL )
787
- init . parent_names = vc5_dbl_names ;
767
+ parent_names [ 0 ] = clk_hw_get_name ( & vc5 -> clk_mul ) ;
788
768
else
789
- init . parent_names = vc5_mux_names ;
769
+ parent_names [ 0 ] = clk_hw_get_name ( & vc5 -> clk_mux ) ;
790
770
init .num_parents = 1 ;
791
771
vc5 -> clk_pfd .init = & init ;
792
772
ret = devm_clk_hw_register (& client -> dev , & vc5 -> clk_pfd );
773
+ kfree (init .name ); /* clock framework made a copy of the name */
793
774
if (ret ) {
794
775
dev_err (& client -> dev , "unable to register %s\n" , init .name );
795
776
goto err_clk ;
796
777
}
797
778
798
779
/* Register PLL */
799
780
memset (& init , 0 , sizeof (init ));
800
- init .name = vc5_pll_names [ 0 ] ;
781
+ init .name = kasprintf ( GFP_KERNEL , "%pOFn.pll" , client -> dev . of_node ) ;
801
782
init .ops = & vc5_pll_ops ;
802
783
init .flags = CLK_SET_RATE_PARENT ;
803
- init .parent_names = vc5_pfd_names ;
784
+ init .parent_names = parent_names ;
785
+ parent_names [0 ] = clk_hw_get_name (& vc5 -> clk_pfd );
804
786
init .num_parents = 1 ;
805
787
vc5 -> clk_pll .num = 0 ;
806
788
vc5 -> clk_pll .vc5 = vc5 ;
807
789
vc5 -> clk_pll .hw .init = & init ;
808
790
ret = devm_clk_hw_register (& client -> dev , & vc5 -> clk_pll .hw );
791
+ kfree (init .name ); /* clock framework made a copy of the name */
809
792
if (ret ) {
810
793
dev_err (& client -> dev , "unable to register %s\n" , init .name );
811
794
goto err_clk ;
@@ -815,15 +798,18 @@ static int vc5_probe(struct i2c_client *client,
815
798
for (n = 0 ; n < vc5 -> chip_info -> clk_fod_cnt ; n ++ ) {
816
799
idx = vc5_map_index_to_output (vc5 -> chip_info -> model , n );
817
800
memset (& init , 0 , sizeof (init ));
818
- init .name = vc5_fod_names [idx ];
801
+ init .name = kasprintf (GFP_KERNEL , "%pOFn.fod%d" ,
802
+ client -> dev .of_node , idx );
819
803
init .ops = & vc5_fod_ops ;
820
804
init .flags = CLK_SET_RATE_PARENT ;
821
- init .parent_names = vc5_pll_names ;
805
+ init .parent_names = parent_names ;
806
+ parent_names [0 ] = clk_hw_get_name (& vc5 -> clk_pll .hw );
822
807
init .num_parents = 1 ;
823
808
vc5 -> clk_fod [n ].num = idx ;
824
809
vc5 -> clk_fod [n ].vc5 = vc5 ;
825
810
vc5 -> clk_fod [n ].hw .init = & init ;
826
811
ret = devm_clk_hw_register (& client -> dev , & vc5 -> clk_fod [n ].hw );
812
+ kfree (init .name ); /* clock framework made a copy of the name */
827
813
if (ret ) {
828
814
dev_err (& client -> dev , "unable to register %s\n" ,
829
815
init .name );
@@ -833,41 +819,45 @@ static int vc5_probe(struct i2c_client *client,
833
819
834
820
/* Register MUX-connected OUT0_I2C_SELB output */
835
821
memset (& init , 0 , sizeof (init ));
836
- init .name = vc5_clk_out_names [0 ];
822
+ init .name = kasprintf (GFP_KERNEL , "%pOFn.out0_sel_i2cb" ,
823
+ client -> dev .of_node );
837
824
init .ops = & vc5_clk_out_ops ;
838
825
init .flags = CLK_SET_RATE_PARENT ;
839
- init .parent_names = vc5_mux_names ;
826
+ init .parent_names = parent_names ;
827
+ parent_names [0 ] = clk_hw_get_name (& vc5 -> clk_mux );
840
828
init .num_parents = 1 ;
841
829
vc5 -> clk_out [0 ].num = idx ;
842
830
vc5 -> clk_out [0 ].vc5 = vc5 ;
843
831
vc5 -> clk_out [0 ].hw .init = & init ;
844
832
ret = devm_clk_hw_register (& client -> dev , & vc5 -> clk_out [0 ].hw );
833
+ kfree (init .name ); /* clock framework made a copy of the name */
845
834
if (ret ) {
846
- dev_err (& client -> dev , "unable to register %s\n" ,
847
- init .name );
835
+ dev_err (& client -> dev , "unable to register %s\n" , init .name );
848
836
goto err_clk ;
849
837
}
850
838
851
839
/* Register FOD-connected OUTx outputs */
852
840
for (n = 1 ; n < vc5 -> chip_info -> clk_out_cnt ; n ++ ) {
853
841
idx = vc5_map_index_to_output (vc5 -> chip_info -> model , n - 1 );
854
- parent_names [0 ] = vc5_fod_names [idx ];
842
+ parent_names [0 ] = clk_hw_get_name ( & vc5 -> clk_fod [idx ]. hw ) ;
855
843
if (n == 1 )
856
- parent_names [1 ] = vc5_mux_names [ 0 ] ;
844
+ parent_names [1 ] = clk_hw_get_name ( & vc5 -> clk_mux ) ;
857
845
else
858
- parent_names [1 ] = vc5_clk_out_names [n - 1 ];
846
+ parent_names [1 ] =
847
+ clk_hw_get_name (& vc5 -> clk_out [n - 1 ].hw );
859
848
860
849
memset (& init , 0 , sizeof (init ));
861
- init .name = vc5_clk_out_names [idx + 1 ];
850
+ init .name = kasprintf (GFP_KERNEL , "%pOFn.out%d" ,
851
+ client -> dev .of_node , idx + 1 );
862
852
init .ops = & vc5_clk_out_ops ;
863
853
init .flags = CLK_SET_RATE_PARENT ;
864
854
init .parent_names = parent_names ;
865
855
init .num_parents = 2 ;
866
856
vc5 -> clk_out [n ].num = idx ;
867
857
vc5 -> clk_out [n ].vc5 = vc5 ;
868
858
vc5 -> clk_out [n ].hw .init = & init ;
869
- ret = devm_clk_hw_register (& client -> dev ,
870
- & vc5 -> clk_out [ n ]. hw );
859
+ ret = devm_clk_hw_register (& client -> dev , & vc5 -> clk_out [ n ]. hw );
860
+ kfree ( init . name ); /* clock framework made a copy of the name */
871
861
if (ret ) {
872
862
dev_err (& client -> dev , "unable to register %s\n" ,
873
863
init .name );
0 commit comments