mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
This was done entirely with mindless brute force, using
git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'
to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.
Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.
For the same reason the 'flex' versions will be done as a separate
conversion.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
84 lines
1.7 KiB
C
84 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
|
*/
|
|
|
|
#include <linux/slab.h>
|
|
#include <linux/completion.h>
|
|
#include <linux/irqreturn.h>
|
|
#include <asm/irq.h>
|
|
#include <irq_kern.h>
|
|
#include <os.h>
|
|
#include "xterm.h"
|
|
|
|
struct xterm_wait {
|
|
struct completion ready;
|
|
int fd;
|
|
int pid;
|
|
int new_fd;
|
|
};
|
|
|
|
static irqreturn_t xterm_interrupt(int irq, void *data)
|
|
{
|
|
struct xterm_wait *xterm = data;
|
|
int fd = -1, n_fds = 1;
|
|
ssize_t ret;
|
|
|
|
ret = os_rcv_fd_msg(xterm->fd, &fd, n_fds,
|
|
&xterm->pid, sizeof(xterm->pid));
|
|
if (ret == -EAGAIN)
|
|
return IRQ_NONE;
|
|
|
|
if (ret < 0)
|
|
fd = ret;
|
|
else if (ret != sizeof(xterm->pid))
|
|
fd = -EMSGSIZE;
|
|
|
|
xterm->new_fd = fd;
|
|
complete(&xterm->ready);
|
|
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
int xterm_fd(int socket, int *pid_out)
|
|
{
|
|
struct xterm_wait *data;
|
|
int err, ret;
|
|
|
|
data = kmalloc_obj(*data);
|
|
if (data == NULL) {
|
|
printk(KERN_ERR "xterm_fd : failed to allocate xterm_wait\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
/* This is a locked semaphore... */
|
|
*data = ((struct xterm_wait) { .fd = socket,
|
|
.pid = -1,
|
|
.new_fd = -1 });
|
|
init_completion(&data->ready);
|
|
|
|
err = um_request_irq(XTERM_IRQ, socket, IRQ_READ, xterm_interrupt,
|
|
IRQF_SHARED, "xterm", data);
|
|
if (err < 0) {
|
|
printk(KERN_ERR "xterm_fd : failed to get IRQ for xterm, "
|
|
"err = %d\n", err);
|
|
ret = err;
|
|
goto out;
|
|
}
|
|
|
|
/* ... so here we wait for an xterm interrupt.
|
|
*
|
|
* XXX Note, if the xterm doesn't work for some reason (eg. DISPLAY
|
|
* isn't set) this will hang... */
|
|
wait_for_completion(&data->ready);
|
|
|
|
um_free_irq(XTERM_IRQ, data);
|
|
|
|
ret = data->new_fd;
|
|
*pid_out = data->pid;
|
|
out:
|
|
kfree(data);
|
|
|
|
return ret;
|
|
}
|