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
c81d6bf0
Commit
c81d6bf0
authored
Jun 09, 2003
by
Patrick Mochel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[numa nodes] Convert to use new system device API
parent
b65b902c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
32 deletions
+13
-32
drivers/base/node.c
drivers/base/node.c
+11
-30
include/linux/node.h
include/linux/node.h
+2
-2
No files found.
drivers/base/node.c
View file @
c81d6bf0
...
...
@@ -10,15 +10,8 @@
#include <asm/topology.h>
static
struct
class
node_class
=
{
.
name
=
"node"
,
};
static
struct
device_driver
node_driver
=
{
.
name
=
"node"
,
.
bus
=
&
system_bus_type
,
static
struct
sysdev_class
node_class
=
{
set_kset_name
(
"node"
),
};
...
...
@@ -27,7 +20,7 @@ static ssize_t node_read_cpumap(struct device * dev, char * buf)
struct
node
*
node_dev
=
to_node
(
to_root
(
dev
));
return
sprintf
(
buf
,
"%lx
\n
"
,
node_dev
->
cpumap
);
}
static
DEVICE
_ATTR
(
cpumap
,
S_IRUGO
,
node_read_cpumap
,
NULL
);
static
SYSDEV
_ATTR
(
cpumap
,
S_IRUGO
,
node_read_cpumap
,
NULL
);
#define K(x) ((x) << (PAGE_SHIFT - 10))
static
ssize_t
node_read_meminfo
(
struct
device
*
dev
,
char
*
buf
)
...
...
@@ -53,7 +46,7 @@ static ssize_t node_read_meminfo(struct device * dev, char * buf)
nid
,
K
(
i
.
freeram
-
i
.
freehigh
));
}
#undef K
static
DEVICE
_ATTR
(
meminfo
,
S_IRUGO
,
node_read_meminfo
,
NULL
);
static
SYSDEV
_ATTR
(
meminfo
,
S_IRUGO
,
node_read_meminfo
,
NULL
);
/*
...
...
@@ -67,17 +60,13 @@ int __init register_node(struct node *node, int num, struct node *parent)
int
error
;
node
->
cpumap
=
node_to_cpumask
(
num
);
node
->
sysroot
.
id
=
num
;
if
(
parent
)
node
->
sysroot
.
dev
.
parent
=
&
parent
->
sysroot
.
sysdev
;
snprintf
(
node
->
sysroot
.
dev
.
name
,
DEVICE_NAME_SIZE
,
"Node %u"
,
num
);
snprintf
(
node
->
sysroot
.
dev
.
bus_id
,
BUS_ID_SIZE
,
"node%u"
,
num
);
node
->
sysroot
.
dev
.
driver
=
&
node_driver
;
node
->
sysroot
.
dev
.
bus
=
&
system_bus_type
;
error
=
sys_register_root
(
&
node
->
sysroot
);
node
->
sysdev
.
id
=
num
;
node
->
sysdev
.
cls
=
&
node_class
;
error
=
sys_device_register
(
&
node
->
sysdev
);
if
(
!
error
){
device_create_file
(
&
node
->
sysroot
.
dev
,
&
dev_
attr_cpumap
);
device_create_file
(
&
node
->
sysroot
.
dev
,
&
dev_
attr_meminfo
);
sys_device_create_file
(
&
node
->
sysroot
.
dev
,
&
attr_cpumap
);
sys_device_create_file
(
&
node
->
sysroot
.
dev
,
&
attr_meminfo
);
}
return
error
;
}
...
...
@@ -85,14 +74,6 @@ int __init register_node(struct node *node, int num, struct node *parent)
int
__init
register_node_type
(
void
)
{
int
error
;
error
=
class_register
(
&
node_class
);
if
(
!
error
)
{
error
=
driver_register
(
&
node_driver
);
if
(
error
)
class_unregister
(
&
node_class
);
}
return
error
;
return
sysdev_class_register
(
&
node_class
);
}
postcore_initcall
(
register_node_type
);
include/linux/node.h
View file @
c81d6bf0
...
...
@@ -19,11 +19,11 @@
#ifndef _LINUX_NODE_H_
#define _LINUX_NODE_H_
#include <linux/
device
.h>
#include <linux/
sysdev
.h>
struct
node
{
unsigned
long
cpumap
;
/* Bitmap of CPUs on the Node */
struct
sys_
root
sysroot
;
struct
sys_
device
sysdev
;
};
extern
int
register_node
(
struct
node
*
,
int
,
struct
node
*
);
...
...
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