Commit 7977c341 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc32: fix MOD_{INC,DEC}_USE_COUNT abuse in 4xx/8xx code

From: Christoph Hellwig <hch@lst.de>

Note that most of the drivers are in a compiling shape currently, but I
want to get rid of the last callers of those.

(acked by Tom Rini)
parent dba1c913
...@@ -1431,7 +1431,6 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp) ...@@ -1431,7 +1431,6 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp)
save_flags(flags); cli(); save_flags(flags); cli();
if (tty_hung_up_p(filp)) { if (tty_hung_up_p(filp)) {
MOD_DEC_USE_COUNT;
restore_flags(flags); restore_flags(flags);
return; return;
} }
...@@ -1452,7 +1451,6 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp) ...@@ -1452,7 +1451,6 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp)
state->count = 0; state->count = 0;
} }
if (state->count) { if (state->count) {
MOD_DEC_USE_COUNT;
restore_flags(flags); restore_flags(flags);
return; return;
} }
...@@ -1495,7 +1493,6 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp) ...@@ -1495,7 +1493,6 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp)
} }
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait); wake_up_interruptible(&info->close_wait);
MOD_DEC_USE_COUNT;
} }
static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout) static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout)
...@@ -1685,9 +1682,7 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp) ...@@ -1685,9 +1682,7 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp)
// is this a line that we've got? // is this a line that we've got?
MOD_INC_USE_COUNT;
if (line >= SERIAL_SICC_NR) { if (line >= SERIAL_SICC_NR) {
MOD_DEC_USE_COUNT;
return -ENODEV; return -ENODEV;
} }
...@@ -1707,7 +1702,6 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp) ...@@ -1707,7 +1702,6 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp)
if (tmp_buf) if (tmp_buf)
free_page(page); free_page(page);
else if (!page) { else if (!page) {
MOD_DEC_USE_COUNT;
return -ENOMEM; return -ENOMEM;
} }
tmp_buf = (u_char *)page; tmp_buf = (u_char *)page;
...@@ -1720,7 +1714,6 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp) ...@@ -1720,7 +1714,6 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp)
(info->flags & ASYNC_CLOSING)) { (info->flags & ASYNC_CLOSING)) {
if (info->flags & ASYNC_CLOSING) if (info->flags & ASYNC_CLOSING)
interruptible_sleep_on(&info->close_wait); interruptible_sleep_on(&info->close_wait);
MOD_DEC_USE_COUNT;
return -EAGAIN; return -EAGAIN;
} }
...@@ -1729,13 +1722,11 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp) ...@@ -1729,13 +1722,11 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp)
*/ */
retval = siccuart_startup(info); retval = siccuart_startup(info);
if (retval) { if (retval) {
MOD_DEC_USE_COUNT;
return retval; return retval;
} }
retval = block_til_ready(tty, filp, info); retval = block_til_ready(tty, filp, info);
if (retval) { if (retval) {
MOD_DEC_USE_COUNT;
return retval; return retval;
} }
...@@ -1778,6 +1769,7 @@ int __init siccuart_init(void) ...@@ -1778,6 +1769,7 @@ int __init siccuart_init(void)
return -ENOMEM; return -ENOMEM;
printk("IBM Vesta SICC serial port driver V 0.1 by Yudong Yang and Yi Ge / IBM CRL .\n"); printk("IBM Vesta SICC serial port driver V 0.1 by Yudong Yang and Yi Ge / IBM CRL .\n");
siccnormal_driver->driver_name = "serial_sicc"; siccnormal_driver->driver_name = "serial_sicc";
siccnormal_driver->owner = THIS_MODULE;
siccnormal_driver->name = SERIAL_SICC_NAME; siccnormal_driver->name = SERIAL_SICC_NAME;
siccnormal_driver->major = SERIAL_SICC_MAJOR; siccnormal_driver->major = SERIAL_SICC_MAJOR;
siccnormal_driver->minor_start = SERIAL_SICC_MINOR; siccnormal_driver->minor_start = SERIAL_SICC_MINOR;
......
...@@ -592,9 +592,7 @@ static _INLINE_ void check_modem_status(struct async_struct *info) ...@@ -592,9 +592,7 @@ static _INLINE_ void check_modem_status(struct async_struct *info)
#ifdef SERIAL_DEBUG_OPEN #ifdef SERIAL_DEBUG_OPEN
printk("scheduling hangup..."); printk("scheduling hangup...");
#endif #endif
MOD_INC_USE_COUNT; schedule_work(&info->tqueue_hangup);
if (schedule_work(&info->tqueue_hangup) == 0)
MOD_DEC_USE_COUNT;
} }
} }
if (info->flags & ASYNC_CTS_FLOW) { if (info->flags & ASYNC_CTS_FLOW) {
...@@ -723,7 +721,6 @@ static void do_serial_hangup(void *private_) ...@@ -723,7 +721,6 @@ static void do_serial_hangup(void *private_)
tty = info->tty; tty = info->tty;
if (tty) if (tty)
tty_hangup(tty); tty_hangup(tty);
MOD_DEC_USE_COUNT;
} }
/*static void rs_8xx_timer(void) /*static void rs_8xx_timer(void)
...@@ -1689,7 +1686,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp) ...@@ -1689,7 +1686,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp)
if (tty_hung_up_p(filp)) { if (tty_hung_up_p(filp)) {
DBG_CNT("before DEC-hung"); DBG_CNT("before DEC-hung");
MOD_DEC_USE_COUNT;
restore_flags(flags); restore_flags(flags);
return; return;
} }
...@@ -1716,7 +1712,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp) ...@@ -1716,7 +1712,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp)
} }
if (state->count) { if (state->count) {
DBG_CNT("before DEC-2"); DBG_CNT("before DEC-2");
MOD_DEC_USE_COUNT;
restore_flags(flags); restore_flags(flags);
return; return;
} }
...@@ -1770,7 +1765,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp) ...@@ -1770,7 +1765,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp)
} }
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait); wake_up_interruptible(&info->close_wait);
MOD_DEC_USE_COUNT;
restore_flags(flags); restore_flags(flags);
} }
...@@ -2021,7 +2015,6 @@ static int rs_8xx_open(struct tty_struct *tty, struct file * filp) ...@@ -2021,7 +2015,6 @@ static int rs_8xx_open(struct tty_struct *tty, struct file * filp)
if (retval) if (retval)
return retval; return retval;
MOD_INC_USE_COUNT;
retval = block_til_ready(tty, filp, info); retval = block_til_ready(tty, filp, info);
if (retval) { if (retval) {
#ifdef SERIAL_DEBUG_OPEN #ifdef SERIAL_DEBUG_OPEN
...@@ -2530,6 +2523,7 @@ static int __init rs_8xx_init(void) ...@@ -2530,6 +2523,7 @@ static int __init rs_8xx_init(void)
/* Initialize the tty_driver structure */ /* Initialize the tty_driver structure */
serial_driver->owner = THIS_MODULE;
serial_driver->driver_name = "serial"; serial_driver->driver_name = "serial";
serial_driver->devfs_name = "tts/"; serial_driver->devfs_name = "tts/";
serial_driver->name = "ttyS"; serial_driver->name = "ttyS";
......
...@@ -1456,21 +1456,10 @@ static void cs_mksound(unsigned int hz, unsigned int ticks) ...@@ -1456,21 +1456,10 @@ static void cs_mksound(unsigned int hz, unsigned int ticks)
restore_flags(flags); restore_flags(flags);
} }
static void CS_open(void)
{
MOD_INC_USE_COUNT;
}
static void CS_release(void)
{
MOD_DEC_USE_COUNT;
}
static MACHINE mach_cs4218 = { static MACHINE mach_cs4218 = {
.owner = THIS_MODULE,
.name = "HIOX CS4218", .name = "HIOX CS4218",
.name2 = "Built-in Sound", .name2 = "Built-in Sound",
.open = CS_open,
.release = CS_release,
.dma_alloc = CS_Alloc, .dma_alloc = CS_Alloc,
.dma_free = CS_Free, .dma_free = CS_Free,
.irqinit = CS_IrqInit, .irqinit = CS_IrqInit,
......
...@@ -583,9 +583,7 @@ static _INLINE_ void check_modem_status(struct async_struct *info) ...@@ -583,9 +583,7 @@ static _INLINE_ void check_modem_status(struct async_struct *info)
#ifdef SERIAL_DEBUG_OPEN #ifdef SERIAL_DEBUG_OPEN
printk("scheduling hangup..."); printk("scheduling hangup...");
#endif #endif
MOD_INC_USE_COUNT; schedule_task(&info->tqueue_hangup);
if (schedule_task(&info->tqueue_hangup) == 0)
MOD_DEC_USE_COUNT;
} }
} }
if (info->flags & ASYNC_CTS_FLOW) { if (info->flags & ASYNC_CTS_FLOW) {
...@@ -719,7 +717,6 @@ static void do_serial_hangup(void *private_) ...@@ -719,7 +717,6 @@ static void do_serial_hangup(void *private_)
tty = info->tty; tty = info->tty;
if (tty) if (tty)
tty_hangup(tty); tty_hangup(tty);
MOD_DEC_USE_COUNT;
} }
/*static void rs_8xx_timer(void) /*static void rs_8xx_timer(void)
...@@ -1664,7 +1661,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp) ...@@ -1664,7 +1661,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp)
if (tty_hung_up_p(filp)) { if (tty_hung_up_p(filp)) {
DBG_CNT("before DEC-hung"); DBG_CNT("before DEC-hung");
MOD_DEC_USE_COUNT;
restore_flags(flags); restore_flags(flags);
return; return;
} }
...@@ -1691,7 +1687,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp) ...@@ -1691,7 +1687,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp)
} }
if (state->count) { if (state->count) {
DBG_CNT("before DEC-2"); DBG_CNT("before DEC-2");
MOD_DEC_USE_COUNT;
restore_flags(flags); restore_flags(flags);
return; return;
} }
...@@ -1746,7 +1741,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp) ...@@ -1746,7 +1741,6 @@ static void rs_8xx_close(struct tty_struct *tty, struct file * filp)
} }
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait); wake_up_interruptible(&info->close_wait);
MOD_DEC_USE_COUNT;
restore_flags(flags); restore_flags(flags);
} }
...@@ -2008,14 +2002,12 @@ static int rs_8xx_open(struct tty_struct *tty, struct file * filp) ...@@ -2008,14 +2002,12 @@ static int rs_8xx_open(struct tty_struct *tty, struct file * filp)
if (retval) if (retval)
return retval; return retval;
MOD_INC_USE_COUNT;
retval = block_til_ready(tty, filp, info); retval = block_til_ready(tty, filp, info);
if (retval) { if (retval) {
#ifdef SERIAL_DEBUG_OPEN #ifdef SERIAL_DEBUG_OPEN
printk("rs_open returning after block_til_ready with %d\n", printk("rs_open returning after block_til_ready with %d\n",
retval); retval);
#endif #endif
MOD_DEC_USE_COUNT;
return retval; return retval;
} }
...@@ -2520,6 +2512,7 @@ static int __init rs_8xx_init(void) ...@@ -2520,6 +2512,7 @@ static int __init rs_8xx_init(void)
/* Initialize the tty_driver structure */ /* Initialize the tty_driver structure */
serial_driver->owner = THIS_MODULE;
serial_driver->driver_name = "serial"; serial_driver->driver_name = "serial";
serial_driver->devfs_name = "tts/"; serial_driver->devfs_name = "tts/";
serial_driver->name = "ttyS"; serial_driver->name = "ttyS";
......
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