Commit 438ea4e5 authored by Linus Torvalds's avatar Linus Torvalds

Merge conflicting tty devfs cleanups

parents d3617826 7c187711
......@@ -2681,8 +2681,8 @@ static int __init rs_init(void)
(state->flags & ASYNC_FOURPORT) ? " FourPort" : "",
state->port, state->irq,
uart_config[state->type].name);
tty_register_device(&serial_driver, state->line);
tty_register_device(&callout_driver, state->line);
tty_register_device(&serial_driver, state->line, NULL);
tty_register_device(&callout_driver, state->line, NULL);
}
return 0;
}
......@@ -2769,8 +2769,8 @@ int register_serial(struct serial_struct *req)
state->iomem_base ? "iomem" : "port",
state->iomem_base ? (unsigned long)state->iomem_base :
state->port, state->irq, uart_config[state->type].name);
tty_register_device(&serial_driver, state->line);
tty_register_device(&callout_driver, state->line);
tty_register_device(&serial_driver, state->line, NULL);
tty_register_device(&callout_driver, state->line, NULL);
return state->line + SERIAL_DEV_OFFSET;
}
......
......@@ -1528,7 +1528,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
if (tty_hung_up_p(filp)) {
DBG_CNT("before DEC-hung");
MOD_DEC_USE_COUNT;
local_irq_restore(flags);
return;
}
......@@ -1555,7 +1554,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
}
if (state->count) {
DBG_CNT("before DEC-2");
MOD_DEC_USE_COUNT;
local_irq_restore(flags);
return;
}
......@@ -1615,7 +1613,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE|
ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait);
MOD_DEC_USE_COUNT;
local_irq_restore(flags);
}
......@@ -1894,15 +1891,12 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
int retval, line;
unsigned long page;
MOD_INC_USE_COUNT;
line = tty->index;
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;
......@@ -2116,6 +2110,7 @@ static int __init rs_init(void)
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;
......
......@@ -2579,15 +2579,12 @@ cy_open(struct tty_struct *tty, struct file * filp)
int retval, line;
unsigned long page;
MOD_INC_USE_COUNT;
line = tty->index;
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;
}
......@@ -2607,7 +2604,6 @@ cy_open(struct tty_struct *tty, struct file * filp)
} else {
printk("cyc:Cyclades-Z firmware not yet loaded\n");
}
MOD_DEC_USE_COUNT;
return -ENODEV;
}
#ifdef CONFIG_CYZ_INTR
......@@ -2803,7 +2799,6 @@ cy_close(struct tty_struct *tty, struct file *filp)
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;
}
......@@ -2834,7 +2829,6 @@ cy_close(struct tty_struct *tty, struct file *filp)
info->count = 0;
}
if (info->count) {
MOD_DEC_USE_COUNT;
CY_UNLOCK(info, flags);
return;
}
......@@ -2931,7 +2925,6 @@ cy_close(struct tty_struct *tty, struct file *filp)
printk(" cyc:cy_close done\n");
#endif
MOD_DEC_USE_COUNT;
CY_UNLOCK(info, flags);
return;
} /* cy_close */
......@@ -5494,6 +5487,7 @@ cy_init(void)
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;
......
......@@ -1332,6 +1332,7 @@ int __init dz_init(void)
memset(&serial_driver, 0, sizeof(struct tty_driver));
serial_driver.magic = TTY_DRIVER_MAGIC;
serial_driver.owner = THIS_MODULE;
#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS))
serial_driver.name = "ttyS";
#else
......@@ -1425,8 +1426,8 @@ int __init dz_init(void)
printk("ttyS%02d at 0x%08x (irq = %d)\n", info->line,
info->port, SERIAL);
tty_register_device(&serial_driver, info->line);
tty_register_device(&callout_driver, info->line);
tty_register_device(&serial_driver, info->line, NULL);
tty_register_device(&callout_driver, info->line, NULL);
}
/* Reset the chip */
......
......@@ -643,9 +643,7 @@ static _INLINE_ void check_modem_status(struct esp_struct *info)
#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);
}
}
}
......@@ -811,7 +809,6 @@ static void do_serial_hangup(void *private_)
tty = info->tty;
if (tty)
tty_hangup(tty);
MOD_DEC_USE_COUNT;
}
/*
......@@ -2132,7 +2129,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
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);
}
......@@ -2375,7 +2372,6 @@ static int esp_open(struct tty_struct *tty, struct file * filp)
#ifdef SERIAL_DEBUG_OPEN
printk("esp_open %s, count = %d\n", tty->name, info->count);
#endif
MOD_INC_USE_COUNT;
info->count++;
tty->driver_data = info;
info->tty = tty;
......@@ -2551,6 +2547,7 @@ int __init espserial_init(void)
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;
......
......@@ -257,6 +257,7 @@ int __init hvc_init(void)
memset(&hvc_driver, 0, sizeof(struct tty_driver));
hvc_driver.magic = TTY_DRIVER_MAGIC;
hvc_driver.owner = THIS_MODULE;
hvc_driver.driver_name = "hvc";
hvc_driver.name = "hvc/";
hvc_driver.major = HVC_MAJOR;
......@@ -282,7 +283,7 @@ int __init hvc_init(void)
for (i = 0; i < hvc_driver.num; i++) {
hvc_struct[i].lock = SPIN_LOCK_UNLOCKED;
hvc_struct[i].index = i;
tty_register_device(&hvc_driver, i);
tty_register_device(&hvc_driver, i, NULL);
}
if (tty_register_driver(&hvc_driver))
......
......@@ -793,6 +793,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
/* 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;
......@@ -891,10 +892,10 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
{
tty_register_device(&ip2_tty_driver,
j + ABS_BIGGEST_BOX *
(box+i*ABS_MAX_BOXES));
(box+i*ABS_MAX_BOXES), NULL);
tty_register_device(&ip2_callout_driver,
j + ABS_BIGGEST_BOX *
(box+i*ABS_MAX_BOXES));
(box+i*ABS_MAX_BOXES), NULL);
}
}
}
......@@ -1567,7 +1568,6 @@ ip2_open( PTTY tty, struct file *pFile )
/* 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 \
......@@ -1767,14 +1767,12 @@ ip2_close( PTTY tty, struct file *pFile )
#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 );
......@@ -1842,7 +1840,6 @@ ip2_close( PTTY tty, struct file *pFile )
DBG_CNT("ip2_close: after wakeups--");
#endif
MOD_DEC_USE_COUNT;
ip2trace (CHANN, ITRC_CLOSE, ITRC_RETURN, 1, 1 );
......
......@@ -590,9 +590,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id,
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);
}
}
}
......@@ -846,7 +844,6 @@ static inline void isicom_setup_board(struct isi_board * bp)
#endif
bp->status |= BOARD_ACTIVE;
MOD_INC_USE_COUNT;
return;
}
......@@ -1104,7 +1101,6 @@ static inline void isicom_shutdown_board(struct isi_board * bp)
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)
......@@ -1644,7 +1640,6 @@ static void do_isicom_hangup(void * data)
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)
......@@ -1715,6 +1710,7 @@ static int register_drivers(void)
/* 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;
......
......@@ -1054,7 +1054,6 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
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 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
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 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
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 @@ static void stli_dohangup(void *arg)
tty_hangup(portp->tty);
}
}
MOD_DEC_USE_COUNT;
}
/*****************************************************************************/
......@@ -3004,9 +2999,7 @@ static inline int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp)
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);
}
}
}
......@@ -5347,6 +5340,7 @@ int __init stli_init(void)
*/
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;
......
......@@ -341,6 +341,7 @@ int moxa_init(void)
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 @@ static void do_moxa_softint(void *private_)
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 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
port = PORTNO(tty);
if (port == MAX_PORTS) {
MOD_INC_USE_COUNT;
return (0);
}
if (!MoxaPortIsValid(port)) {
......@@ -579,7 +578,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
}
up(&moxaBuffSem);
MOD_INC_USE_COUNT;
ch = &moxaChannels[port];
ch->count++;
tty->driver_data = ch;
......@@ -619,7 +617,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
port = PORTNO(tty);
if (port == MAX_PORTS) {
MOD_DEC_USE_COUNT;
return;
}
if (!MoxaPortIsValid(port)) {
......@@ -633,7 +630,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
return;
}
if (tty_hung_up_p(filp)) {
MOD_DEC_USE_COUNT;
return;
}
ch = (struct moxa_str *) tty->driver_data;
......@@ -649,7 +645,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
ch->count = 0;
}
if (ch->count) {
MOD_DEC_USE_COUNT;
return;
}
ch->asyncflags |= ASYNC_CLOSING;
......@@ -688,7 +683,6 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
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 @@ static void moxa_poll(unsigned long ignored)
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);
}
}
}
......
......@@ -501,6 +501,7 @@ static int __init mxser_module_init(void)
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 @@ static void mxser_do_softint(void *private_)
tty_hangup(tty); /* FIXME: module removal race here - AKPM */
}
}
MOD_DEC_USE_COUNT;
}
/*
......@@ -767,8 +767,6 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
info->session = current->session;
info->pgrp = current->pgrp;
MOD_INC_USE_COUNT;
return (0);
}
......@@ -795,7 +793,6 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
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 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
}
if (info->count) {
restore_flags(flags);
MOD_DEC_USE_COUNT;
return;
}
info->flags |= ASYNC_CLOSING;
......@@ -881,7 +877,6 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
wake_up_interruptible(&info->close_wait);
restore_flags(flags);
MOD_DEC_USE_COUNT;
}
static int mxser_write(struct tty_struct *tty, int from_user,
......@@ -1492,9 +1487,7 @@ static inline void mxser_transmit_chars(struct mxser_struct *info)
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;
......@@ -1523,9 +1516,7 @@ static inline void mxser_check_modem_status(struct mxser_struct *info,
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) {
......@@ -1535,9 +1526,7 @@ static inline void mxser_check_modem_status(struct mxser_struct *info,
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)) {
......
......@@ -431,8 +431,6 @@ int pcxe_open(struct tty_struct *tty, struct file * filp)
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 @@ static void pcxe_close(struct tty_struct * tty, struct file * filp)
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 @@ static void pcxe_close(struct tty_struct * tty, struct file * filp)
}
if (info->count-- > 1) {
restore_flags(flags);
MOD_DEC_USE_COUNT;
return;
}
if (info->count < 0) {
......@@ -651,7 +647,6 @@ static void pcxe_close(struct tty_struct * tty, struct file * filp)
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 @@ int __init pcxe_init(void)
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;
......
......@@ -389,29 +389,6 @@ void rio_udelay (int usecs)
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;
......@@ -660,7 +637,6 @@ static void rio_hungup (void *ptr)
PortP = (struct Port *)ptr;
PortP->gs.tty = NULL;
rio_dec_mod_count ();
func_exit ();
}
......@@ -686,7 +662,6 @@ static void rio_close (void *ptr)
}
PortP->gs.tty = NULL;
rio_dec_mod_count ();
func_exit ();
}
......@@ -908,6 +883,7 @@ static int rio_init_drivers(void)
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;
......
......@@ -87,9 +87,6 @@ struct vpd_prom {
#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
......
......@@ -139,7 +139,6 @@ default_sg =
extern struct rio_info *p;
extern void rio_inc_mod_count (void);
int
......@@ -205,8 +204,6 @@ riotopen(struct tty_struct * tty, struct file * filp)
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",
......@@ -215,8 +212,6 @@ riotopen(struct tty_struct * tty, struct file * filp)
retval = gs_init_port (&PortP->gs);
if (retval) {
PortP->gs.count--;
if (PortP->gs.count)
rio_dec_mod_count ();
return -ENXIO;
}
/*
......
......@@ -552,9 +552,7 @@ static inline void rc_check_modem(struct riscom_board const * bp)
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);
}
}
......@@ -676,7 +674,6 @@ static inline int rc_setup_board(struct riscom_board * bp)
IRQ_to_board[bp->irq] = bp;
bp->flags |= RC_BOARD_ACTIVE;
MOD_INC_USE_COUNT;
return 0;
}
......@@ -694,7 +691,6 @@ static inline void rc_shutdown_board(struct riscom_board *bp)
bp->DTR = ~0;
rc_out(bp, RC_DTR, bp->DTR); /* Drop DTR on all ports */
MOD_DEC_USE_COUNT;
}
/*
......@@ -1678,7 +1674,6 @@ static void do_rc_hangup(void *private_)
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)
......@@ -1757,6 +1752,7 @@ static inline int rc_init_drivers(void)
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;
......
......@@ -874,9 +874,6 @@ static int rp_open(struct tty_struct *tty, struct file * filp)
}
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 @@ static void rp_close(struct tty_struct *tty, struct file * filp)
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);
......@@ -1504,9 +1498,6 @@ static void rp_hangup(struct tty_struct *tty)
return;
}
if (info->count) {
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
rp_num_ports_open--;
}
......@@ -2012,6 +2003,7 @@ int __init rp_init(void)
*/
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";
#else
......
......@@ -272,7 +272,6 @@ static void a2232_shutdown_port(void *ptr)
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 @@ static void a2232_close(void *ptr)
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 @@ static int a2232_open(struct tty_struct * tty, struct file * filp)
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 @@ static int a2232_init_drivers(void)
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;
......
......@@ -2395,6 +2395,7 @@ scrn[1] = '\0';
memset(&cy_serial_driver, 0, sizeof(struct tty_driver));
cy_serial_driver.magic = TTY_DRIVER_MAGIC;
cy_serial_driver.owner = THIS_MODULE;
#ifdef CONFIG_DEVFS_FS
cy_serial_driver.name = "tts/";
#else
......
......@@ -41,8 +41,6 @@ static int rs_get_CD (void * ptr);
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 @@ static struct real_driver rs_real_driver = {
.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 @@ static int rs_open (struct tty_struct * tty, struct file * filp)
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 @@ static int rs_open (struct tty_struct * tty, struct file * filp)
retval, port->gs.count);
if (retval) {
MOD_DEC_USE_COUNT;
port->gs.count--;
return retval;
}
......@@ -621,32 +613,6 @@ static int rs_open (struct tty_struct * tty, struct file * filp)
}
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 @@ static int rs_init_drivers(void)
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;
......
......@@ -71,8 +71,6 @@ static void sci_enable_rx_interrupts(void *ptr);
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 @@ static struct real_driver sci_real_driver = {
sci_shutdown_port,
sci_set_real_termios,
sci_chars_in_buffer,
sci_close,
sci_hungup,
NULL
};
......@@ -838,12 +834,7 @@ static int sci_open(struct tty_struct * tty, struct file * filp)
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 @@ static int sci_open(struct tty_struct * tty, struct file * filp)
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 @@ static int sci_init_drivers(void)
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/";
......
......@@ -833,9 +833,7 @@ static inline void sx_check_modem(struct specialix_board * bp)
#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");
......@@ -980,7 +978,6 @@ static inline int sx_setup_board(struct specialix_board * bp)
turn_ints_on (bp);
bp->flags |= SX_BOARD_ACTIVE;
MOD_INC_USE_COUNT;
return 0;
}
......@@ -1000,7 +997,6 @@ static inline void sx_shutdown_board(struct specialix_board *bp)
turn_ints_off (bp);
MOD_DEC_USE_COUNT;
}
......@@ -2150,7 +2146,6 @@ static void do_sx_hangup(void *private_)
tty = port->tty;
if (tty)
tty_hangup(tty); /* FIXME: module removal race here */
MOD_DEC_USE_COUNT;
}
......@@ -2233,6 +2228,7 @@ static int sx_init_drivers(void)
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;
......
......@@ -1044,8 +1044,6 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
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.
......@@ -1207,14 +1205,12 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
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;
}
......@@ -1267,7 +1263,6 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
portp->flags &= ~(ASYNC_CALLOUT_ACTIVE | ASYNC_NORMAL_ACTIVE |
ASYNC_CLOSING);
wake_up_interruptible(&portp->close_wait);
MOD_DEC_USE_COUNT;
restore_flags(flags);
}
......@@ -2241,11 +2236,11 @@ static void stl_offintr(void *private)
#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)) {
......@@ -2270,8 +2265,6 @@ static void stl_offintr(void *private)
}
}
unlock_kernel();
out:
MOD_DEC_USE_COUNT;
}
/*****************************************************************************/
......@@ -3229,6 +3222,7 @@ int __init stl_init(void)
*/
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 @@ static void stl_cd1400txisr(stlpanel_t *panelp, int ioaddr)
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 @@ static void stl_cd1400mdmisr(stlpanel_t *panelp, int ioaddr)
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 @@ static void stl_sc26198txisr(stlport_t *portp)
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 @@ static void stl_sc26198otherisr(stlport_t *portp, unsigned int iack)
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;
......
......@@ -2088,21 +2088,6 @@ static void tty_default_put_char(struct tty_struct *tty, unsigned char ch)
}
#ifdef CONFIG_DEVFS_FS
static void tty_register_devfs(struct tty_driver *driver, unsigned index)
{
dev_t dev = MKDEV(driver->major, driver->minor_start) + index;
char buf[32];
if (index >= driver->num) {
printk(KERN_ERR "Attempt to register invalid tty line number "
"with devfs (%d).\n", index);
return;
}
tty_line_name(driver, index, buf);
devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR, buf);
}
static void tty_unregister_devfs(struct tty_driver *driver, int index)
{
char path[64];
......@@ -2110,21 +2095,131 @@ static void tty_unregister_devfs(struct tty_driver *driver, int index)
devfs_remove(path);
}
#else
# define tty_register_devfs(driver, index) do { } while (0)
# define tty_unregister_devfs(driver, index) do { } while (0)
#endif /* CONFIG_DEVFS_FS */
/*
* Register a tty device described by <driver>, with minor number <minor>.
static struct class tty_class = {
.name = "tty",
};
struct tty_dev {
struct list_head node;
dev_t dev;
struct class_device class_dev;
};
#define to_tty_dev(d) container_of(d, struct tty_dev, class_dev)
static LIST_HEAD(tty_dev_list);
static ssize_t show_dev(struct class_device *class_dev, char *buf)
{
struct tty_dev *tty_dev = to_tty_dev(class_dev);
return sprintf(buf, "%04x\n", tty_dev->dev);
}
static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
static void tty_add_class_device(char *name, dev_t dev, struct device *device)
{
struct tty_dev *tty_dev = NULL;
char *temp;
int retval;
tty_dev = kmalloc(sizeof(*tty_dev), GFP_KERNEL);
if (!tty_dev)
return;
memset(tty_dev, 0x00, sizeof(*tty_dev));
/* stupid '/' in tty name strings... */
temp = strchr(name, '/');
if (temp && (temp[1] != 0x00))
++temp;
else
temp = name;
tty_dev->class_dev.dev = device;
tty_dev->class_dev.class = &tty_class;
snprintf(tty_dev->class_dev.class_id, BUS_ID_SIZE, "%s", temp);
retval = class_device_register(&tty_dev->class_dev);
if (retval)
goto error;
class_device_create_file (&tty_dev->class_dev, &class_device_attr_dev);
tty_dev->dev = dev;
list_add(&tty_dev->node, &tty_dev_list);
return;
error:
kfree(tty_dev);
}
void tty_remove_class_device(dev_t dev)
{
struct tty_dev *tty_dev = NULL;
struct list_head *tmp;
int found = 0;
list_for_each (tmp, &tty_dev_list) {
tty_dev = list_entry(tmp, struct tty_dev, node);
if ((MAJOR(tty_dev->dev) == MAJOR(dev)) &&
(MINOR(tty_dev->dev) == MINOR(dev))) {
found = 1;
break;
}
}
if (found) {
list_del(&tty_dev->node);
class_device_unregister(&tty_dev->class_dev);
kfree(tty_dev);
}
}
/**
* tty_register_device - register a tty device
* @driver: the tty driver that describes the tty device
* @index: the index in the tty driver for this tty device
* @device: a struct device that is associated with this tty device.
* This field is optional, if there is no known struct device for this
* tty device it can be set to NULL safely.
*
* This call is required to be made to register an individual tty device if
* the tty driver's flags have the TTY_DRIVER_NO_DEVFS bit set. If that
* bit is not set, this function should not be called.
*/
void tty_register_device(struct tty_driver *driver, unsigned index)
void tty_register_device(struct tty_driver *driver, unsigned index,
struct device *device)
{
tty_register_devfs(driver, index);
dev_t dev = MKDEV(driver->major, driver->minor_start) + index;
char name[64];
if (index >= driver->num) {
printk(KERN_ERR "Attempt to register invalid tty line number "
" (%d).\n", index);
return;
}
tty_line_name(driver, index, name);
devfs_register(NULL, name, 0, MAJOR(dev), MINOR(dev),
S_IFCHR | S_IRUSR | S_IWUSR, &tty_fops, NULL);
/* stupid console driver devfs names... change vc/X into ttyX */
if (driver->type == TTY_DRIVER_TYPE_CONSOLE)
sprintf(name, "tty%d", MINOR(dev));
/* we don't care about the ptys */
if (driver->type != TTY_DRIVER_TYPE_PTY)
tty_add_class_device (name, dev, device);
}
/**
* tty_unregister_device - unregister a tty device
* @driver: the tty driver that describes the tty device
* @index: the index in the tty driver for this tty device
*
* If a tty device is registered with a call to tty_register_device() then
* this function must be made when the tty device is gone.
*/
void tty_unregister_device(struct tty_driver *driver, unsigned index)
{
tty_unregister_devfs(driver, index);
tty_remove_class_device(MKDEV(driver->major, driver->minor_start) + index);
}
EXPORT_SYMBOL(tty_register_device);
......@@ -2206,7 +2301,7 @@ int tty_register_driver(struct tty_driver *driver)
if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) {
for(i = 0; i < driver->num; i++)
tty_register_device(driver, i);
tty_register_device(driver, i, NULL);
}
proc_tty_register_driver(driver);
return error;
......@@ -2287,10 +2382,6 @@ void __init console_init(void)
extern int vty_init(void);
#endif
static struct class tty_class = {
.name = "tty",
};
static int __init tty_class_init(void)
{
return class_register(&tty_class);
......@@ -2308,17 +2399,20 @@ void __init tty_init(void)
"/dev/tty", &tty_fops) < 0)
panic("Couldn't register /dev/tty driver\n");
devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty");
tty_add_class_device ("tty", MKDEV(TTYAUX_MAJOR, 0), NULL);
if (register_chrdev_region(TTYAUX_MAJOR, 1, 1,
"/dev/console", &tty_fops) < 0)
panic("Couldn't register /dev/console driver\n");
devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console");
tty_add_class_device ("console", MKDEV(TTYAUX_MAJOR, 1), NULL);
#ifdef CONFIG_UNIX98_PTYS
if (register_chrdev_region(TTYAUX_MAJOR, 2, 1,
"/dev/ptmx", &tty_fops) < 0)
panic("Couldn't register /dev/ptmx driver\n");
devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 2), S_IFCHR|S_IRUGO|S_IWUGO, "ptmx");
tty_add_class_device ("ptmx", MKDEV(TTYAUX_MAJOR, 2), NULL);
#endif
#ifdef CONFIG_VT
......@@ -2326,6 +2420,8 @@ void __init tty_init(void)
"/dev/vc/0", &tty_fops) < 0)
panic("Couldn't register /dev/tty0 driver\n");
devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0");
tty_add_class_device ("tty0", MKDEV(TTY_MAJOR, 0), NULL);
vty_init();
#endif
......
......@@ -129,6 +129,7 @@ static int scc_init_drivers(void)
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/";
......@@ -795,7 +796,6 @@ static void scc_hungup(void *ptr)
{
scc_disable_tx_interrupts(ptr);
scc_disable_rx_interrupts(ptr);
MOD_DEC_USE_COUNT;
}
......@@ -803,7 +803,6 @@ static void scc_close(void *ptr)
{
scc_disable_tx_interrupts(ptr);
scc_disable_rx_interrupts(ptr);
MOD_DEC_USE_COUNT;
}
......@@ -938,13 +937,9 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
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;
}
......
......@@ -200,10 +200,8 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
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 @@ static void capiminor_free(struct capiminor *mp)
skb_queue_purge(&mp->outqueue);
capiminor_del_all_ack(mp);
kfree(mp);
MOD_DEC_USE_COUNT;
}
struct capiminor *capiminor_find(unsigned int minor)
......@@ -1280,6 +1277,7 @@ static int capinc_tty_init(void)
memset(drv, 0, sizeof(struct tty_driver));
drv->magic = TTY_DRIVER_MAGIC;
drv->owner = THIS_MODULE;
drv->driver_name = "capi_nc";
drv->name = "capi/";
drv->major = capi_ttymajor;
......@@ -1460,7 +1458,6 @@ static int __init capi_init(void)
char *p;
char *compileinfo;
MOD_INC_USE_COUNT;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(rev, p + 2, sizeof(rev));
......@@ -1472,7 +1469,6 @@ static int __init capi_init(void)
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;
}
......@@ -1484,7 +1480,6 @@ static int __init capi_init(void)
#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 */
......@@ -1503,7 +1498,6 @@ static int __init capi_init(void)
printk(KERN_NOTICE "capi20: Rev %s: started up with major %d%s\n",
rev, capi_major, compileinfo);
MOD_DEC_USE_COUNT;
return 0;
}
......
......@@ -1932,7 +1932,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
spin_lock_irqsave(&info->lock, flags);
if (tty_hung_up_p(filp)) {
MOD_DEC_USE_COUNT;
spin_unlock_irqrestore(&info->lock, flags);
return;
}
......@@ -1956,7 +1955,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
info->count = 0;
}
if (info->count) {
MOD_DEC_USE_COUNT;
spin_unlock_irqrestore(&info->lock, flags);
return;
}
......@@ -2026,7 +2024,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
info->flags &= ~(ZILOG_NORMAL_ACTIVE|ZILOG_CALLOUT_ACTIVE|
ZILOG_CLOSING);
wake_up_interruptible(&info->close_wait);
MOD_DEC_USE_COUNT;
}
/*
......@@ -2233,17 +2230,14 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
int retval, line;
unsigned long page;
MOD_INC_USE_COUNT;
line = tty->index;
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
......@@ -2610,6 +2604,7 @@ int macserial_init(void)
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/";
......
......@@ -2242,7 +2242,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
* Register the port whether it's detected or not. This allows
* setserial to be used to alter this ports parameters.
*/
tty_register_device(drv->tty_driver, port->line);
tty_register_device(drv->tty_driver, port->line, NULL);
out:
up(&port_sem);
......
......@@ -1867,6 +1867,7 @@ int rs_init(void)
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;
......
......@@ -1872,6 +1872,7 @@ int __init zs_init(void)
memset(&serial_driver, 0, sizeof(struct tty_driver));
serial_driver.magic = TTY_DRIVER_MAGIC;
serial_driver.owner = THIS_MODULE;
#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS))
serial_driver.name = "tts/";
#else
......@@ -1970,8 +1971,8 @@ int __init zs_init(void)
printk("ttyS%02d at 0x%08x (irq = %d)", info->line,
info->port, info->irq);
printk(" is a Z85C30 SCC\n");
tty_register_device(&serial_driver, info->line);
tty_register_device(&callout_driver, info->line);
tty_register_device(&serial_driver, info->line, NULL);
tty_register_device(&callout_driver, info->line, NULL);
}
......
......@@ -1198,7 +1198,7 @@ static int usb_bluetooth_probe (struct usb_interface *intf,
bluetooth, endpoint->bInterval);
/* initialize the devfs nodes for this device and let the user know what bluetooths we are bound to */
tty_register_device (&bluetooth_tty_driver, minor);
tty_register_device (&bluetooth_tty_driver, minor, &intf->dev);
info("Bluetooth converter now attached to ttyUB%d (or usb/ttub/%d for devfs)", minor, minor);
bluetooth_table[minor] = bluetooth;
......
......@@ -653,7 +653,7 @@ static int acm_probe (struct usb_interface *intf,
usb_driver_claim_interface(&acm_driver, acm->iface + 0, acm);
usb_driver_claim_interface(&acm_driver, acm->iface + 1, acm);
tty_register_device(&acm_tty_driver, minor);
tty_register_device(&acm_tty_driver, minor, &intf->dev);
acm_table[minor] = acm;
usb_set_intfdata (intf, acm);
......
......@@ -23,18 +23,6 @@
#include "usb-serial.h"
static ssize_t show_dev (struct device *dev, char *buf)
{
struct usb_serial_port *port= to_usb_serial_port(dev);
dev_t base;
port = to_usb_serial_port(dev);
base = MKDEV(SERIAL_TTY_MAJOR, port->number);
return sprintf(buf, "%04x\n", base);
}
static DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
static int usb_serial_device_match (struct device *dev, struct device_driver *drv)
{
struct usb_serial_device_type *driver;
......@@ -88,10 +76,7 @@ static int usb_serial_device_probe (struct device *dev)
}
minor = port->number;
tty_register_device (&usb_serial_tty_driver, minor);
device_create_file (dev, &dev_attr_dev);
tty_register_device (&usb_serial_tty_driver, minor, dev);
dev_info(&port->serial->dev->dev,
"%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n",
driver->name, minor, minor);
......
......@@ -243,6 +243,7 @@ struct tty_flip_buffer {
#define L_PENDIN(tty) _L_FLAG((tty),PENDIN)
#define L_IEXTEN(tty) _L_FLAG((tty),IEXTEN)
struct device;
/*
* Where all of the state associated with a tty is kept while the tty
* is open. Since the termios state should be kept even if the tty
......@@ -380,7 +381,7 @@ extern void start_tty(struct tty_struct * tty);
extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
extern int tty_register_driver(struct tty_driver *driver);
extern int tty_unregister_driver(struct tty_driver *driver);
extern void tty_register_device(struct tty_driver *driver, unsigned index);
extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev);
extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
int buflen);
......
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