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
Kirill Smelkov
linux
Commits
60c37a8b
Commit
60c37a8b
authored
Jun 09, 2003
by
Patrick Mochel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[driver model] Convert to new system device API
parent
9777b1de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
40 deletions
+6
-40
drivers/base/cpu.c
drivers/base/cpu.c
+6
-40
No files found.
drivers/base/cpu.c
View file @
60c37a8b
...
...
@@ -9,15 +9,8 @@
#include <asm/topology.h>
struct
class
cpu_class
=
{
.
name
=
"cpu"
,
};
struct
device_driver
cpu_driver
=
{
.
name
=
"cpu"
,
.
bus
=
&
system_bus_type
,
struct
sysdev_class
cpu_sysdev_class
=
{
set_kset_name
(
"cpu"
),
};
/*
...
...
@@ -28,42 +21,15 @@ struct device_driver cpu_driver = {
*/
int
__init
register_cpu
(
struct
cpu
*
cpu
,
int
num
,
struct
node
*
root
)
{
int
retval
;
cpu
->
node_id
=
cpu_to_node
(
num
);
cpu
->
sysdev
.
name
=
"cpu"
;
cpu
->
sysdev
.
id
=
num
;
if
(
root
)
cpu
->
sysdev
.
root
=
&
root
->
sysroot
;
snprintf
(
cpu
->
sysdev
.
dev
.
name
,
DEVICE_NAME_SIZE
,
"CPU %u"
,
num
);
cpu
->
sysdev
.
dev
.
driver
=
&
cpu_driver
;
retval
=
sys_device_register
(
&
cpu
->
sysdev
);
if
(
retval
)
return
retval
;
memset
(
&
cpu
->
sysdev
.
class_dev
,
0x00
,
sizeof
(
struct
class_device
));
cpu
->
sysdev
.
class_dev
.
dev
=
&
cpu
->
sysdev
.
dev
;
cpu
->
sysdev
.
class_dev
.
class
=
&
cpu_class
;
snprintf
(
cpu
->
sysdev
.
class_dev
.
class_id
,
BUS_ID_SIZE
,
"cpu%d"
,
num
);
retval
=
class_device_register
(
&
cpu
->
sysdev
.
class_dev
);
if
(
retval
)
{
sys_device_unregister
(
&
cpu
->
sysdev
);
return
retval
;
}
return
0
;
cpu
->
sysdev
.
cls
=
&
cpu_sysdev_class
;
return
sys_device_register
(
&
cpu
->
sysdev
);
}
int
__init
cpu_dev_init
(
void
)
{
int
error
;
error
=
class_register
(
&
cpu_class
);
if
(
error
)
goto
out
;
error
=
driver_register
(
&
cpu_driver
);
if
(
error
)
class_unregister
(
&
cpu_class
);
out:
return
error
;
return
sysdev_class_register
(
&
cpu_sysdev_class
);
}
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