summaryrefslogtreecommitdiff
path: root/xpp/xbus-core.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-02-07 20:29:22 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-02-07 20:29:22 +0000
commit237daca586a95a8f46c5e3326acf9015a004bf1b (patch)
tree052ef72671e0b8b7b423d3941d6741e98281a7d9 /xpp/xbus-core.c
parentab60762aebbdb955b1057e1ff7d62e3b1979accc (diff)
build XPP on the kernels that Xorcom says are OK to build on
update workqueue usage to conform to kernel 2.6.20 API git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2110 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xbus-core.c')
-rw-r--r--xpp/xbus-core.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/xpp/xbus-core.c b/xpp/xbus-core.c
index d39c10c..ca14b38 100644
--- a/xpp/xbus-core.c
+++ b/xpp/xbus-core.c
@@ -72,7 +72,6 @@ DEF_PARM(uint, poll_timeout, POLL_TIMEOUT,"Timeout (in jiffies) waiting for unit
static DEVICE_ATTR_FUNC(connector_show, dev, buf);
static DEVICE_ATTR_FUNC(status_show, dev, buf);
-static int xbus_poll(void *data);
static void xbus_release(struct device *dev);
static int xbus_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data);
static int xbus_read_waitfor_xpds(char *page, char **start, off_t off, int count, int *eof, void *data);
@@ -429,8 +428,16 @@ out:
* it returns only when all XPD's on the bus are detected and
* initialized.
*/
-static int xbus_poll(void *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;
@@ -440,11 +447,10 @@ static int xbus_poll(void *data)
struct list_head additions_list;
int count_removed;
int count_added;
- xbus_t *xbus = data;
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);
@@ -543,7 +549,6 @@ static int xbus_poll(void *data)
wake_up(&xbus->wait_for_xpd_initialization);
out:
up_read(&xbus->in_use);
- return ret;
}
@@ -560,7 +565,11 @@ void xbus_activate(xbus_t *xbus)
xbus->hardware_exists = 1;
DBG("Activating: %s\n", xbus->busname);
/* Poll it */
- INIT_WORK(&xbus->xpds_init_work, (void (*)(void *))xbus_poll, (void *)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 */