Commit ed651f72 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://ldm.bkbits.net/linux-2.5-core

into home.transmeta.com:/home/torvalds/v2.5/linux
parents de68aa5a 76d2b471
......@@ -13,7 +13,7 @@
#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/ptrace.h>
#include <linux/device.h>
#include <linux/sysdev.h>
#include <asm/hardware.h>
#include <asm/irq.h>
......@@ -211,25 +211,16 @@ static struct resource irq_resource = {
.end = 0x9005ffff,
};
struct sa1100irq_state {
static struct {
unsigned int saved;
unsigned int icmr;
unsigned int iclr;
unsigned int iccr;
};
} sa1100irq_state;
static int sa1100irq_suspend(struct device *dev, u32 state, u32 level)
{
struct sa1100irq_state *st;
if (!dev->saved_state && level == SUSPEND_NOTIFY)
dev->saved_state = kmalloc(sizeof(struct sa1100irq_state),
GFP_KERNEL);
if (!dev->saved_state)
return -ENOMEM;
if (level == SUSPEND_POWER_DOWN) {
st = (struct sa1100irq_state *)dev->saved_state;
struct sa1100irq_state *st = &sa1100irq_state;
st->saved = 1;
st->icmr = ICMR;
......@@ -253,17 +244,13 @@ static int sa1100irq_suspend(struct device *dev, u32 state, u32 level)
* Clear any pending GPIO interrupts.
*/
GEDR = GEDR;
}
return 0;
}
static int sa1100irq_resume(struct device *dev, u32 level)
static int sa1100irq_resume(struct sys_device *dev)
{
struct sa1100irq_state *st;
if (level == RESUME_POWER_ON) {
st = (struct sa1100irq_state *)dev->saved_state;
dev->saved_state = NULL;
struct sa1100irq_state *st = &sa1100irq_state;
if (st->saved) {
ICCR = st->iccr;
......@@ -274,31 +261,23 @@ static int sa1100irq_resume(struct device *dev, u32 level)
ICMR = st->icmr;
}
kfree(st);
}
return 0;
}
static struct device_driver sa1100irq_driver = {
.name = "sa11x0-irq",
.bus = &system_bus_type,
static struct sysdev_class sa1100irq_sysclass = {
set_kset_name("sa11x0-irq"),
.suspend = sa1100irq_suspend,
.resume = sa1100irq_resume,
};
static struct sys_device sa1100irq_device = {
.name = "irq",
.id = 0,
.dev = {
.name = "Intel SA11x0 [Interrupt Controller]",
.driver = &sa1100irq_driver,
},
.cls = &sa1100irq_sysclass,
};
static int __init sa1100irq_init_devicefs(void)
{
driver_register(&sa1100irq_driver);
sysdev_class_register(&sa1100irq_sysclass);
return sys_device_register(&sa1100irq_device);
}
......
......@@ -13,13 +13,6 @@ static struct sysdev_class memblk_class = {
set_kset_name("memblk"),
};
static struct device_driver memblk_driver = {
.name = "memblk",
.bus = &system_bus_type,
};
/*
* register_memblk - Setup a driverfs device for a MemBlk
* @num - MemBlk number to use when creating the device.
......@@ -37,7 +30,7 @@ int __init register_memblk(struct memblk *memblk, int num, struct node *root)
error = sys_device_register(&memblk->sysdev);
if (!error)
error = sysfs_create_link(&root->sysdev.kobj,
&memblk->sysdev,kobj,
&memblk->sysdev.kobj,
memblk->sysdev.kobj.name);
return error;
}
......
......@@ -2,7 +2,7 @@
* drivers/base/node.c - basic Node class support
*/
#include <linux/device.h>
#include <linux/sysdev.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/mm.h>
......@@ -14,18 +14,17 @@ static struct sysdev_class node_class = {
};
static ssize_t node_read_cpumap(struct device * dev, char * buf)
static ssize_t node_read_cpumap(struct sys_device * dev, char * buf)
{
struct node *node_dev = to_node(to_root(dev));
struct node *node_dev = to_node(dev);
return sprintf(buf,"%lx\n",node_dev->cpumap);
}
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)
static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
{
struct sys_root *node = to_root(dev);
int nid = node->id;
int nid = dev->id;
struct sysinfo i;
si_meminfo_node(&i, nid);
return sprintf(buf, "\n"
......@@ -64,8 +63,8 @@ int __init register_node(struct node *node, int num, struct node *parent)
error = sys_device_register(&node->sysdev);
if (!error){
sys_device_create_file(&node->sysroot.dev, &attr_cpumap);
sys_device_create_file(&node->sysroot.dev, &attr_meminfo);
sysdev_create_file(&node->sysdev, &attr_cpumap);
sysdev_create_file(&node->sysdev, &attr_meminfo);
}
return error;
}
......
......@@ -10,7 +10,7 @@
*
*/
#define DEBUG
#undef DEBUG
#include <linux/device.h>
#include <linux/module.h>
......@@ -49,19 +49,19 @@ extern int sysdev_restore(void);
*/
int device_suspend(u32 state, u32 level)
{
struct list_head * node;
struct device * dev;
int error = 0;
printk(KERN_EMERG "Suspending devices\n");
down_write(&devices_subsys.rwsem);
list_for_each(node,&devices_subsys.kset.list) {
struct device * dev = to_dev(node);
list_for_each_entry_reverse(dev,&devices_subsys.kset.list,kobj.entry) {
if (dev->driver && dev->driver->suspend) {
pr_debug("suspending device %s\n",dev->name);
error = dev->driver->suspend(dev,state,level);
if (error)
printk(KERN_ERR "%s: suspend returned %d\n",dev->name,error);
printk(KERN_ERR "%s: suspend returned %d\n",
dev->name,error);
}
}
up_write(&devices_subsys.rwsem);
......@@ -93,7 +93,7 @@ int device_suspend(u32 state, u32 level)
*/
void device_resume(u32 level)
{
struct list_head * node;
struct device * dev;
switch (level) {
case RESUME_POWER_ON:
......@@ -107,8 +107,7 @@ void device_resume(u32 level)
}
down_write(&devices_subsys.rwsem);
list_for_each_prev(node,&devices_subsys.kset.list) {
struct device * dev = to_dev(node);
list_for_each_entry(dev,&devices_subsys.kset.list,kobj.entry) {
if (dev->driver && dev->driver->resume) {
pr_debug("resuming device %s\n",dev->name);
dev->driver->resume(dev,level);
......@@ -124,13 +123,12 @@ void device_resume(u32 level)
*/
void device_shutdown(void)
{
struct list_head * entry;
struct device * dev;
printk(KERN_EMERG "Shutting down devices\n");
down_write(&devices_subsys.rwsem);
list_for_each(entry,&devices_subsys.kset.list) {
struct device * dev = to_dev(entry);
list_for_each_entry_reverse(dev,&devices_subsys.kset.list,kobj.entry) {
pr_debug("shutting down %s: ",dev->name);
if (dev->driver && dev->driver->shutdown) {
pr_debug("Ok\n");
......
......@@ -12,7 +12,7 @@
* add themselves as children of the system bus.
*/
#define DEBUG
#undef DEBUG
#include <linux/sysdev.h>
#include <linux/err.h>
......@@ -62,6 +62,19 @@ static struct kobj_type ktype_sysdev = {
.sysfs_ops = &sysfs_ops,
};
int sysdev_create_file(struct sys_device * s, struct sysdev_attribute * a)
{
return sysfs_create_file(&s->kobj,&a->attr);
}
void sysdev_remove_file(struct sys_device * s, struct sysdev_attribute * a)
{
sysfs_remove_file(&s->kobj,&a->attr);
}
/*
* declare system_subsys
*/
......
......@@ -28,7 +28,6 @@ struct node {
extern int register_node(struct node *, int, struct node *);
#define to_node(_root) container_of(_root, struct node, sysroot)
#define to_root(_dev) container_of(_dev, struct sys_root, dev)
#define to_node(sys_device) container_of(sys_device, struct node, sysdev)
#endif /* _LINUX_NODE_H_ */
......@@ -252,14 +252,15 @@ int kobject_add(struct kobject * kobj)
if (kobj->kset) {
down_write(&kobj->kset->subsys->rwsem);
if (parent)
list_add_tail(&kobj->entry,&parent->entry);
else {
if (!parent)
parent = kobject_get(&kobj->kset->kobj);
list_add_tail(&kobj->entry,&kobj->kset->list);
kobj->parent = kobject_get(&kobj->kset->kobj);
}
up_write(&kobj->kset->subsys->rwsem);
}
kobj->parent = parent;
error = create_dir(kobj);
if (error)
unlink(kobj);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment