[openib-general] Re: [PATCH 9 of 20] ipath - char devices for diagnostics and lightweight subnet management
Roland Dreier
rdreier at cisco.com
Fri Mar 10 09:08:16 PST 2006
Bryan> OK. What's a safe way to iterate over the devices in the
Bryan> presence of hotplug, then? I assume it's
Bryan> list_for_each_mumble; I just don't know what mumble is :-)
You need something that takes a reference to each device while you're
looking at it, like for_each_pci_dev(). But in general iterating
through devices is usually the wrong thing to do, because devices can
come and go in the middle of your loop. It's better to be driven by
the add and remove callbacks.
Bryan> No, ipath_max is updated any time a probe routine is
Bryan> called.
Yes, that's true. (BTW, what does making ipath_max an atomic_t get
you? The updates are protected by a lock anyway). But I was talking
about the code in ipath_verbs_init(), which is the only place you call
ipath_verbs_register() that I could find. You make one pass through
the devices that are present when ipath_verbs_init() is called at
module load time, and any devices that get added later are missed.
Similarly, if a device is unplugged while the verbs module is loaded,
there's no notification from the core driver of that, and you'll go
ahead and do ipath_verbs_unregister() on a device that is long gone
when you get to ipath_verbs_cleanup().
- R.
More information about the general
mailing list