[dahdi-commits] fjoe: freebsd/trunk r10599 - in /freebsd/trunk: bsd-kmod/dahdi/ drivers/dahdi/
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Mon Mar 26 15:21:27 CDT 2012
Author: fjoe
Date: Mon Mar 26 15:21:22 2012
New Revision: 10599
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10599
Log:
- dahdi_device_open(): fix "file" initialization
- Fix "make install"
- Fix copying data from userspace buffer in DAHDI_LOADZONE ioctl
- Fix copying data from userspace buffer in ECHOCANCEL_PARAMS ioctl
- Fix panic in smp_tlb_shootdown() when iface is created or re-created.
- Temporary bandaid for panic in smp_tlb_shootdown() on amd64 when tone_zone_put()
is called
Modified:
freebsd/trunk/bsd-kmod/dahdi/Makefile
freebsd/trunk/drivers/dahdi/dahdi-base.c
Modified: freebsd/trunk/bsd-kmod/dahdi/Makefile
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/bsd-kmod/dahdi/Makefile?view=diff&rev=10599&r1=10598&r2=10599
==============================================================================
--- freebsd/trunk/bsd-kmod/dahdi/Makefile (original)
+++ freebsd/trunk/bsd-kmod/dahdi/Makefile Mon Mar 26 15:21:22 2012
@@ -9,7 +9,8 @@
SRCS+= device_if.h bus_if.h pci_if.h
CLEANFILES= version.h dahdi
CFLAGS+= -I${.CURDIR}
-INCS= user.h wctdm_user.h compat/types.h
+DAHDI_INCS= dahdi_config.h user.h wctdm_user.h
+LINUX_INCS= ioctl.h types.h
DAHDIVERSION!= ${.CURDIR}/../../build_tools/make_version ${.CURDIR}/../.. dahdi/freebsd
version.h::
@@ -18,12 +19,17 @@
@rm -f ${.TARGET}.tmp
@[ -e dahdi ] || ln -sf . dahdi
+.if !defined(WITHOUT_HEADERS)
afterinstall: install-headers
+.endif
install-headers:
- ${MKDIR} ${PREFIX}/include/dahdi/compat
-.for _h in ${INCS}
+ ${MKDIR} ${PREFIX}/include/dahdi/compat/linux
+.for _h in ${DAHDI_INCS}
${INSTALL_DATA} ${INCLUDEDIR}/dahdi/${_h} ${PREFIX}/include/dahdi/${_h:H}
+.endfor
+.for _h in ${LINUX_INCS}
+ ${INSTALL_DATA} ${INCLUDEDIR}/linux/${_h} ${PREFIX}/include/dahdi/compat/linux/${_h:H}
.endfor
.include <bsd.kmod.mk>
Modified: freebsd/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=10599&r1=10598&r2=10599
==============================================================================
--- freebsd/trunk/drivers/dahdi/dahdi-base.c (original)
+++ freebsd/trunk/drivers/dahdi/dahdi-base.c Mon Mar 26 15:21:22 2012
@@ -1578,7 +1578,13 @@
if (chan->curzone) {
struct dahdi_zone *zone = chan->curzone;
chan->curzone = NULL;
+#if defined(__FreeBSD__)
+ spin_unlock_irqrestore(&chan->lock, flags);
+#endif
tone_zone_put(zone);
+#if defined(__FreeBSD__)
+ spin_lock_irqsave(&chan->lock, flags);
+#endif
}
chan->cadencepos = 0;
chan->pdialcount = 0;
@@ -1838,7 +1844,13 @@
if (chan->curzone) {
struct dahdi_zone *zone = chan->curzone;
chan->curzone = NULL;
+#if defined(__FreeBSD__)
+ spin_unlock_irqrestore(&chan->lock, flags);
+#endif
tone_zone_put(zone);
+#if defined(__FreeBSD__)
+ spin_lock_irqsave(&chan->lock, flags);
+#endif
}
chan->curzone = z;
memcpy(chan->ringcadence, z->ringcadence, sizeof(chan->ringcadence));
@@ -2032,7 +2044,7 @@
return -EINVAL;
}
- res = dahdi_net_chan_init(ms);
+ res = dahdi_net_chan_init(ms, DAHDI_DEFAULT_NUM_BUFS);
if (res)
return res;
@@ -3421,7 +3433,7 @@
return -ENOMEM;
#if defined(__FreeBSD__)
- if (copy_from_user(&data, (void *) data, sizeof(data))) {
+ if (copy_from_user(&user_data, (void *) data, sizeof(data))) {
res = -EFAULT;
goto error_exit;
}
@@ -4701,7 +4713,9 @@
}
#elif defined(__FreeBSD__)
if (dahdi_have_netdev(chan)) {
+ spin_unlock_irqrestore(&chan->lock, flags);
dahdi_iface_destroy(chan);
+ spin_lock_irqsave(&chan->lock, flags);
clear_bit(DAHDI_FLAGBIT_NETDEV, &chan->flags);
}
#else
@@ -4850,9 +4864,13 @@
#elif defined(__FreeBSD__)
if (!res &&
(newmaster == chan) &&
- (chan->sig == DAHDI_SIG_HDLCNET) &&
- (res = dahdi_iface_create(chan)) == 0) {
- set_bit(DAHDI_FLAGBIT_NETDEV, &chan->flags);
+ (chan->sig == DAHDI_SIG_HDLCNET)) {
+ spin_unlock_irqrestore(&chan->lock, flags);
+ /* Briefly restore interrupts while we register the device */
+ res = dahdi_iface_create(chan);
+ if (!res)
+ set_bit(DAHDI_FLAGBIT_NETDEV, &chan->flags);
+ spin_lock_irqsave(&chan->lock, flags);
}
#endif
if ((chan->sig == DAHDI_SIG_HDLCNET) &&
@@ -6521,7 +6539,7 @@
#endif /* __FreeBSD__ */
if (!(chan->flags & DAHDI_FLAG_AUDIO))
return -EINVAL;
- ret = copy_from_user(&ecp,
+ ret = dahdi_copy_from_user(&ecp,
(struct dahdi_echocanparams __user *)data,
sizeof(ecp));
if (ret)
@@ -10083,6 +10101,8 @@
kfree(file);
}
+static const struct file_operations dahdi_fops;
+
static int
dahdi_device_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
{
@@ -10097,6 +10117,10 @@
file = kzalloc(sizeof(*file), GFP_KERNEL);
if (file == NULL)
return ENOMEM;
+ file->dev = dev;
+ file->f_flags = oflags;
+ file->private_data = NULL;
+ file->f_op = &dahdi_fops;
res = devfs_set_cdevpriv(file, dahdi_device_free_file);
if (res) {
kfree(file);
@@ -10615,11 +10639,17 @@
while (!list_empty(&tone_zones)) {
z = list_entry(tone_zones.next, struct dahdi_zone, node);
list_del(&z->node);
+#if defined(__FreeBSD__)
+ spin_unlock(&zone_lock);
+#endif
if (!tone_zone_put(z)) {
module_printk(KERN_WARNING,
"Potential memory leak detected in %s\n",
__func__);
}
+#if defined(__FreeBSD__)
+ spin_lock(&zone_lock);
+#endif
}
spin_unlock(&zone_lock);
More information about the dahdi-commits
mailing list