Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Mon, 11 Dec 2000 11:13:32 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Mon, 11 Dec 2000 11:13:22 -0500 Received: from montreal.eicon.com ([192.219.17.120]:14597 "EHLO mtl_exchange.eicon.com") by vger.kernel.org with ESMTP id ; Mon, 11 Dec 2000 11:13:15 -0500 Message-ID: From: Carlo Pagano To: linux-kernel@vger.kernel.org Subject: Wait Queues Date: Mon, 11 Dec 2000 10:43:35 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1460.8) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C06389.1F9140BA" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C06389.1F9140BA Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am trying to modify a driver that worked great on 2.2.16 to 2.4.0-x.. =A0 My old code was: =A0 static struct wait_queue *roundrobin_wait;=20 static struct wait_queue *task_stop_wait;=20 =A0 static struct tq_struct roundrobin_task;=20 static struct timer_list timeout_timer;=20 =A0 ... =A0 init_timer(&timeout_timer);=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=20 timeout_timer.function =3D Timer;=20 timeout_timer.data =3D (unsigned long)&timer_data;=20 timeout_timer.expires =3D jiffies + 3*HZ; =A0 void Timer(unsigned long ptr)=20 {=20 =A0=A0=A0 struct clientdata *pTimerData =3D (struct clientdata *) ptr; =A0 if (pTimerData->one_shot_queue_task){ =A0=A0=A0=A0=A0=A0=A0 // start the main round robin =A0=A0=A0=A0=A0=A0=A0 queue_task(&roundrobin_task, &tq_scheduler);=20 =A0=A0=A0=A0=A0=A0=A0 pTimerData->one_shot_queue_task =3D FALSE; =A0=A0=A0 } =A0 =A0=A0=A0 /* wake-up the task responsible for the Timeout callbacks = round-robin */ =A0=A0=A0 wake_up_interruptible(&roundrobin_wait);=20 =A0 =A0=A0=A0 /* re-schedule this Timer function */ =A0=A0=A0 = init_timer(&timeout_timer);=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=20 =A0=A0=A0 timeout_timer.function =3D Timer;=20 =A0=A0=A0 timeout_timer.data =3D (unsigned long)&timer_data;=20 =A0=A0=A0 timeout_timer.expires =3D jiffies + HZ/100;=20 =A0=A0=A0 add_timer(&timeout_timer);=20 }=20 =A0 void RoundRobin(void *ptr)=20 {=20 =A0=A0=A0 struct clientdata *data =3D (struct clientdata *) ptr; =A0 =A0=A0=A0 interruptible_sleep_on(&roundrobin_wait);=20 =A0 =A0=A0=A0 if (data->queue)=A0=A0=A0 // data->queue set to NULL in = Stop() =A0=A0=A0 { =A0=A0=A0=A0=A0=A0=A0 /* do whatever you want to do here ... */=20 =A0=A0=A0=A0=A0=A0=A0 OSALTimeoutCallback *pCallback =3D = data->callback;=20 =A0 =A0=A0=A0=A0=A0=A0=A0 pCallback->RoundRobinCallbacks();=20 =A0=A0=A0 } =A0 =A0=A0=A0 /* re-register itself, if needed */=20 =A0=A0=A0 roundrobin_task.routine =3D RoundRobin; //main_round_robin;=20 =A0=A0=A0 roundrobin_task.data =3D (void *) &roundrobin_data;=20 =A0=A0=A0 if (data->queue) =A0=A0=A0 {=20 =A0=A0=A0=A0=A0=A0=A0 queue_task(&roundrobin_task, data->queue);=20 =A0=A0=A0 }=20 =A0=A0=A0 else=20 =A0=A0=A0 {=20 =A0=A0=A0=A0=A0=A0=A0 wake_up_interruptible(&task_stop_wait);=20 =A0 =A0=A0=A0 }=20 }=20 =A0 =A0 =A0 =A0 =A0 Carlo Pagano Software Designer Trisignal Communications, a division of=A0i-data Technology (514) 832-3603 carlop@trisignal.com =A0 ------_=_NextPart_001_01C06389.1F9140BA Content-Type: text/html; charset="iso-8859-1"
I am trying to modify a driver that worked great on 2.2.16 to 2.4.0-x..
 
My old code was:
 
static struct wait_queue *roundrobin_wait;
static struct wait_queue *task_stop_wait;
 
static struct tq_struct roundrobin_task;
static struct timer_list timeout_timer;
 
...
 
init_timer(&timeout_timer);             
timeout_timer.function = Timer;
timeout_timer.data = (unsigned long)&timer_data;
timeout_timer.expires = jiffies + 3*HZ;
 
void Timer(unsigned long ptr)
{
    struct clientdata *pTimerData = (struct clientdata *) ptr;
 
if (pTimerData->one_shot_queue_task){
        // start the main round robin
        queue_task(&roundrobin_task, &tq_scheduler);
        pTimerData->one_shot_queue_task = FALSE;
    }
 
    /* wake-up the task responsible for the Timeout callbacks round-robin */
    wake_up_interruptible(&roundrobin_wait);
 
    /* re-schedule this Timer function */
    init_timer(&timeout_timer);             
    timeout_timer.function = Timer;
    timeout_timer.data = (unsigned long)&timer_data;
    timeout_timer.expires = jiffies + HZ/100;
    add_timer(&timeout_timer);
}
 
void RoundRobin(void *ptr)
{
    struct clientdata *data = (struct clientdata *) ptr;
 
    interruptible_sleep_on(&roundrobin_wait);
 
    if (data->queue)    // data->queue set to NULL in Stop()
    {
        /* do whatever you want to do here ... */
        OSALTimeoutCallback *pCallback = data->callback;
 
        pCallback->RoundRobinCallbacks();
    }
 
    /* re-register itself, if needed */
    roundrobin_task.routine = RoundRobin; //main_round_robin;
    roundrobin_task.data = (void *) &roundrobin_data;
    if (data->queue)
    {
        queue_task(&roundrobin_task, data->queue);
    }
    else
    {
        wake_up_interruptible(&task_stop_wait);
 
    }
}
 
 
 
 
 
Carlo Pagano
Software Designer
Trisignal Communications, a division of i-data Technology
(514) 832-3603
 
------_=_NextPart_001_01C06389.1F9140BA-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/