Commit 51442d5a authored by Hanna V. Linder's avatar Hanna V. Linder Committed by Greg Kroah-Hartman

[PATCH] moxa tty_driver add .owner field remove MOD_INC/DEC_USE_COUNT

parent fb762119
...@@ -341,6 +341,7 @@ int moxa_init(void) ...@@ -341,6 +341,7 @@ int moxa_init(void)
memset(&moxaDriver, 0, sizeof(struct tty_driver)); memset(&moxaDriver, 0, sizeof(struct tty_driver));
memset(&moxaCallout, 0, sizeof(struct tty_driver)); memset(&moxaCallout, 0, sizeof(struct tty_driver));
moxaDriver.magic = TTY_DRIVER_MAGIC; moxaDriver.magic = TTY_DRIVER_MAGIC;
moxaDriver.owner = THIS_MODULE;
moxaDriver.name = "ttya"; moxaDriver.name = "ttya";
moxaDriver.major = ttymajor; moxaDriver.major = ttymajor;
moxaDriver.minor_start = 0; moxaDriver.minor_start = 0;
...@@ -544,7 +545,6 @@ static void do_moxa_softint(void *private_) ...@@ -544,7 +545,6 @@ static void do_moxa_softint(void *private_)
ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CALLOUT_ACTIVE); ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CALLOUT_ACTIVE);
} }
} }
MOD_DEC_USE_COUNT;
} }
static int moxa_open(struct tty_struct *tty, struct file *filp) static int moxa_open(struct tty_struct *tty, struct file *filp)
...@@ -556,7 +556,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp) ...@@ -556,7 +556,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
port = PORTNO(tty); port = PORTNO(tty);
if (port == MAX_PORTS) { if (port == MAX_PORTS) {
MOD_INC_USE_COUNT;
return (0); return (0);
} }
if (!MoxaPortIsValid(port)) { if (!MoxaPortIsValid(port)) {
...@@ -579,7 +578,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp) ...@@ -579,7 +578,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
} }
up(&moxaBuffSem); up(&moxaBuffSem);
MOD_INC_USE_COUNT;
ch = &moxaChannels[port]; ch = &moxaChannels[port];
ch->count++; ch->count++;
tty->driver_data = ch; tty->driver_data = ch;
...@@ -619,7 +617,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) ...@@ -619,7 +617,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
port = PORTNO(tty); port = PORTNO(tty);
if (port == MAX_PORTS) { if (port == MAX_PORTS) {
MOD_DEC_USE_COUNT;
return; return;
} }
if (!MoxaPortIsValid(port)) { if (!MoxaPortIsValid(port)) {
...@@ -633,7 +630,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) ...@@ -633,7 +630,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
return; return;
} }
if (tty_hung_up_p(filp)) { if (tty_hung_up_p(filp)) {
MOD_DEC_USE_COUNT;
return; return;
} }
ch = (struct moxa_str *) tty->driver_data; ch = (struct moxa_str *) tty->driver_data;
...@@ -649,7 +645,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) ...@@ -649,7 +645,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
ch->count = 0; ch->count = 0;
} }
if (ch->count) { if (ch->count) {
MOD_DEC_USE_COUNT;
return; return;
} }
ch->asyncflags |= ASYNC_CLOSING; ch->asyncflags |= ASYNC_CLOSING;
...@@ -688,7 +683,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) ...@@ -688,7 +683,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CALLOUT_ACTIVE | ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CALLOUT_ACTIVE |
ASYNC_CLOSING); ASYNC_CLOSING);
wake_up_interruptible(&ch->close_wait); wake_up_interruptible(&ch->close_wait);
MOD_DEC_USE_COUNT;
} }
static int moxa_write(struct tty_struct *tty, int from_user, static int moxa_write(struct tty_struct *tty, int from_user,
...@@ -1024,9 +1018,7 @@ static void moxa_poll(unsigned long ignored) ...@@ -1024,9 +1018,7 @@ static void moxa_poll(unsigned long ignored)
wake_up_interruptible(&ch->open_wait); wake_up_interruptible(&ch->open_wait);
else { else {
set_bit(MOXA_EVENT_HANGUP, &ch->event); set_bit(MOXA_EVENT_HANGUP, &ch->event);
MOD_DEC_USE_COUNT; schedule_work(&ch->tqueue);
if (schedule_work(&ch->tqueue) == 0)
MOD_INC_USE_COUNT;
} }
} }
} }
......
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