设备驱动模型之子系统注册: int subsys_interface_register(struct subsys_interface *sif) {  struct bus_type *subsys;  struct subsys_dev_iter iter;  struct device *dev;


if (!sif || !sif->subsys)
  return -ENODEV;
 subsys = bus_get(sif->subsys);
 if (!subsys)
  return -EINVAL;
 mutex_lock(&subsys->p->mutex);
 list_add_tail(&sif->node, &subsys->p->interfaces);
 if (sif->add_dev) {
  subsys_dev_iter_init(&iter, subsys, NULL, NULL);
  while ((dev = subsys_dev_iter_next(&iter)))
   sif->add_dev(dev, sif);
  subsys_dev_iter_exit(&iter);
 }
 mutex_unlock(&subsys->p->mutex);
 return 0;
}