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
0d120f58
Commit
0d120f58
authored
Apr 28, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
driver core: fix up cpu.c, memblk.c, and node.c due to the class changes
parent
28926b3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
31 deletions
+26
-31
drivers/base/cpu.c
drivers/base/cpu.c
+18
-11
drivers/base/memblk.c
drivers/base/memblk.c
+4
-10
drivers/base/node.c
drivers/base/node.c
+4
-10
No files found.
drivers/base/cpu.c
View file @
0d120f58
...
...
@@ -10,23 +10,16 @@
#include <asm/topology.h>
static
int
cpu_add_device
(
struct
device
*
dev
)
{
return
0
;
}
struct
device_class
cpu_devclass
=
{
struct
class
cpu_class
=
{
.
name
=
"cpu"
,
.
add_device
=
cpu_add_device
,
};
struct
device_driver
cpu_driver
=
{
.
name
=
"cpu"
,
.
bus
=
&
system_bus_type
,
.
devclass
=
&
cpu_devclass
,
};
/*
* register_cpu - Setup a driverfs device for a CPU.
* @num - CPU number to use when creating the device.
...
...
@@ -35,6 +28,8 @@ 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
;
...
...
@@ -42,7 +37,19 @@ int __init register_cpu(struct cpu *cpu, int num, struct node *root)
cpu
->
sysdev
.
root
=
&
root
->
sysroot
;
snprintf
(
cpu
->
sysdev
.
dev
.
name
,
DEVICE_NAME_SIZE
,
"CPU %u"
,
num
);
cpu
->
sysdev
.
dev
.
driver
=
&
cpu_driver
;
return
sys_device_register
(
&
cpu
->
sysdev
);
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
)
{
// FIXME cleanup sys_device_register
return
retval
;
}
return
0
;
}
...
...
@@ -50,11 +57,11 @@ int __init cpu_dev_init(void)
{
int
error
;
error
=
devclass_register
(
&
cpu_dev
class
);
error
=
class_register
(
&
cpu_
class
);
if
(
!
error
)
{
error
=
driver_register
(
&
cpu_driver
);
if
(
error
)
devclass_unregister
(
&
cpu_dev
class
);
class_unregister
(
&
cpu_
class
);
}
return
error
;
}
drivers/base/memblk.c
View file @
0d120f58
...
...
@@ -11,20 +11,14 @@
#include <asm/topology.h>
static
int
memblk_add_device
(
struct
device
*
dev
)
{
return
0
;
}
struct
device_class
memblk_devclass
=
{
static
struct
class
memblk_class
=
{
.
name
=
"memblk"
,
.
add_device
=
memblk_add_device
,
};
struct
device_driver
memblk_driver
=
{
st
atic
st
ruct
device_driver
memblk_driver
=
{
.
name
=
"memblk"
,
.
bus
=
&
system_bus_type
,
.
devclass
=
&
memblk_devclass
,
};
...
...
@@ -51,11 +45,11 @@ int __init register_memblk_type(void)
{
int
error
;
error
=
devclass_register
(
&
memblk_dev
class
);
error
=
class_register
(
&
memblk_
class
);
if
(
!
error
)
{
error
=
driver_register
(
&
memblk_driver
);
if
(
error
)
devclass_unregister
(
&
memblk_dev
class
);
class_unregister
(
&
memblk_
class
);
}
return
error
;
}
...
...
drivers/base/node.c
View file @
0d120f58
...
...
@@ -11,20 +11,14 @@
#include <asm/topology.h>
static
int
node_add_device
(
struct
device
*
dev
)
{
return
0
;
}
struct
device_class
node_devclass
=
{
static
struct
class
node_class
=
{
.
name
=
"node"
,
.
add_device
=
node_add_device
,
};
struct
device_driver
node_driver
=
{
st
atic
st
ruct
device_driver
node_driver
=
{
.
name
=
"node"
,
.
bus
=
&
system_bus_type
,
.
devclass
=
&
node_devclass
,
};
...
...
@@ -93,11 +87,11 @@ int __init register_node_type(void)
{
int
error
;
error
=
devclass_register
(
&
node_dev
class
);
error
=
class_register
(
&
node_
class
);
if
(
!
error
)
{
error
=
driver_register
(
&
node_driver
);
if
(
error
)
devclass_unregister
(
&
node_dev
class
);
class_unregister
(
&
node_
class
);
}
return
error
;
}
...
...
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