Are you talking about this comment?
It isn't wrong. device_add() may indeed be called with a device
semaphore held -- just not the semaphore for the device being added.
Quite often it is called with device's parent's semaphore held. The
implication is not that we may deadlock in bus_attach_device(); rather
it is that the order of acquisition must always be device semaphore
first, dev_list_mutex second.
No, you have missed the entire point. The problem doesn't exist in the
current code; it exists only if we switch over to using a single list.
Routines like dpm_suspend() won't be able to use list_for_each_entry()
to traverse the list because entries may be removed by other threads
during the traversal. Even list_for_each_entry_safe() won't work
correctly without careful attention to details.
Alan Stern
--