@@ -456,103 +456,6 @@ struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
456
456
}
457
457
EXPORT_SYMBOL_GPL (dev_pm_opp_find_freq_exact );
458
458
459
- /**
460
- * dev_pm_opp_find_level_exact() - search for an exact level
461
- * @dev: device for which we do this operation
462
- * @level: level to search for
463
- *
464
- * Return: Searches for exact match in the opp table and returns pointer to the
465
- * matching opp if found, else returns ERR_PTR in case of error and should
466
- * be handled using IS_ERR. Error return values can be:
467
- * EINVAL: for bad pointer
468
- * ERANGE: no match found for search
469
- * ENODEV: if device not found in list of registered devices
470
- *
471
- * The callers are required to call dev_pm_opp_put() for the returned OPP after
472
- * use.
473
- */
474
- struct dev_pm_opp * dev_pm_opp_find_level_exact (struct device * dev ,
475
- unsigned int level )
476
- {
477
- struct opp_table * opp_table ;
478
- struct dev_pm_opp * temp_opp , * opp = ERR_PTR (- ERANGE );
479
-
480
- opp_table = _find_opp_table (dev );
481
- if (IS_ERR (opp_table )) {
482
- int r = PTR_ERR (opp_table );
483
-
484
- dev_err (dev , "%s: OPP table not found (%d)\n" , __func__ , r );
485
- return ERR_PTR (r );
486
- }
487
-
488
- mutex_lock (& opp_table -> lock );
489
-
490
- list_for_each_entry (temp_opp , & opp_table -> opp_list , node ) {
491
- if (temp_opp -> level == level ) {
492
- opp = temp_opp ;
493
-
494
- /* Increment the reference count of OPP */
495
- dev_pm_opp_get (opp );
496
- break ;
497
- }
498
- }
499
-
500
- mutex_unlock (& opp_table -> lock );
501
- dev_pm_opp_put_opp_table (opp_table );
502
-
503
- return opp ;
504
- }
505
- EXPORT_SYMBOL_GPL (dev_pm_opp_find_level_exact );
506
-
507
- /**
508
- * dev_pm_opp_find_level_ceil() - search for an rounded up level
509
- * @dev: device for which we do this operation
510
- * @level: level to search for
511
- *
512
- * Return: Searches for rounded up match in the opp table and returns pointer
513
- * to the matching opp if found, else returns ERR_PTR in case of error and
514
- * should be handled using IS_ERR. Error return values can be:
515
- * EINVAL: for bad pointer
516
- * ERANGE: no match found for search
517
- * ENODEV: if device not found in list of registered devices
518
- *
519
- * The callers are required to call dev_pm_opp_put() for the returned OPP after
520
- * use.
521
- */
522
- struct dev_pm_opp * dev_pm_opp_find_level_ceil (struct device * dev ,
523
- unsigned int * level )
524
- {
525
- struct opp_table * opp_table ;
526
- struct dev_pm_opp * temp_opp , * opp = ERR_PTR (- ERANGE );
527
-
528
- opp_table = _find_opp_table (dev );
529
- if (IS_ERR (opp_table )) {
530
- int r = PTR_ERR (opp_table );
531
-
532
- dev_err (dev , "%s: OPP table not found (%d)\n" , __func__ , r );
533
- return ERR_PTR (r );
534
- }
535
-
536
- mutex_lock (& opp_table -> lock );
537
-
538
- list_for_each_entry (temp_opp , & opp_table -> opp_list , node ) {
539
- if (temp_opp -> available && temp_opp -> level >= * level ) {
540
- opp = temp_opp ;
541
- * level = opp -> level ;
542
-
543
- /* Increment the reference count of OPP */
544
- dev_pm_opp_get (opp );
545
- break ;
546
- }
547
- }
548
-
549
- mutex_unlock (& opp_table -> lock );
550
- dev_pm_opp_put_opp_table (opp_table );
551
-
552
- return opp ;
553
- }
554
- EXPORT_SYMBOL_GPL (dev_pm_opp_find_level_ceil );
555
-
556
459
static noinline struct dev_pm_opp * _find_freq_ceil (struct opp_table * opp_table ,
557
460
unsigned long * freq )
558
461
{
@@ -729,6 +632,103 @@ struct dev_pm_opp *dev_pm_opp_find_freq_ceil_by_volt(struct device *dev,
729
632
}
730
633
EXPORT_SYMBOL_GPL (dev_pm_opp_find_freq_ceil_by_volt );
731
634
635
+ /**
636
+ * dev_pm_opp_find_level_exact() - search for an exact level
637
+ * @dev: device for which we do this operation
638
+ * @level: level to search for
639
+ *
640
+ * Return: Searches for exact match in the opp table and returns pointer to the
641
+ * matching opp if found, else returns ERR_PTR in case of error and should
642
+ * be handled using IS_ERR. Error return values can be:
643
+ * EINVAL: for bad pointer
644
+ * ERANGE: no match found for search
645
+ * ENODEV: if device not found in list of registered devices
646
+ *
647
+ * The callers are required to call dev_pm_opp_put() for the returned OPP after
648
+ * use.
649
+ */
650
+ struct dev_pm_opp * dev_pm_opp_find_level_exact (struct device * dev ,
651
+ unsigned int level )
652
+ {
653
+ struct opp_table * opp_table ;
654
+ struct dev_pm_opp * temp_opp , * opp = ERR_PTR (- ERANGE );
655
+
656
+ opp_table = _find_opp_table (dev );
657
+ if (IS_ERR (opp_table )) {
658
+ int r = PTR_ERR (opp_table );
659
+
660
+ dev_err (dev , "%s: OPP table not found (%d)\n" , __func__ , r );
661
+ return ERR_PTR (r );
662
+ }
663
+
664
+ mutex_lock (& opp_table -> lock );
665
+
666
+ list_for_each_entry (temp_opp , & opp_table -> opp_list , node ) {
667
+ if (temp_opp -> level == level ) {
668
+ opp = temp_opp ;
669
+
670
+ /* Increment the reference count of OPP */
671
+ dev_pm_opp_get (opp );
672
+ break ;
673
+ }
674
+ }
675
+
676
+ mutex_unlock (& opp_table -> lock );
677
+ dev_pm_opp_put_opp_table (opp_table );
678
+
679
+ return opp ;
680
+ }
681
+ EXPORT_SYMBOL_GPL (dev_pm_opp_find_level_exact );
682
+
683
+ /**
684
+ * dev_pm_opp_find_level_ceil() - search for an rounded up level
685
+ * @dev: device for which we do this operation
686
+ * @level: level to search for
687
+ *
688
+ * Return: Searches for rounded up match in the opp table and returns pointer
689
+ * to the matching opp if found, else returns ERR_PTR in case of error and
690
+ * should be handled using IS_ERR. Error return values can be:
691
+ * EINVAL: for bad pointer
692
+ * ERANGE: no match found for search
693
+ * ENODEV: if device not found in list of registered devices
694
+ *
695
+ * The callers are required to call dev_pm_opp_put() for the returned OPP after
696
+ * use.
697
+ */
698
+ struct dev_pm_opp * dev_pm_opp_find_level_ceil (struct device * dev ,
699
+ unsigned int * level )
700
+ {
701
+ struct opp_table * opp_table ;
702
+ struct dev_pm_opp * temp_opp , * opp = ERR_PTR (- ERANGE );
703
+
704
+ opp_table = _find_opp_table (dev );
705
+ if (IS_ERR (opp_table )) {
706
+ int r = PTR_ERR (opp_table );
707
+
708
+ dev_err (dev , "%s: OPP table not found (%d)\n" , __func__ , r );
709
+ return ERR_PTR (r );
710
+ }
711
+
712
+ mutex_lock (& opp_table -> lock );
713
+
714
+ list_for_each_entry (temp_opp , & opp_table -> opp_list , node ) {
715
+ if (temp_opp -> available && temp_opp -> level >= * level ) {
716
+ opp = temp_opp ;
717
+ * level = opp -> level ;
718
+
719
+ /* Increment the reference count of OPP */
720
+ dev_pm_opp_get (opp );
721
+ break ;
722
+ }
723
+ }
724
+
725
+ mutex_unlock (& opp_table -> lock );
726
+ dev_pm_opp_put_opp_table (opp_table );
727
+
728
+ return opp ;
729
+ }
730
+ EXPORT_SYMBOL_GPL (dev_pm_opp_find_level_ceil );
731
+
732
732
/**
733
733
* dev_pm_opp_find_bw_ceil() - Search for a rounded ceil bandwidth
734
734
* @dev: device for which we do this operation
0 commit comments