Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
95dd7227
Commit
95dd7227
authored
Oct 18, 2006
by
Dave Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CPUFREQ] acpi-cpufreq: Fix up some CodingStyle nits leftover from the lindenting.
Signed-off-by:
Dave Jones
<
davej@redhat.com
>
parent
0a1230ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
41 deletions
+34
-41
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+34
-41
No files found.
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
View file @
95dd7227
...
@@ -92,7 +92,7 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
...
@@ -92,7 +92,7 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
perf
=
data
->
acpi_data
;
perf
=
data
->
acpi_data
;
for
(
i
=
0
;
i
<
perf
->
state_count
;
i
++
)
{
for
(
i
=
0
;
i
<
perf
->
state_count
;
i
++
)
{
if
(
value
==
perf
->
states
[
i
].
status
)
if
(
value
==
perf
->
states
[
i
].
status
)
return
data
->
freq_table
[
i
].
frequency
;
return
data
->
freq_table
[
i
].
frequency
;
}
}
...
@@ -107,7 +107,7 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
...
@@ -107,7 +107,7 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
msr
&=
INTEL_MSR_RANGE
;
msr
&=
INTEL_MSR_RANGE
;
perf
=
data
->
acpi_data
;
perf
=
data
->
acpi_data
;
for
(
i
=
0
;
data
->
freq_table
[
i
].
frequency
!=
CPUFREQ_TABLE_END
;
i
++
)
{
for
(
i
=
0
;
data
->
freq_table
[
i
].
frequency
!=
CPUFREQ_TABLE_END
;
i
++
)
{
if
(
msr
==
perf
->
states
[
data
->
freq_table
[
i
].
index
].
status
)
if
(
msr
==
perf
->
states
[
data
->
freq_table
[
i
].
index
].
status
)
return
data
->
freq_table
[
i
].
frequency
;
return
data
->
freq_table
[
i
].
frequency
;
}
}
...
@@ -128,25 +128,23 @@ static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data)
...
@@ -128,25 +128,23 @@ static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data)
static
void
wrport
(
u16
port
,
u8
bit_width
,
u32
value
)
static
void
wrport
(
u16
port
,
u8
bit_width
,
u32
value
)
{
{
if
(
bit_width
<=
8
)
{
if
(
bit_width
<=
8
)
outb
(
value
,
port
);
outb
(
value
,
port
);
}
else
if
(
bit_width
<=
16
)
{
else
if
(
bit_width
<=
16
)
outw
(
value
,
port
);
outw
(
value
,
port
);
}
else
if
(
bit_width
<=
32
)
{
else
if
(
bit_width
<=
32
)
outl
(
value
,
port
);
outl
(
value
,
port
);
}
}
}
static
void
rdport
(
u16
port
,
u8
bit_width
,
u32
*
ret
)
static
void
rdport
(
u16
port
,
u8
bit_width
,
u32
*
ret
)
{
{
*
ret
=
0
;
*
ret
=
0
;
if
(
bit_width
<=
8
)
{
if
(
bit_width
<=
8
)
*
ret
=
inb
(
port
);
*
ret
=
inb
(
port
);
}
else
if
(
bit_width
<=
16
)
{
else
if
(
bit_width
<=
16
)
*
ret
=
inw
(
port
);
*
ret
=
inw
(
port
);
}
else
if
(
bit_width
<=
32
)
{
else
if
(
bit_width
<=
32
)
*
ret
=
inl
(
port
);
*
ret
=
inl
(
port
);
}
}
}
struct
msr_addr
{
struct
msr_addr
{
...
@@ -202,7 +200,7 @@ static void do_drv_write(struct drv_cmd *cmd)
...
@@ -202,7 +200,7 @@ static void do_drv_write(struct drv_cmd *cmd)
}
}
}
}
static
inline
void
drv_read
(
struct
drv_cmd
*
cmd
)
static
void
drv_read
(
struct
drv_cmd
*
cmd
)
{
{
cpumask_t
saved_mask
=
current
->
cpus_allowed
;
cpumask_t
saved_mask
=
current
->
cpus_allowed
;
cmd
->
val
=
0
;
cmd
->
val
=
0
;
...
@@ -210,7 +208,6 @@ static inline void drv_read(struct drv_cmd *cmd)
...
@@ -210,7 +208,6 @@ static inline void drv_read(struct drv_cmd *cmd)
set_cpus_allowed
(
current
,
cmd
->
mask
);
set_cpus_allowed
(
current
,
cmd
->
mask
);
do_drv_read
(
cmd
);
do_drv_read
(
cmd
);
set_cpus_allowed
(
current
,
saved_mask
);
set_cpus_allowed
(
current
,
saved_mask
);
}
}
static
void
drv_write
(
struct
drv_cmd
*
cmd
)
static
void
drv_write
(
struct
drv_cmd
*
cmd
)
...
@@ -323,11 +320,10 @@ static unsigned int get_measured_perf(unsigned int cpu)
...
@@ -323,11 +320,10 @@ static unsigned int get_measured_perf(unsigned int cpu)
mperf_cur
.
split
.
lo
>>=
shift_count
;
mperf_cur
.
split
.
lo
>>=
shift_count
;
}
}
if
(
aperf_cur
.
split
.
lo
&&
mperf_cur
.
split
.
lo
)
{
if
(
aperf_cur
.
split
.
lo
&&
mperf_cur
.
split
.
lo
)
perf_percent
=
(
aperf_cur
.
split
.
lo
*
100
)
/
mperf_cur
.
split
.
lo
;
perf_percent
=
(
aperf_cur
.
split
.
lo
*
100
)
/
mperf_cur
.
split
.
lo
;
}
else
{
else
perf_percent
=
0
;
perf_percent
=
0
;
}
#else
#else
if
(
unlikely
(((
unsigned
long
)(
-
1
)
/
100
)
<
aperf_cur
.
whole
))
{
if
(
unlikely
(((
unsigned
long
)(
-
1
)
/
100
)
<
aperf_cur
.
whole
))
{
...
@@ -336,11 +332,10 @@ static unsigned int get_measured_perf(unsigned int cpu)
...
@@ -336,11 +332,10 @@ static unsigned int get_measured_perf(unsigned int cpu)
mperf_cur
.
whole
>>=
shift_count
;
mperf_cur
.
whole
>>=
shift_count
;
}
}
if
(
aperf_cur
.
whole
&&
mperf_cur
.
whole
)
{
if
(
aperf_cur
.
whole
&&
mperf_cur
.
whole
)
perf_percent
=
(
aperf_cur
.
whole
*
100
)
/
mperf_cur
.
whole
;
perf_percent
=
(
aperf_cur
.
whole
*
100
)
/
mperf_cur
.
whole
;
}
else
{
else
perf_percent
=
0
;
perf_percent
=
0
;
}
#endif
#endif
...
@@ -377,7 +372,7 @@ static unsigned int check_freqs(cpumask_t mask, unsigned int freq,
...
@@ -377,7 +372,7 @@ static unsigned int check_freqs(cpumask_t mask, unsigned int freq,
unsigned
int
cur_freq
;
unsigned
int
cur_freq
;
unsigned
int
i
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
100
;
i
++
)
{
for
(
i
=
0
;
i
<
100
;
i
++
)
{
cur_freq
=
extract_freq
(
get_cur_val
(
mask
),
data
);
cur_freq
=
extract_freq
(
get_cur_val
(
mask
),
data
);
if
(
cur_freq
==
freq
)
if
(
cur_freq
==
freq
)
return
1
;
return
1
;
...
@@ -507,15 +502,15 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
...
@@ -507,15 +502,15 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
unsigned
long
freq
;
unsigned
long
freq
;
unsigned
long
freqn
=
perf
->
states
[
0
].
core_frequency
*
1000
;
unsigned
long
freqn
=
perf
->
states
[
0
].
core_frequency
*
1000
;
for
(
i
=
0
;
i
<
(
perf
->
state_count
-
1
);
i
++
)
{
for
(
i
=
0
;
i
<
(
perf
->
state_count
-
1
);
i
++
)
{
freq
=
freqn
;
freq
=
freqn
;
freqn
=
perf
->
states
[
i
+
1
].
core_frequency
*
1000
;
freqn
=
perf
->
states
[
i
+
1
].
core_frequency
*
1000
;
if
((
2
*
cpu_khz
)
>
(
freqn
+
freq
))
{
if
((
2
*
cpu_khz
)
>
(
freqn
+
freq
))
{
perf
->
state
=
i
;
perf
->
state
=
i
;
return
freq
;
return
freq
;
}
}
}
}
perf
->
state
=
perf
->
state_count
-
1
;
perf
->
state
=
perf
->
state_count
-
1
;
return
freqn
;
return
freqn
;
}
else
{
}
else
{
/* assume CPU is at P0... */
/* assume CPU is at P0... */
...
@@ -608,9 +603,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
...
@@ -608,9 +603,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
data
->
acpi_data
=
acpi_perf_data
[
cpu
];
data
->
acpi_data
=
acpi_perf_data
[
cpu
];
drv_data
[
cpu
]
=
data
;
drv_data
[
cpu
]
=
data
;
if
(
cpu_has
(
c
,
X86_FEATURE_CONSTANT_TSC
))
{
if
(
cpu_has
(
c
,
X86_FEATURE_CONSTANT_TSC
))
acpi_cpufreq_driver
.
flags
|=
CPUFREQ_CONST_LOOPS
;
acpi_cpufreq_driver
.
flags
|=
CPUFREQ_CONST_LOOPS
;
}
result
=
acpi_processor_register_performance
(
data
->
acpi_data
,
cpu
);
result
=
acpi_processor_register_performance
(
data
->
acpi_data
,
cpu
);
if
(
result
)
if
(
result
)
...
@@ -618,6 +612,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
...
@@ -618,6 +612,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
perf
=
data
->
acpi_data
;
perf
=
data
->
acpi_data
;
policy
->
shared_type
=
perf
->
shared_type
;
policy
->
shared_type
=
perf
->
shared_type
;
/*
/*
* Will let policy->cpus know about dependency only when software
* Will let policy->cpus know about dependency only when software
* coordination is required.
* coordination is required.
...
@@ -667,9 +662,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
...
@@ -667,9 +662,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
goto
err_unreg
;
goto
err_unreg
;
}
}
data
->
freq_table
=
data
->
freq_table
=
kmalloc
(
sizeof
(
struct
cpufreq_frequency_table
)
*
kmalloc
(
sizeof
(
struct
cpufreq_frequency_table
)
*
(
perf
->
state_count
+
1
),
GFP_KERNEL
);
(
perf
->
state_count
+
1
),
GFP_KERNEL
);
if
(
!
data
->
freq_table
)
{
if
(
!
data
->
freq_table
)
{
result
=
-
ENOMEM
;
result
=
-
ENOMEM
;
goto
err_unreg
;
goto
err_unreg
;
...
@@ -677,7 +671,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
...
@@ -677,7 +671,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
/* detect transition latency */
/* detect transition latency */
policy
->
cpuinfo
.
transition_latency
=
0
;
policy
->
cpuinfo
.
transition_latency
=
0
;
for
(
i
=
0
;
i
<
perf
->
state_count
;
i
++
)
{
for
(
i
=
0
;
i
<
perf
->
state_count
;
i
++
)
{
if
((
perf
->
states
[
i
].
transition_latency
*
1000
)
>
if
((
perf
->
states
[
i
].
transition_latency
*
1000
)
>
policy
->
cpuinfo
.
transition_latency
)
policy
->
cpuinfo
.
transition_latency
)
policy
->
cpuinfo
.
transition_latency
=
policy
->
cpuinfo
.
transition_latency
=
...
@@ -687,9 +681,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
...
@@ -687,9 +681,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
data
->
max_freq
=
perf
->
states
[
0
].
core_frequency
*
1000
;
data
->
max_freq
=
perf
->
states
[
0
].
core_frequency
*
1000
;
/* table init */
/* table init */
for
(
i
=
0
;
i
<
perf
->
state_count
;
i
++
)
{
for
(
i
=
0
;
i
<
perf
->
state_count
;
i
++
)
{
if
(
i
>
0
&&
perf
->
states
[
i
].
core_frequency
==
if
(
i
>
0
&&
perf
->
states
[
i
].
core_frequency
==
perf
->
states
[
i
-
1
].
core_frequency
)
perf
->
states
[
i
-
1
].
core_frequency
)
continue
;
continue
;
data
->
freq_table
[
valid_states
].
index
=
i
;
data
->
freq_table
[
valid_states
].
index
=
i
;
...
@@ -700,9 +694,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
...
@@ -700,9 +694,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
data
->
freq_table
[
perf
->
state_count
].
frequency
=
CPUFREQ_TABLE_END
;
data
->
freq_table
[
perf
->
state_count
].
frequency
=
CPUFREQ_TABLE_END
;
result
=
cpufreq_frequency_table_cpuinfo
(
policy
,
data
->
freq_table
);
result
=
cpufreq_frequency_table_cpuinfo
(
policy
,
data
->
freq_table
);
if
(
result
)
{
if
(
result
)
goto
err_freqfree
;
goto
err_freqfree
;
}
switch
(
data
->
cpu_feature
)
{
switch
(
data
->
cpu_feature
)
{
case
ACPI_ADR_SPACE_SYSTEM_IO
:
case
ACPI_ADR_SPACE_SYSTEM_IO
:
...
@@ -724,10 +717,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
...
@@ -724,10 +717,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
if
(
c
->
x86_vendor
==
X86_VENDOR_INTEL
&&
c
->
cpuid_level
>=
6
)
{
if
(
c
->
x86_vendor
==
X86_VENDOR_INTEL
&&
c
->
cpuid_level
>=
6
)
{
unsigned
int
ecx
;
unsigned
int
ecx
;
ecx
=
cpuid_ecx
(
6
);
ecx
=
cpuid_ecx
(
6
);
if
(
ecx
&
CPUID_6_ECX_APERFMPERF_CAPABILITY
)
{
if
(
ecx
&
CPUID_6_ECX_APERFMPERF_CAPABILITY
)
acpi_cpufreq_driver
.
getavg
=
get_measured_perf
;
acpi_cpufreq_driver
.
getavg
=
get_measured_perf
;
}
}
}
dprintk
(
"CPU%u - ACPI performance management activated.
\n
"
,
cpu
);
dprintk
(
"CPU%u - ACPI performance management activated.
\n
"
,
cpu
);
for
(
i
=
0
;
i
<
perf
->
state_count
;
i
++
)
for
(
i
=
0
;
i
<
perf
->
state_count
;
i
++
)
...
@@ -747,11 +739,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
...
@@ -747,11 +739,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
return
result
;
return
result
;
err_freqfree:
err_freqfree:
kfree
(
data
->
freq_table
);
kfree
(
data
->
freq_table
);
err_unreg:
err_unreg:
acpi_processor_unregister_performance
(
perf
,
cpu
);
acpi_processor_unregister_performance
(
perf
,
cpu
);
err_free:
err_free:
kfree
(
data
);
kfree
(
data
);
drv_data
[
cpu
]
=
NULL
;
drv_data
[
cpu
]
=
NULL
;
...
@@ -827,7 +819,8 @@ static void __exit acpi_cpufreq_exit(void)
...
@@ -827,7 +819,8 @@ static void __exit acpi_cpufreq_exit(void)
module_param
(
acpi_pstate_strict
,
uint
,
0644
);
module_param
(
acpi_pstate_strict
,
uint
,
0644
);
MODULE_PARM_DESC
(
acpi_pstate_strict
,
MODULE_PARM_DESC
(
acpi_pstate_strict
,
"value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes."
);
"value 0 or non-zero. non-zero -> strict ACPI checks are "
"performed during frequency changes."
);
late_initcall
(
acpi_cpufreq_init
);
late_initcall
(
acpi_cpufreq_init
);
module_exit
(
acpi_cpufreq_exit
);
module_exit
(
acpi_cpufreq_exit
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment