When we take the devices off of the list, after list_del(), still under
the lock, we can null out the list pointers. Then, later under the
lock, we can check the pointer before we move to it. We aren't doing
fancy list_* functions with the pci device lists at all.
> > I don't want to try to hold a lock over start/next/stop as that would
> > just be asking for trouble :)
>
> Heh, I agree, it doesn't feel quite right to acquire lock and release
> lock in separate functions, but in the case of start/show/next/stop this
> seems to be the design. Alternative here seems to be keeping thing on
> list with get and deleting from with put on last ref, but that didn't
> look so simple.
No, that isn't the proper model anyway. After the device is removed, we
don't want to still have it floating around on the device lists, even if
someone has a reference to it. That would make things just too
difficult :)
I'll go and try to see how the above proposed changes will work out, and
see if I can see any side affects when beating on /proc/pci on a pci
hotplug box...
thanks,
greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/