Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
2717cc0d
Commit
2717cc0d
authored
Jul 15, 2003
by
Dave Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CPUFREQ] Fix locking [6/11]
Change the function parameter of cpufreq_cpu_put to struct cpufreq_policy *.
parent
3563db15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
22 deletions
+32
-22
kernel/cpufreq.c
kernel/cpufreq.c
+32
-22
No files found.
kernel/cpufreq.c
View file @
2717cc0d
...
@@ -94,9 +94,9 @@ static struct cpufreq_policy * cpufreq_cpu_get(unsigned int cpu)
...
@@ -94,9 +94,9 @@ static struct cpufreq_policy * cpufreq_cpu_get(unsigned int cpu)
return
NULL
;
return
NULL
;
}
}
static
void
cpufreq_cpu_put
(
unsigned
int
cpu
)
static
void
cpufreq_cpu_put
(
struct
cpufreq_policy
*
data
)
{
{
kobject_put
(
&
cpufreq_driver
->
policy
[
cpu
].
kobj
);
kobject_put
(
&
data
->
kobj
);
module_put
(
cpufreq_driver
->
owner
);
module_put
(
cpufreq_driver
->
owner
);
}
}
...
@@ -303,10 +303,11 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf)
...
@@ -303,10 +303,11 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf)
struct
cpufreq_policy
*
policy
=
to_policy
(
kobj
);
struct
cpufreq_policy
*
policy
=
to_policy
(
kobj
);
struct
freq_attr
*
fattr
=
to_attr
(
attr
);
struct
freq_attr
*
fattr
=
to_attr
(
attr
);
ssize_t
ret
;
ssize_t
ret
;
if
(
!
cpufreq_cpu_get
(
policy
->
cpu
))
policy
=
cpufreq_cpu_get
(
policy
->
cpu
);
if
(
!
policy
)
return
-
EINVAL
;
return
-
EINVAL
;
ret
=
fattr
->
show
?
fattr
->
show
(
policy
,
buf
)
:
0
;
ret
=
fattr
->
show
?
fattr
->
show
(
policy
,
buf
)
:
0
;
cpufreq_cpu_put
(
policy
->
cpu
);
cpufreq_cpu_put
(
policy
);
return
ret
;
return
ret
;
}
}
...
@@ -316,10 +317,11 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr,
...
@@ -316,10 +317,11 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr,
struct
cpufreq_policy
*
policy
=
to_policy
(
kobj
);
struct
cpufreq_policy
*
policy
=
to_policy
(
kobj
);
struct
freq_attr
*
fattr
=
to_attr
(
attr
);
struct
freq_attr
*
fattr
=
to_attr
(
attr
);
ssize_t
ret
;
ssize_t
ret
;
if
(
!
cpufreq_cpu_get
(
policy
->
cpu
))
policy
=
cpufreq_cpu_get
(
policy
->
cpu
);
if
(
!
policy
)
return
-
EINVAL
;
return
-
EINVAL
;
ret
=
fattr
->
store
?
fattr
->
store
(
policy
,
buf
,
count
)
:
0
;
ret
=
fattr
->
store
?
fattr
->
store
(
policy
,
buf
,
count
)
:
0
;
cpufreq_cpu_put
(
policy
->
cpu
);
cpufreq_cpu_put
(
policy
);
return
ret
;
return
ret
;
}
}
...
@@ -473,15 +475,20 @@ static int cpufreq_restore(struct sys_device * sysdev)
...
@@ -473,15 +475,20 @@ static int cpufreq_restore(struct sys_device * sysdev)
int
cpu
=
sysdev
->
id
;
int
cpu
=
sysdev
->
id
;
unsigned
int
ret
=
0
;
unsigned
int
ret
=
0
;
struct
cpufreq_policy
policy
;
struct
cpufreq_policy
policy
;
struct
cpufreq_policy
*
cpu_policy
;
if
(
cpu_online
(
cpu
)
&&
cpufreq_cpu_get
(
cpu
))
{
if
(
!
cpu_online
(
cpu
))
down
(
&
cpufreq_driver_sem
);
return
0
;
memcpy
(
&
policy
,
&
cpufreq_driver
->
policy
[
cpu
],
sizeof
(
struct
cpufreq_policy
));
cpu_policy
=
cpufreq_cpu_get
(
cpu
);
up
(
&
cpufreq_driver_sem
);
ret
=
cpufreq_set_policy
(
&
policy
);
down
(
&
cpufreq_driver_sem
);
cpufreq_cpu_put
(
cpu
);
memcpy
(
&
policy
,
cpu_policy
,
sizeof
(
struct
cpufreq_policy
));
}
up
(
&
cpufreq_driver_sem
);
ret
=
cpufreq_set_policy
(
&
policy
);
cpufreq_cpu_put
(
cpu_policy
);
return
ret
;
return
ret
;
}
}
...
@@ -584,7 +591,7 @@ inline int cpufreq_driver_target(struct cpufreq_policy *policy,
...
@@ -584,7 +591,7 @@ inline int cpufreq_driver_target(struct cpufreq_policy *policy,
up
(
&
policy
->
lock
);
up
(
&
policy
->
lock
);
cpufreq_cpu_put
(
policy
->
cpu
);
cpufreq_cpu_put
(
policy
);
return
ret
;
return
ret
;
}
}
...
@@ -629,7 +636,7 @@ int cpufreq_governor(unsigned int cpu, unsigned int event)
...
@@ -629,7 +636,7 @@ int cpufreq_governor(unsigned int cpu, unsigned int event)
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
}
}
cpufreq_cpu_put
(
cpu
);
cpufreq_cpu_put
(
policy
);
return
ret
;
return
ret
;
}
}
...
@@ -691,16 +698,19 @@ EXPORT_SYMBOL_GPL(cpufreq_unregister_governor);
...
@@ -691,16 +698,19 @@ EXPORT_SYMBOL_GPL(cpufreq_unregister_governor);
*/
*/
int
cpufreq_get_policy
(
struct
cpufreq_policy
*
policy
,
unsigned
int
cpu
)
int
cpufreq_get_policy
(
struct
cpufreq_policy
*
policy
,
unsigned
int
cpu
)
{
{
if
(
!
policy
||
!
cpufreq_cpu_get
(
cpu
))
struct
cpufreq_policy
*
cpu_policy
;
if
(
!
policy
)
return
-
EINVAL
;
cpu_policy
=
cpufreq_cpu_get
(
cpu
);
if
(
!
cpu_policy
)
return
-
EINVAL
;
return
-
EINVAL
;
down
(
&
cpufreq_driver_sem
);
down
(
&
cpufreq_driver_sem
);
memcpy
(
policy
,
memcpy
(
policy
,
cpu_policy
,
sizeof
(
struct
cpufreq_policy
));
&
cpufreq_driver
->
policy
[
cpu
],
sizeof
(
struct
cpufreq_policy
));
up
(
&
cpufreq_driver_sem
);
up
(
&
cpufreq_driver_sem
);
cpufreq_cpu_put
(
cpu
);
cpufreq_cpu_put
(
cpu
_policy
);
return
0
;
return
0
;
}
}
...
@@ -796,7 +806,7 @@ int cpufreq_set_policy(struct cpufreq_policy *policy)
...
@@ -796,7 +806,7 @@ int cpufreq_set_policy(struct cpufreq_policy *policy)
up
(
&
cpufreq_driver_sem
);
up
(
&
cpufreq_driver_sem
);
error_out:
error_out:
cpufreq_cpu_put
(
data
->
cpu
);
cpufreq_cpu_put
(
data
);
return
ret
;
return
ret
;
}
}
...
...
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