mmtimer: Push BKL down into the ioctl handler
Switches to unlocked_ioctl read to remove ioctl BKL method. Fix the unknown ioctl return. Probably a nice easy one to kill off BKL usage entirely later Signed-off-by: Alan Cox <alan@redhat.com> Acked-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
This commit is contained in:
parent
fb86611f8f
commit
4cddb886a4
|
@ -32,6 +32,7 @@
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/time.h>
|
#include <linux/time.h>
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
|
#include <linux/smp_lock.h>
|
||||||
|
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/sn/addrs.h>
|
#include <asm/sn/addrs.h>
|
||||||
|
@ -57,8 +58,8 @@ extern unsigned long sn_rtc_cycles_per_second;
|
||||||
|
|
||||||
#define rtc_time() (*RTC_COUNTER_ADDR)
|
#define rtc_time() (*RTC_COUNTER_ADDR)
|
||||||
|
|
||||||
static int mmtimer_ioctl(struct inode *inode, struct file *file,
|
static long mmtimer_ioctl(struct file *file, unsigned int cmd,
|
||||||
unsigned int cmd, unsigned long arg);
|
unsigned long arg);
|
||||||
static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma);
|
static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -67,9 +68,9 @@ static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma);
|
||||||
static unsigned long mmtimer_femtoperiod = 0;
|
static unsigned long mmtimer_femtoperiod = 0;
|
||||||
|
|
||||||
static const struct file_operations mmtimer_fops = {
|
static const struct file_operations mmtimer_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.mmap = mmtimer_mmap,
|
.mmap = mmtimer_mmap,
|
||||||
.ioctl = mmtimer_ioctl,
|
.unlocked_ioctl = mmtimer_ioctl,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -339,7 +340,6 @@ restart:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mmtimer_ioctl - ioctl interface for /dev/mmtimer
|
* mmtimer_ioctl - ioctl interface for /dev/mmtimer
|
||||||
* @inode: inode of the device
|
|
||||||
* @file: file structure for the device
|
* @file: file structure for the device
|
||||||
* @cmd: command to execute
|
* @cmd: command to execute
|
||||||
* @arg: optional argument to command
|
* @arg: optional argument to command
|
||||||
|
@ -365,11 +365,13 @@ restart:
|
||||||
* %MMTIMER_GETCOUNTER - Gets the current value in the counter and places it
|
* %MMTIMER_GETCOUNTER - Gets the current value in the counter and places it
|
||||||
* in the address specified by @arg.
|
* in the address specified by @arg.
|
||||||
*/
|
*/
|
||||||
static int mmtimer_ioctl(struct inode *inode, struct file *file,
|
static long mmtimer_ioctl(struct file *file, unsigned int cmd,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case MMTIMER_GETOFFSET: /* offset of the counter */
|
case MMTIMER_GETOFFSET: /* offset of the counter */
|
||||||
/*
|
/*
|
||||||
|
@ -384,15 +386,14 @@ static int mmtimer_ioctl(struct inode *inode, struct file *file,
|
||||||
case MMTIMER_GETRES: /* resolution of the clock in 10^-15 s */
|
case MMTIMER_GETRES: /* resolution of the clock in 10^-15 s */
|
||||||
if(copy_to_user((unsigned long __user *)arg,
|
if(copy_to_user((unsigned long __user *)arg,
|
||||||
&mmtimer_femtoperiod, sizeof(unsigned long)))
|
&mmtimer_femtoperiod, sizeof(unsigned long)))
|
||||||
return -EFAULT;
|
ret = -EFAULT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMTIMER_GETFREQ: /* frequency in Hz */
|
case MMTIMER_GETFREQ: /* frequency in Hz */
|
||||||
if(copy_to_user((unsigned long __user *)arg,
|
if(copy_to_user((unsigned long __user *)arg,
|
||||||
&sn_rtc_cycles_per_second,
|
&sn_rtc_cycles_per_second,
|
||||||
sizeof(unsigned long)))
|
sizeof(unsigned long)))
|
||||||
return -EFAULT;
|
ret = -EFAULT;
|
||||||
ret = 0;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMTIMER_GETBITS: /* number of bits in the clock */
|
case MMTIMER_GETBITS: /* number of bits in the clock */
|
||||||
|
@ -406,13 +407,13 @@ static int mmtimer_ioctl(struct inode *inode, struct file *file,
|
||||||
case MMTIMER_GETCOUNTER:
|
case MMTIMER_GETCOUNTER:
|
||||||
if(copy_to_user((unsigned long __user *)arg,
|
if(copy_to_user((unsigned long __user *)arg,
|
||||||
RTC_COUNTER_ADDR, sizeof(unsigned long)))
|
RTC_COUNTER_ADDR, sizeof(unsigned long)))
|
||||||
return -EFAULT;
|
ret = -EFAULT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -ENOSYS;
|
ret = -ENOTTY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
unlock_kernel();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue