aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:45:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:45:43 -0500
commit5cbb3d216e2041700231bcfc383ee5f8b7fc8b74 (patch)
treea738fa82dbcefa9bd283c08bc67f38827be63937 /drivers/char
parent9bc9ccd7db1c9f043f75380b5a5b94912046a60e (diff)
parent4e9b45a19241354daec281d7a785739829b52359 (diff)
Merge branch 'akpm' (patches from Andrew Morton)
Merge first patch-bomb from Andrew Morton: "Quite a lot of other stuff is banked up awaiting further next->mainline merging, but this batch contains: - Lots of random misc patches - OCFS2 - Most of MM - backlight updates - lib/ updates - printk updates - checkpatch updates - epoll tweaking - rtc updates - hfs - hfsplus - documentation - procfs - update gcov to gcc-4.7 format - IPC" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (269 commits) ipc, msg: fix message length check for negative values ipc/util.c: remove unnecessary work pending test devpts: plug the memory leak in kill_sb ./Makefile: export initial ramdisk compression config option init/Kconfig: add option to disable kernel compression drivers: w1: make w1_slave::flags long to avoid memory corruption drivers/w1/masters/ds1wm.cuse dev_get_platdata() drivers/memstick/core/ms_block.c: fix unreachable state in h_msb_read_page() drivers/memstick/core/mspro_block.c: fix attributes array allocation drivers/pps/clients/pps-gpio.c: remove redundant of_match_ptr kernel/panic.c: reduce 1 byte usage for print tainted buffer gcov: reuse kbasename helper kernel/gcov/fs.c: use pr_warn() kernel/module.c: use pr_foo() gcov: compile specific gcov implementation based on gcc version gcov: add support for gcc 4.7 gcov format gcov: move gcov structs definitions to a gcc version specific file kernel/taskstats.c: return -ENOMEM when alloc memory fails in add_del_listener() kernel/taskstats.c: add nla_nest_cancel() for failure processing between nla_nest_start() and nla_nest_end() kernel/sysctl_binary.c: use scnprintf() instead of snprintf() ...
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Kconfig10
-rw-r--r--drivers/char/hpet.c24
2 files changed, 30 insertions, 4 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 14219972c745..fa3243d71c76 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -522,10 +522,16 @@ config HPET_MMAP
522 If you say Y here, user applications will be able to mmap 522 If you say Y here, user applications will be able to mmap
523 the HPET registers. 523 the HPET registers.
524 524
525config HPET_MMAP_DEFAULT
526 bool "Enable HPET MMAP access by default"
527 default y
528 depends on HPET_MMAP
529 help
525 In some hardware implementations, the page containing HPET 530 In some hardware implementations, the page containing HPET
526 registers may also contain other things that shouldn't be 531 registers may also contain other things that shouldn't be
527 exposed to the user. If this applies to your hardware, 532 exposed to the user. This option selects the default (if
528 say N here. 533 kernel parameter hpet_mmap is not set) user access to the
534 registers for applications that require it.
529 535
530config HANGCHECK_TIMER 536config HANGCHECK_TIMER
531 tristate "Hangcheck timer" 537 tristate "Hangcheck timer"
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index dca5834685cf..5d9c31dfc905 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -367,12 +367,29 @@ static unsigned int hpet_poll(struct file *file, poll_table * wait)
367 return 0; 367 return 0;
368} 368}
369 369
370#ifdef CONFIG_HPET_MMAP
371#ifdef CONFIG_HPET_MMAP_DEFAULT
372static int hpet_mmap_enabled = 1;
373#else
374static int hpet_mmap_enabled = 0;
375#endif
376
377static __init int hpet_mmap_enable(char *str)
378{
379 get_option(&str, &hpet_mmap_enabled);
380 pr_info("HPET mmap %s\n", hpet_mmap_enabled ? "enabled" : "disabled");
381 return 1;
382}
383__setup("hpet_mmap", hpet_mmap_enable);
384
370static int hpet_mmap(struct file *file, struct vm_area_struct *vma) 385static int hpet_mmap(struct file *file, struct vm_area_struct *vma)
371{ 386{
372#ifdef CONFIG_HPET_MMAP
373 struct hpet_dev *devp; 387 struct hpet_dev *devp;
374 unsigned long addr; 388 unsigned long addr;
375 389
390 if (!hpet_mmap_enabled)
391 return -EACCES;
392
376 devp = file->private_data; 393 devp = file->private_data;
377 addr = devp->hd_hpets->hp_hpet_phys; 394 addr = devp->hd_hpets->hp_hpet_phys;
378 395
@@ -381,10 +398,13 @@ static int hpet_mmap(struct file *file, struct vm_area_struct *vma)
381 398
382 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 399 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
383 return vm_iomap_memory(vma, addr, PAGE_SIZE); 400 return vm_iomap_memory(vma, addr, PAGE_SIZE);
401}
384#else 402#else
403static int hpet_mmap(struct file *file, struct vm_area_struct *vma)
404{
385 return -ENOSYS; 405 return -ENOSYS;
386#endif
387} 406}
407#endif
388 408
389static int hpet_fasync(int fd, struct file *file, int on) 409static int hpet_fasync(int fd, struct file *file, int on)
390{ 410{