From: "Bryan O'Sullivan" <bos@serpentine.com>
To: Andi Kleen <ak@suse.de>, Linus Torvalds <torvalds@transmeta.com>
Cc: discuss@x86-64.org, linux-kernel@vger.kernel.org
Subject: [BK PATCH] Apply new sysfs API to x86_64 core
Date: 14 Jun 2003 23:14:16 -0700 [thread overview]
Message-ID: <1055657656.28852.27.camel@camp4.serpentine.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 87 bytes --]
This patch is against 2.5.71, and brings x86_64 into line with the new
sysfs API.
<b
[-- Attachment #2: x86_64-sysfs-1.patch --]
[-- Type: text/plain, Size: 4616 bytes --]
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1314 -> 1.1315
# arch/x86_64/kernel/apic.c 1.23 -> 1.24
# arch/x86_64/kernel/nmi.c 1.12 -> 1.13
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/06/14 bos@serpentine.com 1.1315
# Bring x86_64 into line with new sysfs API.
# --------------------------------------------
#
diff -Nru a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
--- a/arch/x86_64/kernel/apic.c Sat Jun 14 23:09:59 2003
+++ b/arch/x86_64/kernel/apic.c Sat Jun 14 23:09:59 2003
@@ -25,6 +25,7 @@
#include <linux/interrupt.h>
#include <linux/mc146818rtc.h>
#include <linux/kernel_stat.h>
+#include <linux/sysdev.h>
#include <asm/atomic.h>
#include <asm/smp.h>
@@ -464,13 +465,11 @@
unsigned int apic_thmr;
} apic_pm_state;
-static int lapic_suspend(struct device *dev, u32 state, u32 level)
+static int lapic_suspend(struct sys_device *dev, u32 state)
{
unsigned int l, h;
unsigned long flags;
- if (level != SUSPEND_POWER_DOWN)
- return 0;
if (!apic_pm_state.active)
return 0;
@@ -497,13 +496,11 @@
return 0;
}
-static int lapic_resume(struct device *dev, u32 level)
+static int lapic_resume(struct sys_device *dev)
{
unsigned int l, h;
unsigned long flags;
- if (level != RESUME_POWER_ON)
- return 0;
if (!apic_pm_state.active)
return 0;
@@ -537,38 +534,35 @@
return 0;
}
-static struct device_driver lapic_driver = {
- .name = "lapic",
- .bus = &system_bus_type,
+static struct sysdev_class lapic_sysclass = {
+ set_kset_name("lapic"),
.resume = lapic_resume,
.suspend = lapic_suspend,
};
-/* not static, needed by child devices */
-struct sys_device device_lapic = {
- .name = "lapic",
+static struct sys_device device_lapic = {
.id = 0,
- .dev = {
- .name = "lapic",
- .driver = &lapic_driver,
- },
+ .cls = &lapic_sysclass,
};
-EXPORT_SYMBOL(device_lapic);
static void __init apic_pm_activate(void)
{
apic_pm_state.active = 1;
}
-static int __init init_lapic_devicefs(void)
+static int __init init_lapic_sysfs(void)
{
+ int error;
+
if (!cpu_has_apic)
return 0;
/* XXX: remove suspend/resume procs if !apic_pm_state.active? */
- driver_register(&lapic_driver);
- return sys_device_register(&device_lapic);
+ error = sysdev_class_register(&lapic_sysclass);
+ if (!error)
+ error = sys_device_register(&device_lapic);
+ return error;
}
-device_initcall(init_lapic_devicefs);
+device_initcall(init_lapic_sysfs);
#else /* CONFIG_PM */
diff -Nru a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
--- a/arch/x86_64/kernel/nmi.c Sat Jun 14 23:09:59 2003
+++ b/arch/x86_64/kernel/nmi.c Sat Jun 14 23:09:59 2003
@@ -22,6 +22,7 @@
#include <linux/mc146818rtc.h>
#include <linux/kernel_stat.h>
#include <linux/module.h>
+#include <linux/sysdev.h>
#include <asm/smp.h>
#include <asm/mtrr.h>
@@ -152,50 +153,45 @@
#include <linux/device.h>
-static int lapic_nmi_suspend(struct device *dev, u32 state, u32 level)
- {
- if (level != SUSPEND_POWER_DOWN)
- return 0;
+static int lapic_nmi_suspend(struct sys_device *dev, u32 state)
+{
disable_lapic_nmi_watchdog();
return 0;
- }
+}
-static int lapic_nmi_resume(struct device *dev, u32 level)
- {
- if (level != RESUME_POWER_ON)
- return 0;
+static int lapic_nmi_resume(struct sys_device *dev)
+{
#if 0
enable_lapic_nmi_watchdog();
#endif
return 0;
- }
+}
-static struct device_driver lapic_nmi_driver = {
- .name = "lapic_nmi",
- .bus = &system_bus_type,
+static struct sysdev_class nmi_sysclass = {
+ set_kset_name("lapic_nmi"),
.resume = lapic_nmi_resume,
.suspend = lapic_nmi_suspend,
};
static struct sys_device device_lapic_nmi = {
- .name = "lapic_nmi",
- .id = 0,
- .dev = {
- .name = "lapic_nmi",
- .driver = &lapic_nmi_driver,
- .parent = &device_lapic.dev,
- },
+ .id = 0,
+ .cls = &nmi_sysclass,
};
-static int __init init_lapic_nmi_devicefs(void)
+static int __init init_lapic_nmi_sysfs(void)
{
+ int error;
+
if (nmi_active == 0)
return 0;
- driver_register(&lapic_nmi_driver);
- return sys_device_register(&device_lapic_nmi);
+
+ error = sysdev_class_register(&nmi_sysclass);
+ if (!error)
+ error = sys_device_register(&device_lapic_nmi);
+ return error;
}
/* must come after the local APIC's device_initcall() */
-late_initcall(init_lapic_nmi_devicefs);
+late_initcall(init_lapic_nmi_sysfs);
#endif /* CONFIG_PM */
next reply other threads:[~2003-06-15 6:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-15 6:14 Bryan O'Sullivan [this message]
2003-06-15 8:15 ` Andi Kleen
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=1055657656.28852.27.camel@camp4.serpentine.com \
--to=bos@serpentine.com \
--cc=ak@suse.de \
--cc=discuss@x86-64.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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
all inboxes | Powered by JetHome®