From: Greg KH <greg@kroah.com>
To: Zwane Mwaikambo <zwane@linuxpower.ca>
Cc: Hanna Linder <hannal@us.ibm.com>,
"H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.6-rc2 RFT] Add's class support to cpuid.c
Date: Tue, 8 Jun 2004 22:45:41 -0700 [thread overview]
Message-ID: <20040609054541.GA9483@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0406082248360.23469@montezuma.fsmlabs.com>
On Tue, Jun 08, 2004 at 10:52:09PM -0400, Zwane Mwaikambo wrote:
> My understanding is that the above removes the class for each online cpu.
Ick, good catch. This change should fix this. Thanks for letting me
know.
greg k-h
# cpuid: fix hotplug cpu remove bug for class device.
#
# Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
#
diff -Nru a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c
--- a/arch/i386/kernel/cpuid.c 2004-06-08 22:44:26 -07:00
+++ b/arch/i386/kernel/cpuid.c 2004-06-08 22:44:26 -07:00
@@ -158,35 +158,27 @@
.open = cpuid_open,
};
-static void cpuid_class_simple_device_remove(void)
-{
- int i = 0;
- for_each_online_cpu(i)
- class_simple_device_remove(MKDEV(CPUID_MAJOR, i));
- return;
-}
-
static int cpuid_class_simple_device_add(int i)
{
int err = 0;
struct class_device *class_err;
class_err = class_simple_device_add(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);
- }
return err;
}
+
static int __devinit cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
{
unsigned int cpu = (unsigned long)hcpu;
- switch(action) {
+ switch (action) {
case CPU_ONLINE:
cpuid_class_simple_device_add(cpu);
break;
case CPU_DEAD:
- cpuid_class_simple_device_remove();
+ class_simple_device_remove(MKDEV(CPUID_MAJOR, cpu));
break;
}
return NOTIFY_OK;
@@ -224,7 +216,10 @@
goto out;
out_class:
- cpuid_class_simple_device_remove();
+ i = 0;
+ for_each_online_cpu(i) {
+ class_simple_device_remove(MKDEV(CPUID_MAJOR, i));
+ }
class_simple_destroy(cpuid_class);
out_chrdev:
unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
@@ -234,7 +229,10 @@
void __exit cpuid_exit(void)
{
- cpuid_class_simple_device_remove();
+ int cpu = 0;
+
+ for_each_online_cpu(cpu)
+ class_simple_device_remove(MKDEV(CPUID_MAJOR, cpu));
class_simple_destroy(cpuid_class);
unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
unregister_cpu_notifier(&cpuid_class_cpu_notifier);
prev parent reply other threads:[~2004-06-09 7:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-02 22:32 [PATCH 2.6.6-rc2 RFT] Add's class support to cpuid.c Hanna Linder
2004-06-03 0:11 ` H. Peter Anvin
2004-06-03 19:32 ` Greg KH
2004-06-03 20:42 ` Hanna Linder
2004-06-08 21:10 ` Hanna Linder
2004-06-08 22:15 ` Hanna Linder
2004-06-08 23:26 ` Greg KH
2004-06-09 2:52 ` Zwane Mwaikambo
2004-06-09 5:45 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040609054541.GA9483@kroah.com \
--to=greg@kroah.com \
--cc=hannal@us.ibm.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zwane@linuxpower.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox