[svn-commits] fjoe: freebsd/trunk r10689 - in /freebsd/trunk: drivers/dahdi/ include/linux/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Jun 6 05:40:39 CDT 2012
Author: fjoe
Date: Wed Jun 6 05:40:35 2012
New Revision: 10689
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10689
Log:
- Fix put_user() implementation (name temporary variable with underscore to not conflict
with other local variables of the same name)
- Switch to older poll() implementation
- Remove FIONBIO/FIOASYNC handling: it is handled by kernel
Modified:
freebsd/trunk/drivers/dahdi/dahdi-base.c
freebsd/trunk/include/linux/poll.h
freebsd/trunk/include/linux/uaccess.h
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=10689&r1=10688&r2=10689
==============================================================================
--- freebsd/trunk/drivers/dahdi/dahdi-base.c (original)
+++ freebsd/trunk/drivers/dahdi/dahdi-base.c Wed Jun 6 05:40:35 2012
@@ -199,8 +199,11 @@
static void
dahdi_poll_wait(struct file *fp, struct selinfo *sel, poll_table *p)
{
- poll_wait(fp, (wait_queue_head_t *) sel, p);
-}
+ p->selinfo = sel;
+}
+
+#undef poll_wait
+#define poll_wait(fp, sel, p) dahdi_poll_wait(fp, sel, p)
static void
dahdi_poll_drain(struct selinfo *sel)
@@ -214,6 +217,7 @@
init_waitqueue_head((wait_queue_head_t *) sel);
}
+#undef init_waitqueue_head
#define init_waitqueue_head(waitq) dahdi_init_waitqueue_head(waitq)
static void
@@ -223,9 +227,7 @@
selwakeup(sel);
}
-#ifdef wake_up_interruptible
#undef wake_up_interruptible
-#endif
#define wake_up_interruptible(waitq) dahdi_wake_up_interruptible(waitq)
static int dahdi_span_register_chardev(struct dahdi_span *span);
@@ -255,12 +257,6 @@
dahdi_copy_from_user(void *to, const void __user *from, int n)
{
return copy_from_user(to, from, n);
-}
-
-static void
-dahdi_poll_wait(struct file *fp, wait_queue_head_t *waitq, poll_table *p)
-{
- poll_wait(fp, waitq, p);
}
static void
@@ -6357,21 +6353,6 @@
WARN_ON(!chan->master);
switch(cmd) {
-#if defined(__FreeBSD__)
- case FIONBIO:
- get_user(j, data);
- spin_lock_irqsave(&chan->lock, flags);
- if (chan->file) {
- if (j)
- chan->file->f_flags |= O_NONBLOCK;
- else
- chan->file->f_flags &= ~O_NONBLOCK;
- }
- spin_unlock_irqrestore(&chan->lock, flags);
- break;
- case FIOASYNC:
- break;
-#endif /* __FreeBSD__ */
case DAHDI_SETSIGFREEZE:
get_user(j, (int __user *)data);
spin_lock_irqsave(&chan->lock, flags);
@@ -9451,7 +9432,7 @@
unsigned long flags;
int ret = 0;
if (timer) {
- dahdi_poll_wait(file, &timer->sel, wait_table);
+ poll_wait(file, &timer->sel, wait_table);
spin_lock_irqsave(&dahdi_timer_lock, flags);
if (timer->tripped || timer->ping)
ret |= POLLPRI;
@@ -9486,7 +9467,7 @@
return POLLERR | POLLHUP | POLLRDHUP | POLLNVAL | POLLPRI;
}
- dahdi_poll_wait(file, &c->waitq, wait_table);
+ poll_wait(file, &c->waitq, wait_table);
spin_lock_irqsave(&c->lock, flags);
ret |= (c->inwritebuf > -1) ? POLLOUT|POLLWRNORM : 0;
@@ -10121,13 +10102,11 @@
dahdi_device_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
{
int res;
- struct file *file = dahdi_device_get_file(dev, -1);
+ struct file *file;
/*
* create file struct
*/
- if (file != NULL)
- return EBUSY;
file = kzalloc(sizeof(*file), GFP_KERNEL);
if (file == NULL)
return ENOMEM;
@@ -10224,11 +10203,14 @@
if (file == NULL)
return ENXIO;
+ wait_table.selinfo = NULL;
res = file->f_op->poll(file, &wait_table);
if (res < 0)
return (0);
res &= events;
+ if (res == 0 && wait_table.selinfo != NULL)
+ selrecord(td, wait_table.selinfo);
return (res);
}
Modified: freebsd/trunk/include/linux/poll.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/linux/poll.h?view=diff&rev=10689&r1=10688&r2=10689
==============================================================================
--- freebsd/trunk/include/linux/poll.h (original)
+++ freebsd/trunk/include/linux/poll.h Wed Jun 6 05:40:35 2012
@@ -8,12 +8,9 @@
#include <linux/uaccess.h>
typedef struct poll_table_struct {
- /* intentionally left empty */
+ struct selinfo *selinfo;
} poll_table;
-static inline void poll_wait(struct file *fp, wait_queue_head_t *wait_address, poll_table *p)
-{
- selrecord(curthread, &fp->selinfo);
-}
+#define poll_wait(fp, wait_address, poll_table) selrecord(curthread, &fp->selinfo)
#endif /* _LINUX_POLL_H_ */
Modified: freebsd/trunk/include/linux/uaccess.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/linux/uaccess.h?view=diff&rev=10689&r1=10688&r2=10689
==============================================================================
--- freebsd/trunk/include/linux/uaccess.h (original)
+++ freebsd/trunk/include/linux/uaccess.h Wed Jun 6 05:40:35 2012
@@ -11,8 +11,8 @@
#define get_user(v, p) copy_from_user(&(v), (void *) (p), sizeof(v))
#define put_user(v, p) \
do { \
- int j = (v); \
- copy_to_user((void *) (p), &j, sizeof(j)); \
+ int _j = (v); \
+ copy_to_user((void *) (p), &_j, sizeof(_j)); \
} while (0)
#endif /* _LINUX_UACCESS_H_ */
More information about the svn-commits
mailing list