W dniu 17 lutego 2010 19:22 użytkownik Rafał Miłecki <zaj...@gmail.com> napisał:
> W dniu 15 lutego 2010 18:52 użytkownik Rafał Miłecki <zaj...@gmail.com> 
> napisał:
>> 2010/2/15 Jaime Velasco Juan <jsagarri...@gmail.com>:
>>> The old code used a false condition so it always waited until
>>> timeout
>>>
>>> Signed-off-by: Jaime Velasco Juan <jsagarri...@gmail.com>
>>> ---
>>>  drivers/gpu/drm/radeon/radeon_pm.c |   10 ++++++----
>>>  1 files changed, 6 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c 
>>> b/drivers/gpu/drm/radeon/radeon_pm.c
>>> index a8e151e..842952f 100644
>>> --- a/drivers/gpu/drm/radeon/radeon_pm.c
>>> +++ b/drivers/gpu/drm/radeon/radeon_pm.c
>>> @@ -337,10 +337,12 @@ static void radeon_pm_set_clocks(struct radeon_device 
>>> *rdev)
>>>                rdev->pm.req_vblank |= (1 << 1);
>>>                drm_vblank_get(rdev->ddev, 1);
>>>        }
>>> -       if (rdev->pm.active_crtcs)
>>> -               wait_event_interruptible_timeout(
>>> -                       rdev->irq.vblank_queue, 0,
>>> -                       msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT));
>>> +       if (rdev->pm.active_crtcs) {
>>> +               long timeout = msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT);
>>> +               __wait_event_interruptible_timeout(
>>> +                       rdev->irq.vblank_queue, 1,
>>> +                       timeout);
>>> +       }
>>
>> Yeah, it seems logic was wrong, thanks.
>
> To make it clear (I didn't understand that correctly earlier):
>
> include/linux/wait.h:
> wait_event_interruptible_timeout - sleep until a condition gets true
> or a timeout elapses
>
> So using your __ prefix and "1" as condition argument is some hack
> that could work indeed...
>
> But maybe there is some "real" kernel function that simply waits for
> wake_up with timeout?

Your solution doesn't work because __wait_event_interruptible checks
once more for condition before scheduling. If finds "1" and so it
breaks loop immediately.

-- 
Rafał

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to