Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263818
b: refs/heads/master
c: 7cf3cf2
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro authored and Linus Torvalds committed Sep 15, 2011
1 parent a8c7695 commit 29e76ae
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 45cd5e2d4e632f55af1d6131f33b554c98f8b929
refs/heads/master: 7cf3cf21aac7d75d27e8e7cd039bd33d19fb300d
38 changes: 24 additions & 14 deletions trunk/arch/um/drivers/line.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,43 +721,53 @@ struct winch {
int pid;
struct tty_struct *tty;
unsigned long stack;
struct work_struct work;
};

static void free_winch(struct winch *winch, int free_irq_ok)
static void __free_winch(struct work_struct *work)
{
int fd = winch->fd;
winch->fd = -1;
if (free_irq_ok)
free_irq(WINCH_IRQ, winch);

list_del(&winch->list);
struct winch *winch = container_of(work, struct winch, work);
free_irq(WINCH_IRQ, winch);

if (winch->pid != -1)
os_kill_process(winch->pid, 1);
if (fd != -1)
os_close_file(fd);
if (winch->stack != 0)
free_stack(winch->stack, 0);
kfree(winch);
}

static void free_winch(struct winch *winch)
{
int fd = winch->fd;
winch->fd = -1;
if (fd != -1)
os_close_file(fd);
list_del(&winch->list);
__free_winch(&winch->work);
}

static irqreturn_t winch_interrupt(int irq, void *data)
{
struct winch *winch = data;
struct tty_struct *tty;
struct line *line;
int fd = winch->fd;
int err;
char c;

if (winch->fd != -1) {
err = generic_read(winch->fd, &c, NULL);
if (fd != -1) {
err = generic_read(fd, &c, NULL);
if (err < 0) {
if (err != -EAGAIN) {
winch->fd = -1;
list_del(&winch->list);
os_close_file(fd);
printk(KERN_ERR "winch_interrupt : "
"read failed, errno = %d\n", -err);
printk(KERN_ERR "fd %d is losing SIGWINCH "
"support\n", winch->tty_fd);
free_winch(winch, 0);
INIT_WORK(&winch->work, __free_winch);
schedule_work(&winch->work);
return IRQ_HANDLED;
}
goto out;
Expand Down Expand Up @@ -829,7 +839,7 @@ static void unregister_winch(struct tty_struct *tty)
list_for_each_safe(ele, next, &winch_handlers) {
winch = list_entry(ele, struct winch, list);
if (winch->tty == tty) {
free_winch(winch, 1);
free_winch(winch);
break;
}
}
Expand All @@ -845,7 +855,7 @@ static void winch_cleanup(void)

list_for_each_safe(ele, next, &winch_handlers) {
winch = list_entry(ele, struct winch, list);
free_winch(winch, 1);
free_winch(winch);
}

spin_unlock(&winch_handler_lock);
Expand Down

0 comments on commit 29e76ae

Please sign in to comment.