[zaptel-commits] kpfleming: branch 1.2 r2118 - in /branches/1.2/xpp: Makefile xbus-core.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Wed Feb 7 14:20:31 MST 2007


Author: kpfleming
Date: Wed Feb  7 15:20:30 2007
New Revision: 2118

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2118
Log:
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

Modified:
    branches/1.2/xpp/Makefile
    branches/1.2/xpp/xbus-core.c

Modified: branches/1.2/xpp/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/Makefile?view=diff&rev=2118&r1=2117&r2=2118
==============================================================================
--- branches/1.2/xpp/Makefile (original)
+++ branches/1.2/xpp/Makefile Wed Feb  7 15:20:30 2007
@@ -8,11 +8,12 @@
 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
 
@@ -41,7 +42,6 @@
 $(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 $@ ; \

Modified: branches/1.2/xpp/xbus-core.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/xbus-core.c?view=diff&rev=2118&r1=2117&r2=2118
==============================================================================
--- branches/1.2/xpp/xbus-core.c (original)
+++ branches/1.2/xpp/xbus-core.c Wed Feb  7 15:20:30 2007
@@ -428,25 +428,19 @@
 }
 
 /*
- * 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 @@
 	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 @@
 	wake_up(&xbus->wait_for_xpd_initialization);
 out:
 	up_read(&xbus->in_use);
-	return ret;
+	return;
 }
 
 
@@ -580,8 +568,14 @@
 	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 */



More information about the zaptel-commits mailing list