Home Home > GIT Browse > stable-xen
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@penguin.transmeta.com>2002-02-08 01:19:58 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-02-08 01:19:58 -0800
commit05124d3ef90636f10d61a3214f086f6500c1c298 (patch)
tree70b84456cb6a7acdc2e3bd58994f744fa6183f95
parent6444d1a165b68c470e6bf60d7972bd680b0a8650 (diff)
parenta0fbd4b2af59952f1859ccda547d90dda8622503 (diff)
Merge master.kernel.org:/home/mochel/BK/linux-2.5v2.5.4-pre4
into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
-rw-r--r--drivers/base/core.c28
-rw-r--r--drivers/pcmcia/cardbus.c6
-rw-r--r--fs/driverfs/inode.c6
3 files changed, 21 insertions, 19 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 0cc155572054..4a8b527c6792 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -18,7 +18,10 @@
# define DBG(x...)
#endif
-static struct device * device_root;
+static struct device device_root = {
+ bus_id: "root",
+ name: "System Root",
+};
int (*platform_notify)(struct device * dev) = NULL;
int (*platform_notify_remove)(struct device * dev) = NULL;
@@ -49,9 +52,9 @@ int device_register(struct device *dev)
spin_lock_init(&dev->lock);
atomic_set(&dev->refcount,2);
- if (dev != device_root) {
+ if (dev != &device_root) {
if (!dev->parent)
- dev->parent = device_root;
+ dev->parent = &device_root;
get_device(dev->parent);
list_add_tail(&dev->node,&dev->parent->children);
}
@@ -117,16 +120,10 @@ void put_device(struct device * dev)
static int __init device_init_root(void)
{
- device_root = kmalloc(sizeof(*device_root),GFP_KERNEL);
- if (!device_root)
- return -ENOMEM;
- memset(device_root,0,sizeof(*device_root));
- strcpy(device_root->bus_id,"root");
- strcpy(device_root->name,"System Root");
- return device_register(device_root);
+ return device_register(&device_root);
}
-static int __init device_driver_init(void)
+static int __init device_init(void)
{
int error = 0;
@@ -141,17 +138,12 @@ static int __init device_driver_init(void)
return error;
}
- error = device_init_root();
- if (error) {
+ if ((error = device_init_root()))
printk(KERN_ERR "%s: device root init failed!\n", __FUNCTION__);
- return error;
- }
-
- DBG("DEV: Done Initialising\n");
return error;
}
-subsys_initcall(device_driver_init);
+subsys_initcall(device_init);
EXPORT_SYMBOL(device_register);
EXPORT_SYMBOL(put_device);
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
index 875160beb31c..84df2ce5bf5e 100644
--- a/drivers/pcmcia/cardbus.c
+++ b/drivers/pcmcia/cardbus.c
@@ -279,6 +279,12 @@ int cb_alloc(socket_info_t * s)
pci_readw(dev, PCI_DEVICE_ID, &dev->device);
dev->hdr_type = hdr & 0x7f;
+ dev->dev.parent = bus->device;
+ dev->dev.sysdata = bus->sysdata;
+ strcpy(dev->dev.name, dev->name);
+ strcpy(dev->dev.bus_id, dev->slot_name);
+ device_register(&dev->dev);
+
pci_setup_device(dev);
/* FIXME: Do we need to enable the expansion ROM? */
diff --git a/fs/driverfs/inode.c b/fs/driverfs/inode.c
index 54e35bce866d..9502dc7cd85d 100644
--- a/fs/driverfs/inode.c
+++ b/fs/driverfs/inode.c
@@ -245,6 +245,9 @@ driverfs_read_file(struct file *file, char *buf, size_t count, loff_t *ppos)
if (!entry->show)
return 0;
+ if (count > PAGE_SIZE)
+ count = PAGE_SIZE;
+
dev = list_entry(entry->parent,struct device, dir);
page = (unsigned char*)__get_free_page(GFP_KERNEL);
@@ -260,7 +263,8 @@ driverfs_read_file(struct file *file, char *buf, size_t count, loff_t *ppos)
if (len < 0)
retval = len;
break;
- }
+ } else if (len > count)
+ len = count;
if (copy_to_user(buf,page,len)) {
retval = -EFAULT;