lkml.org 
[lkml]   [2010]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: wait_for_completion_interruptible does not wait !! [During PM suspend]
On Sun, Jun 20, 2010 at 12:23 AM, Jiri Slaby <jirislaby@gmail.com> wrote:
> On 06/20/2010 08:52 AM, Suresh Rajashekara wrote:
>> The ioctl waits on a completion variable (using
>> wait_for_completion_interruptible).
> ...
>> I tried wait_for_completion instead, but now the kernel refuses to suspend.
>
> Do you check return value of wait_for_completion_interruptible and
> return its value if nonzero?
>
> We need the code to comment, otherwise it's hard to say.

No. I am not checking the return value of the
wait_for_completion_interruptible. I can do it

The code is as follows. I have cut the relevant portion of the code
and pasted in to the email

My test application. The actual application is exactly similar (actual
application has different names)
<SNIP>
void *headset_detect_thread_start ( void *private_date )
{
int hs_fd = 0;
int iState = 0;
hs_fd = open("/dev/adc", O_RDWR);

if ( hs_fd == -1 ) {
printf("The headset device could not be opened\n");
goto hs_thread_exit;
}
for (;;) {
pthread_testcancel();
ioctl(hs_fd, IOCTL_CODEC_HEADSET_DETECT, &iState);
pthread_testcancel();
if ( iState )
printf("\n++++ Headset Insertion detected\n");
else
printf("\n---- Headset Removal detected\n");
SignalEvent(); // Dummy function, but the actual application
does inside the function
}
hs_thread_out:
close(hs_fd);
hs_thread_exit:
pthread_exit(NULL);
}
</SNIP>

Kernel Code:

/* Code from Ioctl of the codec driver*/
<SNIP>
case IOCTL_CODEC_HEADSET_DETECT:
headset_detect();
headset_detect_state = get_hsdetect_state();
copy_to_user( argp, &headset_detect_state, sizeof(int)) ;
break;
</SNIP>
implementation of headset_detect in the codec driver
<SNIP>
void headset_detect(void){
/* This variable is completed in interrupt handler */
wait_for_completion_interruptible(&drv_priv->headset_completion);
}
</SNIP>
Thanks,
Suresh


\
 
 \ /
  Last update: 2010-06-20 09:45    [W:0.077 / U:0.336 seconds]
©2003-2014 Jasper Spaans. Advertise on this site