lkml.org 
[lkml]   [2008]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [Bug 10030] Suspend doesn't work when SD card is inserted
    On Wed, 20 Feb 2008, Rafael J. Wysocki wrote:

    > Well, below is an uncompiled and untested but illustrating the idea that
    > might allow people not to bother with device_pm_schedule_removal()
    > explicitly and can fix the issue at hand.
    >
    > [There are some cases that need handling and are not covered here.]
    >
    > Please have a look.
    >
    > Thanks,
    > Rafael

    > +static struct task_struct *suspending_task;
    > +static DEFINE_MUTEX(suspending_task_mtx);

    I suspect you don't really need this mutex.

    > +bool in_suspend_context(void)
    > +{
    > + bool result;
    > +
    > + mutex_lock(&suspending_task_mtx);
    > + result = (suspending_task == current);
    > + mutex_unlock(&suspending_task_mtx);
    > + return result;
    > +}

    If suspending_task == current then you are guaranteed to be serialized,
    because everything a single task does is serial.

    > @@ -1162,7 +1162,10 @@ void device_destroy(struct class *class,
    > dev = class_find_device(class, &devt, __match_devt);
    > if (dev) {
    > put_device(dev);
    > - device_unregister(dev);
    > + if (in_suspend_context())
    > + device_pm_schedule_removal(dev);
    > + else
    > + device_unregister(dev);
    > }
    > }

    But what about device_del()? Can a similar change be made there?

    Alan Stern



    \
     
     \ /
      Last update: 2008-02-20 23:27    [W:7.159 / U:0.040 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site