* start using arch/foo.h again instead of archfoo.h (trivial) * make constructor an initializer. * fix memory leak/code flow error in current code * add spinlocking * drop malloc and use new_device for device allocation instead. * ad CONFIG_SMP as it is needed by spinlocks and soon other stuff.
tested in qemu and works.
Signed-off-by: Stefan Reinauer stepan@coresystems.de
vice/device.h =================================================================== --- include/device/device.h (revision 417) +++ include/device/device.h (working copy) @@ -112,18 +112,22 @@ void (*set_link)(struct device * dev, unsigned int link); void (*reset_bus)(struct bus *bus);
- /* a constructor. The constructor for a given device is defined in the device source file. - * When is this called? Not for the static tree. When the scan bus code finds a new device, it must - * create it and insert it into the device tree. To do this, it calls a device constructor. - * The set of all device constructors is concatenated into the constructors array of structures via the usual - * gcc hack of naming a segment.
Let's drop the "gcc hack" comment, it no longer applies.
Index: device/device.c =================================================================== --- device/device.c (revision 417) +++ device/device.c (working copy)
-// spin_lock(&dev_lock); + spin_lock(&dev_lock);
/* Find the last child of our parent. */ for (child = parent->children; child && child->sibling; /* */) { child = child->sibling; }
- dev = constructor(devid); + dev = new_device(); if (!dev) - printk(BIOS_DEBUG, "%s: No constructor, going with empty dev", - dev_id_string(devid)); + return NULL;
are you missing a spin_unlock here? If we are doing lock/unlock then the failure case should probably be a goto Error in the kernel style, so we don' t leave a dangling lock.
thanks,
ron
* ron minnich rminnich@gmail.com [070629 18:36]:
Let's drop the "gcc hack" comment, it no longer applies.
dropped.
if (!dev)
printk(BIOS_DEBUG, "%s: No constructor, going with empty dev",
dev_id_string(devid));
return NULL;
are you missing a spin_unlock here? If we are doing lock/unlock then the failure case should probably be a goto Error in the kernel style, so we don' t leave a dangling lock.
Oh yeah! Even though this case does usually mean we can not really continue.
new patch ... Signed-off-by: Stefan Reinauer stepan@coresystems.de
On Fri, Jun 29, 2007 at 09:53:49AM -0700, ron minnich wrote:
Acked-by: Ronald G. Minnich rminnich@gmail.com
r418.
Uwe.