Commit 2fccfcc0 authored by Johannes Berg's avatar Johannes Berg Committed by Richard Weinberger

um: Remove IRQ_NONE type

We don't actually use this in um_request_irq(), so it can
never be assigned. It's also not clear what that would be
useful for, so just remove it.

This results in quite a number of cleanups, all the way to
removing the "SIGIO on close" startup check, since the data
it assigns (pty_close_sigio) is not used anymore.

While at it, also make this an enum so we get a minimum of
type checking, and remove the IRQ_NONE hack in virtio since
we now no longer have the name twice.
Acked-By: default avatarAnton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Acked-By: default avatarAnton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 0737402f
...@@ -79,7 +79,7 @@ static int __init rng_init (void) ...@@ -79,7 +79,7 @@ static int __init rng_init (void)
if (err < 0) if (err < 0)
goto err_out_cleanup_hw; goto err_out_cleanup_hw;
sigio_broken(random_fd, 1); sigio_broken(random_fd);
hwrng.name = RNG_MODULE_NAME; hwrng.name = RNG_MODULE_NAME;
hwrng.read = rng_dev_read; hwrng.read = rng_dev_read;
hwrng.quality = 1024; hwrng.quality = 1024;
......
...@@ -33,11 +33,6 @@ ...@@ -33,11 +33,6 @@
#include <os.h> #include <os.h>
#include "vhost_user.h" #include "vhost_user.h"
/* Workaround due to a conflict between irq_user.h and irqreturn.h */
#ifdef IRQ_NONE
#undef IRQ_NONE
#endif
#define MAX_SUPPORTED_QUEUE_SIZE 256 #define MAX_SUPPORTED_QUEUE_SIZE 256
#define to_virtio_uml_device(_vdev) \ #define to_virtio_uml_device(_vdev) \
......
...@@ -8,11 +8,12 @@ ...@@ -8,11 +8,12 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include "irq_user.h"
#define UM_IRQ_ALLOC -1 #define UM_IRQ_ALLOC -1
int um_request_irq(int irq, int fd, int type, irq_handler_t handler, int um_request_irq(int irq, int fd, enum um_irq_type type,
unsigned long irqflags, const char * devname, irq_handler_t handler, unsigned long irqflags,
void *dev_id); const char *devname, void *dev_id);
void um_free_irq(int irq, void *dev_id); void um_free_irq(int irq, void *dev_id);
#endif #endif
...@@ -9,10 +9,11 @@ ...@@ -9,10 +9,11 @@
#include <sysdep/ptrace.h> #include <sysdep/ptrace.h>
#include <stdbool.h> #include <stdbool.h>
#define IRQ_READ 0 enum um_irq_type {
#define IRQ_WRITE 1 IRQ_READ,
#define IRQ_NONE 2 IRQ_WRITE,
#define NUM_IRQ_TYPES (IRQ_NONE + 1) NUM_IRQ_TYPES,
};
struct siginfo; struct siginfo;
extern void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs); extern void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs);
......
...@@ -299,7 +299,7 @@ extern void reboot_skas(void); ...@@ -299,7 +299,7 @@ extern void reboot_skas(void);
extern int os_waiting_for_events_epoll(void); extern int os_waiting_for_events_epoll(void);
extern void *os_epoll_get_data_pointer(int index); extern void *os_epoll_get_data_pointer(int index);
extern int os_epoll_triggered(int index, int events); extern int os_epoll_triggered(int index, int events);
extern int os_event_mask(int irq_type); extern int os_event_mask(enum um_irq_type irq_type);
extern int os_setup_epoll(void); extern int os_setup_epoll(void);
extern int os_add_epoll_fd(int events, int fd, void *data); extern int os_add_epoll_fd(int events, int fd, void *data);
extern int os_mod_epoll_fd(int events, int fd, void *data); extern int os_mod_epoll_fd(int events, int fd, void *data);
...@@ -310,8 +310,8 @@ extern void os_close_epoll_fd(void); ...@@ -310,8 +310,8 @@ extern void os_close_epoll_fd(void);
/* sigio.c */ /* sigio.c */
extern int add_sigio_fd(int fd); extern int add_sigio_fd(int fd);
extern int ignore_sigio_fd(int fd); extern int ignore_sigio_fd(int fd);
extern void maybe_sigio_broken(int fd, int read); extern void maybe_sigio_broken(int fd);
extern void sigio_broken(int fd, int read); extern void sigio_broken(int fd);
/* prctl.c */ /* prctl.c */
extern int os_arch_prctl(int pid, int option, unsigned long *arg2); extern int os_arch_prctl(int pid, int option, unsigned long *arg2);
......
...@@ -32,7 +32,7 @@ extern void free_irqs(void); ...@@ -32,7 +32,7 @@ extern void free_irqs(void);
struct irq_reg { struct irq_reg {
void *id; void *id;
int type; enum um_irq_type type;
int irq; int irq;
int events; int events;
bool active; bool active;
...@@ -96,7 +96,7 @@ void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs) ...@@ -96,7 +96,7 @@ void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs)
} }
for (i = 0; i < n ; i++) { for (i = 0; i < n ; i++) {
/* Epoll back reference is the entry with 3 irq_reg /* Epoll back reference is the entry with 2 irq_reg
* leaves - one for each irq type. * leaves - one for each irq type.
*/ */
irq_entry = (struct irq_entry *) irq_entry = (struct irq_entry *)
...@@ -139,7 +139,7 @@ static int assign_epoll_events_to_irq(struct irq_entry *irq_entry) ...@@ -139,7 +139,7 @@ static int assign_epoll_events_to_irq(struct irq_entry *irq_entry)
static int activate_fd(int irq, int fd, int type, void *dev_id) static int activate_fd(int irq, int fd, enum um_irq_type type, void *dev_id)
{ {
struct irq_reg *new_fd; struct irq_reg *new_fd;
struct irq_entry *irq_entry; struct irq_entry *irq_entry;
...@@ -217,7 +217,7 @@ static int activate_fd(int irq, int fd, int type, void *dev_id) ...@@ -217,7 +217,7 @@ static int activate_fd(int irq, int fd, int type, void *dev_id)
/* Turn back IO on with the correct (new) IO event mask */ /* Turn back IO on with the correct (new) IO event mask */
assign_epoll_events_to_irq(irq_entry); assign_epoll_events_to_irq(irq_entry);
spin_unlock_irqrestore(&irq_lock, flags); spin_unlock_irqrestore(&irq_lock, flags);
maybe_sigio_broken(fd, (type != IRQ_NONE)); maybe_sigio_broken(fd);
return 0; return 0;
out_unlock: out_unlock:
...@@ -444,10 +444,9 @@ void um_free_irq(int irq, void *dev) ...@@ -444,10 +444,9 @@ void um_free_irq(int irq, void *dev)
} }
EXPORT_SYMBOL(um_free_irq); EXPORT_SYMBOL(um_free_irq);
int um_request_irq(int irq, int fd, int type, int um_request_irq(int irq, int fd, enum um_irq_type type,
irq_handler_t handler, irq_handler_t handler, unsigned long irqflags,
unsigned long irqflags, const char * devname, const char *devname, void *dev_id)
void *dev_id)
{ {
int err; int err;
......
...@@ -45,7 +45,7 @@ int os_epoll_triggered(int index, int events) ...@@ -45,7 +45,7 @@ int os_epoll_triggered(int index, int events)
* access to the right includes/defines for EPOLL constants. * access to the right includes/defines for EPOLL constants.
*/ */
int os_event_mask(int irq_type) int os_event_mask(enum um_irq_type irq_type)
{ {
if (irq_type == IRQ_READ) if (irq_type == IRQ_READ)
return EPOLLIN | EPOLLPRI; return EPOLLIN | EPOLLPRI;
......
...@@ -338,7 +338,7 @@ static void write_sigio_workaround(void) ...@@ -338,7 +338,7 @@ static void write_sigio_workaround(void)
close(l_write_sigio_fds[1]); close(l_write_sigio_fds[1]);
} }
void sigio_broken(int fd, int read) void sigio_broken(int fd)
{ {
int err; int err;
...@@ -354,7 +354,7 @@ void sigio_broken(int fd, int read) ...@@ -354,7 +354,7 @@ void sigio_broken(int fd, int read)
all_sigio_fds.poll[all_sigio_fds.used++] = all_sigio_fds.poll[all_sigio_fds.used++] =
((struct pollfd) { .fd = fd, ((struct pollfd) { .fd = fd,
.events = read ? POLLIN : POLLOUT, .events = POLLIN,
.revents = 0 }); .revents = 0 });
out: out:
sigio_unlock(); sigio_unlock();
...@@ -362,17 +362,16 @@ void sigio_broken(int fd, int read) ...@@ -362,17 +362,16 @@ void sigio_broken(int fd, int read)
/* Changed during early boot */ /* Changed during early boot */
static int pty_output_sigio; static int pty_output_sigio;
static int pty_close_sigio;
void maybe_sigio_broken(int fd, int read) void maybe_sigio_broken(int fd)
{ {
if (!isatty(fd)) if (!isatty(fd))
return; return;
if ((read || pty_output_sigio) && (!read || pty_close_sigio)) if (pty_output_sigio)
return; return;
sigio_broken(fd, read); sigio_broken(fd);
} }
static void sigio_cleanup(void) static void sigio_cleanup(void)
...@@ -516,19 +515,6 @@ static void tty_output(int master, int slave) ...@@ -516,19 +515,6 @@ static void tty_output(int master, int slave)
printk(UM_KERN_CONT "tty_output : read failed, err = %d\n", n); printk(UM_KERN_CONT "tty_output : read failed, err = %d\n", n);
} }
static void tty_close(int master, int slave)
{
printk(UM_KERN_INFO "Checking that host ptys support SIGIO on "
"close...");
close(slave);
if (got_sigio) {
printk(UM_KERN_CONT "Yes\n");
pty_close_sigio = 1;
} else
printk(UM_KERN_CONT "No, enabling workaround\n");
}
static void __init check_sigio(void) static void __init check_sigio(void)
{ {
if ((access("/dev/ptmx", R_OK) < 0) && if ((access("/dev/ptmx", R_OK) < 0) &&
...@@ -538,7 +524,6 @@ static void __init check_sigio(void) ...@@ -538,7 +524,6 @@ static void __init check_sigio(void)
return; return;
} }
check_one_sigio(tty_output); check_one_sigio(tty_output);
check_one_sigio(tty_close);
} }
/* Here because it only does the SIGIO testing for now */ /* Here because it only does the SIGIO testing for now */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment