lkml.org 
[lkml]   [2009]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH] PM: Introduce core framework for run-time PM of I/O devices (rev. 8)
    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-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/

    \
     
     \ /
      Last update: 2009-07-08 16:29    [W:2.407 / U:0.756 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site