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
8874b414
Commit
8874b414
authored
Mar 23, 2005
by
gregkh@suse.de
Committed by
Greg Kroah-Hartman
Jun 20, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] class: convert arch/* to use the new class api instead of class_simple
Signed-off-by:
Greg Kroah-Hartman
<
gregkh@suse.de
>
parent
d253878b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
arch/i386/kernel/cpuid.c
arch/i386/kernel/cpuid.c
+11
-11
arch/i386/kernel/msr.c
arch/i386/kernel/msr.c
+11
-11
No files found.
arch/i386/kernel/cpuid.c
View file @
8874b414
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/system.h>
static
struct
class
_simple
*
cpuid_class
;
static
struct
class
*
cpuid_class
;
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
...
@@ -158,12 +158,12 @@ static struct file_operations cpuid_fops = {
...
@@ -158,12 +158,12 @@ static struct file_operations cpuid_fops = {
.
open
=
cpuid_open
,
.
open
=
cpuid_open
,
};
};
static
int
cpuid_class_
simple_device_add
(
int
i
)
static
int
cpuid_class_
device_create
(
int
i
)
{
{
int
err
=
0
;
int
err
=
0
;
struct
class_device
*
class_err
;
struct
class_device
*
class_err
;
class_err
=
class_
simple_device_add
(
cpuid_class
,
MKDEV
(
CPUID_MAJOR
,
i
),
NULL
,
"cpu%d"
,
i
);
class_err
=
class_
device_create
(
cpuid_class
,
MKDEV
(
CPUID_MAJOR
,
i
),
NULL
,
"cpu%d"
,
i
);
if
(
IS_ERR
(
class_err
))
if
(
IS_ERR
(
class_err
))
err
=
PTR_ERR
(
class_err
);
err
=
PTR_ERR
(
class_err
);
return
err
;
return
err
;
...
@@ -175,10 +175,10 @@ static int __devinit cpuid_class_cpu_callback(struct notifier_block *nfb, unsign
...
@@ -175,10 +175,10 @@ static int __devinit cpuid_class_cpu_callback(struct notifier_block *nfb, unsign
switch
(
action
)
{
switch
(
action
)
{
case
CPU_ONLINE
:
case
CPU_ONLINE
:
cpuid_class_
simple_device_add
(
cpu
);
cpuid_class_
device_create
(
cpu
);
break
;
break
;
case
CPU_DEAD
:
case
CPU_DEAD
:
class_
simple_device_remove
(
MKDEV
(
CPUID_MAJOR
,
cpu
));
class_
device_destroy
(
cpuid_class
,
MKDEV
(
CPUID_MAJOR
,
cpu
));
break
;
break
;
}
}
return
NOTIFY_OK
;
return
NOTIFY_OK
;
...
@@ -200,13 +200,13 @@ static int __init cpuid_init(void)
...
@@ -200,13 +200,13 @@ static int __init cpuid_init(void)
err
=
-
EBUSY
;
err
=
-
EBUSY
;
goto
out
;
goto
out
;
}
}
cpuid_class
=
class_
simple_
create
(
THIS_MODULE
,
"cpuid"
);
cpuid_class
=
class_create
(
THIS_MODULE
,
"cpuid"
);
if
(
IS_ERR
(
cpuid_class
))
{
if
(
IS_ERR
(
cpuid_class
))
{
err
=
PTR_ERR
(
cpuid_class
);
err
=
PTR_ERR
(
cpuid_class
);
goto
out_chrdev
;
goto
out_chrdev
;
}
}
for_each_online_cpu
(
i
)
{
for_each_online_cpu
(
i
)
{
err
=
cpuid_class_
simple_device_add
(
i
);
err
=
cpuid_class_
device_create
(
i
);
if
(
err
!=
0
)
if
(
err
!=
0
)
goto
out_class
;
goto
out_class
;
}
}
...
@@ -218,9 +218,9 @@ static int __init cpuid_init(void)
...
@@ -218,9 +218,9 @@ static int __init cpuid_init(void)
out_class:
out_class:
i
=
0
;
i
=
0
;
for_each_online_cpu
(
i
)
{
for_each_online_cpu
(
i
)
{
class_
simple_device_remove
(
MKDEV
(
CPUID_MAJOR
,
i
));
class_
device_destroy
(
cpuid_class
,
MKDEV
(
CPUID_MAJOR
,
i
));
}
}
class_
simple_
destroy
(
cpuid_class
);
class_destroy
(
cpuid_class
);
out_chrdev:
out_chrdev:
unregister_chrdev
(
CPUID_MAJOR
,
"cpu/cpuid"
);
unregister_chrdev
(
CPUID_MAJOR
,
"cpu/cpuid"
);
out:
out:
...
@@ -232,8 +232,8 @@ static void __exit cpuid_exit(void)
...
@@ -232,8 +232,8 @@ static void __exit cpuid_exit(void)
int
cpu
=
0
;
int
cpu
=
0
;
for_each_online_cpu
(
cpu
)
for_each_online_cpu
(
cpu
)
class_
simple_device_remove
(
MKDEV
(
CPUID_MAJOR
,
cpu
));
class_
device_destroy
(
cpuid_class
,
MKDEV
(
CPUID_MAJOR
,
cpu
));
class_
simple_
destroy
(
cpuid_class
);
class_destroy
(
cpuid_class
);
unregister_chrdev
(
CPUID_MAJOR
,
"cpu/cpuid"
);
unregister_chrdev
(
CPUID_MAJOR
,
"cpu/cpuid"
);
unregister_cpu_notifier
(
&
cpuid_class_cpu_notifier
);
unregister_cpu_notifier
(
&
cpuid_class_cpu_notifier
);
}
}
...
...
arch/i386/kernel/msr.c
View file @
8874b414
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/system.h>
static
struct
class
_simple
*
msr_class
;
static
struct
class
*
msr_class
;
/* Note: "err" is handled in a funny way below. Otherwise one version
/* Note: "err" is handled in a funny way below. Otherwise one version
of gcc or another breaks. */
of gcc or another breaks. */
...
@@ -260,12 +260,12 @@ static struct file_operations msr_fops = {
...
@@ -260,12 +260,12 @@ static struct file_operations msr_fops = {
.
open
=
msr_open
,
.
open
=
msr_open
,
};
};
static
int
msr_class_
simple_device_add
(
int
i
)
static
int
msr_class_
device_create
(
int
i
)
{
{
int
err
=
0
;
int
err
=
0
;
struct
class_device
*
class_err
;
struct
class_device
*
class_err
;
class_err
=
class_
simple_device_add
(
msr_class
,
MKDEV
(
MSR_MAJOR
,
i
),
NULL
,
"msr%d"
,
i
);
class_err
=
class_
device_create
(
msr_class
,
MKDEV
(
MSR_MAJOR
,
i
),
NULL
,
"msr%d"
,
i
);
if
(
IS_ERR
(
class_err
))
if
(
IS_ERR
(
class_err
))
err
=
PTR_ERR
(
class_err
);
err
=
PTR_ERR
(
class_err
);
return
err
;
return
err
;
...
@@ -277,10 +277,10 @@ static int __devinit msr_class_cpu_callback(struct notifier_block *nfb, unsigned
...
@@ -277,10 +277,10 @@ static int __devinit msr_class_cpu_callback(struct notifier_block *nfb, unsigned
switch
(
action
)
{
switch
(
action
)
{
case
CPU_ONLINE
:
case
CPU_ONLINE
:
msr_class_
simple_device_add
(
cpu
);
msr_class_
device_create
(
cpu
);
break
;
break
;
case
CPU_DEAD
:
case
CPU_DEAD
:
class_
simple_device_remove
(
MKDEV
(
MSR_MAJOR
,
cpu
));
class_
device_destroy
(
msr_class
,
MKDEV
(
MSR_MAJOR
,
cpu
));
break
;
break
;
}
}
return
NOTIFY_OK
;
return
NOTIFY_OK
;
...
@@ -302,13 +302,13 @@ static int __init msr_init(void)
...
@@ -302,13 +302,13 @@ static int __init msr_init(void)
err
=
-
EBUSY
;
err
=
-
EBUSY
;
goto
out
;
goto
out
;
}
}
msr_class
=
class_
simple_
create
(
THIS_MODULE
,
"msr"
);
msr_class
=
class_create
(
THIS_MODULE
,
"msr"
);
if
(
IS_ERR
(
msr_class
))
{
if
(
IS_ERR
(
msr_class
))
{
err
=
PTR_ERR
(
msr_class
);
err
=
PTR_ERR
(
msr_class
);
goto
out_chrdev
;
goto
out_chrdev
;
}
}
for_each_online_cpu
(
i
)
{
for_each_online_cpu
(
i
)
{
err
=
msr_class_
simple_device_add
(
i
);
err
=
msr_class_
device_create
(
i
);
if
(
err
!=
0
)
if
(
err
!=
0
)
goto
out_class
;
goto
out_class
;
}
}
...
@@ -320,8 +320,8 @@ static int __init msr_init(void)
...
@@ -320,8 +320,8 @@ static int __init msr_init(void)
out_class:
out_class:
i
=
0
;
i
=
0
;
for_each_online_cpu
(
i
)
for_each_online_cpu
(
i
)
class_
simple_device_remove
(
MKDEV
(
MSR_MAJOR
,
i
));
class_
device_destroy
(
msr_class
,
MKDEV
(
MSR_MAJOR
,
i
));
class_
simple_
destroy
(
msr_class
);
class_destroy
(
msr_class
);
out_chrdev:
out_chrdev:
unregister_chrdev
(
MSR_MAJOR
,
"cpu/msr"
);
unregister_chrdev
(
MSR_MAJOR
,
"cpu/msr"
);
out:
out:
...
@@ -332,8 +332,8 @@ static void __exit msr_exit(void)
...
@@ -332,8 +332,8 @@ static void __exit msr_exit(void)
{
{
int
cpu
=
0
;
int
cpu
=
0
;
for_each_online_cpu
(
cpu
)
for_each_online_cpu
(
cpu
)
class_
simple_device_remove
(
MKDEV
(
MSR_MAJOR
,
cpu
));
class_
device_destroy
(
msr_class
,
MKDEV
(
MSR_MAJOR
,
cpu
));
class_
simple_
destroy
(
msr_class
);
class_destroy
(
msr_class
);
unregister_chrdev
(
MSR_MAJOR
,
"cpu/msr"
);
unregister_chrdev
(
MSR_MAJOR
,
"cpu/msr"
);
unregister_cpu_notifier
(
&
msr_class_cpu_notifier
);
unregister_cpu_notifier
(
&
msr_class_cpu_notifier
);
}
}
...
...
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