diff options
author | kpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-02-07 21:20:30 +0000 |
---|---|---|
committer | kpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-02-07 21:20:30 +0000 |
commit | 12adaa05721959bf0400a5194d33fa2eeeb60c20 (patch) | |
tree | 34f18a19326dcc820944332323af2744e0bd21a2 /xpp/xbus-core.c | |
parent | f0c640e9744f955d52f11ffba02d2397f0c23cfe (diff) |
don't reference ZAPTEL_DIR before it has been defined
don't print a pointless 'Compile for Unknown' message (if you want a version string, use the top-level version string that we've already created)
use a simpler method of conforming to the 2.6.20 workqueue API... there is no need to document the change in the code, nor #define entries that are only used in one place
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2118 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xbus-core.c')
-rw-r--r-- | xpp/xbus-core.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/xpp/xbus-core.c b/xpp/xbus-core.c index 5260804..f68d04a 100644 --- a/xpp/xbus-core.c +++ b/xpp/xbus-core.c @@ -428,25 +428,19 @@ out: } /* - * Workqueue API change in kernel 2.6.20 - * The work function always receives the work_struct as parameter - * and not an arbitrary pointer. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -#define WORK_DATA void -#define XBUS_WORK(xbus) INIT_WORK(&(xbus)->xpds_init_work, (void (*)(void *))xbus_poll, (void *)(xbus)) -#else -#define WORK_DATA struct work_struct -#define XBUS_WORK(xbus) INIT_WORK(&(xbus)->xpds_init_work, (work_func_t)xbus_poll) -#endif - -/* * This must be called from synchronous (non-interrupt) context * it returns only when all XPD's on the bus are detected and * initialized. */ -static int xbus_poll(WORK_DATA *data) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) +static void xbus_poll(struct work_struct *work) { + xbus_t *xbus = container_of(work, xbus_t, xpds_init_work); +#else +static void xbus_poll(void *data) + xbus_t *xbus = data; +#endif + int id; int ret = 0; unsigned long flags; @@ -456,16 +450,10 @@ static int xbus_poll(WORK_DATA *data) struct list_head additions_list; int count_removed; int count_added; - xbus_t *xbus; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - xbus = data; -#else - xbus = container_of(data, xbus_t, xpds_init_work); -#endif if(!down_read_trylock(&xbus->in_use)) { ERR("%s is being removed...\n", xbus->busname); - return -EBUSY; + return; } msleep(2); /* roundtrip for older polls */ spin_lock_irqsave(&xbus->lock, flags); @@ -564,7 +552,7 @@ static int xbus_poll(WORK_DATA *data) wake_up(&xbus->wait_for_xpd_initialization); out: up_read(&xbus->in_use); - return ret; + return; } @@ -580,8 +568,14 @@ void xbus_activate(xbus_t *xbus) BUG_ON(!ops->xframe_new || !ops->xframe_free); xbus->hardware_exists = 1; DBG("Activating: %s\n", xbus->busname); + /* Poll it */ - XBUS_WORK(xbus); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + INIT_WORK(&xbus->xpds_init_work, xbus_poll); +#else + INIT_WORK(&xbus->xpds_init_work, xbus_poll, xbus); +#endif + if(!queue_work(xpp_worker, &xbus->xpds_init_work)) { ERR("Failed to queue xpd initialization work\n"); /* FIXME: need to return error */ |