From eefeaa10082077bf9cc52d5fa5c28d1a79cd7ecd Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Fri, 8 Feb 2008 11:57:07 +0000 Subject: [PATCH] Remove the requirement that all ops have a constructor, since many of them just use the default. Signed-off-by: Ronald G. Minnich Acked-by: Carl-Daniel Hailfinger git-svn-id: svn://coreboot.org/repository/coreboot-v3@579 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- device/device.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/device/device.c b/device/device.c index 9a1c656ceb..3694276a92 100644 --- a/device/device.c +++ b/device/device.c @@ -126,7 +126,7 @@ struct constructor *find_constructor(struct device_id *id) for (c = all_constructors[i]; c->ops; c++) { printk(BIOS_SPEW, "%s: cons %p, cons id %s\n", __func__, c, dev_id_string(&c->id)); - if ((!c->ops) || (!c->ops->constructor)) { + if (!c->ops) { continue; } if (id_eq(&c->id, id)) { @@ -182,8 +182,12 @@ void constructor(struct device *dev, struct device_id *id) c = find_constructor(id); printk(BIOS_SPEW, "%s: constructor is %p\n", __func__, c); - if(c && c->ops && c->ops->constructor) - c->ops->constructor(dev, c); + if(c && c->ops) { + if(c->ops->constructor) + c->ops->constructor(dev, c); + else + default_device_constructor(dev, c); + } else printk(BIOS_INFO, "No constructor called for %s.\n", dev_id_string(&c->id));