review: 2.5.59 patches to fix bug 282
Please review these changes (following what gregkh has already done in the usb dir). These fix bug number 282 at:
http://bugme.osdl.org and are tty cleanups to fix a module race condition and utilize the new owner field of the tty_driver structure.
I have not compiled yet so just a brief review is ok.
Thanks.
Hanna
[email protected]
included is a gzipped tar ball and the text below, they are the same code.
-----
drivers/char/amiserial.c +1 -6
@@ -1535,7 +1535,6 @@if (tty_hung_up_p (filp)) {DBG_CNT ("before DEC-hung" ); -MOD_DEC_USE_COUNT ;local_irq_restore (flags);return ; }
@@ -1562,7 +1561,6 @@ }if (state->count) {DBG_CNT ("before DEC-2" ); -MOD_DEC_USE_COUNT ;local_irq_restore (flags);return ; }
@@ -1622,7 +1620,6 @@ info->flags &= ~(ASYNC_NORMAL_ACTIVE |ASYNC_CALLOUT_ACTIVE |ASYNC_CLOSING );wake_up_interruptible (&info->close_wait); -MOD_DEC_USE_COUNT ;local_irq_restore (flags); }
@@ -1902,15 +1899,12 @@int retval, line;unsigned long page; -MOD_INC_USE_COUNT ; line =minor (tty->device) - tty->driver.minor_start;if ((line <0 ) || (line >=NR_PORTS )) { -MOD_DEC_USE_COUNT ;return -ENODEV ; } retval =get_async_struct (line, &info);if (retval) { -MOD_DEC_USE_COUNT ;return retval; } tty->driver_data = info;
@@ -2127,6 +2121,7 @@memset (&serial_driver,0 ,sizeof (struct tty_driver )); serial_driver.magic =TTY_DRIVER_MAGIC ; + serial_driver.owner =THIS_MODULE ; serial_driver.driver_name ="amiserial" ; serial_driver.name ="ttyS" ; serial_driver.major =TTY_MAJOR ;
drivers/char/cyclades.c +1 -7
@@ -2578,15 +2578,12 @@int retval, line;unsigned long page; -MOD_INC_USE_COUNT ; line =minor (tty->device) - tty->driver.minor_start;if ((line <0 ) || (NR_PORTS <= line)){ -MOD_DEC_USE_COUNT ;return -ENODEV ; } info = &cy_port[line];if (info->line <0 ){ -MOD_DEC_USE_COUNT ;return -ENODEV ; }
@@ -2606,7 +2603,6 @@ }else {printk ("cyc:Cyclades-Z firmware not yet loaded\n" ); } -MOD_DEC_USE_COUNT ;return -ENODEV ; }#ifdef CONFIG_CYZ_INTR
@@ -2802,7 +2798,6 @@CY_LOCK (info, flags);/* If the TTY is being hung up, nothing to do */ if (tty_hung_up_p (filp)) { -MOD_DEC_USE_COUNT ;CY_UNLOCK (info, flags);return ; }
@@ -2833,7 +2828,6 @@ info->count =0 ; }if (info->count) { -MOD_DEC_USE_COUNT ;CY_UNLOCK (info, flags);return ; }
@@ -2930,7 +2924,6 @@printk (" cyc:cy_close done\n" );#endif -MOD_DEC_USE_COUNT ;CY_UNLOCK (info, flags);return ; }/* cy_close */
@@ -5507,6 +5500,7 @@memset (&cy_serial_driver,0 ,sizeof (struct tty_driver )); cy_serial_driver.magic =TTY_DRIVER_MAGIC ; + cy_serial_driver.owner =THIS_MODULE ; cy_serial_driver.driver_name ="cyclades" ; cy_serial_driver.name ="ttyC" ; cy_serial_driver.major =CYCLADES_MAJOR ;
drivers/char/epca.c +2 -10
@@ -481,9 +481,7 @@-------------------------------------------------------------------------*/ ch->event |=1 << event; -MOD_INC_USE_COUNT ; -if (schedule_work (&ch->tqueue) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_work (&ch->tqueue); }/* End pc_sched_event */
@@ -604,7 +602,6 @@ ASYNC_CALLOUT_ACTIVE | ASYNC_CLOSING);wake_up_interruptible (&ch->close_wait); -MOD_DEC_USE_COUNT ;restore_flags (flags);
@@ -692,10 +689,6 @@shutdown (ch); -if (ch->count) -MOD_DEC_USE_COUNT ; - - ch->tty =NULL ; ch->event =0 ; ch->count =0 ;
@@ -1389,8 +1382,6 @@ } -MOD_INC_USE_COUNT ; - ch = &digi_channels[line]; boardnum = ch->boardnum;
@@ -1714,6 +1705,7 @@memset (&pc_info,0 ,sizeof (struct tty_driver )); pc_driver.magic =TTY_DRIVER_MAGIC ; + pc_driver.owner =THIS_MODULE ; pc_driver.name ="ttyD" ; pc_driver.major =DIGI_MAJOR ; pc_driver.minor_start =0 ;
drivers/char/esp.c +3 -6
@@ -643,9 +643,7 @@#ifdef SERIAL_DEBUG_OPEN printk ("scheduling hangup..." );#endif -MOD_INC_USE_COUNT ; -if (schedule_task (&info->tqueue_hangup) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_task (&info->tqueue_hangup); } } }
@@ -809,7 +807,6 @@ tty = info->tty;if (tty)tty_hangup (tty); -MOD_DEC_USE_COUNT ; }/*
@@ -2130,7 +2127,7 @@ info->flags &= ~(ASYNC_NORMAL_ACTIVE |ASYNC_CALLOUT_ACTIVE |ASYNC_CLOSING );wake_up_interruptible (&info->close_wait); -out:MOD_DEC_USE_COUNT ; +out:restore_flags (flags); }
@@ -2374,7 +2371,6 @@printk ("esp_open %s%d, count = %d\n" , tty->driver.name, info->line, info->count);#endif -MOD_INC_USE_COUNT ; info->count++; tty->driver_data = info; info->tty = tty;
@@ -2550,6 +2546,7 @@memset (&esp_driver,0 ,sizeof (struct tty_driver )); esp_driver.magic =TTY_DRIVER_MAGIC ; + esp_driver.owner =THIS_MODULE ; esp_driver.name ="ttyP" ; esp_driver.major =ESP_IN_MAJOR ; esp_driver.minor_start =0 ;
drivers/char/ip2main.c +1 -4
@@ -793,6 +793,7 @@/* Initialise the relevant fields. */ ip2_tty_driver.magic =TTY_DRIVER_MAGIC ; + ip2_tty_driver.owner =THIS_MODULE ; ip2_tty_driver.name = pcTty;#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,1 ,0 ) ip2_tty_driver.driver_name = pcDriver_name;
@@ -1574,7 +1575,6 @@/* Setup pointer links in device and tty structures */ pCh->pTTY = tty; tty->driver_data = pCh; -MOD_INC_USE_COUNT ;#ifdef IP2DEBUG_OPEN printk(KERN_DEBUG \
@@ -1775,14 +1775,12 @@#endif if (tty_hung_up_p ( pFile ) ) { -MOD_DEC_USE_COUNT ;ip2trace (CHANN ,ITRC_CLOSE ,2 ,1 ,2 );return ; }if ( tty->count >1 ) {/* not the last close */ -MOD_DEC_USE_COUNT ;ip2trace (CHANN ,ITRC_CLOSE ,2 ,1 ,3 );
@@ -1850,7 +1848,6 @@DBG_CNT ("ip2_close: after wakeups--" );#endif -MOD_DEC_USE_COUNT ;ip2trace (CHANN ,ITRC_CLOSE ,ITRC_RETURN ,1 ,1 );
drivers/char/isicom.c +2 -6
@@ -589,9 +589,7 @@ port->status &= ~ISI_DCD ;if (!((port->flags &ASYNC_CALLOUT_ACTIVE ) && (port->flags &ASYNC_CALLOUT_NOHUP ))) { -MOD_INC_USE_COUNT ; -if (schedule_task (&port->hangup_tq) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_task (&port->hangup_tq); } } }
@@ -845,7 +843,6 @@#endif bp->status |=BOARD_ACTIVE ; -MOD_INC_USE_COUNT ;return ; }
@@ -1103,7 +1100,6 @@for (channel =0 ; channel < bp->port_count; channel++, port++) {drop_dtr_rts (port); } -MOD_DEC_USE_COUNT ; }static void isicom_shutdown_port (struct isi_port * port)
@@ -1643,7 +1639,6 @@ tty = port->tty;if (tty)tty_hangup (tty);/* FIXME: module removal race here - AKPM */ -MOD_DEC_USE_COUNT ; }static void isicom_hangup (struct tty_struct * tty)
@@ -1714,6 +1709,7 @@/* tty driver structure initialization */ memset (&isicom_normal,0 ,sizeof (struct tty_driver )); isicom_normal.magic =TTY_DRIVER_MAGIC ; + isicom_normal.owner =THIS_MODULE ; isicom_normal.name ="ttyM" ; isicom_normal.major =ISICOM_NMAJOR ; isicom_normal.minor_start =0 ;
drivers/char/istallion.c +2 -8
@@ -1054,7 +1054,6 @@if (portp->devnr <1 )return (-ENODEV ); -MOD_INC_USE_COUNT ;/* * Check if this port is in the middle of closing. If so then wait
@@ -1170,14 +1169,12 @@save_flags (flags);cli ();if (tty_hung_up_p (filp)) { -MOD_DEC_USE_COUNT ;restore_flags (flags);return ; }if ((tty->count ==1 ) && (portp->refcount !=1 )) portp->refcount =1 ;if (portp->refcount-- >1 ) { -MOD_DEC_USE_COUNT ;restore_flags (flags);return ; }
@@ -1232,7 +1229,6 @@ portp->flags &= ~(ASYNC_CALLOUT_ACTIVE |ASYNC_NORMAL_ACTIVE |ASYNC_CLOSING );wake_up_interruptible (&portp->close_wait); -MOD_DEC_USE_COUNT ;restore_flags (flags); }
@@ -2369,7 +2365,6 @@tty_hangup (portp->tty); } } -MOD_DEC_USE_COUNT ; }/*****************************************************************************/
@@ -3004,9 +2999,7 @@if (! ((portp->flags &ASYNC_CALLOUT_ACTIVE ) && (portp->flags &ASYNC_CALLOUT_NOHUP ))) {if (tty != (struct tty_struct *)NULL ) { -MOD_INC_USE_COUNT ; -if (schedule_task (&portp->tqhangup) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_task (&portp->tqhangup); } } }
@@ -5350,6 +5343,7 @@*/ memset (&stli_serial,0 ,sizeof (struct tty_driver )); stli_serial.magic =TTY_DRIVER_MAGIC ; + stli_serial.owner =THIS_MODULE ; stli_serial.driver_name = stli_drvname; stli_serial.name = stli_serialname; stli_serial.major =STL_SERIALMAJOR ;
drivers/char/moxa.c +2 -10
@@ -341,6 +341,7 @@memset (&moxaDriver,0 ,sizeof (struct tty_driver ));memset (&moxaCallout,0 ,sizeof (struct tty_driver )); moxaDriver.magic =TTY_DRIVER_MAGIC ; + moxaDriver.owner =THIS_MODULE ; moxaDriver.name ="ttya" ; moxaDriver.major = ttymajor; moxaDriver.minor_start =0 ;
@@ -544,7 +545,6 @@ ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE |ASYNC_CALLOUT_ACTIVE ); } } -MOD_DEC_USE_COUNT ; }static int moxa_open (struct tty_struct *tty,struct file *filp)
@@ -556,7 +556,6 @@ port =PORTNO (tty);if (port ==MAX_PORTS ) { -MOD_INC_USE_COUNT ;return (0 ); }if (!MoxaPortIsValid (port)) {
@@ -579,7 +578,6 @@ }up (&moxaBuffSem); -MOD_INC_USE_COUNT ; ch = &moxaChannels[port]; ch->count++; tty->driver_data = ch;
@@ -619,7 +617,6 @@ port =PORTNO (tty);if (port ==MAX_PORTS ) { -MOD_DEC_USE_COUNT ;return ; }if (!MoxaPortIsValid (port)) {
@@ -633,7 +630,6 @@return ; }if (tty_hung_up_p (filp)) { -MOD_DEC_USE_COUNT ;return ; } ch = (struct moxa_str *) tty->driver_data;
@@ -649,7 +645,6 @@ ch->count =0 ; }if (ch->count) { -MOD_DEC_USE_COUNT ;return ; } ch->asyncflags |=ASYNC_CLOSING ;
@@ -688,7 +683,6 @@ ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE |ASYNC_CALLOUT_ACTIVE |ASYNC_CLOSING );wake_up_interruptible (&ch->close_wait); -MOD_DEC_USE_COUNT ; } static int moxa_write(struct tty_struct *tty, int from_user,
@@ -1024,9 +1018,7 @@wake_up_interruptible (&ch->open_wait); else {set_bit (MOXA_EVENT_HANGUP , &ch->event); -MOD_DEC_USE_COUNT ; -if (schedule_work (&ch->tqueue) ==0 ) -MOD_INC_USE_COUNT ; +schedule_work (&ch->tqueue); } } }
drivers/char/mxser.c +4 -15
@@ -501,6 +501,7 @@memset (&mxvar_sdriver,0 ,sizeof (struct tty_driver )); mxvar_sdriver.magic =TTY_DRIVER_MAGIC ; + mxvar_sdriver.owner =THIS_MODULE ; mxvar_sdriver.name ="ttyM" ; mxvar_sdriver.major = ttymajor; mxvar_sdriver.minor_start =0 ;
@@ -708,7 +709,6 @@tty_hangup (tty);/* FIXME: module removal race here - AKPM */ } } -MOD_DEC_USE_COUNT ; }/*
@@ -767,8 +767,6 @@ info->session = current->session; info->pgrp = current->pgrp; -MOD_INC_USE_COUNT ; -return (0 ); }
@@ -795,7 +793,6 @@if (tty_hung_up_p (filp)) {restore_flags (flags); -MOD_DEC_USE_COUNT ;return ; }if ((tty->count ==1 ) && (info->count !=1 )) {
@@ -817,7 +814,6 @@ }if (info->count) {restore_flags (flags); -MOD_DEC_USE_COUNT ;return ; } info->flags |=ASYNC_CLOSING ;
@@ -881,7 +877,6 @@wake_up_interruptible (&info->close_wait);restore_flags (flags); -MOD_DEC_USE_COUNT ; } static int mxser_write(struct tty_struct *tty, int from_user,
@@ -1489,9 +1484,7 @@if (info->xmit_cnt <WAKEUP_CHARS ) {set_bit (MXSER_EVENT_TXLOW , &info->event); -MOD_INC_USE_COUNT ; -if (schedule_work (&info->tqueue) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_work (&info->tqueue); }if (info->xmit_cnt <=0 ) { info->IER &= ~UART_IER_THRI ;
@@ -1520,9 +1513,7 @@else if (!((info->flags &ASYNC_CALLOUT_ACTIVE ) && (info->flags &ASYNC_CALLOUT_NOHUP )))set_bit (MXSER_EVENT_HANGUP , &info->event); -MOD_INC_USE_COUNT ; -if (schedule_work (&info->tqueue) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_work (&info->tqueue); }if (info->flags &ASYNC_CTS_FLOW ) {if (info->tty->hw_stopped) {
@@ -1532,9 +1523,7 @@outb (info->IER, info->base +UART_IER );set_bit (MXSER_EVENT_TXLOW , &info->event); -MOD_INC_USE_COUNT ; -if (schedule_work (&info->tqueue) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_work (&info->tqueue); } }else {if (!(status &UART_MSR_CTS )) {
drivers/char/pcmcia/synclink_cs.c +1 -7
@@ -2690,7 +2690,6 @@if (debug_level >=DEBUG_LEVEL_INFO )printk ("%s(%d):mgslpc_close(%s) exit, count=%d\n" , __FILE__,__LINE__, tty->driver.name, info->count); -MOD_DEC_USE_COUNT ; }/* Wait until the transmitter is empty.
@@ -2942,8 +2941,6 @@printk ("%s(%d):mgslpc_open(%s), old ref count = %d\n" , __FILE__,__LINE__,tty->driver.name, info->count); -MOD_INC_USE_COUNT ; -/* If port is closing, signal caller to try again */ if (tty_hung_up_p (filp) || info->flags &ASYNC_CLOSING ){if (info->flags &ASYNC_CLOSING )
@@ -2998,7 +2995,6 @@ cleanup:if (retval) { -MOD_DEC_USE_COUNT ;if (info->count) info->count--; }
@@ -3250,6 +3246,7 @@memset (&serial_driver,0 ,sizeof (struct tty_driver )); serial_driver.magic =TTY_DRIVER_MAGIC ; + serial_driver.owner =THIS_MODULE ; serial_driver.driver_name ="synclink_cs" ; serial_driver.name ="ttySLP" ; serial_driver.major = ttymajor;
@@ -4401,7 +4398,6 @@return -EBUSY ; } info->netcount=1 ; -MOD_INC_USE_COUNT ;spin_unlock_irqrestore (&info->netlock, flags);/* claim resources and init adapter */
@@ -4424,7 +4420,6 @@ open_fail:spin_lock_irqsave (&info->netlock, flags); info->netcount=0 ; -MOD_DEC_USE_COUNT ;spin_unlock_irqrestore (&info->netlock, flags);return err; }
@@ -4494,7 +4489,6 @@spin_lock_irqsave (&info->netlock, flags); info->netcount=0 ; -MOD_DEC_USE_COUNT ;spin_unlock_irqrestore (&info->netlock, flags);return 0 ; }
drivers/char/pcxx.c +1 -5
@@ -431,8 +431,6 @@return (-ENODEV ); } -/* flag the kernel that there is somebody using this guy */ -MOD_INC_USE_COUNT ;/* * If the device is in the middle of being closed, then block * until it's done, and then try again.
@@ -576,7 +574,6 @@if (tty_hung_up_p (filp)) {/* flag that somebody is done with this module */ -MOD_DEC_USE_COUNT ;restore_flags (flags);return ; }
@@ -594,7 +591,6 @@ }if (info->count-- >1 ) {restore_flags (flags); -MOD_DEC_USE_COUNT ;return ; }if (info->count <0 ) {
@@ -651,7 +647,6 @@ info->asyncflags &= ~(ASYNC_NORMAL_ACTIVE |ASYNC_CALLOUT_ACTIVE |ASYNC_CLOSING );wake_up_interruptible (&info->close_wait); -MOD_DEC_USE_COUNT ;restore_flags (flags); } }
@@ -1228,6 +1223,7 @@memset (&pcxe_driver,0 ,sizeof (struct tty_driver )); pcxe_driver.magic =TTY_DRIVER_MAGIC ; + pcxe_driver.owner =THIS_MODULE ; pcxe_driver.name ="ttyD" ; pcxe_driver.major =DIGI_MAJOR ; pcxe_driver.minor_start =0 ;
drivers/char/rio/rio_linux.c +1 -25
@@ -392,29 +392,6 @@udelay (usecs); } - -void rio_inc_mod_count (void ) -{ -#ifdef MODULE -func_enter (); -rio_dprintk (RIO_DEBUG_MOD_COUNT ,"rio_inc_mod_count\n" ); -MOD_INC_USE_COUNT ; -func_exit (); -#endif -} - - -void rio_dec_mod_count (void ) -{ -#ifdef MODULE -func_enter (); -rio_dprintk (RIO_DEBUG_MOD_COUNT ,"rio_dec_mod_count\n" ); -MOD_DEC_USE_COUNT ; -func_exit (); -#endif -} - -static int rio_set_real_termios (void *ptr) {int rv, modem;
@@ -662,7 +639,6 @@ PortP = (struct Port *)ptr; PortP->gs.tty =NULL ; -rio_dec_mod_count ();func_exit (); }
@@ -688,7 +664,6 @@ } PortP->gs.tty =NULL ; -rio_dec_mod_count ();func_exit (); }
@@ -910,6 +885,7 @@memset (&rio_driver,0 ,sizeof (rio_driver)); rio_driver.magic =TTY_DRIVER_MAGIC ; + rio_driver.owner =THIS_MODULE ; rio_driver.driver_name ="specialix_rio" ; rio_driver.name ="ttySR" ; rio_driver.major =RIO_NORMAL_MAJOR0 ;
drivers/char/rio/rio_linux.h +0 -3
@@ -87,9 +87,6 @@#endif -void rio_dec_mod_count (void ); -void rio_inc_mod_count (void ); -/* Allow us to debug "in the field" without requiring clients to recompile.... */ #if 1
drivers/char/rio/riotty.c +0 -5
@@ -141,7 +141,6 @@extern struct rio_info *p; -extern void rio_inc_mod_count (void );int
@@ -207,8 +206,6 @@ tty->driver_data = PortP; PortP->gs.tty = tty; -if (!PortP->gs.count) -rio_inc_mod_count (); PortP->gs.count++; rio_dprintk (RIO_DEBUG_TTY, "%d bytes in tx buffer\n",
@@ -217,8 +214,6 @@ retval =gs_init_port (&PortP->gs);if (retval) { PortP->gs.count--; -if (PortP->gs.count) -rio_dec_mod_count ();return -ENXIO ; }/*
drivers/char/riscom8.c +2 -6
@@ -552,9 +552,7 @@wake_up_interruptible (&port->open_wait); else if (!((port->flags & ASYNC_CALLOUT_ACTIVE) && (port->flags & ASYNC_CALLOUT_NOHUP))) { -MOD_INC_USE_COUNT ; -if (schedule_task (&port->tqueue_hangup) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_task (&port->tqueue_hangup); } }
@@ -674,7 +672,6 @@ IRQ_to_board[bp->irq] = bp; bp->flags |=RC_BOARD_ACTIVE ; -MOD_INC_USE_COUNT ;return 0 ; }
@@ -692,7 +689,6 @@ bp->DTR = ~0 ;rc_out (bp,RC_DTR , bp->DTR);/* Drop DTR on all ports */ -MOD_DEC_USE_COUNT ; }/*
@@ -1676,7 +1672,6 @@ tty = port->tty;if (tty)tty_hangup (tty);/* FIXME: module removal race still here */ -MOD_DEC_USE_COUNT ; }static void rc_hangup (struct tty_struct * tty)
@@ -1755,6 +1750,7 @@memset (IRQ_to_board,0 ,sizeof (IRQ_to_board));memset (&riscom_driver,0 ,sizeof (riscom_driver)); riscom_driver.magic =TTY_DRIVER_MAGIC ; + riscom_driver.owner =THIS_MODULE ; riscom_driver.name ="ttyL" ; riscom_driver.major =RISCOM8_NORMAL_MAJOR ; riscom_driver.num =RC_NBOARD *RC_NPORT ;
drivers/char/rocket.c +1 -9
@@ -874,9 +874,6 @@ }if (info->count++ ==0 ) { -#ifdef MODULE -MOD_INC_USE_COUNT ; -#endif rp_num_ports_open++;#ifdef ROCKET_DEBUG_OPEN printk ("rocket mod++ = %d..." , rp_num_ports_open);
@@ -1071,9 +1068,6 @@ tty->closing =0 ;wake_up_interruptible (&info->close_wait); -#ifdef MODULE -MOD_DEC_USE_COUNT ; -#endif rp_num_ports_open--;#ifdef ROCKET_DEBUG_OPEN printk ("rocket mod-- = %d..." , rp_num_ports_open);
@@ -1517,9 +1511,6 @@return ; }if (info->count) { -#ifdef MODULE -MOD_DEC_USE_COUNT ; -#endif rp_num_ports_open--; }
@@ -2025,6 +2016,7 @@*/ memset (&rocket_driver,0 ,sizeof (struct tty_driver )); rocket_driver.magic =TTY_DRIVER_MAGIC ; + rocket_driver.owner =THIS_MODULE ;#ifdef CONFIG_DEVFS_FS rocket_driver.name ="tts/R%d" ;#else
drivers/char/ser_a2232.c +1 -6
@@ -272,7 +272,6 @@not in "a2232_close()". See the comment in "sx.c", too. If you run into problems, compile this driver into the kernel instead of compiling it as a module. */ -MOD_DEC_USE_COUNT ; }static int a2232_set_real_termios (void *ptr)
@@ -414,7 +413,6 @@a2232_disable_tx_interrupts (ptr);a2232_disable_rx_interrupts (ptr);/* see the comment in a2232_shutdown_port above. */ -/* MOD_DEC_USE_COUNT; */ }static void a2232_hungup (void *ptr)
@@ -468,13 +466,9 @@return retval; } port->gs.flags |=GS_ACTIVE ; -if (port->gs.count ==1 ) { -MOD_INC_USE_COUNT ; - } retval =gs_block_til_ready (port, filp);if (retval) { -MOD_DEC_USE_COUNT ; port->gs.count--;return retval; }
@@ -711,6 +705,7 @@memset (&a2232_driver,0 ,sizeof (a2232_driver)); a2232_driver.magic =TTY_DRIVER_MAGIC ; + a2232_driver.owner =THIS_MODULE ; a2232_driver.driver_name ="commodore_a2232" ; a2232_driver.name ="ttyY" ; a2232_driver.major =A2232_NORMAL_MAJOR ;
drivers/char/serial_tx3912.c +1 -34
@@ -41,8 +41,6 @@static void rs_shutdown_port (void * ptr);static int rs_set_real_termios (void *ptr);static int rs_chars_in_buffer (void * ptr); -static void rs_hungup (void *ptr); -static void rs_close (void *ptr);/* * Used by generic serial driver to access hardware
@@ -56,8 +54,6 @@ .shutdown_port = rs_shutdown_port, .set_real_termios = rs_set_real_termios, .chars_in_buffer = rs_chars_in_buffer, - .close = rs_close, - .hungup = rs_hungup, };/*
@@ -579,9 +575,6 @@rs_dprintk (TX3912_UART_DEBUG_OPEN ,"before inc_use_count (count=%d.\n" , port->gs.count); -if (port->gs.count ==1 ) { -MOD_INC_USE_COUNT ; - }rs_dprintk (TX3912_UART_DEBUG_OPEN ,"after inc_use_count\n" );/* Jim: Initialize port hardware here */
@@ -595,7 +588,6 @@ retval, port->gs.count);if (retval) { -MOD_DEC_USE_COUNT ; port->gs.count--;return retval; }
@@ -621,32 +613,6 @@ } - -static void rs_close (void *ptr) -{ -func_enter (); - -/* Anything to do here? */ - -MOD_DEC_USE_COUNT ; -func_exit (); -} - - -/* I haven't the foggiest why the decrement use count has to happen -here. The whole linux serial drivers stuff needs to be redesigned. -My guess is that this is a hack to minimize the impact of a bug -elsewhere. Thinking about it some more. (try it sometime) Try -running minicom on a serial port that is driven by a modularized -driver. Have the modem hangup. Then remove the driver module. Then -exit minicom. I expect an "oops". -- REW */ -static void rs_hungup (void *ptr) -{ -func_enter (); -MOD_DEC_USE_COUNT ; -func_exit (); -} -static int rs_ioctl (struct tty_struct * tty,struct file * filp,unsigned int cmd,unsigned long arg) {
@@ -839,6 +805,7 @@memset (&rs_driver,0 ,sizeof (rs_driver)); rs_driver.magic =TTY_DRIVER_MAGIC ; + rs_driver.owner =THIS_MODULE ; rs_driver.driver_name ="serial" ; rs_driver.name ="ttyS" ; rs_driver.major =TTY_MAJOR ;
drivers/char/sh-sci.c +1 -21
@@ -71,8 +71,6 @@static int sci_get_CD (void *ptr);static void sci_shutdown_port (void *ptr);static int sci_set_real_termios (void *ptr); -static void sci_hungup (void *ptr); -static void sci_close (void *ptr);static int sci_chars_in_buffer (void *ptr);static int sci_request_irq (struct sci_port *port);static void sci_free_irq (struct sci_port *port);
@@ -216,8 +214,6 @@ sci_shutdown_port, sci_set_real_termios, sci_chars_in_buffer, - sci_close, - sci_hungup, NULL };
@@ -838,12 +834,7 @@sci_setsignals (port,1 ,1 );if (port->gs.count ==1 ) { -MOD_INC_USE_COUNT ; - retval =sci_request_irq (port); -if (retval) { - goto failed_2; - } } retval =gs_block_til_ready (port, filp);
@@ -878,23 +869,11 @@ failed_3:sci_free_irq (port); -failed_2: -MOD_DEC_USE_COUNT ; failed_1: port->gs.count--;return retval; } -static void sci_hungup (void *ptr) -{ -MOD_DEC_USE_COUNT ; -} - -static void sci_close (void *ptr) -{ -MOD_DEC_USE_COUNT ; -} -static int sci_ioctl (struct tty_struct * tty,struct file * filp,unsigned int cmd,unsigned long arg) {
@@ -1019,6 +998,7 @@memset (&sci_driver,0 ,sizeof (sci_driver)); sci_driver.magic =TTY_DRIVER_MAGIC ; + sci_driver.owner =THIS_MODULE ; sci_driver.driver_name ="sci" ;#ifdef CONFIG_DEVFS_FS sci_driver.name ="ttsc/%d" ;
drivers/char/specialix.c +2 -6
@@ -833,9 +833,7 @@#ifdef SPECIALIX_DEBUG printk ("Sending HUP.\n" );#endif -MOD_INC_USE_COUNT ; -if (schedule_task (&port->tqueue_hangup) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_task (&port->tqueue_hangup); }else {#ifdef SPECIALIX_DEBUG printk ("Don't need to send HUP.\n" );
@@ -979,7 +977,6 @@turn_ints_on (bp); bp->flags |=SX_BOARD_ACTIVE ; -MOD_INC_USE_COUNT ;return 0 ; }
@@ -999,7 +996,6 @@turn_ints_off (bp); -MOD_DEC_USE_COUNT ; }
@@ -2149,7 +2145,6 @@ tty = port->tty;if (tty)tty_hangup (tty);/* FIXME: module removal race here */ -MOD_DEC_USE_COUNT ; }
@@ -2232,6 +2227,7 @@init_bh (SPECIALIX_BH , do_specialix_bh);memset (&specialix_driver,0 ,sizeof (specialix_driver)); specialix_driver.magic =TTY_DRIVER_MAGIC ; + specialix_driver.owner =THIS_MODULE ; specialix_driver.name ="ttyW" ; specialix_driver.major =SPECIALIX_NORMAL_MAJOR ; specialix_driver.num =SX_NBOARD *SX_NPORT ;
drivers/char/stallion.c +7 -21
@@ -1045,8 +1045,6 @@if (portp == (stlport_t *)NULL )return (-ENODEV ); -MOD_INC_USE_COUNT ; -/* * On the first open of the device setup the port hardware, and * initialize the per port data structure.
@@ -1208,14 +1206,12 @@save_flags (flags);cli ();if (tty_hung_up_p (filp)) { -MOD_DEC_USE_COUNT ;restore_flags (flags);return ; }if ((tty->count ==1 ) && (portp->refcount !=1 )) portp->refcount =1 ;if (portp->refcount-- >1 ) { -MOD_DEC_USE_COUNT ;restore_flags (flags);return ; }
@@ -1268,7 +1264,6 @@ portp->flags &= ~(ASYNC_CALLOUT_ACTIVE |ASYNC_NORMAL_ACTIVE |ASYNC_CLOSING );wake_up_interruptible (&portp->close_wait); -MOD_DEC_USE_COUNT ;restore_flags (flags); }
@@ -2239,11 +2234,11 @@#endif if (portp == (stlport_t *)NULL ) - goto out; +return ; tty = portp->tty;if (tty == (struct tty_struct *)NULL ) - goto out; +return ;lock_kernel ();if (test_bit (ASYI_TXLOW , &portp->istate)) {
@@ -2268,8 +2263,6 @@ } }unlock_kernel (); -out: -MOD_DEC_USE_COUNT ; }/*****************************************************************************/
@@ -3229,6 +3222,7 @@*/ memset (&stl_serial,0 ,sizeof (struct tty_driver )); stl_serial.magic =TTY_DRIVER_MAGIC ; + stl_serial.owner =THIS_MODULE ; stl_serial.driver_name = stl_drvname; stl_serial.name = stl_serialname; stl_serial.major =STL_SERIALMAJOR ;
@@ -4134,9 +4128,7 @@if ((len ==0 ) || ((len <STL_TXBUFLOW ) && (test_bit (ASYI_TXLOW , &portp->istate) ==0 ))) {set_bit (ASYI_TXLOW , &portp->istate); -MOD_INC_USE_COUNT ; -if (schedule_work (&portp->tqueue) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_work (&portp->tqueue); }if (len ==0 ) {
@@ -4316,9 +4308,7 @@ misr =inb (ioaddr +EREG_DATA );if (misr &MISR_DCD ) {set_bit (ASYI_DCDCHANGE , &portp->istate); -MOD_INC_USE_COUNT ; -if (schedule_task (&portp->tqueue) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_task (&portp->tqueue); portp->stats.modem++; }
@@ -5115,9 +5105,7 @@if ((len ==0 ) || ((len <STL_TXBUFLOW ) && (test_bit (ASYI_TXLOW , &portp->istate) ==0 ))) {set_bit (ASYI_TXLOW , &portp->istate); -MOD_INC_USE_COUNT ; -if (schedule_task (&portp->tqueue) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_task (&portp->tqueue); }if (len ==0 ) {
@@ -5334,9 +5322,7 @@ ipr =stl_sc26198getreg (portp,IPR );if (ipr &IPR_DCDCHANGE ) {set_bit (ASYI_DCDCHANGE , &portp->istate); -MOD_INC_USE_COUNT ; -if (schedule_task (&portp->tqueue) ==0 ) -MOD_DEC_USE_COUNT ; +schedule_task (&portp->tqueue); portp->stats.modem++; }break ;
drivers/char/sx.c +1 -41
90 lines not on this page · raw message
drivers/char/synclink.c +1 -7
@@ -3323,7 +3323,6 @@if (debug_level >=DEBUG_LEVEL_INFO )printk ("%s(%d):mgsl_close(%s) exit, count=%d\n" , __FILE__,__LINE__, tty->driver.name, info->count); -MOD_DEC_USE_COUNT ; }/* end of mgsl_close() */
@@ -3615,8 +3614,6 @@printk ("%s(%d):mgsl_open(%s), old ref count = %d\n" , __FILE__,__LINE__,tty->driver.name, info->count); -MOD_INC_USE_COUNT ; -/* If port is closing, signal caller to try again */ if (tty_hung_up_p (filp) || info->flags &ASYNC_CLOSING ){if (info->flags &ASYNC_CLOSING )
@@ -3683,7 +3680,6 @@ cleanup:if (retval) { -MOD_DEC_USE_COUNT ;if (info->count) info->count--; }
@@ -4571,6 +4567,7 @@memset (&serial_driver,0 ,sizeof (struct tty_driver )); serial_driver.magic =TTY_DRIVER_MAGIC ; + serial_driver.owner =THIS_MODULE ; serial_driver.driver_name ="synclink" ; serial_driver.name ="ttySL" ; serial_driver.major = ttymajor;
@@ -8003,7 +8000,6 @@return -EBUSY ; } info->netcount=1 ; -MOD_INC_USE_COUNT ;spin_unlock_irqrestore (&info->netlock, flags);/* claim resources and init adapter */
@@ -8026,7 +8022,6 @@ open_fail:spin_lock_irqsave (&info->netlock, flags); info->netcount=0 ; -MOD_DEC_USE_COUNT ;spin_unlock_irqrestore (&info->netlock, flags);return err; }
@@ -8092,7 +8087,6 @@spin_lock_irqsave (&info->netlock, flags); info->netcount=0 ; -MOD_DEC_USE_COUNT ;spin_unlock_irqrestore (&info->netlock, flags);return 0 ; }
drivers/char/synclinkmp.c +1 -7
@@ -770,8 +770,6 @@printk ("%s(%d):%s open(), old ref count = %d\n" , __FILE__,__LINE__,tty->driver.name, info->count); -MOD_INC_USE_COUNT ; -/* If port is closing, signal caller to try again */ if (tty_hung_up_p (filp) || info->flags &ASYNC_CLOSING ){if (info->flags &ASYNC_CLOSING )
@@ -826,7 +824,6 @@ cleanup:if (retval) { -MOD_DEC_USE_COUNT ;if (info->count) info->count--; }
@@ -925,7 +922,6 @@if (debug_level >=DEBUG_LEVEL_INFO )printk ("%s(%d):%s close() exit, count=%d\n" , __FILE__,__LINE__, tty->driver.name, info->count); -MOD_DEC_USE_COUNT ; }/* Called by tty_hangup() when a hangup is signaled.
@@ -1729,7 +1725,6 @@return -EBUSY ; } info->netcount=1 ; -MOD_INC_USE_COUNT ;spin_unlock_irqrestore (&info->netlock, flags);/* claim resources and init adapter */
@@ -1752,7 +1747,6 @@ open_fail:spin_lock_irqsave (&info->netlock, flags); info->netcount=0 ; -MOD_DEC_USE_COUNT ;spin_unlock_irqrestore (&info->netlock, flags);return err; }
@@ -1818,7 +1812,6 @@spin_lock_irqsave (&info->netlock, flags); info->netcount=0 ; -MOD_DEC_USE_COUNT ;spin_unlock_irqrestore (&info->netlock, flags);return 0 ; }
@@ -3875,6 +3868,7 @@memset (&serial_driver,0 ,sizeof (struct tty_driver )); serial_driver.magic =TTY_DRIVER_MAGIC ; + serial_driver.owner =THIS_MODULE ; serial_driver.driver_name ="synclinkmp" ; serial_driver.name ="ttySLM" ; serial_driver.major = ttymajor;
drivers/char/vme_scc.c +1 -6
@@ -129,6 +129,7 @@memset (&scc_driver,0 ,sizeof (scc_driver)); scc_driver.magic =TTY_DRIVER_MAGIC ; + scc_driver.owner =THIS_MODULE ; scc_driver.driver_name ="scc" ;#ifdef CONFIG_DEVFS_FS scc_driver.name ="tts/%d" ;
@@ -795,7 +796,6 @@ {scc_disable_tx_interrupts (ptr);scc_disable_rx_interrupts (ptr); -MOD_DEC_USE_COUNT ; }
@@ -803,7 +803,6 @@ {scc_disable_tx_interrupts (ptr);scc_disable_rx_interrupts (ptr); -MOD_DEC_USE_COUNT ; }
@@ -938,13 +937,9 @@return retval; } port->gs.flags |=GS_ACTIVE ; -if (port->gs.count ==1 ) { -MOD_INC_USE_COUNT ; - } retval =gs_block_til_ready (port, filp);if (retval) { -MOD_DEC_USE_COUNT ; port->gs.count--;return retval; }
drivers/isdn/capi/capi.c +1 -7
@@ -200,10 +200,8 @@unsigned int minor =0 ;unsigned long flags; -MOD_INC_USE_COUNT ; mp =kmalloc (sizeof (*mp),GFP_ATOMIC );if (!mp) { -MOD_DEC_USE_COUNT ;printk (KERN_ERR "capi: can't alloc capiminor\n" );return 0 ; }
@@ -249,7 +247,6 @@skb_queue_purge (&mp->outqueue);capiminor_del_all_ack (mp);kfree (mp); -MOD_DEC_USE_COUNT ; }struct capiminor *capiminor_find (unsigned int minor)
@@ -1282,6 +1279,7 @@memset (drv,0 ,sizeof (struct tty_driver )); drv->magic =TTY_DRIVER_MAGIC ; + drv->owner =THIS_MODULE ; drv->driver_name ="capi_nc" ; drv->name ="capi/%d" ; drv->major = capi_ttymajor;
@@ -1462,7 +1460,6 @@char *p;char *compileinfo; -MOD_INC_USE_COUNT ;if ((p =strchr (revision,':' )) !=0 && p[1 ]) {strncpy (rev, p +2 ,sizeof (rev));
@@ -1474,7 +1471,6 @@if (register_chrdev (capi_major,"capi20" , &capi_fops)) {printk (KERN_ERR "capi20: unable to get major %d\n" , capi_major); -MOD_DEC_USE_COUNT ;return -EIO ; }
@@ -1486,7 +1482,6 @@#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE if (capinc_tty_init () <0 ) {unregister_chrdev (capi_major,"capi20" ); -MOD_DEC_USE_COUNT ;return -ENOMEM ; }#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
@@ -1505,7 +1500,6 @@printk (KERN_NOTICE "capi20: Rev %s: started up with major %d%s\n" , rev, capi_major, compileinfo); -MOD_DEC_USE_COUNT ;return 0 ; }
drivers/macintosh/macserial.c +1 -6
@@ -1935,7 +1935,6 @@save_flags (flags);cli ();if (tty_hung_up_p (filp)) { -MOD_DEC_USE_COUNT ;restore_flags (flags);return ; }
@@ -1959,7 +1958,6 @@ info->count =0 ; }if (info->count) { -MOD_DEC_USE_COUNT ;restore_flags (flags);return ; }
@@ -2029,7 +2027,6 @@ info->flags &= ~(ZILOG_NORMAL_ACTIVE |ZILOG_CALLOUT_ACTIVE |ZILOG_CLOSING );wake_up_interruptible (&info->close_wait); -MOD_DEC_USE_COUNT ; }/*
@@ -2236,17 +2233,14 @@int retval, line;unsigned long page; -MOD_INC_USE_COUNT ; line =minor (tty->device) - tty->driver.minor_start;if ((line <0 ) || (line >= zs_channels_found)) { -MOD_DEC_USE_COUNT ;return -ENODEV ; } info = zs_soft + line;#ifdef CONFIG_KGDB if (info->kgdb_channel) { -MOD_DEC_USE_COUNT ;return -ENODEV ; }#endif
@@ -2616,6 +2610,7 @@memset (&serial_driver,0 ,sizeof (struct tty_driver )); serial_driver.magic =TTY_DRIVER_MAGIC ; + serial_driver.owner =THIS_MODULE ; serial_driver.driver_name ="macserial" ;#ifdef CONFIG_DEVFS_FS serial_driver.name ="tts/%d" ;
drivers/s390/char/con3215.c +1 -0
@@ -1177,6 +1177,7 @@memset (&tty3215_driver,0 ,sizeof (struct tty_driver )); tty3215_driver.magic =TTY_DRIVER_MAGIC ; + tty3215_driver.owner =THIS_MODULE ; tty3215_driver.driver_name ="tty3215" ; tty3215_driver.name ="ttyS" ; tty3215_driver.name_base =0 ;
drivers/s390/char/sclp_tty.c +1 -0
@@ -743,6 +743,7 @@memset (&sclp_tty_driver,0 ,sizeof (struct tty_driver )); sclp_tty_driver.magic =TTY_DRIVER_MAGIC ; + sclp_tty_driver.owner =THIS_MODULE ; sclp_tty_driver.driver_name ="tty_sclp" ; sclp_tty_driver.name ="ttyS" ; sclp_tty_driver.name_base =0 ;
drivers/s390/char/tuball.c +0 -12
@@ -216,18 +216,6 @@ }#endif /* Not a MODULE or a MODULE */ -void -tub_inc_use_count (void ) -{ -MOD_INC_USE_COUNT ; -} - -void -tub_dec_use_count (void ) -{ -MOD_DEC_USE_COUNT ; -} -static int tub3270_is_ours (s390_dev_info_t *dp) {
drivers/s390/char/tubfs.c +0 -3
@@ -119,7 +119,6 @@return -EBUSY ; } -tub_inc_use_count (); fp->private_data = ip; tubp->mode =TBM_FS ; tubp->intv = fs3270_int;
@@ -145,7 +144,6 @@fs3270_wait (tubp, &flags); tubp->fsopen =0 ; tubp->fs_pid =0 ; -tub_dec_use_count (); tubp->intv =NULL ; tubp->mode =0 ;tty3270_refresh (tubp);
@@ -166,7 +164,6 @@fs3270_wait (tubp, &flags); tubp->fsopen =0 ; tubp->fs_pid =0 ; -tub_dec_use_count (); tubp->intv =NULL ; tubp->mode =0 ;/*tty3270_refresh(tubp);*/
drivers/s390/char/tubio.h +0 -2
@@ -421,8 +421,6 @@return tubp; } -extern void tub_inc_use_count (void ); -extern void tub_dec_use_count (void );extern int tub3270_movedata (bcb_t *,bcb_t *,int );#if 0 #if (LINUX_VERSION_CODE <KERNEL_VERSION (2 ,3 ,0 ))
drivers/s390/char/tubtty.c +1 -3
@@ -80,6 +80,7 @@/* Initialize for tty driver */ td->magic =TTY_DRIVER_MAGIC ; + td->owner =THIS_MODULE ; td->driver_name ="tty3270" ; td->name ="tty3270" ; td->major =IBM_TTY3270_MAJOR ;
@@ -189,7 +190,6 @@return -ENODEV ; } -tub_inc_use_count ();if ((rc =tty3270_wait (tubp, &flags)) !=0 ) goto do_fail;if (tubp->lnopen >0 ) {
@@ -231,7 +231,6 @@tty3270_aid_fini (tubp);tty3270_rcl_fini (tubp);TUBUNLOCK (tubp->irq, flags); -tub_dec_use_count ();return rc; }
@@ -253,7 +252,6 @@tty3270_rcl_fini (tubp);tty3270_scl_fini (tubp); do_return: -tub_dec_use_count ();TUBUNLOCK (tubp->irq, flags); }