Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104527
b: refs/heads/master
c: 4cddb88
h: refs/heads/master
i:
  104525: dbfa13b
  104523: 3b8d1cc
  104519: 7e898b8
  104511: 13a002a
v: v3
  • Loading branch information
Alan Cox authored and Tony Luck committed Jul 17, 2008
1 parent 4dae4bb commit c5ab7b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fb86611f8f3251865784d5938a485a0238ec1427
refs/heads/master: 4cddb886a4d0e5cc7a790151740bfb87b568c97d
29 changes: 15 additions & 14 deletions trunk/drivers/char/mmtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <linux/interrupt.h>
#include <linux/time.h>
#include <linux/math64.h>
#include <linux/smp_lock.h>

#include <asm/uaccess.h>
#include <asm/sn/addrs.h>
Expand All @@ -57,8 +58,8 @@ extern unsigned long sn_rtc_cycles_per_second;

#define rtc_time() (*RTC_COUNTER_ADDR)

static int mmtimer_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
static long mmtimer_ioctl(struct file *file, unsigned int cmd,
unsigned long arg);
static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma);

/*
Expand All @@ -67,9 +68,9 @@ static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma);
static unsigned long mmtimer_femtoperiod = 0;

static const struct file_operations mmtimer_fops = {
.owner = THIS_MODULE,
.mmap = mmtimer_mmap,
.ioctl = mmtimer_ioctl,
.owner = THIS_MODULE,
.mmap = mmtimer_mmap,
.unlocked_ioctl = mmtimer_ioctl,
};

/*
Expand Down Expand Up @@ -339,7 +340,6 @@ static void mmtimer_set_next_timer(int nodeid)

/**
* mmtimer_ioctl - ioctl interface for /dev/mmtimer
* @inode: inode of the device
* @file: file structure for the device
* @cmd: command to execute
* @arg: optional argument to command
Expand All @@ -365,11 +365,13 @@ static void mmtimer_set_next_timer(int nodeid)
* %MMTIMER_GETCOUNTER - Gets the current value in the counter and places it
* in the address specified by @arg.
*/
static int mmtimer_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
static long mmtimer_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
int ret = 0;

lock_kernel();

switch (cmd) {
case MMTIMER_GETOFFSET: /* offset of the counter */
/*
Expand All @@ -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 */
if(copy_to_user((unsigned long __user *)arg,
&mmtimer_femtoperiod, sizeof(unsigned long)))
return -EFAULT;
ret = -EFAULT;
break;

case MMTIMER_GETFREQ: /* frequency in Hz */
if(copy_to_user((unsigned long __user *)arg,
&sn_rtc_cycles_per_second,
sizeof(unsigned long)))
return -EFAULT;
ret = 0;
ret = -EFAULT;
break;

case MMTIMER_GETBITS: /* number of bits in the clock */
Expand All @@ -406,13 +407,13 @@ static int mmtimer_ioctl(struct inode *inode, struct file *file,
case MMTIMER_GETCOUNTER:
if(copy_to_user((unsigned long __user *)arg,
RTC_COUNTER_ADDR, sizeof(unsigned long)))
return -EFAULT;
ret = -EFAULT;
break;
default:
ret = -ENOSYS;
ret = -ENOTTY;
break;
}

unlock_kernel();
return ret;
}

Expand Down

0 comments on commit c5ab7b5

Please sign in to comment.