aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-21 17:55:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-21 17:55:23 -0400
commiteb4225b2da2b9f3c1ee43efe58ed1415cc1d4c47 (patch)
tree573ce3591679ffcdc179801ed86107e48e0e11ca /drivers/char
parent807677f812639bdeeddf86abc66117e124eaedb2 (diff)
parent4cddb886a4d0e5cc7a790151740bfb87b568c97d (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6: (25 commits) mmtimer: Push BKL down into the ioctl handler [IA64] Remove experimental status of kdump [IA64] Update ia64 mmr list for SGI uv [IA64] Avoid overflowing ia64_cpu_to_sapicid in acpi_map_lsapic() [IA64] adding parameter check to module_free() [IA64] improper printk format in acpi-cpufreq [IA64] pv_ops: move some functions in ivt.S to avoid lack of space. [IA64] pvops: documentation on ia64/pv_ops [IA64] pvops: add to hooks, pv_time_ops, for steal time accounting. [IA64] pvops: add hooks, pv_irq_ops, to paravirtualized irq related operations. [IA64] pvops: add hooks, pv_iosapic_ops, to paravirtualize iosapic. [IA64] pvops: define initialization hooks, pv_init_ops, for paravirtualized environment. [IA64] pvops: paravirtualize NR_IRQS [IA64] pvops: paravirtualize entry.S [IA64] pvops: paravirtualize ivt.S [IA64] pvops: paravirtualize minstate.h. [IA64] pvops: define paravirtualized instructions for native. [IA64] pvops: preparation for paravirtulization of hand written assembly code. [IA64] pvops: introduce pv_cpu_ops to paravirtualize privileged instructions. [IA64] pvops: add an early setup hook for pv_ops. ...
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/mmtimer.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index 192961fd7173..918711aa56f3 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -32,6 +32,7 @@
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/time.h> 33#include <linux/time.h>
34#include <linux/math64.h> 34#include <linux/math64.h>
35#include <linux/smp_lock.h>
35 36
36#include <asm/uaccess.h> 37#include <asm/uaccess.h>
37#include <asm/sn/addrs.h> 38#include <asm/sn/addrs.h>
@@ -57,8 +58,8 @@ extern unsigned long sn_rtc_cycles_per_second;
57 58
58#define rtc_time() (*RTC_COUNTER_ADDR) 59#define rtc_time() (*RTC_COUNTER_ADDR)
59 60
60static int mmtimer_ioctl(struct inode *inode, struct file *file, 61static long mmtimer_ioctl(struct file *file, unsigned int cmd,
61 unsigned int cmd, unsigned long arg); 62 unsigned long arg);
62static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma); 63static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma);
63 64
64/* 65/*
@@ -67,9 +68,9 @@ static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma);
67static unsigned long mmtimer_femtoperiod = 0; 68static unsigned long mmtimer_femtoperiod = 0;
68 69
69static const struct file_operations mmtimer_fops = { 70static const struct file_operations mmtimer_fops = {
70 .owner = THIS_MODULE, 71 .owner = THIS_MODULE,
71 .mmap = mmtimer_mmap, 72 .mmap = mmtimer_mmap,
72 .ioctl = mmtimer_ioctl, 73 .unlocked_ioctl = mmtimer_ioctl,
73}; 74};
74 75
75/* 76/*
@@ -339,7 +340,6 @@ restart:
339 340
340/** 341/**
341 * mmtimer_ioctl - ioctl interface for /dev/mmtimer 342 * mmtimer_ioctl - ioctl interface for /dev/mmtimer
342 * @inode: inode of the device
343 * @file: file structure for the device 343 * @file: file structure for the device
344 * @cmd: command to execute 344 * @cmd: command to execute
345 * @arg: optional argument to command 345 * @arg: optional argument to command
@@ -365,11 +365,13 @@ restart:
365 * %MMTIMER_GETCOUNTER - Gets the current value in the counter and places it 365 * %MMTIMER_GETCOUNTER - Gets the current value in the counter and places it
366 * in the address specified by @arg. 366 * in the address specified by @arg.
367 */ 367 */
368static int mmtimer_ioctl(struct inode *inode, struct file *file, 368static long mmtimer_ioctl(struct file *file, unsigned int cmd,
369 unsigned int cmd, unsigned long arg) 369 unsigned long arg)
370{ 370{
371 int ret = 0; 371 int ret = 0;
372 372
373 lock_kernel();
374
373 switch (cmd) { 375 switch (cmd) {
374 case MMTIMER_GETOFFSET: /* offset of the counter */ 376 case MMTIMER_GETOFFSET: /* offset of the counter */
375 /* 377 /*
@@ -384,15 +386,14 @@ static int mmtimer_ioctl(struct inode *inode, struct file *file,
384 case MMTIMER_GETRES: /* resolution of the clock in 10^-15 s */ 386 case MMTIMER_GETRES: /* resolution of the clock in 10^-15 s */
385 if(copy_to_user((unsigned long __user *)arg, 387 if(copy_to_user((unsigned long __user *)arg,
386 &mmtimer_femtoperiod, sizeof(unsigned long))) 388 &mmtimer_femtoperiod, sizeof(unsigned long)))
387 return -EFAULT; 389 ret = -EFAULT;
388 break; 390 break;
389 391
390 case MMTIMER_GETFREQ: /* frequency in Hz */ 392 case MMTIMER_GETFREQ: /* frequency in Hz */
391 if(copy_to_user((unsigned long __user *)arg, 393 if(copy_to_user((unsigned long __user *)arg,
392 &sn_rtc_cycles_per_second, 394 &sn_rtc_cycles_per_second,
393 sizeof(unsigned long))) 395 sizeof(unsigned long)))
394 return -EFAULT; 396 ret = -EFAULT;
395 ret = 0;
396 break; 397 break;
397 398
398 case MMTIMER_GETBITS: /* number of bits in the clock */ 399 case MMTIMER_GETBITS: /* number of bits in the clock */
@@ -406,13 +407,13 @@ static int mmtimer_ioctl(struct inode *inode, struct file *file,
406 case MMTIMER_GETCOUNTER: 407 case MMTIMER_GETCOUNTER:
407 if(copy_to_user((unsigned long __user *)arg, 408 if(copy_to_user((unsigned long __user *)arg,
408 RTC_COUNTER_ADDR, sizeof(unsigned long))) 409 RTC_COUNTER_ADDR, sizeof(unsigned long)))
409 return -EFAULT; 410 ret = -EFAULT;
410 break; 411 break;
411 default: 412 default:
412 ret = -ENOSYS; 413 ret = -ENOTTY;
413 break; 414 break;
414 } 415 }
415 416 unlock_kernel();
416 return ret; 417 return ret;
417} 418}
418 419