@@ -128,15 +128,16 @@ static const struct clk_ops main_osc_ops = {
128
128
.is_prepared = clk_main_osc_is_prepared ,
129
129
};
130
130
131
- static struct clk * __init
131
+ static struct clk_hw * __init
132
132
at91_clk_register_main_osc (struct regmap * regmap ,
133
133
const char * name ,
134
134
const char * parent_name ,
135
135
bool bypass )
136
136
{
137
137
struct clk_main_osc * osc ;
138
- struct clk * clk = NULL ;
139
138
struct clk_init_data init ;
139
+ struct clk_hw * hw ;
140
+ int ret ;
140
141
141
142
if (!name || !parent_name )
142
143
return ERR_PTR (- EINVAL );
@@ -160,16 +161,19 @@ at91_clk_register_main_osc(struct regmap *regmap,
160
161
AT91_PMC_MOSCEN ,
161
162
AT91_PMC_OSCBYPASS | AT91_PMC_KEY );
162
163
163
- clk = clk_register (NULL , & osc -> hw );
164
- if (IS_ERR (clk ))
164
+ hw = & osc -> hw ;
165
+ ret = clk_hw_register (NULL , & osc -> hw );
166
+ if (ret ) {
165
167
kfree (osc );
168
+ hw = ERR_PTR (ret );
169
+ }
166
170
167
- return clk ;
171
+ return hw ;
168
172
}
169
173
170
174
static void __init of_at91rm9200_clk_main_osc_setup (struct device_node * np )
171
175
{
172
- struct clk * clk ;
176
+ struct clk_hw * hw ;
173
177
const char * name = np -> name ;
174
178
const char * parent_name ;
175
179
struct regmap * regmap ;
@@ -183,11 +187,11 @@ static void __init of_at91rm9200_clk_main_osc_setup(struct device_node *np)
183
187
if (IS_ERR (regmap ))
184
188
return ;
185
189
186
- clk = at91_clk_register_main_osc (regmap , name , parent_name , bypass );
187
- if (IS_ERR (clk ))
190
+ hw = at91_clk_register_main_osc (regmap , name , parent_name , bypass );
191
+ if (IS_ERR (hw ))
188
192
return ;
189
193
190
- of_clk_add_provider (np , of_clk_src_simple_get , clk );
194
+ of_clk_add_hw_provider (np , of_clk_hw_simple_get , hw );
191
195
}
192
196
CLK_OF_DECLARE (at91rm9200_clk_main_osc , "atmel,at91rm9200-clk-main-osc" ,
193
197
of_at91rm9200_clk_main_osc_setup );
@@ -271,14 +275,15 @@ static const struct clk_ops main_rc_osc_ops = {
271
275
.recalc_accuracy = clk_main_rc_osc_recalc_accuracy ,
272
276
};
273
277
274
- static struct clk * __init
278
+ static struct clk_hw * __init
275
279
at91_clk_register_main_rc_osc (struct regmap * regmap ,
276
280
const char * name ,
277
281
u32 frequency , u32 accuracy )
278
282
{
279
283
struct clk_main_rc_osc * osc ;
280
- struct clk * clk = NULL ;
281
284
struct clk_init_data init ;
285
+ struct clk_hw * hw ;
286
+ int ret ;
282
287
283
288
if (!name || !frequency )
284
289
return ERR_PTR (- EINVAL );
@@ -298,16 +303,19 @@ at91_clk_register_main_rc_osc(struct regmap *regmap,
298
303
osc -> frequency = frequency ;
299
304
osc -> accuracy = accuracy ;
300
305
301
- clk = clk_register (NULL , & osc -> hw );
302
- if (IS_ERR (clk ))
306
+ hw = & osc -> hw ;
307
+ ret = clk_hw_register (NULL , hw );
308
+ if (ret ) {
303
309
kfree (osc );
310
+ hw = ERR_PTR (ret );
311
+ }
304
312
305
- return clk ;
313
+ return hw ;
306
314
}
307
315
308
316
static void __init of_at91sam9x5_clk_main_rc_osc_setup (struct device_node * np )
309
317
{
310
- struct clk * clk ;
318
+ struct clk_hw * hw ;
311
319
u32 frequency = 0 ;
312
320
u32 accuracy = 0 ;
313
321
const char * name = np -> name ;
@@ -321,11 +329,11 @@ static void __init of_at91sam9x5_clk_main_rc_osc_setup(struct device_node *np)
321
329
if (IS_ERR (regmap ))
322
330
return ;
323
331
324
- clk = at91_clk_register_main_rc_osc (regmap , name , frequency , accuracy );
325
- if (IS_ERR (clk ))
332
+ hw = at91_clk_register_main_rc_osc (regmap , name , frequency , accuracy );
333
+ if (IS_ERR (hw ))
326
334
return ;
327
335
328
- of_clk_add_provider (np , of_clk_src_simple_get , clk );
336
+ of_clk_add_hw_provider (np , of_clk_hw_simple_get , hw );
329
337
}
330
338
CLK_OF_DECLARE (at91sam9x5_clk_main_rc_osc , "atmel,at91sam9x5-clk-main-rc-osc" ,
331
339
of_at91sam9x5_clk_main_rc_osc_setup );
@@ -395,14 +403,15 @@ static const struct clk_ops rm9200_main_ops = {
395
403
.recalc_rate = clk_rm9200_main_recalc_rate ,
396
404
};
397
405
398
- static struct clk * __init
406
+ static struct clk_hw * __init
399
407
at91_clk_register_rm9200_main (struct regmap * regmap ,
400
408
const char * name ,
401
409
const char * parent_name )
402
410
{
403
411
struct clk_rm9200_main * clkmain ;
404
- struct clk * clk = NULL ;
405
412
struct clk_init_data init ;
413
+ struct clk_hw * hw ;
414
+ int ret ;
406
415
407
416
if (!name )
408
417
return ERR_PTR (- EINVAL );
@@ -423,16 +432,19 @@ at91_clk_register_rm9200_main(struct regmap *regmap,
423
432
clkmain -> hw .init = & init ;
424
433
clkmain -> regmap = regmap ;
425
434
426
- clk = clk_register (NULL , & clkmain -> hw );
427
- if (IS_ERR (clk ))
435
+ hw = & clkmain -> hw ;
436
+ ret = clk_hw_register (NULL , & clkmain -> hw );
437
+ if (ret ) {
428
438
kfree (clkmain );
439
+ hw = ERR_PTR (ret );
440
+ }
429
441
430
- return clk ;
442
+ return hw ;
431
443
}
432
444
433
445
static void __init of_at91rm9200_clk_main_setup (struct device_node * np )
434
446
{
435
- struct clk * clk ;
447
+ struct clk_hw * hw ;
436
448
const char * parent_name ;
437
449
const char * name = np -> name ;
438
450
struct regmap * regmap ;
@@ -444,11 +456,11 @@ static void __init of_at91rm9200_clk_main_setup(struct device_node *np)
444
456
if (IS_ERR (regmap ))
445
457
return ;
446
458
447
- clk = at91_clk_register_rm9200_main (regmap , name , parent_name );
448
- if (IS_ERR (clk ))
459
+ hw = at91_clk_register_rm9200_main (regmap , name , parent_name );
460
+ if (IS_ERR (hw ))
449
461
return ;
450
462
451
- of_clk_add_provider (np , of_clk_src_simple_get , clk );
463
+ of_clk_add_hw_provider (np , of_clk_hw_simple_get , hw );
452
464
}
453
465
CLK_OF_DECLARE (at91rm9200_clk_main , "atmel,at91rm9200-clk-main" ,
454
466
of_at91rm9200_clk_main_setup );
@@ -529,16 +541,17 @@ static const struct clk_ops sam9x5_main_ops = {
529
541
.get_parent = clk_sam9x5_main_get_parent ,
530
542
};
531
543
532
- static struct clk * __init
544
+ static struct clk_hw * __init
533
545
at91_clk_register_sam9x5_main (struct regmap * regmap ,
534
546
const char * name ,
535
547
const char * * parent_names ,
536
548
int num_parents )
537
549
{
538
550
struct clk_sam9x5_main * clkmain ;
539
- struct clk * clk = NULL ;
540
551
struct clk_init_data init ;
541
552
unsigned int status ;
553
+ struct clk_hw * hw ;
554
+ int ret ;
542
555
543
556
if (!name )
544
557
return ERR_PTR (- EINVAL );
@@ -561,16 +574,19 @@ at91_clk_register_sam9x5_main(struct regmap *regmap,
561
574
regmap_read (clkmain -> regmap , AT91_CKGR_MOR , & status );
562
575
clkmain -> parent = status & AT91_PMC_MOSCEN ? 1 : 0 ;
563
576
564
- clk = clk_register (NULL , & clkmain -> hw );
565
- if (IS_ERR (clk ))
577
+ hw = & clkmain -> hw ;
578
+ ret = clk_hw_register (NULL , & clkmain -> hw );
579
+ if (ret ) {
566
580
kfree (clkmain );
581
+ hw = ERR_PTR (ret );
582
+ }
567
583
568
- return clk ;
584
+ return hw ;
569
585
}
570
586
571
587
static void __init of_at91sam9x5_clk_main_setup (struct device_node * np )
572
588
{
573
- struct clk * clk ;
589
+ struct clk_hw * hw ;
574
590
const char * parent_names [2 ];
575
591
unsigned int num_parents ;
576
592
const char * name = np -> name ;
@@ -587,12 +603,12 @@ static void __init of_at91sam9x5_clk_main_setup(struct device_node *np)
587
603
588
604
of_property_read_string (np , "clock-output-names" , & name );
589
605
590
- clk = at91_clk_register_sam9x5_main (regmap , name , parent_names ,
606
+ hw = at91_clk_register_sam9x5_main (regmap , name , parent_names ,
591
607
num_parents );
592
- if (IS_ERR (clk ))
608
+ if (IS_ERR (hw ))
593
609
return ;
594
610
595
- of_clk_add_provider (np , of_clk_src_simple_get , clk );
611
+ of_clk_add_hw_provider (np , of_clk_hw_simple_get , hw );
596
612
}
597
613
CLK_OF_DECLARE (at91sam9x5_clk_main , "atmel,at91sam9x5-clk-main" ,
598
614
of_at91sam9x5_clk_main_setup );
0 commit comments