len = idlen;
retval = parport_read (dev->port, buffer, len);
- if (retval != len) {
+ if (retval != len)
printk (KERN_DEBUG "%s: only read %d of %d ID bytes\n",
dev->port->name, retval, len);
- goto restore_fs;
- }
/* Some printer manufacturers mistakenly believe that
the length field is supposed to be _exclusive_. */
/* In addition, there are broken devices out there
that don't even finish off with a semi-colon. */
- if (idlen == len && buffer[len - 1] != ';') {
+ if (buffer[len - 1] != ';') {
ssize_t diff;
diff = parport_read (dev->port, buffer + len, 2);
retval += diff;
else {
/* One semi-colon short of a device ID. */
buffer[len++] = ';';
- buffer[len] = '\0';
printk (KERN_DEBUG "%s: faking semi-colon\n",
dev->port->name);
}
restore_fs:
+ buffer[len] = '\0';
set_fs (oldfs);
parport_negotiate (dev->port, IEEE1284_MODE_COMPAT);
}
parport_release (dev);
- if (retval > 0)
+ if (retval > 2)
parse_data (dev->port, dev->daisy, buffer);
parport_close (dev);
if (n < 0)
goto out_nofds;
- if (n > current->files->max_fdset + 1)
- n = current->files->max_fdset + 1;
+ if (n > current->files->max_fdset)
+ n = current->files->max_fdset;
/*
* We need 6 bitmaps (in/out/ex for both incoming and outgoing),
* long-words.
*/
ret = -ENOMEM;
- size = (n + 8 * sizeof(long) - 1) / (8 * sizeof(long)) * sizeof(long);
+ size = FDS_BYTES(n);
bits = kmalloc(6 * size, GFP_KERNEL);
if (!bits)
goto out_nofds;
extern __inline__ void sigaddset(sigset_t *set, int _sig)
{
- __asm__("btsl %1,%0" : "=m"(*set) : "ir"(_sig - 1) : "cc");
+ __asm__("btsl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
}
extern __inline__ void sigdelset(sigset_t *set, int _sig)
{
- __asm__("btrl %1,%0" : "=m"(*set) : "ir"(_sig - 1) : "cc");
+ __asm__("btrl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
}
extern __inline__ int __const_sigismember(sigset_t *set, int _sig)
{
int ret;
__asm__("btl %2,%1\n\tsbbl %0,%0"
- : "=r"(ret) : "m"(*set), "ir"(_sig-1) : "cc");
+ : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
return ret;
}
* increased. The larger it is, though, the longer it will be between
* necessary transmits - don't set this too large.
*/
-#define TX_TIMEOUT 20
+#define TX_TIMEOUT (20*HZ/100)
/* Display warnings about the driver being an ALPHA version.
#define CLONE_PID 0x00001000 /* set if pid shared */
#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
+#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
/*
* These are the constant used to fake the fixed-point load-average
p->run_list.next = NULL;
p->run_list.prev = NULL;
- p->p_pptr = p->p_opptr = current;
+ if ((clone_flags & CLONE_VFORK) || !(clone_flags & CLONE_PARENT))
+ p->p_pptr = p->p_opptr = current;
p->p_cptr = NULL;
init_waitqueue_head(&p->wait_chldexit);
p->vfork_sem = NULL;
if (!vma)
goto out_unlock;
}
- if (!handle_mm_fault(current, vma, ptr, (rw==READ)))
+ if (handle_mm_fault(current, vma, ptr, (rw==READ)) <= 0)
goto out_unlock;
+ spin_lock(&mm->page_table_lock);
page = follow_page(ptr);
if (!page) {
- printk (KERN_ERR "Missing page in map_user_kiobuf\n");
- goto out_unlock;
+ dprintk (KERN_ERR "Missing page in map_user_kiobuf\n");
+ map = NULL;
+ goto retry;
}
map = get_page_map(page);
if (map) {
- if (TryLockPage(map))
+ if (TryLockPage(map)) {
goto retry;
+ }
atomic_inc(&map->count);
}
+ spin_unlock(&mm->page_table_lock);
dprintk ("Installing page %p %p: %d\n", (void *)page, map, i);
iobuf->pagelist[i] = page;
iobuf->maplist[i] = map;
/*
* Undo the locking so far, wait on the page we got to, and try again.
*/
+ spin_unlock(&mm->page_table_lock);
unmap_kiobuf(iobuf);
up(&mm->mmap_sem);
/*
* Did the release also unlock the page we got stuck on?
*/
- if (!PageLocked(map)) {
- /* If so, we may well have the page mapped twice in the
- * IO address range. Bad news. Of course, it _might_
- * just be a coincidence, but if it happens more than
- * once, chances are we have a double-mapped page. */
- if (++doublepage >= 3) {
- return -EINVAL;
+ if (map) {
+ if (!PageLocked(map)) {
+ /* If so, we may well have the page mapped twice
+ * in the IO address range. Bad news. Of
+ * course, it _might_ * just be a coincidence,
+ * but if it happens more than * once, chances
+ * are we have a double-mapped page. */
+ if (++doublepage >= 3) {
+ return -EINVAL;
+ }
}
+
+ /*
+ * Try again...
+ */
+ wait_on_page(map);
}
- /*
- * Try again...
- */
- wait_on_page(map);
if (++repeat < 16)
goto repeat;
return -EAGAIN;