On Wed, 8 Jul 2009, Magnus Damm wrote: > >> > All good with the code above, but there seem to be some issue with how > >> > usage_count is counted up and down and when runtime_disabled is set: > >> > > >> > 1. pm_runtime_init(): usage_count = 1, runtime_disabled = true > >> > 2. driver_probe_device(): pm_runtime_get_sync() > >> > 3. pm_runtime_get_sync(): usage_count = 2 > >> > 4. device driver probe(): pm_runtime_enable() > >> > 5. pm_runtime_enable(): usage_count = 1 > >> > 6. driver_probe_device(): pm_runtime_put() > >> > 7. pm_runtime_put(): usage_count = 0 > >> > > >> > I expect runtime_disabled = false in 7. > > > > Wasn't it? It should have been set to false in step 4 and remained > > that way. > > I may misunderstand, but in v8 won't the pm_runtime_enable() function > do a atomic_dec_test() where the counter value will go from 2 to 1 in > the case above? This would mean that atomic_dec_test() returns false > so runtime_disabled is never modified. There still hasn't been any time for me to look through the code. It sounds like Rafael was trying to use one counter for two separate purposes. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html