[dahdi-commits] fjoe: freebsd/trunk r8737 - in /freebsd/trunk: drivers/dahdi/ drivers/dahdi/v...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Tue Jun 1 12:09:16 CDT 2010
Author: fjoe
Date: Tue Jun 1 12:09:14 2010
New Revision: 8737
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8737
Log:
Reduce the number of #if defined(__FreeBSD__):
pretend that we have Linux 2.6.32 KPI.
Modified:
freebsd/trunk/drivers/dahdi/dahdi_dynamic_eth.c
freebsd/trunk/drivers/dahdi/dahdi_dynamic_ethmf.c
freebsd/trunk/drivers/dahdi/voicebus/GpakCust.c
freebsd/trunk/drivers/dahdi/voicebus/voicebus.c
freebsd/trunk/drivers/dahdi/wctdm24xxp/xhfc.c
freebsd/trunk/drivers/dahdi/wcte12xp/base.c
freebsd/trunk/freebsd/dahdi/bsd-compat.c
freebsd/trunk/include/dahdi/compat/bsd.h
freebsd/trunk/include/dahdi/kernel.h
Modified: freebsd/trunk/drivers/dahdi/dahdi_dynamic_eth.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/dahdi_dynamic_eth.c?view=diff&rev=8737&r1=8736&r2=8737
==============================================================================
--- freebsd/trunk/drivers/dahdi/dahdi_dynamic_eth.c (original)
+++ freebsd/trunk/drivers/dahdi/dahdi_dynamic_eth.c Tue Jun 1 12:09:14 2010
@@ -442,7 +442,7 @@
z->subaddr = htons(sub);
}
z->dev = dev_get_by_name(
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+#if !defined(__FreeBSD__) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
&init_net,
#endif
z->ethdev);
Modified: freebsd/trunk/drivers/dahdi/dahdi_dynamic_ethmf.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/dahdi_dynamic_ethmf.c?view=diff&rev=8737&r1=8736&r2=8737
==============================================================================
--- freebsd/trunk/drivers/dahdi/dahdi_dynamic_ethmf.c (original)
+++ freebsd/trunk/drivers/dahdi/dahdi_dynamic_ethmf.c Tue Jun 1 12:09:14 2010
@@ -455,7 +455,7 @@
unsigned short subaddr;
struct net_device *dev;
int spans_ready = 0, index = 0;
-#if !defined(__FreeBSD__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10)
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
unsigned long flags;
#endif
@@ -748,7 +748,7 @@
return NULL;
}
z->dev = dev_get_by_name(
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
+#if !defined(__FreeBSD__) && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
&init_net,
#endif
z->ethdev);
Modified: freebsd/trunk/drivers/dahdi/voicebus/GpakCust.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/voicebus/GpakCust.c?view=diff&rev=8737&r1=8736&r2=8737
==============================================================================
--- freebsd/trunk/drivers/dahdi/voicebus/GpakCust.c (original)
+++ freebsd/trunk/drivers/dahdi/voicebus/GpakCust.c Tue Jun 1 12:09:14 2010
@@ -400,7 +400,7 @@
* the hardware can take some time while messages are sent to the VPMADT032
* module and the driver waits for the responses.
*/
-#if !defined(__FreeBSD__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static void vpmadt032_bh(void *data)
{
struct vpmadt032 *vpm = data;
@@ -670,7 +670,7 @@
goto failed_exit;
}
-#if !defined(__FreeBSD__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&vpm->work, vpmadt032_bh, vpm);
#else
INIT_WORK(&vpm->work, vpmadt032_bh);
Modified: freebsd/trunk/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=8737&r1=8736&r2=8737
==============================================================================
--- freebsd/trunk/drivers/dahdi/voicebus/voicebus.c (original)
+++ freebsd/trunk/drivers/dahdi/voicebus/voicebus.c Tue Jun 1 12:09:14 2010
@@ -1236,7 +1236,7 @@
voicebus_stop(vb);
/* Make sure the underrun_work isn't running or going to run. */
-#if !defined(__FreeBSD__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
flush_scheduled_work();
#else
cancel_work_sync(&vb->underrun_work);
@@ -1573,7 +1573,7 @@
* @work: The work_struct used to queue this function.
*
*/
-#if !defined(__FreeBSD__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static void handle_hardunderrun(void *data)
{
struct voicebus *vb = data;
@@ -1751,7 +1751,7 @@
vb->timer.data = (unsigned long)vb;
#endif
-#if !defined(__FreeBSD__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
INIT_WORK(&vb->underrun_work, handle_hardunderrun, vb);
#else
INIT_WORK(&vb->underrun_work, handle_hardunderrun);
@@ -1944,7 +1944,7 @@
spin_unlock(&loader_list_lock);
if (!loader_present) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
+#if defined(__FreeBSD__) || LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
ret = request_module("dahdi_vpmadt032_loader");
#else
/* If we use the blocking 'request_module' here and we are
Modified: freebsd/trunk/drivers/dahdi/wctdm24xxp/xhfc.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wctdm24xxp/xhfc.c?view=diff&rev=8737&r1=8736&r2=8737
==============================================================================
--- freebsd/trunk/drivers/dahdi/wctdm24xxp/xhfc.c (original)
+++ freebsd/trunk/drivers/dahdi/wctdm24xxp/xhfc.c Tue Jun 1 12:09:14 2010
@@ -2367,7 +2367,7 @@
/*
*/
-#if !defined(__FreeBSD__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static void xhfc_work(void *data)
{
struct b400m *b4 = data;
@@ -2619,7 +2619,7 @@
snprintf(b4->name, sizeof(b4->name) - 1, "b400m-%d",
b4->b400m_no);
b4->xhfc_ws = create_singlethread_workqueue(b4->name);
-#if !defined(__FreeBSD__) && if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
INIT_WORK(&b4->xhfc_wq, xhfc_work, b4);
# else
INIT_WORK(&b4->xhfc_wq, xhfc_work);
Modified: freebsd/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8737&r1=8736&r2=8737
==============================================================================
--- freebsd/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ freebsd/trunk/drivers/dahdi/wcte12xp/base.c Tue Jun 1 12:09:14 2010
@@ -1831,7 +1831,7 @@
t1_receiveprep(wc, vbb->data);
}
-#if !defined(__FreeBSD__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static void timer_work_func(void *param)
{
struct t1 *wc = param;
@@ -1914,7 +1914,7 @@
setup_timer(&wc->timer, te12xp_timer, (unsigned long)wc);
# endif
-# if !defined(__FreeBSD__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
INIT_WORK(&wc->timer_work, timer_work_func, wc);
# else
INIT_WORK(&wc->timer_work, timer_work_func);
Modified: freebsd/trunk/freebsd/dahdi/bsd-compat.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/freebsd/dahdi/bsd-compat.c?view=diff&rev=8737&r1=8736&r2=8737
==============================================================================
--- freebsd/trunk/freebsd/dahdi/bsd-compat.c (original)
+++ freebsd/trunk/freebsd/dahdi/bsd-compat.c Tue Jun 1 12:09:14 2010
@@ -123,8 +123,16 @@
mtx_init(&t->mtx, "dahdi timer lock", NULL, MTX_SPIN);
callout_init(&t->callout, CALLOUT_MPSAFE);
t->expires = 0;
- t->function = 0;
- t->data = 0;
+ // function and data are not initialized intentionally:
+ // they are not initialized by Linux implementation too
+}
+
+void
+setup_timer(struct timer_list *t, void (*function)(unsigned long), unsigned long data)
+{
+ t->function = function;
+ t->data = data;
+ init_timer(t);
}
void
Modified: freebsd/trunk/include/dahdi/compat/bsd.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/dahdi/compat/bsd.h?view=diff&rev=8737&r1=8736&r2=8737
==============================================================================
--- freebsd/trunk/include/dahdi/compat/bsd.h (original)
+++ freebsd/trunk/include/dahdi/compat/bsd.h Tue Jun 1 12:09:14 2010
@@ -14,8 +14,8 @@
#include <machine/atomic.h>
#include <machine/bus.h>
-#define LINUX_VERSION_CODE -1
-#define KERNEL_VERSION(x, y, z) 0
+#define LINUX_VERSION_CODE KERNEL_VERSION(2, 6, 32)
+#define KERNEL_VERSION(x, y, z) (((x) << 16) + ((y) << 8) + (z))
/*
* Byte order API
@@ -188,6 +188,7 @@
};
void init_timer(struct timer_list *t);
+void setup_timer(struct timer_list *t, void (*function)(unsigned long), unsigned long data);
void mod_timer(struct timer_list *t, unsigned long expires);
void add_timer(struct timer_list *t);
void del_timer(struct timer_list *t);
@@ -287,6 +288,7 @@
#define KERN_NOTICE "<5>" /* normal but significant condition */
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */
+#define KERN_CONT ""
#define dev_err(dev, fmt, args...) device_printf(*(dev), fmt, ##args)
#define dev_warn(dev, fmt, args...) device_printf(*(dev), fmt, ##args)
@@ -297,6 +299,7 @@
#define pr_info(fmt, args...) printf(fmt, ##args)
#define printk(fmt, args...) printf(fmt, ##args)
+#define vprintk(fmt, args) vprintf(fmt, args)
int printk_ratelimit(void);
@@ -448,6 +451,8 @@
#define DAHDI_IRQ_HANDLER(a) static int a(void *dev_id)
+#define clamp(x, low, high) min(max(low, x), high)
+
extern u_short fcstab[256];
/*
Modified: freebsd/trunk/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/dahdi/kernel.h?view=diff&rev=8737&r1=8736&r2=8737
==============================================================================
--- freebsd/trunk/include/dahdi/kernel.h (original)
+++ freebsd/trunk/include/dahdi/kernel.h Tue Jun 1 12:09:14 2010
@@ -1238,14 +1238,12 @@
#define clamp(x, low, high) min (max (low, x), high)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
-#if !defined(__FreeBSD__)
/* Some distributions backported fatal_signal_pending so we'll use a macro to
* override the inline functino definition. */
#define fatal_signal_pending(p) \
(signal_pending((p)) && sigismember(&(p)->pending.signal, SIGKILL))
-#endif
-
-#if !defined(__FreeBSD__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
static inline void list_replace(struct list_head *old, struct list_head *new)
{
new->next = old->next;
More information about the dahdi-commits
mailing list