summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-15 03:32:22 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-15 03:32:22 +0000
commitf1da2c3860e301527d56a1ef0b56c649ee7c4b1b (patch)
tree562b5d2e8b9cb62eb983d78ff6bcf9789e08fcf6 /drivers/char
parent00f11569ac8ca73cbcdef8822de1583e79aee571 (diff)
Merge with Linux 2.4.0-test5-pre1. This works again on Origin UP.
The IP22 cache bugs which are plaguing some machines are still unfixed.
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/acquirewdt.c3
-rw-r--r--drivers/char/agp/agpgart_fe.c15
-rw-r--r--drivers/char/amikeyb.c2
-rw-r--r--drivers/char/applicom.c26
-rw-r--r--drivers/char/busmouse.c3
-rw-r--r--drivers/char/cyclades.c173
-rw-r--r--drivers/char/dn_keyb.c3
-rw-r--r--drivers/char/drm/ffb_drv.c48
-rw-r--r--drivers/char/drm/gamma_drv.c31
-rw-r--r--drivers/char/drm/tdfx_drv.c15
-rw-r--r--drivers/char/drm/vm.c2
-rw-r--r--drivers/char/dsp56k.c3
-rw-r--r--drivers/char/dtlk.c3
-rw-r--r--drivers/char/ftape/zftape/zftape-init.c106
-rw-r--r--drivers/char/h8.c12
-rw-r--r--drivers/char/i2c-parport.c2
-rw-r--r--drivers/char/i810_rng.c7
-rw-r--r--drivers/char/ip2main.c3
-rw-r--r--drivers/char/joystick/Config.in4
-rw-r--r--drivers/char/lp.c3
-rw-r--r--drivers/char/mixcomwd.c4
-rw-r--r--drivers/char/msp3400.c2
-rw-r--r--drivers/char/nvram.c4
-rw-r--r--drivers/char/pc110pad.c8
-rw-r--r--drivers/char/pc_keyb.c7
-rw-r--r--drivers/char/pcmcia/Config.in6
-rw-r--r--drivers/char/pcwd.c3
-rw-r--r--drivers/char/ppdev.c86
-rw-r--r--drivers/char/qpmouse.c3
-rw-r--r--drivers/char/raw.c3
-rw-r--r--drivers/char/sbc60xxwdt.c3
-rw-r--r--drivers/char/softdog.c7
-rw-r--r--drivers/char/tpqic02.c3
-rw-r--r--drivers/char/tty_io.c2
-rw-r--r--drivers/char/tvmixer.c10
-rw-r--r--drivers/char/videodev.c19
-rw-r--r--drivers/char/wdt.c3
-rw-r--r--drivers/char/wdt285.c7
-rw-r--r--drivers/char/wdt977.c7
-rw-r--r--drivers/char/wdt_pci.c8
40 files changed, 344 insertions, 315 deletions
diff --git a/drivers/char/acquirewdt.c b/drivers/char/acquirewdt.c
index eaa9e6bae..b28df7e34 100644
--- a/drivers/char/acquirewdt.c
+++ b/drivers/char/acquirewdt.c
@@ -38,6 +38,7 @@
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/spinlock.h>
+#include <linux/smp_lock.h>
static int acq_is_open=0;
static spinlock_t acq_lock;
@@ -140,6 +141,7 @@ static int acq_open(struct inode *inode, struct file *file)
static int acq_close(struct inode *inode, struct file *file)
{
+ lock_kernel();
if(MINOR(inode->i_rdev)==WATCHDOG_MINOR)
{
spin_lock(&acq_lock);
@@ -149,6 +151,7 @@ static int acq_close(struct inode *inode, struct file *file)
acq_is_open=0;
spin_unlock(&acq_lock);
}
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/agp/agpgart_fe.c b/drivers/char/agp/agpgart_fe.c
index e67beef38..d16c62a22 100644
--- a/drivers/char/agp/agpgart_fe.c
+++ b/drivers/char/agp/agpgart_fe.c
@@ -41,6 +41,7 @@
#include <linux/miscdevice.h>
#include <linux/agp_backend.h>
#include <linux/agpgart.h>
+#include <linux/smp_lock.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/io.h>
@@ -605,14 +606,17 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
agp_file_private *priv = (agp_file_private *) file->private_data;
agp_kern_info kerninfo;
+ lock_kernel();
AGP_LOCK();
if (agp_fe.backend_acquired != TRUE) {
AGP_UNLOCK();
+ unlock_kernel();
return -EPERM;
}
if (!(test_bit(AGP_FF_IS_VALID, &priv->access_flags))) {
AGP_UNLOCK();
+ unlock_kernel();
return -EPERM;
}
agp_copy_info(&kerninfo);
@@ -624,42 +628,51 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
if (test_bit(AGP_FF_IS_CLIENT, &priv->access_flags)) {
if ((size + offset) > current_size) {
AGP_UNLOCK();
+ unlock_kernel();
return -EINVAL;
}
client = agp_find_client_by_pid(current->pid);
if (client == NULL) {
AGP_UNLOCK();
+ unlock_kernel();
return -EPERM;
}
if (!agp_find_seg_in_client(client, offset,
size, vma->vm_page_prot)) {
AGP_UNLOCK();
+ unlock_kernel();
return -EINVAL;
}
if (remap_page_range(vma->vm_start,
(kerninfo.aper_base + offset),
size, vma->vm_page_prot)) {
AGP_UNLOCK();
+ unlock_kernel();
return -EAGAIN;
}
AGP_UNLOCK();
+ unlock_kernel();
return 0;
}
if (test_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags)) {
if (size != current_size) {
AGP_UNLOCK();
+ unlock_kernel();
return -EINVAL;
}
if (remap_page_range(vma->vm_start, kerninfo.aper_base,
size, vma->vm_page_prot)) {
AGP_UNLOCK();
+ unlock_kernel();
return -EAGAIN;
}
AGP_UNLOCK();
+ unlock_kernel();
return 0;
}
AGP_UNLOCK();
+ unlock_kernel();
return -EPERM;
}
@@ -667,6 +680,7 @@ static int agp_release(struct inode *inode, struct file *file)
{
agp_file_private *priv = (agp_file_private *) file->private_data;
+ lock_kernel();
AGP_LOCK();
if (test_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags)) {
@@ -688,6 +702,7 @@ static int agp_release(struct inode *inode, struct file *file)
agp_remove_file_private(priv);
kfree(priv);
AGP_UNLOCK();
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/amikeyb.c b/drivers/char/amikeyb.c
index 15e21be68..73b8fecd2 100644
--- a/drivers/char/amikeyb.c
+++ b/drivers/char/amikeyb.c
@@ -176,7 +176,7 @@ static unsigned int key_repeat_rate = DEFAULT_KEYB_REP_RATE;
static unsigned char rep_scancode;
static void amikeyb_rep(unsigned long ignore);
-static struct timer_list amikeyb_rep_timer = {NULL, NULL, 0, 0, amikeyb_rep};
+static struct timer_list amikeyb_rep_timer = {function: amikeyb_rep};
static void amikeyb_rep(unsigned long ignore)
{
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index d5091ff4d..c109c5965 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -101,21 +101,18 @@ static unsigned int ReadErrorCount; /* number of read error */
static unsigned int DeviceErrorCount; /* number of device error */
static loff_t ac_llseek(struct file *, loff_t, int);
-static int ac_open(struct inode *, struct file *);
static ssize_t ac_read (struct file *, char *, size_t, loff_t *);
static ssize_t ac_write (struct file *, const char *, size_t, loff_t *);
static int ac_ioctl(struct inode *, struct file *, unsigned int,
unsigned long);
-static int ac_release(struct inode *, struct file *);
static void ac_interrupt(int, void *, struct pt_regs *);
struct file_operations ac_fops = {
+ owner:THIS_MODULE,
llseek:ac_llseek,
read:ac_read,
write:ac_write,
ioctl:ac_ioctl,
- open:ac_open,
- release:ac_release,
};
struct miscdevice ac_miscdev = {
@@ -124,6 +121,8 @@ struct miscdevice ac_miscdev = {
&ac_fops
};
+static int dummy; /* dev_id for request_irq() */
+
int ac_register_board(unsigned long physloc, unsigned long loc,
unsigned char boardno)
{
@@ -180,7 +179,7 @@ void cleanup_module(void)
iounmap((void *) apbs[i].RamIO);
if (apbs[i].irq)
- free_irq(apbs[i].irq, &ac_open);
+ free_irq(apbs[i].irq, &dummy);
}
}
@@ -226,7 +225,7 @@ int __init applicom_init(void)
continue;
}
- if (request_irq(dev->irq, &ac_interrupt, SA_SHIRQ, "Applicom PCI", &ac_open)) {
+ if (request_irq(dev->irq, &ac_interrupt, SA_SHIRQ, "Applicom PCI", &dummy)) {
printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq);
iounmap(RamIO);
apbs[boardno - 1].RamIO = 0;
@@ -277,7 +276,7 @@ int __init applicom_init(void)
printk(KERN_NOTICE "Applicom ISA card found at mem 0x%lx, irq %d\n", mem + (LEN_RAM_IO*i), irq);
if (!numisa) {
- if (request_irq(irq, &ac_interrupt, SA_SHIRQ, "Applicom ISA", &ac_open)) {
+ if (request_irq(irq, &ac_interrupt, SA_SHIRQ, "Applicom ISA", &dummy)) {
printk(KERN_WARNING "Could not allocate IRQ %d for ISA Applicom device.\n", irq);
iounmap((void *) RamIO);
apbs[boardno - 1].RamIO = 0;
@@ -346,19 +345,6 @@ static loff_t ac_llseek(struct file *file, loff_t offset, int origin)
return -ESPIPE;
}
-static int ac_open(struct inode *inode, struct file *filp)
-{
- MOD_INC_USE_COUNT;
- return 0;
-}
-
-static int ac_release(struct inode *inode, struct file *file)
-{
- MOD_DEC_USE_COUNT;
- return 0;
-}
-
-
static ssize_t ac_write(struct file *file, const char *buf, size_t count, loff_t * ppos)
{
unsigned int NumCard; /* Board number 1 -> 8 */
diff --git a/drivers/char/busmouse.c b/drivers/char/busmouse.c
index bc8345cff..9bfe4b2b3 100644
--- a/drivers/char/busmouse.c
+++ b/drivers/char/busmouse.c
@@ -19,6 +19,7 @@
#include <linux/miscdevice.h>
#include <linux/random.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/system.h>
@@ -167,6 +168,7 @@ static int busmouse_release(struct inode *inode, struct file *file)
struct busmouse_data *mse = (struct busmouse_data *)file->private_data;
int ret = 0;
+ lock_kernel();
busmouse_fasync(-1, file, 0);
if (--mse->active == 0) {
@@ -178,6 +180,7 @@ static int busmouse_release(struct inode *inode, struct file *file)
}
mse->ready = 0;
}
+ unlock_kernel();
return ret;
}
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index cf4bb1f83..d0e801180 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -2,7 +2,7 @@
#define Z_WAKE
#undef Z_EXT_CHARS_IN_BUFFER
static char rcsid[] =
-"$Revision: 2.3.2.7 $$Date: 2000/06/01 18:26:34 $";
+"$Revision: 2.3.2.8 $$Date: 2000/07/06 18:14:16 $";
/*
* linux/drivers/char/cyclades.c
@@ -25,6 +25,11 @@ static char rcsid[] =
* This version supports shared IRQ's (only for PCI boards).
*
* $Log: cyclades.c,v $
+ * Revision 2.3.2.8 2000/07/06 18:14:16 ivan
+ * Fixed the PCI detection function to work properly on Alpha systems.
+ * Implemented support for TIOCSERGETLSR ioctl.
+ * Implemented full support for non-standard baud rates.
+ *
* Revision 2.3.2.7 2000/06/01 18:26:34 ivan
* Request PLX I/O region, although driver doesn't use it, to avoid
* problems with other drivers accessing it.
@@ -1363,9 +1368,16 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
while (char_count-- > 0){
if (!info->xmit_cnt){
- cy_writeb((u_long)base_addr+(CySRER<<index),
- cy_readb(base_addr+(CySRER<<index)) &
- ~CyTxRdy);
+ if (cy_readb(base_addr+(CySRER<<index))&CyTxMpty) {
+ cy_writeb((u_long)base_addr+(CySRER<<index),
+ cy_readb(base_addr+(CySRER<<index)) &
+ ~CyTxMpty);
+ } else {
+ cy_writeb((u_long)base_addr+(CySRER<<index),
+ ((cy_readb(base_addr+(CySRER<<index))
+ & ~CyTxRdy)
+ | CyTxMpty));
+ }
goto txdone;
}
if (info->xmit_buf == 0){
@@ -3176,6 +3188,30 @@ cy_chars_in_buffer(struct tty_struct *tty)
* ------------------------------------------------------------
*/
+static void
+cyy_baud_calc(struct cyclades_port *info, uclong baud)
+{
+ int co, co_val, bpr;
+ uclong cy_clock = ((info->chip_rev >= CD1400_REV_J) ? 60000000 : 25000000);
+
+ if (baud == 0) {
+ info->tbpr = info->tco = info->rbpr = info->rco = 0;
+ return;
+ }
+
+ /* determine which prescaler to use */
+ for (co = 4, co_val = 2048; co; co--, co_val >>= 2) {
+ if (cy_clock / co_val / baud > 63)
+ break;
+ }
+
+ bpr = (cy_clock / co_val * 2 / baud + 1) / 2;
+ if (bpr > 255)
+ bpr = 255;
+
+ info->tbpr = info->rbpr = bpr;
+ info->tco = info->rco = co;
+}
/*
* This routine finds or computes the various line characteristics.
@@ -3189,7 +3225,7 @@ set_line_char(struct cyclades_port * info)
int card,chip,channel,index;
unsigned cflag, iflag;
unsigned short chip_number;
- int baud;
+ int baud, baud_rate = 0;
int i;
@@ -3225,12 +3261,14 @@ set_line_char(struct cyclades_port * info)
index = cy_card[card].bus_index;
/* baud rate */
- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) {
- baud = info->baud;
- } else {
- baud = tty_get_baud_rate(info->tty);
- }
- if (baud > CD1400_MAX_SPEED) {
+ baud = tty_get_baud_rate(info->tty);
+ if ((baud == 38400) &&
+ ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) {
+ if (info->custom_divisor)
+ baud_rate = info->baud / info->custom_divisor;
+ else
+ baud_rate = info->baud;
+ } else if (baud > CD1400_MAX_SPEED) {
baud = CD1400_MAX_SPEED;
}
/* find the baud index */
@@ -3243,22 +3281,29 @@ set_line_char(struct cyclades_port * info)
i = 19; /* CD1400_MAX_SPEED */
}
-
- if(info->chip_rev >= CD1400_REV_J) {
- /* It is a CD1400 rev. J or later */
- info->tbpr = baud_bpr_60[i]; /* Tx BPR */
- info->tco = baud_co_60[i]; /* Tx CO */
- info->rbpr = baud_bpr_60[i]; /* Rx BPR */
- info->rco = baud_co_60[i]; /* Rx CO */
+ if ((baud == 38400) &&
+ ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) {
+ cyy_baud_calc(info, baud_rate);
} else {
- info->tbpr = baud_bpr_25[i]; /* Tx BPR */
- info->tco = baud_co_25[i]; /* Tx CO */
- info->rbpr = baud_bpr_25[i]; /* Rx BPR */
- info->rco = baud_co_25[i]; /* Rx CO */
+ if(info->chip_rev >= CD1400_REV_J) {
+ /* It is a CD1400 rev. J or later */
+ info->tbpr = baud_bpr_60[i]; /* Tx BPR */
+ info->tco = baud_co_60[i]; /* Tx CO */
+ info->rbpr = baud_bpr_60[i]; /* Rx BPR */
+ info->rco = baud_co_60[i]; /* Rx CO */
+ } else {
+ info->tbpr = baud_bpr_25[i]; /* Tx BPR */
+ info->tco = baud_co_25[i]; /* Tx CO */
+ info->rbpr = baud_bpr_25[i]; /* Rx BPR */
+ info->rco = baud_co_25[i]; /* Rx CO */
+ }
}
if (baud_table[i] == 134) {
- info->timeout = (info->xmit_fifo_size*HZ*15/269) + 2;
/* get it right for 134.5 baud */
+ info->timeout = (info->xmit_fifo_size*HZ*30/269) + 2;
+ } else if ((baud == 38400) &&
+ ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) {
+ info->timeout = (info->xmit_fifo_size*HZ*15/baud_rate) + 2;
} else if (baud_table[i]) {
info->timeout = (info->xmit_fifo_size*HZ*15/baud_table[i]) + 2;
/* this needs to be propagated into the card info */
@@ -3447,19 +3492,24 @@ set_line_char(struct cyclades_port * info)
buf_ctrl = &zfw_ctrl->buf_ctrl[channel];
/* baud rate */
- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) {
- baud = info->baud;
- } else {
- baud = tty_get_baud_rate(info->tty);
- }
- if (baud > CYZ_MAX_SPEED) {
+ baud = tty_get_baud_rate(info->tty);
+ if ((baud == 38400) &&
+ ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) {
+ if (info->custom_divisor)
+ baud_rate = info->baud / info->custom_divisor;
+ else
+ baud_rate = info->baud;
+ } else if (baud > CYZ_MAX_SPEED) {
baud = CYZ_MAX_SPEED;
}
cy_writel(&ch_ctrl->comm_baud , baud);
if (baud == 134) {
- info->timeout = (info->xmit_fifo_size*HZ*30/269) + 2;
/* get it right for 134.5 baud */
+ info->timeout = (info->xmit_fifo_size*HZ*30/269) + 2;
+ } else if ((baud == 38400) &&
+ ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) {
+ info->timeout = (info->xmit_fifo_size*HZ*15/baud_rate) + 2;
} else if (baud) {
info->timeout = (info->xmit_fifo_size*HZ*15/baud) + 2;
/* this needs to be propagated into the card info */
@@ -3549,8 +3599,6 @@ set_line_char(struct cyclades_port * info)
clear_bit(TTY_IO_ERROR, &info->tty->flags);
}
}
-
-
} /* set_line_char */
@@ -3571,7 +3619,7 @@ get_serial_info(struct cyclades_port * info,
tmp.flags = info->flags;
tmp.close_delay = info->close_delay;
tmp.baud_base = info->baud;
- tmp.custom_divisor = 0; /*!!!*/
+ tmp.custom_divisor = info->custom_divisor;
tmp.hub6 = 0; /*!!!*/
return copy_to_user(retinfo,&tmp,sizeof(*retinfo))?-EFAULT:0;
} /* get_serial_info */
@@ -3597,6 +3645,7 @@ set_serial_info(struct cyclades_port * info,
info->flags = ((info->flags & ~ASYNC_USR_MASK) |
(new_serial.flags & ASYNC_USR_MASK));
info->baud = new_serial.baud_base;
+ info->custom_divisor = new_serial.custom_divisor;
goto check_and_exit;
}
@@ -3607,6 +3656,7 @@ set_serial_info(struct cyclades_port * info,
*/
info->baud = new_serial.baud_base;
+ info->custom_divisor = new_serial.custom_divisor;
info->flags = ((info->flags & ~ASYNC_FLAGS) |
(new_serial.flags & ASYNC_FLAGS));
info->close_delay = new_serial.close_delay * HZ/100;
@@ -3621,6 +3671,43 @@ check_and_exit:
}
} /* set_serial_info */
+/*
+ * get_lsr_info - get line status register info
+ *
+ * Purpose: Let user call ioctl() to get info when the UART physically
+ * is emptied. On bus types like RS485, the transmitter must
+ * release the bus after transmitting. This must be done when
+ * the transmit shift register is empty, not be done when the
+ * transmit holding register is empty. This functionality
+ * allows an RS485 driver to be written in user space.
+ */
+static int get_lsr_info(struct cyclades_port *info, unsigned int *value)
+{
+ int card, chip, channel, index;
+ unsigned char status;
+ unsigned int result;
+ unsigned long flags;
+ unsigned char *base_addr;
+
+ card = info->card;
+ channel = (info->line) - (cy_card[card].first_line);
+ if (!IS_CYC_Z(cy_card[card])) {
+ chip = channel>>2;
+ channel &= 0x03;
+ index = cy_card[card].bus_index;
+ base_addr = (unsigned char *)
+ (cy_card[card].base_addr + (cy_chip_offset[chip]<<index));
+
+ CY_LOCK(info, flags);
+ status = cy_readb(base_addr+(CySRER<<index)) & (CyTxRdy|CyTxMpty);
+ CY_UNLOCK(info, flags);
+ result = (status ? 0 : TIOCSER_TEMT);
+ } else {
+ /* Not supported yet */
+ return -EINVAL;
+ }
+ return cy_put_user(result, (unsigned long *) value);
+}
static int
get_modem_info(struct cyclades_port * info, unsigned int *value)
@@ -4247,6 +4334,9 @@ cy_ioctl(struct tty_struct *tty, struct file * file,
case TIOCSSERIAL:
ret_val = set_serial_info(info, (struct serial_struct *) arg);
break;
+ case TIOCSERGETLSR: /* Get line status register */
+ ret_val = get_lsr_info(info, (unsigned int *) arg);
+ break;
/*
* Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change
* - mask passed in arg for lines of interest
@@ -4937,10 +5027,9 @@ cy_detect_pci(void)
i--;
continue;
}
-#else
+#endif
cy_pci_addr0 = (ulong)ioremap(cy_pci_phys0, CyPCI_Yctl);
cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ywin);
-#endif
#ifdef CY_PCI_DEBUG
printk("Cyclom-Y/PCI: relocate winaddr=0x%lx ctladdr=0x%lx\n",
@@ -5048,9 +5137,7 @@ cy_detect_pci(void)
printk("Cyclades-Z/PCI: found winaddr=0x%lx ctladdr=0x%lx\n",
(ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
#endif
-#if !defined(__alpha__)
- cy_pci_addr0 = (ulong)ioremap(cy_pci_phys0, CyPCI_Zctl);
-#endif
+ cy_pci_addr0 = (ulong)ioremap(cy_pci_phys0, CyPCI_Zctl);
/* Disable interrupts on the PLX before resetting it */
cy_writew(cy_pci_addr0+0x68,
@@ -5078,9 +5165,7 @@ cy_detect_pci(void)
request_region(cy_pci_phys1, CyPCI_Zctl, "Cyclades-Z");
if (mailbox == ZE_V1) {
-#if !defined(__alpha__)
- cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ze_win);
-#endif
+ cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ze_win);
if (ZeIndex == NR_CARDS) {
printk("Cyclades-Ze/PCI found at 0x%lx ",
(ulong)cy_pci_phys2);
@@ -5097,9 +5182,7 @@ cy_detect_pci(void)
i--;
continue;
} else {
-#if !defined(__alpha__)
- cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Zwin);
-#endif
+ cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Zwin);
}
#ifdef CY_PCI_DEBUG
@@ -5538,6 +5621,7 @@ cy_init(void)
info->tco = 0;
info->rbpr = 0;
info->rco = 0;
+ info->custom_divisor = 0;
info->close_delay = 5*HZ/10;
info->closing_wait = CLOSING_WAIT_DELAY;
info->icount.cts = info->icount.dsr =
@@ -5596,6 +5680,7 @@ cy_init(void)
info->cor3 = 0x08; /* _very_ small rcv threshold */
info->cor4 = 0;
info->cor5 = 0;
+ info->custom_divisor = 0;
info->close_delay = 5*HZ/10;
info->closing_wait = CLOSING_WAIT_DELAY;
info->icount.cts = info->icount.dsr =
diff --git a/drivers/char/dn_keyb.c b/drivers/char/dn_keyb.c
index 8d8766b85..980ee13ba 100644
--- a/drivers/char/dn_keyb.c
+++ b/drivers/char/dn_keyb.c
@@ -51,8 +51,7 @@ static u_char *shadow_buf=&debug_buf2[0];
static short debug_buf_count=0;
static int debug_buf_overrun=0,debug_timer_running=0;
static unsigned long debug_buffer_updated=0;
-static struct timer_list debug_keyb_timer = { NULL, NULL, 0, 0,
- debug_keyb_timer_handler };
+static struct timer_list debug_keyb_timer = { function: debug_keyb_timer_handler };
#endif
static u_short dnplain_map[NR_KEYS] __initdata = {
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c
index a1ab1f279..5ad4885bf 100644
--- a/drivers/char/drm/ffb_drv.c
+++ b/drivers/char/drm/ffb_drv.c
@@ -6,6 +6,8 @@
#include "drmP.h"
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include <asm/oplib.h>
#include <asm/upa.h>
@@ -44,6 +46,7 @@ extern int ffb_rmctx(struct inode *, struct file *, unsigned int, unsigned long)
extern int ffb_context_switch(drm_device_t *, int, int);
static struct file_operations ffb_fops = {
+ owner: THIS_MODULE,
open: ffb_open,
flush: drm_flush,
release: ffb_release,
@@ -501,7 +504,6 @@ static int ffb_open(struct inode *inode, struct file *filp)
DRM_DEBUG("open_count = %d\n", dev->open_count);
ret = drm_open_helper(inode, filp, dev);
if (!ret) {
- MOD_INC_USE_COUNT;
atomic_inc(&dev->total_open);
spin_lock(&dev->count_lock);
if (!dev->open_count++) {
@@ -517,9 +519,11 @@ static int ffb_open(struct inode *inode, struct file *filp)
static int ffb_release(struct inode *inode, struct file *filp)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev;
int ret = 0;
+ lock_kernel();
+ dev = priv->dev;
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (dev->lock.hw_lock != NULL
&& _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
@@ -541,7 +545,6 @@ static int ffb_release(struct inode *inode, struct file *filp)
ret = drm_release(inode, filp);
if (!ret) {
- MOD_DEC_USE_COUNT;
atomic_inc(&dev->total_close);
spin_lock(&dev->count_lock);
if (!--dev->open_count) {
@@ -550,14 +553,18 @@ static int ffb_release(struct inode *inode, struct file *filp)
atomic_read(&dev->ioctl_count),
dev->blocked);
spin_unlock(&dev->count_lock);
+ unlock_kernel();
return -EBUSY;
}
spin_unlock(&dev->count_lock);
- return ffb_takedown(dev);
+ ret = ffb_takedown(dev);
+ unlock_kernel();
+ return ret;
}
spin_unlock(&dev->count_lock);
}
+ unlock_kernel();
return ret;
}
@@ -756,6 +763,7 @@ static int ffb_mmap(struct file *filp, struct vm_area_struct *vma)
DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
vma->vm_start, vma->vm_end, VM_OFFSET(vma));
+ lock_kernel();
minor = MINOR(filp->f_dentry->d_inode->i_rdev);
ffb_priv = NULL;
for (i = 0; i < ffb_dev_table_size; i++) {
@@ -763,13 +771,15 @@ static int ffb_mmap(struct file *filp, struct vm_area_struct *vma)
if (ffb_priv->miscdev.minor == minor)
break;
}
- if (i >= ffb_dev_table_size)
+ if (i >= ffb_dev_table_size) {
+ unlock_kernel();
return -EINVAL;
-
+ }
/* We don't support/need dma mappings, so... */
- if (!VM_OFFSET(vma))
+ if (!VM_OFFSET(vma)) {
+ unlock_kernel();
return -EINVAL;
-
+ }
for (i = 0; i < dev->map_count; i++) {
unsigned long off;
@@ -781,16 +791,19 @@ static int ffb_mmap(struct file *filp, struct vm_area_struct *vma)
break;
}
- if (i >= dev->map_count)
+ if (i >= dev->map_count) {
+ unlock_kernel();
return -EINVAL;
-
+ }
if (!map ||
- ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN)))
+ ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN))) {
+ unlock_kernel();
return -EPERM;
-
- if (map->size != (vma->vm_end - vma->vm_start))
+ }
+ if (map->size != (vma->vm_end - vma->vm_start)) {
+ unlock_kernel();
return -EINVAL;
-
+ }
/* Set read-only attribute before mappings are created
* so it works for fb/reg maps too.
*/
@@ -813,9 +826,10 @@ static int ffb_mmap(struct file *filp, struct vm_area_struct *vma)
if (io_remap_page_range(vma->vm_start,
ffb_priv->card_phys_base + VM_OFFSET(vma),
vma->vm_end - vma->vm_start,
- vma->vm_page_prot, 0))
+ vma->vm_page_prot, 0)) {
+ unlock_kernel();
return -EAGAIN;
-
+ }
vma->vm_ops = &drm_vm_ops;
break;
case _DRM_SHM:
@@ -828,8 +842,10 @@ static int ffb_mmap(struct file *filp, struct vm_area_struct *vma)
vma->vm_flags |= VM_LOCKED;
break;
default:
+ unlock_kernel();
return -EINVAL; /* This should never happen. */
};
+ unlock_kernel();
vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
diff --git a/drivers/char/drm/gamma_drv.c b/drivers/char/drm/gamma_drv.c
index 7e0d6e53e..8809d1810 100644
--- a/drivers/char/drm/gamma_drv.c
+++ b/drivers/char/drm/gamma_drv.c
@@ -29,6 +29,8 @@
*/
#include <linux/config.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include "drmP.h"
#include "gamma_drv.h"
EXPORT_SYMBOL(gamma_init);
@@ -44,14 +46,15 @@ EXPORT_SYMBOL(gamma_cleanup);
static drm_device_t gamma_device;
static struct file_operations gamma_fops = {
- open: gamma_open,
- flush: drm_flush,
- release: gamma_release,
- ioctl: gamma_ioctl,
- mmap: drm_mmap,
- read: drm_read,
- fasync: drm_fasync,
- poll: drm_poll,
+ owner: THIS_MODULE,
+ open: gamma_open,
+ flush: drm_flush,
+ release: gamma_release,
+ ioctl: gamma_ioctl,
+ mmap: drm_mmap,
+ read: drm_read,
+ fasync: drm_fasync,
+ poll: drm_poll,
};
static struct miscdevice gamma_misc = {
@@ -407,7 +410,6 @@ int gamma_open(struct inode *inode, struct file *filp)
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_open_helper(inode, filp, dev))) {
- MOD_INC_USE_COUNT;
atomic_inc(&dev->total_open);
spin_lock(&dev->count_lock);
if (!dev->open_count++) {
@@ -422,12 +424,13 @@ int gamma_open(struct inode *inode, struct file *filp)
int gamma_release(struct inode *inode, struct file *filp)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev;
int retcode = 0;
+ lock_kernel();
+ dev = priv->dev;
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_release(inode, filp))) {
- MOD_DEC_USE_COUNT;
atomic_inc(&dev->total_close);
spin_lock(&dev->count_lock);
if (!--dev->open_count) {
@@ -436,13 +439,17 @@ int gamma_release(struct inode *inode, struct file *filp)
atomic_read(&dev->ioctl_count),
dev->blocked);
spin_unlock(&dev->count_lock);
+ unlock_kernel();
return -EBUSY;
}
spin_unlock(&dev->count_lock);
- return gamma_takedown(dev);
+ retcode = gamma_takedown(dev);
+ unlock_kernel();
+ return retcode;
}
spin_unlock(&dev->count_lock);
}
+ unlock_kernel();
return retcode;
}
diff --git a/drivers/char/drm/tdfx_drv.c b/drivers/char/drm/tdfx_drv.c
index 23c9c55bf..b0c41c93c 100644
--- a/drivers/char/drm/tdfx_drv.c
+++ b/drivers/char/drm/tdfx_drv.c
@@ -30,6 +30,8 @@
*/
#include <linux/config.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include "drmP.h"
#include "tdfx_drv.h"
@@ -44,6 +46,7 @@ static drm_device_t tdfx_device;
drm_ctx_t tdfx_res_ctx;
static struct file_operations tdfx_fops = {
+ owner: THIS_MODULE,
open: tdfx_open,
flush: drm_flush,
release: tdfx_release,
@@ -343,7 +346,6 @@ int tdfx_open(struct inode *inode, struct file *filp)
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_open_helper(inode, filp, dev))) {
- MOD_INC_USE_COUNT;
atomic_inc(&dev->total_open);
spin_lock(&dev->count_lock);
if (!dev->open_count++) {
@@ -358,12 +360,13 @@ int tdfx_open(struct inode *inode, struct file *filp)
int tdfx_release(struct inode *inode, struct file *filp)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev;
int retcode = 0;
+ lock_kernel();
+ dev = priv->dev;
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_release(inode, filp))) {
- MOD_DEC_USE_COUNT;
atomic_inc(&dev->total_close);
spin_lock(&dev->count_lock);
if (!--dev->open_count) {
@@ -372,13 +375,17 @@ int tdfx_release(struct inode *inode, struct file *filp)
atomic_read(&dev->ioctl_count),
dev->blocked);
spin_unlock(&dev->count_lock);
+ unlock_kernel();
return -EBUSY;
}
spin_unlock(&dev->count_lock);
- return tdfx_takedown(dev);
+ retcode = tdfx_takedown(dev);
+ unlock_kernel();
+ return retcode;
}
spin_unlock(&dev->count_lock);
}
+ unlock_kernel();
return retcode;
}
diff --git a/drivers/char/drm/vm.c b/drivers/char/drm/vm.c
index b4c4c5bbf..b6595c88c 100644
--- a/drivers/char/drm/vm.c
+++ b/drivers/char/drm/vm.c
@@ -144,7 +144,6 @@ void drm_vm_open(struct vm_area_struct *vma)
DRM_DEBUG("0x%08lx,0x%08lx\n",
vma->vm_start, vma->vm_end - vma->vm_start);
atomic_inc(&dev->vma_count);
- MOD_INC_USE_COUNT;
#if DRM_DEBUG_CODE
vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS);
@@ -169,7 +168,6 @@ void drm_vm_close(struct vm_area_struct *vma)
DRM_DEBUG("0x%08lx,0x%08lx\n",
vma->vm_start, vma->vm_end - vma->vm_start);
- MOD_DEC_USE_COUNT;
atomic_dec(&dev->vma_count);
#if DRM_DEBUG_CODE
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
index 6fe41e118..0ada290ac 100644
--- a/drivers/char/dsp56k.c
+++ b/drivers/char/dsp56k.c
@@ -35,6 +35,7 @@
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
+#include <linux/smp_lock.h>
#include <asm/segment.h>
#include <asm/atarihw.h>
@@ -483,7 +484,9 @@ static int dsp56k_release(struct inode *inode, struct file *file)
{
case DSP56K_DEV_56001:
+ lock_kernel();
dsp56k.in_use = 0;
+ unlock_kernel();
break;
default:
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
index 475e1d052..867a7fcec 100644
--- a/drivers/char/dtlk.c
+++ b/drivers/char/dtlk.c
@@ -69,6 +69,7 @@
#include <linux/poll.h> /* for POLLIN, etc. */
#include <linux/dtlk.h> /* local header file for DoubleTalk values */
#include <linux/devfs_fs_kernel.h>
+#include <linux/smp_lock.h>
#ifdef TRACING
#define TRACE_TEXT(str) printk(str);
@@ -333,7 +334,9 @@ static int dtlk_release(struct inode *inode, struct file *file)
}
TRACE_RET;
+ lock_kernel();
del_timer(&dtlk_timer);
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c
index fd81f24ca..a57e3abc1 100644
--- a/drivers/char/ftape/zftape/zftape-init.c
+++ b/drivers/char/ftape/zftape/zftape-init.c
@@ -35,15 +35,11 @@
#endif
#include <linux/fcntl.h>
#include <linux/wrapper.h>
+#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/zftape.h>
-#if LINUX_VERSION_CODE >=KERNEL_VER(2,1,16)
#include <linux/init.h>
-#else
-#define __initdata
-#define __initfunc(__arg) __arg
-#endif
#include "../zftape/zftape-init.h"
#include "../zftape/zftape-read.h"
@@ -56,7 +52,6 @@ char zft_src[] __initdata = "$Source: /homes/cvs/ftape-stacked/ftape/zftape/zfta
char zft_rev[] __initdata = "$Revision: 1.8 $";
char zft_dat[] __initdata = "$Date: 1997/11/06 00:48:56 $";
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
MODULE_AUTHOR("(c) 1996, 1997 Claus-Justus Heine "
"(claus@momo.math.rwth-aachen.de)");
MODULE_DESCRIPTION(ZFTAPE_VERSION " - "
@@ -64,7 +59,6 @@ MODULE_DESCRIPTION(ZFTAPE_VERSION " - "
"Support for QIC-113 compatible volume table "
"and builtin compression (lzrw3 algorithm)");
MODULE_SUPPORTED_DEVICE("char-major-27");
-#endif
/* Global vars.
*/
@@ -90,38 +84,18 @@ static sigset_t orig_sigmask;
*/
static int zft_open (struct inode *ino, struct file *filep);
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,31)
static int zft_close(struct inode *ino, struct file *filep);
-#else
-static void zft_close(struct inode *ino, struct file *filep);
-#endif
static int zft_ioctl(struct inode *ino, struct file *filep,
unsigned int command, unsigned long arg);
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,56)
static int zft_mmap(struct file *filep, struct vm_area_struct *vma);
-#else
-static int zft_mmap(struct inode *ino, struct file *filep,
- struct vm_area_struct *vma);
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
static ssize_t zft_read (struct file *fp, char *buff,
size_t req_len, loff_t *ppos);
static ssize_t zft_write(struct file *fp, const char *buff,
size_t req_len, loff_t *ppos);
-#elif LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
-static long zft_read (struct inode *ino, struct file *fp, char *buff,
- unsigned long req_len);
-static long zft_write(struct inode *ino, struct file *fp, const char *buff,
- unsigned long req_len);
-#else
-static int zft_read (struct inode *ino, struct file *fp, char *buff,
- int req_len);
-static int zft_write(struct inode *ino, struct file *fp, const char *buff,
- int req_len);
-#endif
static struct file_operations zft_cdev =
{
+ owner: THIS_MODULE,
read: zft_read,
write: zft_write,
ioctl: zft_ioctl,
@@ -137,15 +111,6 @@ static int zft_open(struct inode *ino, struct file *filep)
int result;
TRACE_FUN(ft_t_flow);
-#if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
- if (!MOD_IN_USE) {
- MOD_INC_USE_COUNT; /* lock module in memory */
- }
-#else
- MOD_INC_USE_COUNT; /* sets MOD_VISITED and MOD_USED_ONCE,
- * locking is done with can_unload()
- */
-#endif
TRACE(ft_t_flow, "called for minor %d", MINOR(ino->i_rdev));
if (busy_flag) {
TRACE_ABORT(-EBUSY, ft_t_warn, "failed: already busy");
@@ -155,11 +120,6 @@ static int zft_open(struct inode *ino, struct file *filep)
>
FTAPE_SEL_D) {
busy_flag = 0;
-#if defined(MODULE) && LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
- if (!zft_dirty()) {
- MOD_DEC_USE_COUNT; /* unlock module in memory */
- }
-#endif
TRACE_ABORT(-ENXIO, ft_t_err, "failed: illegal unit nr");
}
orig_sigmask = current->blocked;
@@ -168,11 +128,6 @@ static int zft_open(struct inode *ino, struct file *filep)
if (result < 0) {
current->blocked = orig_sigmask; /* restore mask */
busy_flag = 0;
-#if defined(MODULE) && LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
- if (!zft_dirty()) {
- MOD_DEC_USE_COUNT; /* unlock module in memory */
- }
-#endif
TRACE_ABORT(result, ft_t_err, "_ftape_open failed");
} else {
/* Mask signals that will disturb proper operation of the
@@ -191,13 +146,11 @@ static int zft_close(struct inode *ino, struct file *filep)
int result;
TRACE_FUN(ft_t_flow);
+ lock_kernel();
if (!busy_flag || MINOR(ino->i_rdev) != zft_unit) {
TRACE(ft_t_err, "failed: not busy or wrong unit");
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,31)
+ unlock_kernel();
TRACE_EXIT 0;
-#else
- TRACE_EXIT; /* keep busy_flag !(?) */
-#endif
}
sigfillset(&current->blocked);
result = _zft_close();
@@ -206,16 +159,8 @@ static int zft_close(struct inode *ino, struct file *filep)
}
current->blocked = orig_sigmask; /* restore before open state */
busy_flag = 0;
-#if defined(MODULE) && LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
- if (!zft_dirty()) {
- MOD_DEC_USE_COUNT; /* unlock module in memory */
- }
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,31)
+ unlock_kernel();
TRACE_EXIT 0;
-#else
- TRACE_EXIT;
-#endif
}
/* Ioctl for floppy tape device
@@ -241,24 +186,14 @@ static int zft_ioctl(struct inode *ino, struct file *filep,
/* Ioctl for floppy tape device
*/
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,56)
static int zft_mmap(struct file *filep, struct vm_area_struct *vma)
-#else
-static int zft_mmap(struct inode *ino,
- struct file *filep,
- struct vm_area_struct *vma)
-#endif
{
int result = -EIO;
sigset_t old_sigmask;
TRACE_FUN(ft_t_flow);
if (!busy_flag ||
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,56)
MINOR(filep->f_dentry->d_inode->i_rdev) != zft_unit ||
-#else
- MINOR(ino->i_rdev) != zft_unit ||
-#endif
ft_failure)
{
TRACE_ABORT(-EIO, ft_t_err,
@@ -266,34 +201,26 @@ static int zft_mmap(struct inode *ino,
}
old_sigmask = current->blocked; /* save mask */
sigfillset(&current->blocked);
+ lock_kernel();
if ((result = ftape_mmap(vma)) >= 0) {
#ifndef MSYNC_BUG_WAS_FIXED
static struct vm_operations_struct dummy = { NULL, };
vma->vm_ops = &dummy;
#endif
}
+ unlock_kernel();
current->blocked = old_sigmask; /* restore mask */
TRACE_EXIT result;
}
/* Read from floppy tape device
*/
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
static ssize_t zft_read(struct file *fp, char *buff,
size_t req_len, loff_t *ppos)
-#elif LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
-static long zft_read(struct inode *ino, struct file *fp, char *buff,
- unsigned long req_len)
-#else
-static int zft_read(struct inode *ino, struct file *fp, char *buff,
- int req_len)
-#endif
{
int result = -EIO;
sigset_t old_sigmask;
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
struct inode *ino = fp->f_dentry->d_inode;
-#endif
TRACE_FUN(ft_t_flow);
TRACE(ft_t_data_flow, "called with count: %ld", (unsigned long)req_len);
@@ -311,22 +238,12 @@ static int zft_read(struct inode *ino, struct file *fp, char *buff,
/* Write to tape device
*/
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
static ssize_t zft_write(struct file *fp, const char *buff,
size_t req_len, loff_t *ppos)
-#elif LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
-static long zft_write(struct inode *ino, struct file *fp, const char *buff,
- unsigned long req_len)
-#else
-static int zft_write(struct inode *ino, struct file *fp, const char *buff,
- int req_len)
-#endif
{
int result = -EIO;
sigset_t old_sigmask;
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
struct inode *ino = fp->f_dentry->d_inode;
-#endif
TRACE_FUN(ft_t_flow);
TRACE(ft_t_flow, "called with count: %ld", (unsigned long)req_len);
@@ -470,9 +387,6 @@ KERN_INFO
&zft_cdev, NULL);
}
-#if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
- register_symtab(&zft_symbol_table); /* add global zftape symbols */
-#endif
#ifdef CONFIG_ZFT_COMPRESSOR
(void)zft_compressor_init();
#endif
@@ -484,24 +398,20 @@ KERN_INFO
#ifdef MODULE
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
/* Called by modules package before trying to unload the module
*/
static int can_unload(void)
{
- return (zft_dirty() || busy_flag) ? -EBUSY : 0;
+ return (GET_USE_COUNT(THIS_MODULE)||zft_dirty()||busy_flag)?-EBUSY:0;
}
-#endif
/* Called by modules package when installing the driver
*/
int init_module(void)
{
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
if (!mod_member_present(&__this_module, can_unload)) {
return -EBUSY;
}
__this_module.can_unload = can_unload;
-#endif
return zft_init();
}
diff --git a/drivers/char/h8.c b/drivers/char/h8.c
index acc898cb8..8a4b4de51 100644
--- a/drivers/char/h8.c
+++ b/drivers/char/h8.c
@@ -106,16 +106,6 @@ static int h8_monitor_timer_active = 0;
static char driver_version[] = "X0.0";/* no spaces */
-static struct file_operations h8_fops = {
- /* twelve lines of crap^WNULLs were here */
-};
-
-static struct miscdevice h8_device = {
- H8_MINOR_DEV,
- "h8",
- &h8_fops
-};
-
union intr_buf intrbuf;
int intr_buf_ptr;
union intr_buf xx;
@@ -297,7 +287,6 @@ static void h8_intr(int irq, void *dev_id, struct pt_regs *regs)
static void __exit h8_cleanup (void)
{
remove_proc_entry("driver/h8", NULL);
- misc_deregister(&h8_device);
release_region(h8_base, 8);
free_irq(h8_irq, NULL);
}
@@ -313,7 +302,6 @@ static int __init h8_init(void)
create_proc_info_entry("driver/h8", 0, NULL, h8_get_info);
- misc_register(&h8_device);
request_region(h8_base, 8, "h8");
h8_alloc_queues();
diff --git a/drivers/char/i2c-parport.c b/drivers/char/i2c-parport.c
index 8304a6ab5..00b574f60 100644
--- a/drivers/char/i2c-parport.c
+++ b/drivers/char/i2c-parport.c
@@ -75,7 +75,7 @@ static void i2c_parport_attach(struct parport *port)
struct parport_i2c_bus *b = kmalloc(sizeof(struct parport_i2c_bus),
GFP_KERNEL);
b->i2c = parport_i2c_bus_template;
- b->i2c.data = port;
+ b->i2c.data = parport_get_port (port);
strncpy(b->i2c.name, port->name, 32);
spin_lock(&bus_list_lock);
b->next = bus_list;
diff --git a/drivers/char/i810_rng.c b/drivers/char/i810_rng.c
index 905d8e8cd..7a6718c02 100644
--- a/drivers/char/i810_rng.c
+++ b/drivers/char/i810_rng.c
@@ -165,6 +165,7 @@
#include <linux/random.h>
#include <linux/sysctl.h>
#include <linux/miscdevice.h>
+#include <linux/smp_lock.h>
#include <asm/io.h>
#include <asm/uaccess.h>
@@ -626,12 +627,16 @@ err_out:
static int rng_dev_release (struct inode *inode, struct file *filp)
{
- if (rng_enable(0) != 0)
+ lock_kernel();
+ if (rng_enable(0) != 0) {
+ unlock_kernel();
return -EIO;
+ }
spin_lock_bh (&rng_lock);
rng_open = 0;
spin_unlock_bh (&rng_lock);
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/ip2main.c b/drivers/char/ip2main.c
index 449bd2f76..6fbfe22df 100644
--- a/drivers/char/ip2main.c
+++ b/drivers/char/ip2main.c
@@ -329,8 +329,7 @@ static long bh_counter = 0;
* selected, the board is serviced periodically to see if anything needs doing.
*/
#define POLL_TIMEOUT (jiffies + 1)
-static struct timer_list PollTimer = { {NULL, NULL}, 0, 0, ip2_poll };
-// next, prev, expires,data, func()
+static struct timer_list PollTimer = { function: ip2_poll };
static char TimerOn = 0;
#ifdef IP2DEBUG_TRACE
diff --git a/drivers/char/joystick/Config.in b/drivers/char/joystick/Config.in
index 1547e5f38..b020f1728 100644
--- a/drivers/char/joystick/Config.in
+++ b/drivers/char/joystick/Config.in
@@ -7,9 +7,7 @@ comment 'Joysticks'
tristate 'Joystick support' CONFIG_JOYSTICK
if [ "$CONFIG_JOYSTICK" != "n" ]; then
-
- define_tristate CONFIG_USB $CONFIG_JOYSTICK
- define_tristate CONFIG_INPUT_JOYDEV $CONFIG_JOYSTICK
+ define_tristate CONFIG_INPUT_JOYDEV $CONFIG_JOYSTICK
comment 'Game port support'
dep_tristate ' ns558 gameports' CONFIG_INPUT_NS558 $CONFIG_JOYSTICK
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index 5e212af34..a602e3b3b 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -119,6 +119,7 @@
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/malloc.h>
#include <linux/fcntl.h>
@@ -407,9 +408,11 @@ static int lp_release(struct inode * inode, struct file * file)
{
unsigned int minor = MINOR(inode->i_rdev);
+ lock_kernel();
kfree_s(lp_table[minor].lp_buffer, LP_BUFFER_SIZE);
lp_table[minor].lp_buffer = NULL;
LP_F(minor) &= ~LP_BUSY;
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/mixcomwd.c b/drivers/char/mixcomwd.c
index 6352d6f73..1daff0de7 100644
--- a/drivers/char/mixcomwd.c
+++ b/drivers/char/mixcomwd.c
@@ -43,6 +43,7 @@
#include <linux/watchdog.h>
#include <linux/reboot.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/io.h>
@@ -100,9 +101,11 @@ static int mixcomwd_open(struct inode *inode, struct file *file)
static int mixcomwd_release(struct inode *inode, struct file *file)
{
+ lock_kernel();
#ifndef CONFIG_WATCHDOG_NOWAYOUT
if(mixcomwd_timer_alive) {
printk(KERN_ERR "mixcomwd: release called while internal timer alive");
+ unlock_kernel();
return -EBUSY;
}
init_timer(&mixcomwd_timer);
@@ -114,6 +117,7 @@ static int mixcomwd_release(struct inode *inode, struct file *file)
#endif
clear_bit(0,&mixcomwd_opened);
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/msp3400.c b/drivers/char/msp3400.c
index dce40c671..5c30ca2f0 100644
--- a/drivers/char/msp3400.c
+++ b/drivers/char/msp3400.c
@@ -1265,8 +1265,10 @@ msp3400c_mixer_release(struct inode *inode, struct file *file)
{
struct i2c_client *client = file->private_data;
+ lock_kernel();
if (client->adapter->dec_use)
client->adapter->dec_use(client->adapter);
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index a32cd18df..6fa72fc8e 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -34,6 +34,8 @@
#include <linux/module.h>
#include <linux/config.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
#define PC 1
#define ATARI 2
@@ -341,11 +343,13 @@ static int nvram_open( struct inode *inode, struct file *file )
static int nvram_release( struct inode *inode, struct file *file )
{
+ lock_kernel();
nvram_open_cnt--;
if (file->f_flags & O_EXCL)
nvram_open_mode &= ~NVRAM_EXCL;
if (file->f_mode & 2)
nvram_open_mode &= ~NVRAM_WRITE;
+ unlock_kernel();
return( 0 );
}
diff --git a/drivers/char/pc110pad.c b/drivers/char/pc110pad.c
index dfef66e39..556d8630e 100644
--- a/drivers/char/pc110pad.c
+++ b/drivers/char/pc110pad.c
@@ -41,6 +41,7 @@
#include <linux/poll.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
+#include <linux/smp_lock.h>
#include <asm/signal.h>
#include <asm/io.h>
@@ -583,10 +584,11 @@ static int fasync_pad(int fd, struct file *filp, int on)
static int close_pad(struct inode * inode, struct file * file)
{
+ lock_kernel();
fasync_pad(-1, file, 0);
- if (--active)
- return 0;
- outb(0x30, current_params.io+2); /* switch off digitiser */
+ if (!--active)
+ outb(0x30, current_params.io+2); /* switch off digitiser */
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/pc_keyb.c b/drivers/char/pc_keyb.c
index c265b927f..34e13c97f 100644
--- a/drivers/char/pc_keyb.c
+++ b/drivers/char/pc_keyb.c
@@ -31,6 +31,7 @@
#include <linux/miscdevice.h>
#include <linux/malloc.h>
#include <linux/kbd_kern.h>
+#include <linux/smp_lock.h>
#include <asm/keyboard.h>
#include <asm/bitops.h>
@@ -872,12 +873,16 @@ static int fasync_aux(int fd, struct file *filp, int on)
static int release_aux(struct inode * inode, struct file * file)
{
+ lock_kernel();
fasync_aux(-1, file, 0);
- if (--aux_count)
+ if (--aux_count) {
+ unlock_kernel();
return 0;
+ }
kbd_write_cmd(AUX_INTS_OFF); /* Disable controller ints */
kbd_write_command_w(KBD_CCMD_MOUSE_DISABLE);
aux_free_irq(AUX_DEV);
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/pcmcia/Config.in b/drivers/char/pcmcia/Config.in
index 766fdd1d0..8baf1932e 100644
--- a/drivers/char/pcmcia/Config.in
+++ b/drivers/char/pcmcia/Config.in
@@ -3,12 +3,12 @@
#
if [ "$CONFIG_SERIAL" = "n" ]; then
- define_bool CONFIG_PCMCIA_SERIAL n
+ define_tristate CONFIG_PCMCIA_SERIAL n
else
if [ "$CONFIG_SERIAL" = "m" -o "$CONFIG_PCMCIA" = "m" ]; then
- define_bool CONFIG_PCMCIA_SERIAL m
+ define_tristate CONFIG_PCMCIA_SERIAL m
else
- define_bool CONFIG_PCMCIA_SERIAL y
+ define_tristate CONFIG_PCMCIA_SERIAL y
fi
fi
diff --git a/drivers/char/pcwd.c b/drivers/char/pcwd.c
index b85a168de..cb197afc5 100644
--- a/drivers/char/pcwd.c
+++ b/drivers/char/pcwd.c
@@ -63,6 +63,7 @@
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/io.h>
@@ -451,6 +452,7 @@ static int pcwd_close(struct inode *ino, struct file *filep)
{
if (MINOR(ino->i_rdev)==WATCHDOG_MINOR)
{
+ lock_kernel();
is_open = 0;
#ifndef CONFIG_WATCHDOG_NOWAYOUT
/* Disable the board */
@@ -460,6 +462,7 @@ static int pcwd_close(struct inode *ino, struct file *filep)
outb_p(0xA5, current_readport + 3);
spin_unlock(&io_lock);
}
+ unlock_kernel();
#endif
}
return 0;
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index 4e2be3c8b..07877c1a7 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -52,6 +52,7 @@
#include <linux/poll.h>
#include <asm/uaccess.h>
#include <linux/ppdev.h>
+#include <linux/smp_lock.h>
#define PP_VERSION "ppdev: user-space parallel port driver"
#define CHRDEV "ppdev"
@@ -83,64 +84,6 @@ struct pp_struct {
/* ROUND_UP macro from fs/select.c */
#define ROUND_UP(x,y) (((x)+(y)-1)/(y))
-struct pp_port_list_struct {
- struct parport *port;
- struct pp_port_list_struct *next;
-};
-static struct pp_port_list_struct *pp_port_list;
-static DECLARE_MUTEX(pp_port_list_lock);
-
-/* pp_attach and pp_detach are for keeping a list of currently
- * available ports, held under a mutex. We do this rather than
- * using parport_enumerate because it stops a load of races.
- */
-
-static void pp_attach (struct parport *port)
-{
- struct pp_port_list_struct *add;
-
- add = kmalloc (sizeof (struct pp_port_list_struct), GFP_KERNEL);
- if (!add) {
- printk (KERN_WARNING CHRDEV ": memory squeeze\n");
- return;
- }
-
- add->port = port;
- down (&pp_port_list_lock);
- add->next = pp_port_list;
- pp_port_list = add;
- up (&pp_port_list_lock);
-}
-
-static void pp_detach (struct parport *port)
-{
- struct pp_port_list_struct *del;
-
- down (&pp_port_list_lock);
- del = pp_port_list;
- if (del->port == port)
- pp_port_list = del->next;
- else {
- struct pp_port_list_struct *prev;
- do {
- prev = del;
- del = del->next;
- } while (del && del->port != port);
- if (del)
- prev->next = del->next;
- }
- up (&pp_port_list_lock);
-
- if (del)
- kfree (del);
-}
-
-static struct parport_driver ppdev_driver = {
- name: CHRDEV,
- attach: pp_attach,
- detach: pp_detach
-};
-
static inline void pp_enable_irq (struct pp_struct *pp)
{
struct parport *port = pp->pdev->port;
@@ -274,7 +217,7 @@ static void pp_irq (int irq, void * private, struct pt_regs * unused)
static int register_device (int minor, struct pp_struct *pp)
{
- struct pp_port_list_struct *ports;
+ struct parport *port;
struct pardevice * pdev = NULL;
char *name;
int fl;
@@ -285,23 +228,17 @@ static int register_device (int minor, struct pp_struct *pp)
sprintf (name, CHRDEV "%x", minor);
- down (&pp_port_list_lock);
- ports = pp_port_list;
- while (ports && ports->port->number != minor)
- ports = ports->next;
- if (ports->port) {
- fl = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0;
- pdev = parport_register_device (ports->port, name, NULL,
- NULL, pp_irq, fl, pp);
- }
- up (&pp_port_list_lock);
-
- if (!ports->port) {
+ port = parport_find_number (minor);
+ if (!port) {
printk (KERN_WARNING "%s: no associated port!\n", name);
kfree (name);
return -ENXIO;
}
+ fl = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0;
+ pdev = parport_register_device (port, name, NULL,
+ NULL, pp_irq, fl, pp);
+ parport_put_port (port);
if (!pdev) {
printk (KERN_WARNING "%s: failed to register device!\n", name);
@@ -595,6 +532,7 @@ static int pp_release (struct inode * inode, struct file * file)
unsigned int minor = MINOR (inode->i_rdev);
struct pp_struct *pp = file->private_data;
+ lock_kernel();
if (pp->pdev && pp->pdev->port->ieee1284.mode != IEEE1284_MODE_COMPAT) {
if (!(pp->flags & PP_CLAIMED)) {
parport_claim_or_block (pp->pdev);
@@ -620,6 +558,7 @@ static int pp_release (struct inode * inode, struct file * file)
printk (KERN_DEBUG CHRDEV "%x: unregistered pardevice\n",
minor);
}
+ unlock_kernel();
kfree (pp);
@@ -654,10 +593,6 @@ static devfs_handle_t devfs_handle = NULL;
static int __init ppdev_init (void)
{
- if (parport_register_driver (&ppdev_driver)) {
- printk (KERN_WARNING CHRDEV ": unable to register driver\n");
- return -EIO;
- }
if (devfs_register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) {
printk (KERN_WARNING CHRDEV ": unable to get major %d\n",
PP_MAJOR);
@@ -678,7 +613,6 @@ static void __exit ppdev_cleanup (void)
/* Clean up all parport stuff */
devfs_unregister (devfs_handle);
devfs_unregister_chrdev (PP_MAJOR, CHRDEV);
- parport_unregister_driver (&ppdev_driver);
}
module_init(ppdev_init);
diff --git a/drivers/char/qpmouse.c b/drivers/char/qpmouse.c
index 6fd5a3d65..4db93b1fb 100644
--- a/drivers/char/qpmouse.c
+++ b/drivers/char/qpmouse.c
@@ -36,6 +36,7 @@
#include <linux/random.h>
#include <linux/poll.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <asm/io.h>
#include <asm/uaccess.h>
@@ -141,6 +142,7 @@ static int release_qp(struct inode * inode, struct file * file)
{
unsigned char status;
+ lock_kernel();
fasync_qp(-1, file, 0);
if (!--qp_count) {
if (!poll_qp_status())
@@ -151,6 +153,7 @@ static int release_qp(struct inode * inode, struct file * file)
printk("Warning: Mouse device busy in release_qp()\n");
free_irq(QP_IRQ, NULL);
}
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index a3159c836..4b1281b50 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -14,6 +14,7 @@
#include <linux/blkdev.h>
#include <linux/raw.h>
#include <linux/capability.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#define dprintk(x...)
@@ -126,9 +127,11 @@ int raw_release(struct inode *inode, struct file *filp)
struct block_device *bdev;
minor = MINOR(inode->i_rdev);
+ lock_kernel();
bdev = raw_device_bindings[minor];
blkdev_put(bdev, BDEV_RAW);
raw_device_inuse[minor]--;
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/sbc60xxwdt.c b/drivers/char/sbc60xxwdt.c
index a0bea62c0..813594244 100644
--- a/drivers/char/sbc60xxwdt.c
+++ b/drivers/char/sbc60xxwdt.c
@@ -66,6 +66,7 @@
#include <linux/malloc.h>
#include <linux/ioport.h>
#include <linux/fcntl.h>
+#include <linux/smp_lock.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/system.h>
@@ -207,6 +208,7 @@ static int fop_open(struct inode * inode, struct file * file)
static int fop_close(struct inode * inode, struct file * file)
{
+ lock_kernel();
if(MINOR(inode->i_rdev) == WATCHDOG_MINOR)
{
if(wdt_expect_close)
@@ -217,6 +219,7 @@ static int fop_close(struct inode * inode, struct file * file)
}
}
wdt_is_open = 0;
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/softdog.c b/drivers/char/softdog.c
index a7620dda0..3d1c57907 100644
--- a/drivers/char/softdog.c
+++ b/drivers/char/softdog.c
@@ -37,6 +37,7 @@
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/reboot.h>
+#include <linux/smp_lock.h>
#include <linux/init.h>
#include <asm/uaccess.h>
@@ -79,7 +80,9 @@ static int softdog_open(struct inode *inode, struct file *file)
{
if(timer_alive)
return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
MOD_INC_USE_COUNT;
+#endif
/*
* Activate timer
*/
@@ -94,11 +97,12 @@ static int softdog_release(struct inode *inode, struct file *file)
* Shut off the timer.
* Lock it in if it's a module and we defined ...NOWAYOUT
*/
+ lock_kernel();
#ifndef CONFIG_WATCHDOG_NOWAYOUT
del_timer(&watchdog_ticktock);
- MOD_DEC_USE_COUNT;
#endif
timer_alive=0;
+ unlock_kernel();
return 0;
}
@@ -146,6 +150,7 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
static struct file_operations softdog_fops=
{
+ owner: THIS_MODULE,
write: softdog_write,
ioctl: softdog_ioctl,
open: softdog_open,
diff --git a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c
index 3ca976b6e..14a42682d 100644
--- a/drivers/char/tpqic02.c
+++ b/drivers/char/tpqic02.c
@@ -89,6 +89,7 @@
#include <linux/mm.h>
#include <linux/malloc.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>
#include <asm/dma.h>
@@ -2411,6 +2412,7 @@ static int qic02_tape_release(struct inode * inode, struct file * filp)
{
kdev_t dev = inode->i_rdev;
+ lock_kernel();
if (TP_DIAGS(dev))
{
printk("qic02_tape_release: dev=%s\n", kdevname(dev));
@@ -2437,6 +2439,7 @@ static int qic02_tape_release(struct inode * inode, struct file * filp)
(void) do_qic_cmd(QCMD_REWIND, TIM_R);
}
}
+ unlock_kernel();
return 0;
} /* qic02_tape_release */
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 60a5c41f5..816f385e1 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1430,7 +1430,9 @@ init_dev_done:
static int tty_release(struct inode * inode, struct file * filp)
{
+ lock_kernel();
release_dev(filp);
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/tvmixer.c b/drivers/char/tvmixer.c
index 0ef5bbd03..c3db65bae 100644
--- a/drivers/char/tvmixer.c
+++ b/drivers/char/tvmixer.c
@@ -7,6 +7,7 @@
#include <linux/errno.h>
#include <linux/malloc.h>
#include <linux/i2c.h>
+#include <linux/smp_lock.h>
#include <linux/videodev.h>
#include <asm/semaphore.h>
#include <linux/init.h>
@@ -220,13 +221,18 @@ static int tvmixer_open(struct inode *inode, struct file *file)
static int tvmixer_release(struct inode *inode, struct file *file)
{
struct TVMIXER *mix = file->private_data;
- struct i2c_client *client = mix->dev;
+ struct i2c_client *client;
- if (NULL == client)
+ lock_kernel();
+ client = mix->dev;
+ if (NULL == client) {
+ unlock_kernel();
return -ENODEV;
+ }
if (client->adapter->dec_use)
client->adapter->dec_use(client->adapter);
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/videodev.c b/drivers/char/videodev.c
index 5103433e1..3657cb518 100644
--- a/drivers/char/videodev.c
+++ b/drivers/char/videodev.c
@@ -21,6 +21,7 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/errno.h>
@@ -158,11 +159,9 @@ static int video_open(struct inode *inode, struct file *file)
if(vfl==NULL) {
char modname[20];
- MOD_INC_USE_COUNT;
sprintf (modname, "char-major-%d-%d", VIDEO_MAJOR, minor);
request_module(modname);
vfl=video_device[minor];
- MOD_DEC_USE_COUNT;
if (vfl==NULL)
return -ENODEV;
}
@@ -188,10 +187,13 @@ static int video_open(struct inode *inode, struct file *file)
static int video_release(struct inode *inode, struct file *file)
{
- struct video_device *vfl=video_device[MINOR(inode->i_rdev)];
+ struct video_device *vfl;
+ lock_kernel();
+ vfl=video_device[MINOR(inode->i_rdev)];
if(vfl->close)
vfl->close(vfl);
vfl->busy=0;
+ unlock_kernel();
return 0;
}
@@ -229,11 +231,15 @@ static int video_ioctl(struct inode *inode, struct file *file,
int video_mmap(struct file *file, struct vm_area_struct *vma)
{
+ int ret = -EINVAL;
struct video_device *vfl=video_device[MINOR(file->f_dentry->d_inode->i_rdev)];
- if(vfl->mmap)
- return vfl->mmap(vfl, (char *)vma->vm_start,
+ if(vfl->mmap) {
+ lock_kernel();
+ ret = vfl->mmap(vfl, (char *)vma->vm_start,
(unsigned long)(vma->vm_end-vma->vm_start));
- return -EINVAL;
+ unlock_kernel();
+ }
+ return ret;
}
/*
@@ -515,6 +521,7 @@ void video_unregister_device(struct video_device *vfd)
static struct file_operations video_fops=
{
+ owner: THIS_MODULE,
llseek: video_lseek,
read: video_read,
write: video_write,
diff --git a/drivers/char/wdt.c b/drivers/char/wdt.c
index 3ac86bf3a..bde40c589 100644
--- a/drivers/char/wdt.c
+++ b/drivers/char/wdt.c
@@ -35,6 +35,7 @@
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include "wd501p.h"
@@ -372,6 +373,7 @@ static int wdt_open(struct inode *inode, struct file *file)
static int wdt_release(struct inode *inode, struct file *file)
{
+ lock_kernel();
if(MINOR(inode->i_rdev)==WATCHDOG_MINOR)
{
#ifndef CONFIG_WATCHDOG_NOWAYOUT
@@ -380,6 +382,7 @@ static int wdt_release(struct inode *inode, struct file *file)
#endif
wdt_is_open=0;
}
+ unlock_kernel();
return 0;
}
diff --git a/drivers/char/wdt285.c b/drivers/char/wdt285.c
index 6efdd7f76..66633fd20 100644
--- a/drivers/char/wdt285.c
+++ b/drivers/char/wdt285.c
@@ -26,6 +26,7 @@
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/interrupt.h>
+#include <linux/smp_lock.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
@@ -74,7 +75,6 @@ static int watchdog_open(struct inode *inode, struct file *file)
{
if(timer_alive)
return -EBUSY;
- MOD_INC_USE_COUNT;
/*
* Ahead watchdog factor ten, Mr Sulu
*/
@@ -86,6 +86,7 @@ static int watchdog_open(struct inode *inode, struct file *file)
request_irq(IRQ_TIMER4, watchdog_fire, 0, "watchdog", NULL);
#else
*CSR_SA110_CNTL |= 1 << 13;
+ MOD_INC_USE_COUNT;
#endif
timer_alive = 1;
return 0;
@@ -94,9 +95,10 @@ static int watchdog_open(struct inode *inode, struct file *file)
static int watchdog_release(struct inode *inode, struct file *file)
{
#ifdef ONLY_TESTING
+ lock_kernel();
free_irq(IRQ_TIMER4, NULL);
timer_alive = 0;
- MOD_DEC_USE_COUNT;
+ unlock_kernel();
#else
/*
* It's irreversible!
@@ -153,6 +155,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *file,
static struct file_operations watchdog_fops=
{
+ owner: THIS_MODULE,
write: watchdog_write,
ioctl: watchdog_ioctl,
open: watchdog_open,
diff --git a/drivers/char/wdt977.c b/drivers/char/wdt977.c
index 9bfbf0cc6..fef6bc7fc 100644
--- a/drivers/char/wdt977.c
+++ b/drivers/char/wdt977.c
@@ -20,6 +20,7 @@
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <asm/io.h>
#include <asm/system.h>
@@ -38,7 +39,9 @@ static int wdt977_open(struct inode *inode, struct file *file)
{
if(timer_alive)
return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
MOD_INC_USE_COUNT;
+#endif
timer_alive++;
//max timeout value = 255 minutes (0xFF). Write 0 to disable WatchDog.
@@ -88,6 +91,7 @@ static int wdt977_release(struct inode *inode, struct file *file)
* Lock it in if it's a module and we defined ...NOWAYOUT
*/
#ifndef CONFIG_WATCHDOG_NOWAYOUT
+ lock_kernel();
// unlock the SuperIO chip
outb(0x87,0x370);
@@ -118,8 +122,8 @@ static int wdt977_release(struct inode *inode, struct file *file)
// lock the SuperIO chip
outb(0xAA,0x370);
- MOD_DEC_USE_COUNT;
timer_alive=0;
+ unlock_kernel();
printk(KERN_INFO "Watchdog: shutdown.\n");
#endif
@@ -162,6 +166,7 @@ static ssize_t wdt977_write(struct file *file, const char *data, size_t len, lof
static struct file_operations wdt977_fops=
{
+ owner: THIS_MODULE,
write: wdt977_write,
open: wdt977_open,
release: wdt977_release,
diff --git a/drivers/char/wdt_pci.c b/drivers/char/wdt_pci.c
index 2bd09930a..8e960841b 100644
--- a/drivers/char/wdt_pci.c
+++ b/drivers/char/wdt_pci.c
@@ -51,6 +51,7 @@
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <linux/pci.h>
@@ -358,7 +359,9 @@ static int wdtpci_open(struct inode *inode, struct file *file)
case WATCHDOG_MINOR:
if(wdt_is_open)
return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
MOD_INC_USE_COUNT;
+#endif
/*
* Activate
*/
@@ -391,7 +394,6 @@ static int wdtpci_open(struct inode *inode, struct file *file)
outb_p(0, WDT_DC); /* Enable */
return 0;
case TEMP_MINOR:
- MOD_INC_USE_COUNT;
return 0;
default:
return -ENODEV;
@@ -414,13 +416,14 @@ static int wdtpci_release(struct inode *inode, struct file *file)
{
if(MINOR(inode->i_rdev)==WATCHDOG_MINOR)
{
+ lock_kernel();
#ifndef CONFIG_WATCHDOG_NOWAYOUT
inb_p(WDT_DC); /* Disable counters */
wdtpci_ctr_load(2,0); /* 0 length reset pulses now */
#endif
wdt_is_open=0;
+ unlock_kernel();
}
- MOD_DEC_USE_COUNT;
return 0;
}
@@ -454,6 +457,7 @@ static int wdtpci_notify_sys(struct notifier_block *this, unsigned long code,
static struct file_operations wdtpci_fops = {
+ owner: THIS_MODULE,
llseek: wdtpci_llseek,
read: wdtpci_read,
write: wdtpci_write,