summaryrefslogtreecommitdiff
path: root/xpp
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-02-07 21:20:30 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-02-07 21:20:30 +0000
commit12adaa05721959bf0400a5194d33fa2eeeb60c20 (patch)
tree34f18a19326dcc820944332323af2744e0bd21a2 /xpp
parentf0c640e9744f955d52f11ffba02d2397f0c23cfe (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')
-rw-r--r--xpp/Makefile6
-rw-r--r--xpp/xbus-core.c40
2 files changed, 20 insertions, 26 deletions
diff --git a/xpp/Makefile b/xpp/Makefile
index 1588416..bf4b14b 100644
--- a/xpp/Makefile
+++ b/xpp/Makefile
@@ -8,12 +8,13 @@ EXTRA_CFLAGS = $(XPP_LOCAL_CFLAGS) \
ifneq (,$(filter y m,$(CONFIG_DEBUG_FS)))
EXTRA_CFLAGS += -DXPP_DEBUGFS
endif
+
+ZAPTEL_DIR = $(SUBDIRS)
+
ifneq (,$(shell grep -w echo_can_state_t $(ZAPTEL_DIR)/zaptel.h))
EXTRA_CFLAGS += -DZAPTEL_EC_TYPEDEF
endif
-ZAPTEL_DIR = $(SUBDIRS)
-
obj-m += xpp.o xpd_fxs.o xpd_fxo.o
HAS_BRISTUFF := $(shell cpp $(CPPFLAGS) -dM $(ZAPTEL_DIR)/zconfig.h | sed -n 's/^.*CONFIG_ZAPATA_BRI_DCHANS/y/p')
@@ -41,7 +42,6 @@ clean-files := xpp_version.h
$(obj)/card_fxs.o $(obj)/card_fxo.o $(obj)/card_bri.o $(obj)/xpp_usb.o $(obj)/xpp.o: $(obj)/xpp_version.h
$(obj)/xpp_version.h: FORCE
- $(Q)echo "Compile for $(XPP_VERSION_STR)"
$(Q)echo '#define XPP_VERSION $(XPP_VERSION_STR)' > $@.tmp
$(Q)if cmp -s $@.tmp $@ ; then echo; else \
mv $@.tmp $@ ; \
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 */