patch-2.4.17 linux/drivers/char/serial.c
Next file: linux/drivers/char/sonypi.c
Previous file: linux/drivers/char/rtc.c
Back to the patch index
Back to the overall index
- Lines: 72
- Date:
Fri Dec 21 16:40:32 2001
- Orig file:
linux-2.4.16/drivers/char/serial.c
- Orig date:
Fri Nov 9 22:12:55 2001
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.16/drivers/char/serial.c linux/drivers/char/serial.c
@@ -3133,6 +3133,10 @@
* enables interrupts for a serial port, linking in its async structure into
* the IRQ chain. It also performs the serial-specific
* initialization for the tty structure.
+ *
+ * Note that on failure, we don't decrement the module use count - the tty
+ * later will call rs_close, which will decrement it for us as long as
+ * tty->driver_data is set non-NULL. --rmk
*/
static int rs_open(struct tty_struct *tty, struct file * filp)
{
@@ -3153,10 +3157,8 @@
}
tty->driver_data = info;
info->tty = tty;
- if (serial_paranoia_check(info, tty->device, "rs_open")) {
- MOD_DEC_USE_COUNT;
+ if (serial_paranoia_check(info, tty->device, "rs_open"))
return -ENODEV;
- }
#ifdef SERIAL_DEBUG_OPEN
printk("rs_open %s%d, count = %d\n", tty->driver.name, info->line,
@@ -3171,10 +3173,8 @@
*/
if (!tmp_buf) {
page = get_zeroed_page(GFP_KERNEL);
- if (!page) {
- MOD_DEC_USE_COUNT;
+ if (!page)
return -ENOMEM;
- }
if (tmp_buf)
free_page(page);
else
@@ -3188,7 +3188,6 @@
(info->flags & ASYNC_CLOSING)) {
if (info->flags & ASYNC_CLOSING)
interruptible_sleep_on(&info->close_wait);
- MOD_DEC_USE_COUNT;
#ifdef SERIAL_DO_RESTART
return ((info->flags & ASYNC_HUP_NOTIFY) ?
-EAGAIN : -ERESTARTSYS);
@@ -3201,10 +3200,8 @@
* Start up serial port
*/
retval = startup(info);
- if (retval) {
- MOD_DEC_USE_COUNT;
+ if (retval)
return retval;
- }
retval = block_til_ready(tty, filp, info);
if (retval) {
@@ -3212,7 +3209,6 @@
printk("rs_open returning after block_til_ready with %d\n",
retval);
#endif
- MOD_DEC_USE_COUNT;
return retval;
}
@@ -4896,7 +4892,7 @@
static struct pci_driver serial_pci_driver = {
name: "serial",
probe: serial_init_one,
- remove: serial_remove_one,
+ remove: __devexit_p(serial_remove_one),
id_table: serial_pci_tbl,
};
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)