What's the purpose of subsys_interface in linux/device.h?

Perr Zhang strongbox8 at zoho.com
Thu Dec 15 10:16:05 EST 2016


Hi, I am reading the code here: device_add()->bus_probe_device()
the source code of bus_probe_device() is:

void bus_probe_device(struct device *dev)
{
        struct bus_type *bus = dev->bus;
        struct subsys_interface *sif;
        ......
        mutex_lock(&bus->p->mutex);
        list_for_each_entry(sif, &bus->p->interfaces, node)
                if (sif->add_dev)
                        sif->add_dev(dev, sif);
        mutex_unlock(&bus->p->mutex);
}
location: http://lxr.free-electrons.com/source/drivers/base/bus.c#L543

Problem:
I have already read the relational code of struct subsys_interface, and can't
figure out the purpose of struce subsys_interface and its method add_dev()

Thank you,

--
Perr




More information about the Kernelnewbies mailing list