diff options
Diffstat (limited to 'drivers/char/hpet.c')
| -rw-r--r-- | drivers/char/hpet.c | 36 | 
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 448ce5e29c5..d5d4cd82b9f 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -34,15 +34,12 @@  #include <linux/uaccess.h>  #include <linux/slab.h>  #include <linux/io.h> - +#include <linux/acpi.h> +#include <linux/hpet.h>  #include <asm/current.h>  #include <asm/irq.h>  #include <asm/div64.h> -#include <linux/acpi.h> -#include <acpi/acpi_bus.h> -#include <linux/hpet.h> -  /*   * The High Precision Event Timer driver.   * This driver is closely modelled after the rtc.c driver. @@ -367,12 +364,29 @@ static unsigned int hpet_poll(struct file *file, poll_table * wait)  	return 0;  } +#ifdef CONFIG_HPET_MMAP +#ifdef CONFIG_HPET_MMAP_DEFAULT +static int hpet_mmap_enabled = 1; +#else +static int hpet_mmap_enabled = 0; +#endif + +static __init int hpet_mmap_enable(char *str) +{ +	get_option(&str, &hpet_mmap_enabled); +	pr_info("HPET mmap %s\n", hpet_mmap_enabled ? "enabled" : "disabled"); +	return 1; +} +__setup("hpet_mmap", hpet_mmap_enable); +  static int hpet_mmap(struct file *file, struct vm_area_struct *vma)  { -#ifdef	CONFIG_HPET_MMAP  	struct hpet_dev *devp;  	unsigned long addr; +	if (!hpet_mmap_enabled) +		return -EACCES; +  	devp = file->private_data;  	addr = devp->hd_hpets->hp_hpet_phys; @@ -381,10 +395,13 @@ static int hpet_mmap(struct file *file, struct vm_area_struct *vma)  	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);  	return vm_iomap_memory(vma, addr, PAGE_SIZE); +}  #else +static int hpet_mmap(struct file *file, struct vm_area_struct *vma) +{  	return -ENOSYS; -#endif  } +#endif  static int hpet_fasync(int fd, struct file *file, int on)  { @@ -486,8 +503,7 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp)  		}  		sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); -		irq_flags = devp->hd_flags & HPET_SHARED_IRQ -						? IRQF_SHARED : IRQF_DISABLED; +		irq_flags = devp->hd_flags & HPET_SHARED_IRQ ? IRQF_SHARED : 0;  		if (request_irq(irq, hpet_interrupt, irq_flags,  				devp->hd_name, (void *)devp)) {  			printk(KERN_ERR "hpet: IRQ %d is not free\n", irq); @@ -971,8 +987,6 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)  		struct acpi_resource_fixed_memory32 *fixmem32;  		fixmem32 = &res->data.fixed_memory32; -		if (!fixmem32) -			return AE_NO_MEMORY;  		hdp->hd_phys_address = fixmem32->address;  		hdp->hd_address = ioremap(fixmem32->address,  | 
