serial tty_driver add .owner field remove MOD_INC/DEC_USE_COUNT (fwd)

serial tty_driver add .owner field remove MOD_INC/DEC_USE_COUNT (fwd)

Post by Hanna Linde » Sat, 01 Mar 2003 21:20:07



Doh! I meant rmk not davem. sorry guys. Dave please
ignore, Russell please review. 37 patches is my excuse.

Hanna

---------- Forwarded Message ----------
Date: Friday, February 28, 2003 11:07:21 AM -0800



Subject: [PATCH 2.5.63] serial tty_driver add .owner field remove MOD_INC/DEC_USE_COUNT

Here are the changes to drivers/serial to set .owner for tty_drivers
and remove MOD_INC/DEC_USE_COUNT. Dave, please review.  I have made
changes to most the other tty drivers and am sending them to

I will, please let me know. I tested the core changes via 8250 following
are the results:

Without patch:

Module                  Size  Used by
8250                   26400  0
core                   21568  1 8250

[1] 4206

Module                  Size  Used by
8250                   26400  1
core                   21568  1 8250


Module                  Size  Used by
8250                   26400  0
core                   21568  1 8250
[1]+  Terminated              cat /dev/ttyS0

with patch:


Module                  Size  Used by
8250                   26400  0
core                   21600  1 8250

[1] 1124

Module                  Size  Used by
8250                   26400  1
core                   21600  2 8250


Module                  Size  Used by
8250                   26400  0
core                   21600  1 8250
[1]+  Terminated              cat /dev/ttyS0

Hanna
------
 68328serial.c |    1 +
 68360serial.c |    6 +-----
 core.c        |    1 +
 mcfserial.c   |    1 +
 4 files changed, 4 insertions(+), 5 deletions(-)

diff -Nru -Xdontdiff linux-2.5.63/drivers/serial/68328serial.c linux-2.5.63-ttydrv/drivers/serial/68328serial.c
--- linux-2.5.63/drivers/serial/68328serial.c   Mon Feb 24 11:05:48 2003

        memset(&serial_driver, 0, sizeof(struct tty_driver));
        serial_driver.magic = TTY_DRIVER_MAGIC;
+       serial_driver.owner = THIS_MODULE;
        serial_driver.name = "ttyS";
        serial_driver.major = TTY_MAJOR;
        serial_driver.minor_start = 64;
diff -Nru -Xdontdiff linux-2.5.63/drivers/serial/68360serial.c linux-2.5.63-ttydrv/drivers/serial/68360serial.c
--- linux-2.5.63/drivers/serial/68360serial.c   Mon Feb 24 11:05:46 2003

        if (tty_hung_up_p(filp)) {
                DBG_CNT("before DEC-hung");
-               MOD_DEC_USE_COUNT;
                local_irq_restore(flags);
                return;

        }
        if (state->count) {
                DBG_CNT("before DEC-2");
-               MOD_DEC_USE_COUNT;
                local_irq_restore(flags);
                return;

        info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE|
                         ASYNC_CLOSING);
        wake_up_interruptible(&info->close_wait);
-       MOD_DEC_USE_COUNT;
        local_irq_restore(flags);
 }

        if (retval)
                return retval;

-       MOD_INC_USE_COUNT;
        retval = block_til_ready(tty, filp, info);
        if (retval) {
 #ifdef SERIAL_DEBUG_OPEN
                printk("rs_open returning after block_til_ready with %d\n",
                       retval);
 #endif
-               MOD_DEC_USE_COUNT;
                return retval;
        }

        serial_driver.magic = TTY_DRIVER_MAGIC;
        /* serial_driver.driver_name = "serial"; */
+       serial_driver.owner = THIS_MODULE;
        serial_driver.name = "ttyS";
        serial_driver.major = TTY_MAJOR;
        serial_driver.minor_start = 64;
diff -Nru -Xdontdiff linux-2.5.63/drivers/serial/core.c linux-2.5.63-ttydrv/drivers/serial/core.c
--- linux-2.5.63/drivers/serial/core.c  Mon Feb 24 11:05:12 2003

        drv->tty_driver = normal;

        normal->magic                = TTY_DRIVER_MAGIC;
+       normal->owner                = THIS_MODULE;
        normal->driver_name  = drv->driver_name;
        normal->name         = drv->dev_name;
        normal->major                = drv->major;
diff -Nru -Xdontdiff linux-2.5.63/drivers/serial/mcfserial.c linux-2.5.63-ttydrv/drivers/serial/mcfserial.c
--- linux-2.5.63/drivers/serial/mcfserial.c     Mon Feb 24 11:05:29 2003

        /* Initialize the tty_driver structure */
        memset(&mcfrs_serial_driver, 0, sizeof(struct tty_driver));
        mcfrs_serial_driver.magic = TTY_DRIVER_MAGIC;
+       mcfrs_serial_driver.owner = THIS_MODULE;
        mcfrs_serial_driver.name = "ttyS";
        mcfrs_serial_driver.major = TTY_MAJOR;
        mcfrs_serial_driver.minor_start = 64;

---------- End Forwarded Message ----------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/