Changeset 125


Ignore:
Timestamp:
Jun 10, 2007, 8:14:08 AM (13 years ago)
Author:
Brendan Oakley
Message:

Added some tasklet code to correct type mismatches with task queues

Location:
GPL/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk/alsa-kernel/include/sound/compat_22.h

    r118 r125  
    380380#define up_write(x) up(x)
    381381
    382 /* this is identical with tq_struct but the "routine" field is renamed to "func" */
    383 struct tasklet_struct {
    384         struct tasklet_struct *next;    /* linked list of active bh's */
    385         unsigned long sync;             /* must be initialized to zero */
    386         void (*func)(void *);           /* function to call */
    387         void *data;                     /* argument to function */
    388 };
    389 
    390 #define tasklet_init(t,f,d)     do { \
    391         (t)->next = NULL; \
    392         (t)->sync = 0; \
    393         (t)->func = (void (*)(void *))(f); \
    394         (t)->data = (void *)(d); \
    395 } while (0)
    396 
    397382#define tasklet_unlock_wait(t)  while (test_bit(0, &(t)->sync)) { }
    398383#define tasklet_kill(t)         tasklet_unlock_wait(t) /* FIXME: world is not perfect... */
  • GPL/trunk/include/linux/interrupt.h

    r32 r125  
    5050        ISICOM_BH
    5151};
     52/* Tasklets --- multithreaded analogue of BHs.
     53
     54   Main feature differing them of generic softirqs: tasklet
     55   is running only on one CPU simultaneously.
     56
     57   Main feature differing them of BHs: different tasklets
     58   may be run simultaneously on different CPUs.
     59
     60   Properties:
     61   * If tasklet_schedule() is called, then tasklet is guaranteed
     62     to be executed on some cpu at least once after this.
     63   * If the tasklet is already scheduled, but its excecution is still not
     64     started, it will be executed only once.
     65   * If this tasklet is already running on another CPU (or schedule is called
     66     from tasklet itself), it is rescheduled for later.
     67   * Tasklet is strictly serialized wrt itself, but not
     68     wrt another tasklets. If client needs some intertask synchronization,
     69     he makes it with spinlocks.
     70 */
     71
     72struct tasklet_struct
     73{
     74        struct tasklet_struct *next;
     75        unsigned long state;
     76        atomic_t count;
     77        void (*func)(unsigned long);
     78        unsigned long data;
     79};
     80
     81extern void tasklet_hi_schedule(struct tasklet_struct *t);
     82
     83extern void tasklet_init(struct tasklet_struct *t,
     84                         void (*func)(unsigned long), unsigned long data);
    5285
    5386/*
  • GPL/trunk/lib32/task.c

    r32 r125  
    2727#include <linux/fs.h>
    2828#include <linux/tqueue.h>
     29#include <linux/interrupt.h>
    2930#define LINUX
    3031#include <ossdefos2.h>
     
    3334struct task_struct *current = &current_task;
    3435
    35 void tasklet_hi_schedule(struct tq_struct *t)
     36void tasklet_hi_schedule(struct tasklet_struct *t)
    3637{
    37   if(t && t->routine) {
    38         t->routine(t->data);
     38  if(t && t->func) {
     39        t->func(t->data);
    3940  }
     41}
     42
     43void tasklet_init(struct tasklet_struct *t,
     44                  void (*func)(unsigned long), unsigned long data)
     45{
     46        t->next = NULL;
     47        t->state = 0;
     48        t->func = func;
     49        t->data = data;
    4050}
    4151
Note: See TracChangeset for help on using the changeset viewer.