* Initialize a specific device. * * The parent should be initialized first to avoid having an ordering problem. * This is done by calling the parent's init() method before its children's * init() methods. * * @param dev The device to be initialized. */
| 537 | * @param dev The device to be initialized. |
| 538 | */ |
| 539 | static void init_dev(struct device *dev) |
| 540 | { |
| 541 | if (!dev->enabled) |
| 542 | return; |
| 543 | |
| 544 | if (!dev->initialized && dev->ops && dev->ops->init) { |
| 545 | struct stopwatch sw; |
| 546 | long init_time; |
| 547 | |
| 548 | if (dev->path.type == DEVICE_PATH_I2C) { |
| 549 | printk(BIOS_DEBUG, "smbus: %s->", dev_path(dev->upstream->dev)); |
| 550 | } |
| 551 | |
| 552 | printk(BIOS_DEBUG, "%s init\n", dev_path(dev)); |
| 553 | |
| 554 | stopwatch_init(&sw); |
| 555 | dev->initialized = 1; |
| 556 | dev->ops->init(dev); |
| 557 | |
| 558 | init_time = stopwatch_duration_msecs(&sw); |
| 559 | printk(BIOS_DEBUG, "%s init finished in %ld msecs\n", dev_path(dev), |
| 560 | init_time); |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | static void init_link(struct bus *link) |
| 565 | { |
no test coverage detected