lkml.org 
[lkml]   [2000]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectWait Queues
Date
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 5.50.4134.600" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Tahoma size=2>I am trying to modify a driver that worked great
on 2.2.16 to 2.4.0-x..</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>My old code was:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>static struct wait_queue *roundrobin_wait;
<BR>static struct wait_queue *task_stop_wait; <BR>&nbsp;<BR>static struct
tq_struct roundrobin_task; <BR>static struct timer_list timeout_timer;
</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>...</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma
size=2>init_timer(&amp;timeout_timer);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<BR>timeout_timer.function = Timer; <BR>timeout_timer.data = (unsigned
long)&amp;timer_data; <BR>timeout_timer.expires = jiffies + 3*HZ;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>void Timer(unsigned long ptr) <BR>{
<BR>&nbsp;&nbsp;&nbsp; struct clientdata *pTimerData = (struct clientdata *)
ptr;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>if
(pTimerData-&gt;one_shot_queue_task){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// start the main round robin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
queue_task(&amp;roundrobin_task, &amp;tq_scheduler);
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pTimerData-&gt;one_shot_queue_task = FALSE;<BR>&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>&nbsp;&nbsp;&nbsp; /* wake-up the task responsible
for the Timeout callbacks round-robin */<BR>&nbsp;&nbsp;&nbsp;
wake_up_interruptible(&amp;roundrobin_wait); </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>&nbsp;&nbsp;&nbsp; /* re-schedule this Timer
function */<BR>&nbsp;&nbsp;&nbsp;
init_timer(&amp;timeout_timer);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<BR>&nbsp;&nbsp;&nbsp; timeout_timer.function = Timer; <BR>&nbsp;&nbsp;&nbsp;
timeout_timer.data = (unsigned long)&amp;timer_data; <BR>&nbsp;&nbsp;&nbsp;
timeout_timer.expires = jiffies + HZ/100; <BR>&nbsp;&nbsp;&nbsp;
add_timer(&amp;timeout_timer); <BR>} <BR>&nbsp;<BR>void RoundRobin(void *ptr)
<BR>{ <BR>&nbsp;&nbsp;&nbsp; struct clientdata *data = (struct clientdata *)
ptr;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>&nbsp;&nbsp;&nbsp;
interruptible_sleep_on(&amp;roundrobin_wait); </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>&nbsp;&nbsp;&nbsp; if
(data-&gt;queue)&nbsp;&nbsp;&nbsp; // data-&gt;queue set to NULL in
Stop()<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*
do whatever you want to do here ... */
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OSALTimeoutCallback *pCallback =
data-&gt;callback; </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pCallback-&gt;RoundRobinCallbacks(); <BR>&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>&nbsp;&nbsp;&nbsp; /* re-register itself, if
needed */ <BR>&nbsp;&nbsp;&nbsp; roundrobin_task.routine = RoundRobin;
//main_round_robin; <BR>&nbsp;&nbsp;&nbsp; roundrobin_task.data = (void *)
&amp;roundrobin_data; <BR>&nbsp;&nbsp;&nbsp; if
(data-&gt;queue)<BR>&nbsp;&nbsp;&nbsp; {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; queue_task(&amp;roundrobin_task,
data-&gt;queue); <BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp; else
<BR>&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
wake_up_interruptible(&amp;task_stop_wait); </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>&nbsp;&nbsp;&nbsp; } <BR>} </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2><STRONG>Carlo Pagano</STRONG></FONT></DIV>
<DIV><FONT face=Tahoma size=2>Software Designer</FONT></DIV>
<DIV><FONT face=Tahoma size=2>Trisignal Communications, a division
of&nbsp;i-data Technology</FONT></DIV>
<DIV><FONT face=Tahoma size=2>(514) 832-3603</FONT></DIV>
<DIV><A href="mailto:carlop@trisignal.com"><FONT face=Tahoma
size=2>carlop@trisignal.com</FONT></A></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>
\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.047 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site