diff options
Diffstat (limited to 'drivers/sbus')
-rw-r--r-- | drivers/sbus/char/bpp.c | 3 | ||||
-rw-r--r-- | drivers/sbus/char/cpwatchdog.c | 4 | ||||
-rw-r--r-- | drivers/sbus/char/display7seg.c | 1 | ||||
-rw-r--r-- | drivers/sbus/char/envctrl.c | 2 | ||||
-rw-r--r-- | drivers/sbus/char/flash.c | 6 | ||||
-rw-r--r-- | drivers/sbus/char/jsflash.c | 13 | ||||
-rw-r--r-- | drivers/sbus/char/openprom.c | 3 | ||||
-rw-r--r-- | drivers/sbus/char/riowatchdog.c | 2 | ||||
-rw-r--r-- | drivers/sbus/char/rtc.c | 3 | ||||
-rw-r--r-- | drivers/sbus/char/uctrl.c | 19 | ||||
-rw-r--r-- | drivers/sbus/char/vfc.h | 4 | ||||
-rw-r--r-- | drivers/sbus/char/vfc_dev.c | 44 | ||||
-rw-r--r-- | drivers/sbus/char/vfc_i2c.c | 12 | ||||
-rw-r--r-- | drivers/sbus/dvma.c | 2 | ||||
-rw-r--r-- | drivers/sbus/sbus.c | 6 |
15 files changed, 77 insertions, 47 deletions
diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c index 03c96605947..bba21e053a1 100644 --- a/drivers/sbus/char/bpp.c +++ b/drivers/sbus/char/bpp.c @@ -19,6 +19,7 @@ #include <linux/timer.h> #include <linux/ioport.h> #include <linux/major.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include <asm/io.h> @@ -429,6 +430,7 @@ static int bpp_open(struct inode *inode, struct file *f) unsigned minor = iminor(inode); int ret; + lock_kernel(); spin_lock(&bpp_open_lock); ret = 0; if (minor >= BPP_NO) { @@ -444,6 +446,7 @@ static int bpp_open(struct inode *inode, struct file *f) } } spin_unlock(&bpp_open_lock); + unlock_kernel(); return ret; } diff --git a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c index 23570341437..23abfdfb44f 100644 --- a/drivers/sbus/char/cpwatchdog.c +++ b/drivers/sbus/char/cpwatchdog.c @@ -279,6 +279,7 @@ static inline int wd_opt_timeout(void) static int wd_open(struct inode *inode, struct file *f) { + lock_kernel(); switch(iminor(inode)) { case WD0_MINOR: @@ -291,6 +292,7 @@ static int wd_open(struct inode *inode, struct file *f) f->private_data = &wd_dev.watchdog[WD2_ID]; break; default: + unlock_kernel(); return(-ENODEV); } @@ -304,11 +306,13 @@ static int wd_open(struct inode *inode, struct file *f) (void *)wd_dev.regs)) { printk("%s: Cannot register IRQ %d\n", WD_OBPNAME, wd_dev.irq); + unlock_kernel(); return(-EBUSY); } wd_dev.initialized = 1; } + unlock_kernel(); return(nonseekable_open(inode, f)); } diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index 3279a1b6501..d8f5c0ca236 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c @@ -94,6 +94,7 @@ static int d7s_open(struct inode *inode, struct file *f) { if (D7S_MINOR != iminor(inode)) return -ENODEV; + cycle_kernel_lock(); atomic_inc(&d7s_users); return 0; } diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c index dadabef116b..a408402426f 100644 --- a/drivers/sbus/char/envctrl.c +++ b/drivers/sbus/char/envctrl.c @@ -27,6 +27,7 @@ #include <linux/miscdevice.h> #include <linux/kmod.h> #include <linux/reboot.h> +#include <linux/smp_lock.h> #include <asm/ebus.h> #include <asm/uaccess.h> @@ -694,6 +695,7 @@ envctrl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static int envctrl_open(struct inode *inode, struct file *file) { + cycle_kernel_lock(); file->private_data = NULL; return 0; } diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c index 44e039865aa..7d95e151513 100644 --- a/drivers/sbus/char/flash.c +++ b/drivers/sbus/char/flash.c @@ -127,9 +127,13 @@ flash_read(struct file * file, char __user * buf, static int flash_open(struct inode *inode, struct file *file) { - if (test_and_set_bit(0, (void *)&flash.busy) != 0) + lock_kernel(); + if (test_and_set_bit(0, (void *)&flash.busy) != 0) { + unlock_kernel(); return -EBUSY; + } + unlock_kernel(); return 0; } diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c index 4b7079fdc10..2bec9ccc029 100644 --- a/drivers/sbus/char/jsflash.c +++ b/drivers/sbus/char/jsflash.c @@ -27,6 +27,7 @@ */ #include <linux/module.h> +#include <linux/smp_lock.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/miscdevice.h> @@ -417,11 +418,17 @@ static int jsf_mmap(struct file * file, struct vm_area_struct * vma) static int jsf_open(struct inode * inode, struct file * filp) { - - if (jsf0.base == 0) return -ENXIO; - if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) + lock_kernel(); + if (jsf0.base == 0) { + unlock_kernel(); + return -ENXIO; + } + if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) { + unlock_kernel(); return -EBUSY; + } + unlock_kernel(); return 0; /* XXX What security? */ } diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index fbfeb89a6f3..29dc735e1a2 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c @@ -33,6 +33,7 @@ #include <linux/kernel.h> #include <linux/errno.h> #include <linux/slab.h> +#include <linux/smp_lock.h> #include <linux/string.h> #include <linux/miscdevice.h> #include <linux/init.h> @@ -689,9 +690,11 @@ static int openprom_open(struct inode * inode, struct file * file) if (!data) return -ENOMEM; + lock_kernel(); data->current_node = of_find_node_by_path("/"); data->lastnode = data->current_node; file->private_data = (void *) data; + unlock_kernel(); return 0; } diff --git a/drivers/sbus/char/riowatchdog.c b/drivers/sbus/char/riowatchdog.c index a2fc6b8c133..88c0fc6395e 100644 --- a/drivers/sbus/char/riowatchdog.c +++ b/drivers/sbus/char/riowatchdog.c @@ -11,6 +11,7 @@ #include <linux/errno.h> #include <linux/init.h> #include <linux/miscdevice.h> +#include <linux/smp_lock.h> #include <asm/io.h> #include <asm/ebus.h> @@ -116,6 +117,7 @@ static void riowd_starttimer(void) static int riowd_open(struct inode *inode, struct file *filp) { + cycle_kernel_lock(); nonseekable_open(inode, filp); return 0; } diff --git a/drivers/sbus/char/rtc.c b/drivers/sbus/char/rtc.c index 18d18f1a114..b0429917154 100644 --- a/drivers/sbus/char/rtc.c +++ b/drivers/sbus/char/rtc.c @@ -12,6 +12,7 @@ */ #include <linux/module.h> +#include <linux/smp_lock.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/miscdevice.h> @@ -213,6 +214,7 @@ static int rtc_open(struct inode *inode, struct file *file) { int ret; + lock_kernel(); spin_lock_irq(&mostek_lock); if (rtc_busy) { ret = -EBUSY; @@ -221,6 +223,7 @@ static int rtc_open(struct inode *inode, struct file *file) ret = 0; } spin_unlock_irq(&mostek_lock); + unlock_kernel(); return ret; } diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c index 383f32c1d34..777637594ac 100644 --- a/drivers/sbus/char/uctrl.c +++ b/drivers/sbus/char/uctrl.c @@ -9,6 +9,7 @@ #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/slab.h> +#include <linux/smp_lock.h> #include <linux/ioport.h> #include <linux/init.h> #include <linux/miscdevice.h> @@ -194,8 +195,8 @@ struct uctrl_driver { static struct uctrl_driver drv; -void uctrl_get_event_status(void); -void uctrl_get_external_status(void); +static void uctrl_get_event_status(void); +static void uctrl_get_external_status(void); static int uctrl_ioctl(struct inode *inode, struct file *file, @@ -211,8 +212,10 @@ uctrl_ioctl(struct inode *inode, struct file *file, static int uctrl_open(struct inode *inode, struct file *file) { + lock_kernel(); uctrl_get_event_status(); uctrl_get_external_status(); + unlock_kernel(); return 0; } @@ -263,12 +266,6 @@ static struct miscdevice uctrl_dev = { driver->regs->uctrl_stat = UCTRL_STAT_RXNE_STA; \ } -void uctrl_set_video(int status) -{ - struct uctrl_driver *driver = &drv; - -} - static void uctrl_do_txn(struct uctrl_txn *txn) { struct uctrl_driver *driver = &drv; @@ -308,7 +305,7 @@ static void uctrl_do_txn(struct uctrl_txn *txn) } } -void uctrl_get_event_status(void) +static void uctrl_get_event_status(void) { struct uctrl_driver *driver = &drv; struct uctrl_txn txn; @@ -328,7 +325,7 @@ void uctrl_get_event_status(void) dprintk(("ev is %x\n", driver->status.event_status)); } -void uctrl_get_external_status(void) +static void uctrl_get_external_status(void) { struct uctrl_driver *driver = &drv; struct uctrl_txn txn; @@ -360,7 +357,7 @@ void uctrl_get_external_status(void) static int __init ts102_uctrl_init(void) { struct uctrl_driver *driver = &drv; - int len, i; + int len; struct linux_prom_irqs tmp_irq[2]; unsigned int vaddr[2] = { 0, 0 }; int tmpnode, uctrlnode = prom_getchild(prom_root_node); diff --git a/drivers/sbus/char/vfc.h b/drivers/sbus/char/vfc.h index f1aa1389ea4..a5240c52aa0 100644 --- a/drivers/sbus/char/vfc.h +++ b/drivers/sbus/char/vfc.h @@ -133,8 +133,6 @@ struct vfc_dev { unsigned char saa9051_state_array[VFC_SAA9051_NR]; }; -extern struct vfc_dev **vfc_dev_lst; - void captstat_reset(struct vfc_dev *); void memptr_reset(struct vfc_dev *); @@ -145,8 +143,6 @@ int vfc_i2c_sendbuf(struct vfc_dev *, unsigned char, char *, int) ; int vfc_i2c_recvbuf(struct vfc_dev *, unsigned char, char *, int) ; int vfc_i2c_reset_bus(struct vfc_dev *); int vfc_init_i2c_bus(struct vfc_dev *); -void vfc_lock_device(struct vfc_dev *); -void vfc_unlock_device(struct vfc_dev *); #define VFC_CONTROL_DIAGMODE 0x10000000 #define VFC_CONTROL_MEMPTR 0x20000000 diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c index d4f8fcded51..25181bb7d62 100644 --- a/drivers/sbus/char/vfc_dev.c +++ b/drivers/sbus/char/vfc_dev.c @@ -24,6 +24,7 @@ #include <linux/spinlock.h> #include <linux/mutex.h> #include <linux/mm.h> +#include <linux/smp_lock.h> #include <asm/openprom.h> #include <asm/oplib.h> @@ -44,7 +45,7 @@ #include <asm/vfc_ioctls.h> static const struct file_operations vfc_fops; -struct vfc_dev **vfc_dev_lst; +static struct vfc_dev **vfc_dev_lst; static char vfcstr[]="vfc"; static unsigned char saa9051_init_array[VFC_SAA9051_NR] = { 0x00, 0x64, 0x72, 0x52, @@ -53,18 +54,18 @@ static unsigned char saa9051_init_array[VFC_SAA9051_NR] = { 0x3e }; -void vfc_lock_device(struct vfc_dev *dev) +static void vfc_lock_device(struct vfc_dev *dev) { mutex_lock(&dev->device_lock_mtx); } -void vfc_unlock_device(struct vfc_dev *dev) +static void vfc_unlock_device(struct vfc_dev *dev) { mutex_unlock(&dev->device_lock_mtx); } -void vfc_captstat_reset(struct vfc_dev *dev) +static void vfc_captstat_reset(struct vfc_dev *dev) { dev->control_reg |= VFC_CONTROL_CAPTRESET; sbus_writel(dev->control_reg, &dev->regs->control); @@ -74,7 +75,7 @@ void vfc_captstat_reset(struct vfc_dev *dev) sbus_writel(dev->control_reg, &dev->regs->control); } -void vfc_memptr_reset(struct vfc_dev *dev) +static void vfc_memptr_reset(struct vfc_dev *dev) { dev->control_reg |= VFC_CONTROL_MEMPTR; sbus_writel(dev->control_reg, &dev->regs->control); @@ -84,7 +85,7 @@ void vfc_memptr_reset(struct vfc_dev *dev) sbus_writel(dev->control_reg, &dev->regs->control); } -int vfc_csr_init(struct vfc_dev *dev) +static int vfc_csr_init(struct vfc_dev *dev) { dev->control_reg = 0x80000000; sbus_writel(dev->control_reg, &dev->regs->control); @@ -106,7 +107,7 @@ int vfc_csr_init(struct vfc_dev *dev) return 0; } -int vfc_saa9051_init(struct vfc_dev *dev) +static int vfc_saa9051_init(struct vfc_dev *dev) { int i; @@ -118,7 +119,7 @@ int vfc_saa9051_init(struct vfc_dev *dev) return 0; } -int init_vfc_hw(struct vfc_dev *dev) +static int init_vfc_hw(struct vfc_dev *dev) { vfc_lock_device(dev); vfc_csr_init(dev); @@ -131,7 +132,7 @@ int init_vfc_hw(struct vfc_dev *dev) return 0; } -int init_vfc_devstruct(struct vfc_dev *dev, int instance) +static int init_vfc_devstruct(struct vfc_dev *dev, int instance) { dev->instance=instance; mutex_init(&dev->device_lock_mtx); @@ -140,7 +141,8 @@ int init_vfc_devstruct(struct vfc_dev *dev, int instance) return 0; } -int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance) +static int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, + int instance) { if(dev == NULL) { printk(KERN_ERR "VFC: Bogus pointer passed\n"); @@ -167,7 +169,7 @@ int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance) } -struct vfc_dev *vfc_get_dev_ptr(int instance) +static struct vfc_dev *vfc_get_dev_ptr(int instance) { return vfc_dev_lst[instance]; } @@ -178,14 +180,17 @@ static int vfc_open(struct inode *inode, struct file *file) { struct vfc_dev *dev; + lock_kernel(); spin_lock(&vfc_dev_lock); dev = vfc_get_dev_ptr(iminor(inode)); if (dev == NULL) { spin_unlock(&vfc_dev_lock); + unlock_kernel(); return -ENODEV; } if (dev->busy) { spin_unlock(&vfc_dev_lock); + unlock_kernel(); return -EBUSY; } @@ -202,6 +207,7 @@ static int vfc_open(struct inode *inode, struct file *file) vfc_captstat_reset(dev); vfc_unlock_device(dev); + unlock_kernel(); return 0; } @@ -287,7 +293,7 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, void __user *argp) return 0; } -int vfc_capture_start(struct vfc_dev *dev) +static int vfc_capture_start(struct vfc_dev *dev) { vfc_captstat_reset(dev); dev->control_reg = sbus_readl(&dev->regs->control); @@ -309,7 +315,7 @@ int vfc_capture_start(struct vfc_dev *dev) return 0; } -int vfc_capture_poll(struct vfc_dev *dev) +static int vfc_capture_poll(struct vfc_dev *dev) { int timeout = 1000; @@ -385,8 +391,8 @@ static int vfc_set_control_ioctl(struct inode *inode, struct file *file, } -int vfc_port_change_ioctl(struct inode *inode, struct file *file, - struct vfc_dev *dev, unsigned long arg) +static int vfc_port_change_ioctl(struct inode *inode, struct file *file, + struct vfc_dev *dev, unsigned long arg) { int ret = 0; int cmd; @@ -455,8 +461,8 @@ int vfc_port_change_ioctl(struct inode *inode, struct file *file, return ret; } -int vfc_set_video_ioctl(struct inode *inode, struct file *file, - struct vfc_dev *dev, unsigned long arg) +static int vfc_set_video_ioctl(struct inode *inode, struct file *file, + struct vfc_dev *dev, unsigned long arg) { int ret = 0; int cmd; @@ -506,8 +512,8 @@ int vfc_set_video_ioctl(struct inode *inode, struct file *file, return ret; } -int vfc_get_video_ioctl(struct inode *inode, struct file *file, - struct vfc_dev *dev, unsigned long arg) +static int vfc_get_video_ioctl(struct inode *inode, struct file *file, + struct vfc_dev *dev, unsigned long arg) { int ret = 0; unsigned int status = NO_LOCK; diff --git a/drivers/sbus/char/vfc_i2c.c b/drivers/sbus/char/vfc_i2c.c index 9efed771f6c..32b986e0ed7 100644 --- a/drivers/sbus/char/vfc_i2c.c +++ b/drivers/sbus/char/vfc_i2c.c @@ -114,7 +114,7 @@ int vfc_i2c_reset_bus(struct vfc_dev *dev) return 0; } -int vfc_i2c_wait_for_bus(struct vfc_dev *dev) +static int vfc_i2c_wait_for_bus(struct vfc_dev *dev) { int timeout = 1000; @@ -126,7 +126,7 @@ int vfc_i2c_wait_for_bus(struct vfc_dev *dev) return 0; } -int vfc_i2c_wait_for_pin(struct vfc_dev *dev, int ack) +static int vfc_i2c_wait_for_pin(struct vfc_dev *dev, int ack) { int timeout = 1000; int s1; @@ -144,7 +144,8 @@ int vfc_i2c_wait_for_pin(struct vfc_dev *dev, int ack) } #define SHIFT(a) ((a) << 24) -int vfc_i2c_xmit_addr(struct vfc_dev *dev, unsigned char addr, char mode) +static int vfc_i2c_xmit_addr(struct vfc_dev *dev, unsigned char addr, + char mode) { int ret, raddr; #if 1 @@ -195,7 +196,7 @@ int vfc_i2c_xmit_addr(struct vfc_dev *dev, unsigned char addr, char mode) return 0; } -int vfc_i2c_xmit_byte(struct vfc_dev *dev,unsigned char *byte) +static int vfc_i2c_xmit_byte(struct vfc_dev *dev,unsigned char *byte) { int ret; u32 val = SHIFT((unsigned int)*byte); @@ -218,7 +219,8 @@ int vfc_i2c_xmit_byte(struct vfc_dev *dev,unsigned char *byte) return ret; } -int vfc_i2c_recv_byte(struct vfc_dev *dev, unsigned char *byte, int last) +static int vfc_i2c_recv_byte(struct vfc_dev *dev, unsigned char *byte, + int last) { int ret; diff --git a/drivers/sbus/dvma.c b/drivers/sbus/dvma.c index 57e1526746a..ab0d2de3324 100644 --- a/drivers/sbus/dvma.c +++ b/drivers/sbus/dvma.c @@ -16,7 +16,7 @@ struct sbus_dma *dma_chain; -void __init init_one_dvma(struct sbus_dma *dma, int num_dma) +static void __init init_one_dvma(struct sbus_dma *dma, int num_dma) { printk("dma%d: ", num_dma); diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c index c37d7c2587f..73a86d09bba 100644 --- a/drivers/sbus/sbus.c +++ b/drivers/sbus/sbus.c @@ -78,7 +78,7 @@ static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sde else sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev; sdev->ofdev.dev.bus = &sbus_bus_type; - sprintf(sdev->ofdev.dev.bus_id, "sbus[%08x]", dp->node); + dev_set_name(&sdev->ofdev.dev, "sbus[%08x]", dp->node); if (of_device_register(&sdev->ofdev) != 0) printk(KERN_DEBUG "sbus: device registration error for %s!\n", @@ -257,11 +257,11 @@ static void __init build_one_sbus(struct device_node *dp, int num_sbus) sbus->ofdev.node = dp; sbus->ofdev.dev.parent = NULL; sbus->ofdev.dev.bus = &sbus_bus_type; - sprintf(sbus->ofdev.dev.bus_id, "sbus%d", num_sbus); + dev_set_name(&sbus->ofdev.dev, "sbus%d", num_sbus); if (of_device_register(&sbus->ofdev) != 0) printk(KERN_DEBUG "sbus: device registration error for %s!\n", - sbus->ofdev.dev.bus_id); + dev_name(&sbus->ofdev.dev)); dev_dp = dp->child; while (dev_dp) { |