summaryrefslogtreecommitdiff
path: root/arch/cris/arch-v10
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-15 09:10:18 -0600
committerJonathan Corbet <corbet@lwn.net>2008-05-18 15:43:40 -0600
commit0c401df37ef9f45f35390a5574e24cbf3f916acf (patch)
tree653b41d514cee2c55565a5b560a5d8238d55e39b /arch/cris/arch-v10
parent75bd2ef1457998791cfc89cd59927574488fc22a (diff)
cris: cdev lock_kernel() pushdown
Push the cdev lock_kernel() call into cris drivers. Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'arch/cris/arch-v10')
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c3
-rw-r--r--arch/cris/arch-v10/drivers/sync_serial.c34
2 files changed, 24 insertions, 13 deletions
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index 68a998bd1069..86048e697eb5 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -16,6 +16,7 @@
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/fs.h>
+#include <linux/smp_lock.h>
#include <linux/string.h>
#include <linux/poll.h>
#include <linux/init.h>
@@ -323,6 +324,7 @@ gpio_open(struct inode *inode, struct file *filp)
if (!priv)
return -ENOMEM;
+ lock_kernel();
priv->minor = p;
/* initialize the io/alarm struct */
@@ -357,6 +359,7 @@ gpio_open(struct inode *inode, struct file *filp)
alarmlist = priv;
spin_unlock_irqrestore(&gpio_lock, flags);
+ unlock_kernel();
return 0;
}
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c
index 069546e342c5..91fea623c7c9 100644
--- a/arch/cris/arch-v10/drivers/sync_serial.c
+++ b/arch/cris/arch-v10/drivers/sync_serial.c
@@ -21,6 +21,7 @@
#include <linux/interrupt.h>
#include <linux/poll.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <linux/timer.h>
#include <asm/irq.h>
#include <asm/dma.h>
@@ -443,18 +444,21 @@ static int sync_serial_open(struct inode *inode, struct file *file)
int dev = MINOR(inode->i_rdev);
struct sync_port *port;
int mode;
+ int err = -EBUSY;
+ lock_kernel();
DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev));
if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) {
DEBUG(printk(KERN_DEBUG "Invalid minor %d\n", dev));
- return -ENODEV;
+ err = -ENODEV;
+ goto out;
}
port = &ports[dev];
/* Allow open this device twice (assuming one reader and one writer) */
if (port->busy == 2) {
DEBUG(printk(KERN_DEBUG "Device is busy.. \n"));
- return -EBUSY;
+ goto out;
}
if (port->init_irqs) {
if (port->use_dma) {
@@ -465,14 +469,14 @@ static int sync_serial_open(struct inode *inode, struct file *file)
&ports[0])) {
printk(KERN_CRIT "Can't alloc "
"sync serial port 1 IRQ");
- return -EBUSY;
+ goto out;
} else if (request_irq(25, rx_interrupt, 0,
"synchronous serial 1 dma rx",
&ports[0])) {
free_irq(24, &port[0]);
printk(KERN_CRIT "Can't alloc "
"sync serial port 1 IRQ");
- return -EBUSY;
+ goto out;
} else if (cris_request_dma(8,
"synchronous serial 1 dma tr",
DMA_VERBOSE_ON_ERROR,
@@ -482,7 +486,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
printk(KERN_CRIT "Can't alloc "
"sync serial port 1 "
"TX DMA channel");
- return -EBUSY;
+ goto out;
} else if (cris_request_dma(9,
"synchronous serial 1 dma rec",
DMA_VERBOSE_ON_ERROR,
@@ -493,7 +497,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
printk(KERN_CRIT "Can't alloc "
"sync serial port 1 "
"RX DMA channel");
- return -EBUSY;
+ goto out;
}
#endif
RESET_DMA(8); WAIT_DMA(8);
@@ -520,14 +524,14 @@ static int sync_serial_open(struct inode *inode, struct file *file)
&ports[1])) {
printk(KERN_CRIT "Can't alloc "
"sync serial port 3 IRQ");
- return -EBUSY;
+ goto out;
} else if (request_irq(21, rx_interrupt, 0,
"synchronous serial 3 dma rx",
&ports[1])) {
free_irq(20, &ports[1]);
printk(KERN_CRIT "Can't alloc "
"sync serial port 3 IRQ");
- return -EBUSY;
+ goto out;
} else if (cris_request_dma(4,
"synchronous serial 3 dma tr",
DMA_VERBOSE_ON_ERROR,
@@ -537,7 +541,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
printk(KERN_CRIT "Can't alloc "
"sync serial port 3 "
"TX DMA channel");
- return -EBUSY;
+ goto out;
} else if (cris_request_dma(5,
"synchronous serial 3 dma rec",
DMA_VERBOSE_ON_ERROR,
@@ -548,7 +552,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
printk(KERN_CRIT "Can't alloc "
"sync serial port 3 "
"RX DMA channel");
- return -EBUSY;
+ goto out;
}
#endif
RESET_DMA(4); WAIT_DMA(4);
@@ -581,7 +585,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
&ports[0])) {
printk(KERN_CRIT "Can't alloc "
"sync serial manual irq");
- return -EBUSY;
+ goto out;
}
} else if (port == &ports[1]) {
if (request_irq(8,
@@ -591,7 +595,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
&ports[1])) {
printk(KERN_CRIT "Can't alloc "
"sync serial manual irq");
- return -EBUSY;
+ goto out;
}
}
port->init_irqs = 0;
@@ -620,7 +624,11 @@ static int sync_serial_open(struct inode *inode, struct file *file)
*R_IRQ_MASK1_SET = 1 << port->data_avail_bit;
DEBUG(printk(KERN_DEBUG "sser%d rec started\n", dev));
}
- return 0;
+ ret = 0;
+
+out:
+ unlock_kernel();
+ return ret;
}
static int sync_serial_release(struct inode *inode, struct file *file)