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