No subject
Sun Dec 9 17:34:17 CET 2012
memset(dev, 0, sizeof(*dev));
dev->path = *path;
dev->id = *devid;
/* Initialize the back pointers in the link fields. */
for (link = 0; link < MAX_LINKS; link++) {
dev->link[link].dev = dev;
dev->link[link].link = link;
}
/* By default devices are enabled. */
dev->enabled = 1;
/* Add the new device to the list of children of the bus. */
dev->bus = parent;
if (child) {
child->sibling = dev;
} else {
parent->children = dev;
}
/* Append a new device to the global device list.
* The list is used to find devices once everything is set up.
*/
*last_dev_p = dev;
last_dev_p = &dev->next;
/* Give the device a name. */
sprintf(dev->dtsname, "dynamic %s", dev_path(dev));
/* Run the device specific constructor as last part of the chain
* so it gets the chance to overwrite the "inherited" values above
*/
constructor(dev);
------=_Part_50322_8025613.1224875135292
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<div dir="ltr">Why do we call the constructor function of a new device? I can't see where we ever set it.<br>Thanks,<br>Myles <br><br>From device/device.c:<br><br> memset(dev, 0, sizeof(*dev));<br> dev->path = *path;<br>
dev->id = *devid;<br><br> /* Initialize the back pointers in the link fields. */<br> for (link = 0; link < MAX_LINKS; link++) {<br> dev->link[link].dev = dev;<br> dev->link[link].link = link;<br>
}<br><br> /* By default devices are enabled. */<br> dev->enabled = 1;<br><br> /* Add the new device to the list of children of the bus. */<br> dev->bus = parent;<br> if (child) {<br> child->sibling = dev;<br>
} else {<br> parent->children = dev;<br> }<br><br> /* Append a new device to the global device list.<br> * The list is used to find devices once everything is set up.<br> */<br> *last_dev_p = dev;<br>
last_dev_p = &dev->next;<br><br> /* Give the device a name. */<br> sprintf(dev->dtsname, "dynamic %s", dev_path(dev));<br><br> /* Run the device specific constructor as last part of the chain<br>
* so it gets the chance to overwrite the "inherited" values above<br> */<br><br> constructor(dev);<br></div>
------=_Part_50322_8025613.1224875135292--
More information about the coreboot
mailing list