#include <linux/fs.h>
#include <linux/init.h>
#include <linux/delay.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include "i2c.h"
* orig 1: relative from current position
* orig 2: position from last eeprom address
*/
-
+ loff_t ret;
+
+ lock_kernel();
switch (orig)
{
case 0:
- file->f_pos = offset;
+ ret = file->f_pos = offset;
break;
case 1:
- file->f_pos += offset;
+ ret = file->f_pos += offset;
break;
case 2:
- file->f_pos = eeprom.size - offset;
+ ret = file->f_pos = eeprom.size - offset;
break;
default:
- return -EINVAL;
+ ret = -EINVAL;
}
/* truncate position */
if (file->f_pos < 0)
{
file->f_pos = 0;
- return(-EOVERFLOW);
+ unlock_kernel();
+ ret = -EOVERFLOW;
}
if (file->f_pos >= eeprom.size)
{
file->f_pos = eeprom.size - 1;
- return(-EOVERFLOW);
+ ret = -EOVERFLOW;
}
- return ( file->f_pos );
+ return ( ret );
}
/* Reads data from eeprom. */
#include <linux/poll.h>
#include <linux/smp.h>
#include <linux/major.h>
+#include <linux/smp_lock.h>
#include <asm/processor.h>
#include <asm/msr.h>
static loff_t cpuid_seek(struct file *file, loff_t offset, int orig)
{
+ loff_t ret;
+
+ lock_kernel();
+
switch (orig) {
case 0:
file->f_pos = offset;
- return file->f_pos;
+ ret = file->f_pos;
+ break;
case 1:
file->f_pos += offset;
- return file->f_pos;
+ ret = file->f_pos;
default:
- return -EINVAL; /* SEEK_END not supported */
+ ret = -EINVAL;
}
+
+ unlock_kernel();
+ return ret;
}
static ssize_t cpuid_read(struct file * file, char * buf,
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/smp.h>
+#include <linux/smp_lock.h>
#include <linux/major.h>
#include <asm/processor.h>
static loff_t msr_seek(struct file *file, loff_t offset, int orig)
{
+ loff_t ret = -EINVAL;
+ lock_kernel();
switch (orig) {
case 0:
file->f_pos = offset;
- return file->f_pos;
+ ret = file->f_pos;
+ break;
case 1:
file->f_pos += offset;
- return file->f_pos;
- default:
- return -EINVAL; /* SEEK_END not supported */
+ ret = file->f_pos;
}
+ unlock_kernel();
+ return ret;
}
static ssize_t msr_read(struct file * file, char * buf,
#include <linux/sysctl.h>
#include <linux/ctype.h>
#include <linux/threads.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/bitops.h>
static long long
ppc_htab_lseek(struct file * file, loff_t offset, int orig)
{
+ long long ret = -EINVAL;
+
+ lock_kernel();
switch (orig) {
case 0:
file->f_pos = offset;
- return(file->f_pos);
+ ret = file->f_pos;
+ break;
case 1:
file->f_pos += offset;
- return(file->f_pos);
- case 2:
- return(-EINVAL);
- default:
- return(-EINVAL);
+ ret = file->f_pos;
}
+ unlock_kernel();
+ return ret;
}
int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
#include <linux/raw.h>
#include <linux/tty.h>
#include <linux/capability.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/io.h>
*/
static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
{
+ int ret;
+
+ lock_kernel();
switch (orig) {
case 0:
file->f_pos = offset;
- return file->f_pos;
+ ret = file->f_pos;
+ break;
case 1:
file->f_pos += offset;
- return file->f_pos;
+ ret = file->f_pos;
+ break;
default:
- return -EINVAL;
+ ret = -EINVAL;
}
+ unlock_kernel();
+ return ret;
}
static int open_port(struct inode * inode, struct file * filp)
static long long nvram_llseek(struct file *file,loff_t offset, int origin )
{
+ lock_kernel();
switch( origin ) {
case 0:
/* nothing to do */
offset += NVRAM_BYTES;
break;
}
+ unlock_kernel();
return( (offset >= 0) ? (file->f_pos = offset) : -EINVAL );
}
#include <linux/spinlock.h>
#include <linux/rwsem.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <asm/hardware/dec21285.h>
#include <asm/io.h>
*/
static long long flash_llseek(struct file *file, long long offset, int orig)
{
+ long long ret;
+
+ lock_kernel();
if (flashdebug)
printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n",
(unsigned int) offset, orig);
switch (orig) {
case 0:
- if (offset < 0)
- return -EINVAL;
+ if (offset < 0) {
+ ret = -EINVAL;
+ break;
+ }
- if ((unsigned int) offset > gbFlashSize)
- return -EINVAL;
+ if ((unsigned int) offset > gbFlashSize) {
+ ret = -EINVAL;
+ break;
+ }
file->f_pos = (unsigned int) offset;
- return file->f_pos;
+ ret = file->f_pos;
+ break;
case 1:
- if ((file->f_pos + offset) > gbFlashSize)
- return -EINVAL;
- if ((file->f_pos + offset) < 0)
- return -EINVAL;
+ if ((file->f_pos + offset) > gbFlashSize) {
+ ret = -EINVAL;
+ break;
+ }
+ if ((file->f_pos + offset) < 0) {
+ ret = -EINVAL;
+ break;
+ }
file->f_pos += offset;
- return file->f_pos;
+ ret = file->f_pos;
+ break;
default:
- return -EINVAL;
+ ret = -EINVAL;
}
+ unlock_kernel();
+ return ret;
}
#include <linux/selection.h>
#include <linux/kbd_kern.h>
#include <linux/console.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
{
- int size = vcs_size(file->f_dentry->d_inode);
+ int size;
+ lock_kernel();
+ size = vcs_size(file->f_dentry->d_inode);
switch (orig) {
default:
+ unlock_kernel();
return -EINVAL;
case 2:
offset += size;
case 0:
break;
}
- if (offset < 0 || offset > size)
+ if (offset < 0 || offset > size) {
+ unlock_kernel();
return -EINVAL;
+ }
file->f_pos = offset;
+ unlock_kernel();
return file->f_pos;
}
#include <linux/pci.h>
#include <linux/fs.h>
#include <linux/poll.h>
+#include <linux/smp_lock.h>
#include <asm/byteorder.h>
#include <asm/atomic.h>
#include <asm/io.h>
loff_t mem_llseek(struct file *file, loff_t offs, int orig)
{
- loff_t newoffs;
+ loff_t newoffs = -1;
+ lock_kernel();
switch (orig) {
case 0:
newoffs = offs;
break;
case 2:
newoffs = PCILYNX_MAX_MEMORY + 1 + offs;
- break;
- default:
- return -EINVAL;
}
- if (newoffs < 0 || newoffs > PCILYNX_MAX_MEMORY + 1) return -EINVAL;
+ if (newoffs < 0 || newoffs > PCILYNX_MAX_MEMORY + 1) {
+ lock_kernel();
+ return -EINVAL;
+ }
file->f_pos = newoffs;
return newoffs;
#include <linux/fcntl.h>
#include <linux/nvram.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/nvram.h>
static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
{
+ lock_kernel();
switch (origin) {
case 1:
offset += file->f_pos;
offset += NVRAM_SIZE;
break;
}
- if (offset < 0)
+ if (offset < 0) {
+ unlock_kernel();
return -EINVAL;
+ }
file->f_pos = offset;
+ unlock_kernel();
return file->f_pos;
}
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mtd/mtd.h>
+#include <linux/smp_lock.h>
#include <linux/slab.h>
#ifdef CONFIG_DEVFS_FS
{
struct mtd_info *mtd=(struct mtd_info *)file->private_data;
+ lock_kernel();
switch (orig) {
case 0:
/* SEEK_SET */
file->f_pos =mtd->size + offset;
break;
default:
+ unlock_kernel();
return -EINVAL;
}
else if (file->f_pos >= mtd->size)
file->f_pos = mtd->size - 1;
+ unlock_kernel();
return file->f_pos;
}
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/seq_file.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>
static loff_t
proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
{
- loff_t new;
+ loff_t new = -1;
+ lock_kernel();
switch (whence) {
case 0:
new = off;
case 2:
new = PCI_CFG_SPACE_SIZE + off;
break;
- default:
- return -EINVAL;
}
+ unlock_kernel();
if (new < 0 || new > PCI_CFG_SPACE_SIZE)
return -EINVAL;
return (file->f_pos = new);
static loff_t isapnp_info_entry_lseek(struct file *file, loff_t offset, int orig)
{
+ loff_t ret;
+
+ lock_kernel();
+
switch (orig) {
case 0: /* SEEK_SET */
file->f_pos = offset;
- return file->f_pos;
+ ret = file->f_pos;
+ break;
case 1: /* SEEK_CUR */
file->f_pos += offset;
- return file->f_pos;
+ ret = file->f_pos;
+ break;
case 2: /* SEEK_END */
default:
- return -EINVAL;
+ ret = -EINVAL;
}
- return -ENXIO;
+
+ unlock_kernel();
+ return ret;
}
static ssize_t isapnp_info_entry_read(struct file *file, char *buffer,
static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence)
{
- loff_t new;
-
+ loff_t new = -1;
+
+ lock_kernel();
switch (whence) {
case 0:
new = off;
case 2:
new = 256 + off;
break;
- default:
- return -EINVAL;
}
- if (new < 0 || new > 256)
+ if (new < 0 || new > 256) {
+ unlock_kernel();
return -EINVAL;
+ }
+ unlock_kernel();
return (file->f_pos = new);
}
static long long
flash_llseek(struct file *file, long long offset, int origin)
{
+ lock_kernel();
switch (origin) {
case 0:
file->f_pos = offset;
file->f_pos = flash.read_size;
break;
default:
+ unlock_kernel();
return -EINVAL;
}
+ unlock_kernel();
return file->f_pos;
}
*/
static loff_t jsf_lseek(struct file * file, loff_t offset, int orig)
{
+ loff_t ret;
+
+ lock_kernel();
switch (orig) {
case 0:
file->f_pos = offset;
- return file->f_pos;
+ ret = file->f_pos;
+ break;
case 1:
file->f_pos += offset;
- return file->f_pos;
+ ret = file->f_pos;
+ break;
default:
- return -EINVAL;
+ ret = -EINVAL;
}
+ unlock_kernel();
+ return ret;
}
/*
static loff_t usb_device_lseek(struct file * file, loff_t offset, int orig)
{
+ loff_t ret;
+
+ lock_kernel();
+
switch (orig) {
case 0:
file->f_pos = offset;
- return file->f_pos;
-
+ ret = file->f_pos;
+ break;
case 1:
file->f_pos += offset;
- return file->f_pos;
-
+ ret = file->f_pos;
+ break;
case 2:
- return -EINVAL;
-
default:
- return -EINVAL;
+ ret = -EINVAL;
}
+
+ unlock_kernel();
+ return ret;
}
struct file_operations usbdevfs_devices_fops = {
static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig)
{
+ loff_t ret;
+
+ lock_kernel();
+
switch (orig) {
case 0:
file->f_pos = offset;
- return file->f_pos;
-
+ ret = file->f_pos;
+ break;
case 1:
file->f_pos += offset;
- return file->f_pos;
-
+ ret = file->f_pos;
+ break;
case 2:
- return -EINVAL;
-
default:
- return -EINVAL;
+ ret = -EINVAL;
}
+
+ unlock_kernel();
+ return ret;
}
static ssize_t usbdev_read(struct file *file, char * buf, size_t nbytes, loff_t *ppos)
#include <linux/mm.h>
#include <linux/usb.h>
#include <linux/usbdevice_fs.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
/*****************************************************************/
static loff_t usb_driver_lseek(struct file * file, loff_t offset, int orig)
{
+ loff_t ret;
+
+ lock_kernel();
switch (orig) {
case 0:
file->f_pos = offset;
- return file->f_pos;
-
+ ret = file->f_pos;
+ break;
case 1:
file->f_pos += offset;
- return file->f_pos;
-
+ ret = file->f_pos;
+ break;
case 2:
- return -EINVAL;
-
default:
- return -EINVAL;
+ ret = -EINVAL;
}
+ unlock_kernel();
+ return ret;
}
struct file_operations usbdevfs_drivers_fops = {
#include <linux/proc_fs.h>
#include <linux/usb.h>
#include <linux/usbdevice_fs.h>
-
+#include <linux/smp_lock.h>
static struct super_operations usbfs_ops;
static struct address_space_operations usbfs_aops;
{
loff_t retval = -EINVAL;
+ lock_kernel();
switch(orig) {
case 0:
if (offset > 0) {
default:
break;
}
+ unlock_kernel();
return retval;
}
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
+#include <linux/smp_lock.h>
#include <asm/io.h>
#include "uhci.h"
static loff_t uhci_proc_lseek(struct file *file, loff_t off, int whence)
{
- struct uhci_proc *up = file->private_data;
- loff_t new;
+ struct uhci_proc *up;
+ loff_t new = -1;
+
+ lock_kernel();
+ up = file->private_data;
switch (whence) {
case 0:
case 1:
new = file->f_pos + off;
break;
- case 2:
- default:
- return -EINVAL;
}
- if (new < 0 || new > up->size)
+ if (new < 0 || new > up->size) {
+ unlock_kernel();
return -EINVAL;
+ }
+ unlock_kernel();
return (file->f_pos = new);
}
#include <linux/zorro.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/amigahw.h>
#include <asm/setup.h>
static loff_t
proc_bus_zorro_lseek(struct file *file, loff_t off, int whence)
{
- loff_t new;
+ loff_t new = -1;
switch (whence) {
case 0:
case 2:
new = sizeof(struct ConfigDev) + off;
break;
- default:
- return -EINVAL;
}
- if (new < 0 || new > sizeof(struct ConfigDev))
+ if (new < 0 || new > sizeof(struct ConfigDev)) {
+ unlock_kernel();
return -EINVAL;
+ }
+ unlock_kernel();
return (file->f_pos = new);
}
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/device.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
{
loff_t retval = -EINVAL;
+ lock_kernel();
switch(orig) {
case 0:
if (offset > 0) {
default:
break;
}
+ unlock_kernel();
return retval;
}