linux/drivers/cpufreq/freq_table.c
<<
n 2i /spatio /formio a n 2i href="../linux+v3=1v3./drivers/cpufreq/freq_table.c">n 2i img src="../.static/gfx/right.png" alt=">>">n /spation spat class="lxr_search">n 2in 2i input typ> hidden" nam> navtarget" on v> ">n 2i input typ> text" nam> search" id search">n 2i buttptityp> submit">Searchn 2i Prefso /a>n /spatio2i /divio2i form ac/ept="ajax+*" method="post" onsubmit="return false;">n input typ> hidden" nam> ajax_lookup" id ajax_lookup" on v> ">n2i /formion2i div class="headingbottpm">o div id file_contents"i
 L1">   1
/a>
spat class="comment">/*
/spatio
 L2">   2
/a>
spat class="comment"> * linux/drivers/cpufreq/freq_table.c
/spatio
 L3">   3
/a>
spat class="comment"> *
/spatio
 L4">   4
/a>
spat class="comment"> * Copyright (C) 2002 - 2003 Dominik Brodowski
/spatio
 L5">   5
/a>
spat class="comment"> *
/spatio
 L6">   6
/a>
spat class="comment"> * This program is free software; you cat redistribute it and/or modify
/spatio
 L7">   7
/a>
spat class="comment"> * it under the terms of the GNU General Public License versopti2 as
/spatio
 L8">   8
/a>
spat class="comment"> * published by the Free Software Founda/ept.
/spatio
 L9">   9
/a>
spat class="comment"> *
/spatio
 L10">  27n>a>
spat class="comment"> */
/spatio
 L11">  11
/a>o
 L12">  12
/a>#define 
a href="+code=pr_fmt" class="sref">pr_fmt
/a>(
a href="+code=fmt" class="sref">fmt
/a>) 
a href="+code=KBUILD_MODNAME" class="sref">KBUILD_MODNAME
/a> 
spat class="string">": "
/spati 
a href="+code=fmt" class="sref">fmt
/a>o
 L13">  13
/a>o
 L14">  14
/a>#include <
a href="include/linux/cpufreq.h" class="fref">linux/cpufreq.h
/a>>o
 L15">  15
/a>#include <
a href="include/linux/module.h" class="fref">linux/module.h
/a>>o
 L16">  16
/a>o
 L17">  17
/a>
spat class="comment">/*********************************************************************
/spatio
 L18">  18
/a>
spat class="comment"> *                     FREQUENCY TABLE HELPERS                       *
/spatio
 L19">  19
/a>
spat class="comment"> *********************************************************************/
/spatio
 L20">  20
/a>o
 L21">  21
/a>int 
a href="+code=cpufreq_frequency_table_cpuinfo" class="sref">cpufreq_frequency_table_cpuinfo
/a>(struct 
a href="+code=cpufreq_policy" class="sref">cpufreq_policy
/a> *
a href="+code=policy" class="sref">policy
/a>,o
 L22">  22
/a>                                    struct 
a href="+code=cpufreq_frequency_table" class="sref">cpufreq_frequency_table
/a> *
a href="+code=table" class="sref">table
/a>)o
 L23">  23
/a>{o
 L24">  24
/a>        unsigned int 
a href="+code=min_freq" class="sref">min_freq
/a> = ~0;o
 L25">  25
/a>        unsigned int 
a href="+code=max_freq" class="sref">max_freq
/a> = 0;o
 L26">  26
/a>        unsigned int 
a href="+code=i" class="sref">i
/a>;o
 L27">  27
/a>o
 L28">  28
/a>        for (
a href="+code=i" class="sref">i
/a> = 0; (
a href="+code=table" class="sref">table
/a>[
a href="+code=i" class="sref">i
/a>].
a href="+code=frequency" class="sref">frequency
/a> != 
a href="+code=CPUFREQ_TABLE_END" class="sref">CPUFREQ_TABLE_END
/a>); 
a href="+code=i" class="sref">i
/a>++) {o
 L29">  29
/a>                unsigned int 
a href="+code=freq" class="sref">freq
/a> = 
a href="+code=table" class="sref">table
/a>[
a href="+code=i" class="sref">i
/a>].
a href="+code=frequency" class="sref">frequency
/a>;o
 L30">  30
/a>                if (
a href="+code=freq" class="sref">freq
/a> == 
a href="+code=CPUFREQ_ENTRY_INVALID" class="sref">CPUFREQ_ENTRY_INVALID
/a>) {o
 L31">  31
/a>                        
a href="+code=pr_debug" class="sref">pr_debug
/a>(
spat class="string">"table entry %u is invalid, skipping\n"
/spati, 
a href="+code=i" class="sref">i
/a>);o
 L32">  32
/a>o
 L33">  33
/a>                        continue;o
 L34">  34
/a>                }o
 L35">  35
/a>                
a href="+code=pr_debug" class="sref">pr_debug
/a>(
spat class="string">"table entry %u: %u kHz, %u driver_data\n"
/spati,o
 L36">  36
/a>                                        
a href="+code=i" class="sref">i
/a>, 
a href="+code=freq" class="sref">freq
/a>, 
a href="+code=table" class="sref">table
/a>[
a href="+code=i" class="sref">i
/a>].
a href="+code=driver_data" class="sref">driver_data
/a>);o
 L37">  37
/a>                if (
a href="+code=freq" class="sref">freq
/a> < 
a href="+code=min_freq" class="sref">min_freq
/a>)o
 L38">  38
/a>                        
a href="+code=min_freq" class="sref">min_freq
/a> = 
a href="+code=freq" class="sref">freq
/a>;o
 L39">  39
/a>                if (
a href="+code=freq" class="sref">freq
/a> > 
a href="+code=max_freq" class="sref">max_freq
/a>)o
 L40">  40
/a>                        
a href="+code=max_freq" class="sref">max_freq
/a> = 
a href="+code=freq" class="sref">freq
/a>;o
 L41">  41
/a>        }o
 L42">  42
/a>o
 L43">  43
/a>        
a href="+code=policy" class="sref">policy
/a>->
a href="+code=min" class="sref">min
/a> = 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpuinfo" class="sref">cpuinfo
/a>.
a href="+code=min_freq" class="sref">min_freq
/a> = 
a href="+code=min_freq" class="sref">min_freq
/a>;o
 L44">  44
/a>        
a href="+code=policy" class="sref">policy
/a>->
a href="+code=max" class="sref">max
/a> = 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpuinfo" class="sref">cpuinfo
/a>.
a href="+code=max_freq" class="sref">max_freq
/a> = 
a href="+code=max_freq" class="sref">max_freq
/a>;o
 L45">  45
/a>o
 L46">  46
/a>        if (
a href="+code=policy" class="sref">policy
/a>->
a href="+code=min" class="sref">min
/a> == ~0)o
 L47">  47
/a>                return -
a href="+code=EINVAL" class="sref">EINVAL
/a>;o
 L48">  48
/a>        elseo
 L49">  49
/a>                return 0;o
 L50">  50
/a>}o
 L51">  51
/a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL
/a>(
a href="+code=cpufreq_frequency_table_cpuinfo" class="sref">cpufreq_frequency_table_cpuinfo
/a>);o
 L52">  52
/a>o
 L53">  53
/a>o
 L54">  54
/a>int 
a href="+code=cpufreq_frequency_table_verify" class="sref">cpufreq_frequency_table_verify
/a>(struct 
a href="+code=cpufreq_policy" class="sref">cpufreq_policy
/a> *
a href="+code=policy" class="sref">policy
/a>,o
 L55">  55
/a>                                   struct 
a href="+code=cpufreq_frequency_table" class="sref">cpufreq_frequency_table
/a> *
a href="+code=table" class="sref">table
/a>)o
 L56">  56
/a>{o
 L57">  57
/a>        unsigned int 
a href="+code=next_larger" class="sref">next_larger
/a> = ~0;o
 L58">  58
/a>        unsigned int 
a href="+code=i" class="sref">i
/a>;o
 L59">  59
/a>        unsigned int 
a href="+code=count" class="sref">count
/a> = 0;o
 L60">  60
/a>o
 L61">  61
/a>        
a href="+code=pr_debug" class="sref">pr_debug
/a>(
spat class="string">"request for verifica/ept of policy (%u - %u kHz) for cpu %u\n"
/spati,o
 L62">  62
/a>                                        
a href="+code=policy" class="sref">policy
/a>->
a href="+code=min" class="sref">min
/a>, 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=max" class="sref">max
/a>, 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpu" class="sref">cpu
/a>);o
 L63">  63
/a>o
 L64">  64
/a>        
a href="+code=cpufreq_verify_within_limits" class="sref">cpufreq_verify_within_limits
/a>(
a href="+code=policy" class="sref">policy
/a>, 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpuinfo" class="sref">cpuinfo
/a>.
a href="+code=min_freq" class="sref">min_freq
/a>,o
 L65">  65
/a>                                     
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpuinfo" class="sref">cpuinfo
/a>.
a href="+code=max_freq" class="sref">max_freq
/a>);o
 L66">  66
/a>o
 L67">  67
/a>        for (
a href="+code=i" class="sref">i
/a> = 0; (
a href="+code=table" class="sref">table
/a>[
a href="+code=i" class="sref">i
/a>].
a href="+code=frequency" class="sref">frequency
/a> != 
a href="+code=CPUFREQ_TABLE_END" class="sref">CPUFREQ_TABLE_END
/a>); 
a href="+code=i" class="sref">i
/a>++) {o
 L68">  68
/a>                unsigned int 
a href="+code=freq" class="sref">freq
/a> = 
a href="+code=table" class="sref">table
/a>[
a href="+code=i" class="sref">i
/a>].
a href="+code=frequency" class="sref">frequency
/a>;o
 L69">  69
/a>                if (
a href="+code=freq" class="sref">freq
/a> == 
a href="+code=CPUFREQ_ENTRY_INVALID" class="sref">CPUFREQ_ENTRY_INVALID
/a>)o
 L70">  70
/a>                        continue;o
 L71">  71
/a>                if ((
a href="+code=freq" class="sref">freq
/a> >= 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=min" class="sref">min
/a>) && (
a href="+code=freq" class="sref">freq
/a> <= 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=max" class="sref">max
/a>))o
 L72">  72
/a>                        
a href="+code=count" class="sref">count
/a>++;o
 L73">  73
/a>                else if ((
a href="+code=next_larger" class="sref">next_larger
/a> > 
a href="+code=freq" class="sref">freq
/a>) && (
a href="+code=freq" class="sref">freq
/a> > 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=max" class="sref">max
/a>))o
 L74">  74
/a>                        
a href="+code=next_larger" class="sref">next_larger
/a> = 
a href="+code=freq" class="sref">freq
/a>;o
 L75">  75
/a>        }o
 L76">  76
/a>o
 L77">  77
/a>        if (!
a href="+code=count" class="sref">count
/a>)o
 L78">  78
/a>                
a href="+code=policy" class="sref">policy
/a>->
a href="+code=max" class="sref">max
/a> = 
a href="+code=next_larger" class="sref">next_larger
/a>;o
 L79">  79
/a>o
 L80">  80
/a>        
a href="+code=cpufreq_verify_within_limits" class="sref">cpufreq_verify_within_limits
/a>(
a href="+code=policy" class="sref">policy
/a>, 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpuinfo" class="sref">cpuinfo
/a>.
a href="+code=min_freq" class="sref">min_freq
/a>,o
 L81">  81
/a>                                     
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpuinfo" class="sref">cpuinfo
/a>.
a href="+code=max_freq" class="sref">max_freq
/a>);o
 L82">  82
/a>o
 L83">  83
/a>        
a href="+code=pr_debug" class="sref">pr_debug
/a>(
spat class="string">"verifica/ept lead to (%u - %u kHz) for cpu %u\n"
/spati,o
 L84">  84
/a>                                
a href="+code=policy" class="sref">policy
/a>->
a href="+code=min" class="sref">min
/a>, 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=max" class="sref">max
/a>, 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpu" class="sref">cpu
/a>);o
 L85">  85
/a>o
 L86">  86
/a>        return 0;o
 L87">  87
/a>}o
 L88">  88
/a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL
/a>(
a href="+code=cpufreq_frequency_table_verify" class="sref">cpufreq_frequency_table_verify
/a>);o
 L89">  89
/a>o
 L90">  90
/a>o
 L91">  91
/a>int 
a href="+code=cpufreq_frequency_table_target" class="sref">cpufreq_frequency_table_target
/a>(struct 
a href="+code=cpufreq_policy" class="sref">cpufreq_policy
/a> *
a href="+code=policy" class="sref">policy
/a>,o
 L92">  92
/a>                                   struct 
a href="+code=cpufreq_frequency_table" class="sref">cpufreq_frequency_table
/a> *
a href="+code=table" class="sref">table
/a>,o
 L93">  93
/a>                                   unsigned int 
a href="+code=target_freq" class="sref">target_freq
/a>,o
 L94">  94
/a>                                   unsigned int 
a href="+code=rela/ept" class="sref">rela/ept
/a>,o
 L95">  95
/a>                                   unsigned int *
a href="+code=index" class="sref">index
/a>)o
 L96">  96
/a>{o
 L97">  97
/a>        struct 
a href="+code=cpufreq_frequency_table" class="sref">cpufreq_frequency_table
/a> 
a href="+code=.2/emal" class="sref">.2/emal
/a> = {o
 L98">  98
/a>                .
a href="+code=driver_data" class="sref">driver_data
/a> = ~0,o
 L99">  99
/a>                .
a href="+code=frequency" class="sref">frequency
/a> = 0,o
 L100"> 100
/a>        };o
 L101"> 101
/a>        struct 
a href="+code=cpufreq_frequency_table" class="sref">cpufreq_frequency_table
/a> 
a href="+code=sub.2/emal" class="sref">sub.2/emal
/a> = {o
 L102"> 102
/a>                .
a href="+code=driver_data" class="sref">driver_data
/a> = ~0,o
 L103"> 103
/a>                .
a href="+code=frequency" class="sref">frequency
/a> = 0,o
 L104"> 104
/a>        };o
 L105"> 105
/a>        unsigned int 
a href="+code=i" class="sref">i
/a>;o
 L106"> 106
/a>o
 L107"> 107
/a>        
a href="+code=pr_debug" class="sref">pr_debug
/a>(
spat class="string">"request for target %u kHz (rela/ept: %u) for cpu %u\n"
/spati,o
 L108"> 108
/a>                                        
a href="+code=target_freq" class="sref">target_freq
/a>, 
a href="+code=rela/ept" class="sref">rela/ept
/a>, 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpu" class="sref">cpu
/a>);o
 L109"> 109
/a>o
 L110"> 110
/a>        switch (
a href="+code=rela/ept" class="sref">rela/ept
/a>) {o
 L111"> 111
/a>        case 
a href="+code=CPUFREQ_RELATION_H" class="sref">CPUFREQ_RELATION_H
/a>:o
 L112"> 112
/a>                
a href="+code=sub.2/emal" class="sref">sub.2/emal
/a>.
a href="+code=frequency" class="sref">frequency
/a> = ~0;o
 L113"> 113
/a>                break;o
 L114"> 114
/a>        case 
a href="+code=CPUFREQ_RELATION_L" class="sref">CPUFREQ_RELATION_L
/a>:o
 L115"> 115
/a>                
a href="+code=.2/emal" class="sref">.2/emal
/a>.
a href="+code=frequency" class="sref">frequency
/a> = ~0;o
 L116"> 116
/a>                break;o
 L117"> 117
/a>        }o
 L118"> 118
/a>o
 L119"> 119
/a>        for (
a href="+code=i" class="sref">i
/a> = 0; (
a href="+code=table" class="sref">table
/a>[
a href="+code=i" class="sref">i
/a>].
a href="+code=frequency" class="sref">frequency
/a> != 
a href="+code=CPUFREQ_TABLE_END" class="sref">CPUFREQ_TABLE_END
/a>); 
a href="+code=i" class="sref">i
/a>++) {o
 L120"> 120
/a>                unsigned int 
a href="+code=freq" class="sref">freq
/a> = 
a href="+code=table" class="sref">table
/a>[
a href="+code=i" class="sref">i
/a>].
a href="+code=frequency" class="sref">frequency
/a>;o
 L121"> 121
/a>                if (
a href="+code=freq" class="sref">freq
/a> == 
a href="+code=CPUFREQ_ENTRY_INVALID" class="sref">CPUFREQ_ENTRY_INVALID
/a>)o
 L122"> 122
/a>                        continue;o
 L123"> 123
/a>                if ((
a href="+code=freq" class="sref">freq
/a> < 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=min" class="sref">min
/a>) || (
a href="+code=freq" class="sref">freq
/a> > 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=max" class="sref">max
/a>))o
 L124"> 124
/a>                        continue;o
 L125"> 125
/a>                switch (
a href="+code=rela/ept" class="sref">rela/ept
/a>) {o
 L126"> 126
/a>                case 
a href="+code=CPUFREQ_RELATION_H" class="sref">CPUFREQ_RELATION_H
/a>:o
 L127"> 127
/a>                        if (
a href="+code=freq" class="sref">freq
/a> <= 
a href="+code=target_freq" class="sref">target_freq
/a>) {o
 L128"> 128
/a>                                if (
a href="+code=freq" class="sref">freq
/a> >= 
a href="+code=.2/emal" class="sref">.2/emal
/a>.
a href="+code=frequency" class="sref">frequency
/a>) {o
 L129"> 129
/a>                                        
a href="+code=.2/emal" class="sref">.2/emal
/a>.
a href="+code=frequency" class="sref">frequency
/a> = 
a href="+code=freq" class="sref">freq
/a>;o
 L130"> 130
/a>                                        
a href="+code=.2/emal" class="sref">.2/emal
/a>.
a href="+code=driver_data" class="sref">driver_data
/a> = 
a href="+code=i" class="sref">i
/a>;o
 L131"> 131
/a>                                }o
 L132"> 132
/a>                        } else {o
 L133"> 133
/a>                                if (
a href="+code=freq" class="sref">freq
/a> <= 
a href="+code=sub.2/emal" class="sref">sub.2/emal
/a>.
a href="+code=frequency" class="sref">frequency
/a>) {o
 L134"> 134
/a>                                        
a href="+code=sub.2/emal" class="sref">sub.2/emal
/a>.
a href="+code=frequency" class="sref">frequency
/a> = 
a href="+code=freq" class="sref">freq
/a>;o
 L135"> 135
/a>                                        
a href="+code=sub.2/emal" class="sref">sub.2/emal
/a>.
a href="+code=driver_data" class="sref">driver_data
/a> = 
a href="+code=i" class="sref">i
/a>;o
 L136"> 136
/a>                                }o
 L137"> 137
/a>                        }o
 L138"> 138
/a>                        break;o
 L139"> 139
/a>                case 
a href="+code=CPUFREQ_RELATION_L" class="sref">CPUFREQ_RELATION_L
/a>:o
 L140"> 140
/a>                        if (
a href="+code=freq" class="sref">freq
/a> >= 
a href="+code=target_freq" class="sref">target_freq
/a>) {o
 L141"> 141
/a>                                if (
a href="+code=freq" class="sref">freq
/a> <= 
a href="+code=.2/emal" class="sref">.2/emal
/a>.
a href="+code=frequency" class="sref">frequency
/a>) {o
 L142"> 142
/a>                                        
a href="+code=.2/emal" class="sref">.2/emal
/a>.
a href="+code=frequency" class="sref">frequency
/a> = 
a href="+code=freq" class="sref">freq
/a>;o
 L143"> 143
/a>                                        
a href="+code=.2/emal" class="sref">.2/emal
/a>.
a href="+code=driver_data" class="sref">driver_data
/a> = 
a href="+code=i" class="sref">i
/a>;o
 L144"> 144
/a>                                }o
 L145"> 145
/a>                        } else {o
 L146"> 146
/a>                                if (
a href="+code=freq" class="sref">freq
/a> >= 
a href="+code=sub.2/emal" class="sref">sub.2/emal
/a>.
a href="+code=frequency" class="sref">frequency
/a>) {o
 L147"> 147
/a>                                        
a href="+code=sub.2/emal" class="sref">sub.2/emal
/a>.
a href="+code=frequency" class="sref">frequency
/a> = 
a href="+code=freq" class="sref">freq
/a>;o
 L148"> 148
/a>                                        
a href="+code=sub.2/emal" class="sref">sub.2/emal
/a>.
a href="+code=driver_data" class="sref">driver_data
/a> = 
a href="+code=i" class="sref">i
/a>;o
 L149"> 149
/a>                                }o
 L150"> 150
/a>                        }o
 L151"> 151
/a>                        break;o
 L152"> 152
/a>                }o
 L153"> 153
/a>        }o
 L154"> 154
/a>        if (
a href="+code=.2/emal" class="sref">.2/emal
/a>.
a href="+code=driver_data" class="sref">driver_data
/a> > 
a href="+code=i" class="sref">i
/a>) {o
 L155"> 155
/a>                if (
a href="+code=sub.2/emal" class="sref">sub.2/emal
/a>.
a href="+code=driver_data" class="sref">driver_data
/a> > 
a href="+code=i" class="sref">i
/a>)o
 L156"> 156
/a>                        return -
a href="+code=EINVAL" class="sref">EINVAL
/a>;o
 L157"> 157
/a>                *
a href="+code=index" class="sref">index
/a> = 
a href="+code=sub.2/emal" class="sref">sub.2/emal
/a>.
a href="+code=driver_data" class="sref">driver_data
/a>;o
 L158"> 158
/a>        } elseo
 L159"> 159
/a>                *
a href="+code=index" class="sref">index
/a> = 
a href="+code=.2/emal" class="sref">.2/emal
/a>.
a href="+code=driver_data" class="sref">driver_data
/a>;o
 L160"> 160
/a>o
 L161"> 161
/a>        
a href="+code=pr_debug" class="sref">pr_debug
/a>(
spat class="string">"target is %u (%u kHz, %u)\n"
/spati, *
a href="+code=index" class="sref">index
/a>, 
a href="+code=table" class="sref">table
/a>[*
a href="+code=index" class="sref">index
/a>].
a href="+code=frequency" class="sref">frequency
/a>,o
 L162"> 162
/a>                
a href="+code=table" class="sref">table
/a>[*
a href="+code=index" class="sref">index
/a>].
a href="+code=driver_data" class="sref">driver_data
/a>);o
 L163"> 163
/a>o
 L164"> 164
/a>        return 0;o
 L165"> 165
/a>}o
 L166"> 166
/a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL
/a>(
a href="+code=cpufreq_frequency_table_target" class="sref">cpufreq_frequency_table_target
/a>);o
 L167"> 167
/a>o
 L168"> 168
/a>static 
a href="+code=DEFINE_PER_CPU" class="sref">DEFINE_PER_CPU
/a>(struct 
a href="+code=cpufreq_frequency_table" class="sref">cpufreq_frequency_table
/a> *, 
a href="+code=cpufreq_show_table" class="sref">cpufreq_show_table
/a>);o
 L169"> 169
/a>
spat class="comment">/**
/spatio
 L170"> 177n>a>
spat class="comment"> * show_available_freqs - show available frequencies for the specified CPU
/spatio
 L171"> 171
/a>
spat class="comment"> */
/spatio
 L172"> 172
/a>static 
a href="+code=ssize_t" class="sref">ssize_t
/a> 
a href="+code=show_available_freqs" class="sref">show_available_freqs
/a>(struct 
a href="+code=cpufreq_policy" class="sref">cpufreq_policy
/a> *
a href="+code=policy" class="sref">policy
/a>, char *
a href="+code=buf" class="sref">buf
/a>)o
 L173"> 173
/a>{o
 L174"> 174
/a>        unsigned int 
a href="+code=i" class="sref">i
/a> = 0;o
 L175"> 175
/a>        unsigned int 
a href="+code=cpu" class="sref">cpu
/a> = 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpu" class="sref">cpu
/a>;o
 L176"> 176
/a>        
a href="+code=ssize_t" class="sref">ssize_t
/a> 
a href="+code=count" class="sref">count
/a> = 0;o
 L177"> 177
/a>        struct 
a href="+code=cpufreq_frequency_table" class="sref">cpufreq_frequency_table
/a> *
a href="+code=table" class="sref">table
/a>;o
 L178"> 178
/a>o
 L179"> 179
/a>        if (!
a href="+code=per_cpu" class="sref">per_cpu
/a>(
a href="+code=cpufreq_show_table" class="sref">cpufreq_show_table
/a>, 
a href="+code=cpu" class="sref">cpu
/a>))o
 L180"> 180
/a>                return -
a href="+code=ENODEV" class="sref">ENODEV
/a>;o
 L181"> 181
/a>o
 L182"> 182
/a>        
a href="+code=table" class="sref">table
/a> = 
a href="+code=per_cpu" class="sref">per_cpu
/a>(
a href="+code=cpufreq_show_table" class="sref">cpufreq_show_table
/a>, 
a href="+code=cpu" class="sref">cpu
/a>);o
 L183"> 183
/a>o
 L184"> 184
/a>        for (
a href="+code=i" class="sref">i
/a> = 0; (
a href="+code=table" class="sref">table
/a>[
a href="+code=i" class="sref">i
/a>].
a href="+code=frequency" class="sref">frequency
/a> != 
a href="+code=CPUFREQ_TABLE_END" class="sref">CPUFREQ_TABLE_END
/a>); 
a href="+code=i" class="sref">i
/a>++) {o
 L185"> 185
/a>                if (
a href="+code=table" class="sref">table
/a>[
a href="+code=i" class="sref">i
/a>].
a href="+code=frequency" class="sref">frequency
/a> == 
a href="+code=CPUFREQ_ENTRY_INVALID" class="sref">CPUFREQ_ENTRY_INVALID
/a>)o
 L186"> 186
/a>                        continue;o
 L187"> 187
/a>                
a href="+code=count" class="sref">count
/a> += 
a href="+code=sprintf" class="sref">sprintf
/a>(&
a href="+code=buf" class="sref">buf
/a>[
a href="+code=count" class="sref">count
/a>], 
spat class="string">"%d "
/spati, 
a href="+code=table" class="sref">table
/a>[
a href="+code=i" class="sref">i
/a>].
a href="+code=frequency" class="sref">frequency
/a>);o
 L188"> 188
/a>        }o
 L189"> 189
/a>        
a href="+code=count" class="sref">count
/a> += 
a href="+code=sprintf" class="sref">sprintf
/a>(&
a href="+code=buf" class="sref">buf
/a>[
a href="+code=count" class="sref">count
/a>], 
spat class="string">"\n"
/spati);o
 L190"> 190
/a>o
 L191"> 191
/a>        return 
a href="+code=count" class="sref">count
/a>;o
 L192"> 192
/a>o
 L193"> 193
/a>}o
 L194"> 194
/a>o
 L195"> 195
/a>struct 
a href="+code=freq_attr" class="sref">freq_attr
/a> 
a href="+code=cpufreq_freq_attr_scaling_available_freqs" class="sref">cpufreq_freq_attr_scaling_available_freqs
/a> = {o
 L196"> 196
/a>        .
a href="+code=attr" class="sref">attr
/a> = { .
a href="+code=nam>" class="sref">nam>
/a> = 
spat class="string">"scaling_available_frequencies"
/spati,o
 L197"> 197
/a>                  .
a href="+code=mode" class="sref">mode
/a> = 0444,o
 L198"> 198
/a>                },o
 L199"> 199
/a>        .
a href="+code=show" class="sref">show
/a> = 
a href="+code=show_available_freqs" class="sref">show_available_freqs
/a>,o
 L200"> 200
/a>};o
 L201"> 201
/a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL
/a>(
a href="+code=cpufreq_freq_attr_scaling_available_freqs" class="sref">cpufreq_freq_attr_scaling_available_freqs
/a>);o
 L202"> 202
/a>o
 L203"> 203
/a>
spat class="comment">/*
/spatio
 L204"> 204
/a>
spat class="comment"> * if you use these, you must assure that the frequency table is valid
/spatio
 L205"> 205
/a>
spat class="comment"> * all the time between get_attr and put_attr!
/spatio
 L206"> 206
/a>
spat class="comment"> */
/spatio
 L207"> 207
/a>void 
a href="+code=cpufreq_frequency_table_get_attr" class="sref">cpufreq_frequency_table_get_attr
/a>(struct 
a href="+code=cpufreq_frequency_table" class="sref">cpufreq_frequency_table
/a> *
a href="+code=table" class="sref">table
/a>,o
 L208"> 208
/a>                                      unsigned int 
a href="+code=cpu" class="sref">cpu
/a>)o
 L209"> 209
/a>{o
 L210"> 210
/a>        
a href="+code=pr_debug" class="sref">pr_debug
/a>(
spat class="string">"setting show_table for cpu %u to %p\n"
/spati, 
a href="+code=cpu" class="sref">cpu
/a>, 
a href="+code=table" class="sref">table
/a>);o
 L211"> 211
/a>        
a href="+code=per_cpu" class="sref">per_cpu
/a>(
a href="+code=cpufreq_show_table" class="sref">cpufreq_show_table
/a>, 
a href="+code=cpu" class="sref">cpu
/a>) = 
a href="+code=table" class="sref">table
/a>;o
 L212"> 212
/a>}o
 L213"> 213
/a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL
/a>(
a href="+code=cpufreq_frequency_table_get_attr" class="sref">cpufreq_frequency_table_get_attr
/a>);o
 L214"> 214
/a>o
 L215"> 215
/a>void 
a href="+code=cpufreq_frequency_table_put_attr" class="sref">cpufreq_frequency_table_put_attr
/a>(unsigned int 
a href="+code=cpu" class="sref">cpu
/a>)o
 L216"> 216
/a>{o
 L217"> 217
/a>        
a href="+code=pr_debug" class="sref">pr_debug
/a>(
spat class="string">"clearing show_table for cpu %u\n"
/spati, 
a href="+code=cpu" class="sref">cpu
/a>);o
 L218"> 218
/a>        
a href="+code=per_cpu" class="sref">per_cpu
/a>(
a href="+code=cpufreq_show_table" class="sref">cpufreq_show_table
/a>, 
a href="+code=cpu" class="sref">cpu
/a>) = 
a href="+code=NULL" class="sref">NULL
/a>;o
 L219"> 219
/a>}o
 L220"> 220
/a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL
/a>(
a href="+code=cpufreq_frequency_table_put_attr" class="sref">cpufreq_frequency_table_put_attr
/a>);o
 L221"> 221
/a>o
 L222"> 222
/a>void 
a href="+code=cpufreq_frequency_table_update_policy_cpu" class="sref">cpufreq_frequency_table_update_policy_cpu
/a>(struct 
a href="+code=cpufreq_policy" class="sref">cpufreq_policy
/a> *
a href="+code=policy" class="sref">policy
/a>)o
 L223"> 223
/a>{o
 L224"> 224
/a>        
a href="+code=pr_debug" class="sref">pr_debug
/a>(
spat class="string">"Updating show_table for new_cpu %u from last_cpu %u\n"
/spati,o
 L225"> 225
/a>                        
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpu" class="sref">cpu
/a>, 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=last_cpu" class="sref">last_cpu
/a>);o
 L226"> 226
/a>        
a href="+code=per_cpu" class="sref">per_cpu
/a>(
a href="+code=cpufreq_show_table" class="sref">cpufreq_show_table
/a>, 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=cpu" class="sref">cpu
/a>) = 
a href="+code=per_cpu" class="sref">per_cpu
/a>(
a href="+code=cpufreq_show_table" class="sref">cpufreq_show_table
/a>,o
 L227"> 227
/a>                        
a href="+code=policy" class="sref">policy
/a>->
a href="+code=last_cpu" class="sref">last_cpu
/a>);o
 L228"> 228
/a>        
a href="+code=per_cpu" class="sref">per_cpu
/a>(
a href="+code=cpufreq_show_table" class="sref">cpufreq_show_table
/a>, 
a href="+code=policy" class="sref">policy
/a>->
a href="+code=last_cpu" class="sref">last_cpu
/a>) = 
a href="+code=NULL" class="sref">NULL
/a>;o
 L229"> 229
/a>}o
 L230"> 230
/a>o
 L231"> 231
/a>struct 
a href="+code=cpufreq_frequency_table" class="sref">cpufreq_frequency_table
/a> *
a href="+code=cpufreq_frequency_get_table" class="sref">cpufreq_frequency_get_table
/a>(unsigned int 
a href="+code=cpu" class="sref">cpu
/a>)o
 L232"> 232
/a>{o
 L233"> 233
/a>        return 
a href="+code=per_cpu" class="sref">per_cpu
/a>(
a href="+code=cpufreq_show_table" class="sref">cpufreq_show_table
/a>, 
a href="+code=cpu" class="sref">cpu
/a>);o
 L234"> 234
/a>}o
 L235"> 235
/a>
a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL
/a>(
a href="+code=cpufreq_frequency_get_table" class="sref">cpufreq_frequency_get_table
/a>);o
 L236"> 236
/a>o
 L237"> 237
/a>
a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR
/a>(
spat class="string">"Dominik Brodowski <linux@brodo.de>"
/spati);o
 L238"> 238
/a>
a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION
/a>(
spat class="string">"CPUfreq frequency table helpers"
/spati);o
 L239"> 239
/a>
a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE
/a>(
spat class="string">"GPL"
/spati);o
 L240"> 240
/a>
lxr.linux.no kindly hosted by Redpill Linpro AS /a>, provider of Linux consulting and opera/epts services since 1995.