All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] /dev/mem __HAVE_PHYS_MEM_ACCESS_PROT tidy-up
@ 2005-12-13 23:56 ` Bjorn Helgaas
  0 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2005-12-13 23:56 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Tony Luck; +Cc: linux-ia64

Tidy up __HAVE_PHYS_MEM_ACCESS_PROT usage to make mmap_mem() easier to read.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

 drivers/char/mem.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

Index: work5/drivers/char/mem.c
===================================================================
--- work5.orig/drivers/char/mem.c	2005-12-09 15:52:28.000000000 -0700
+++ work5/drivers/char/mem.c	2005-12-09 16:17:50.000000000 -0700
@@ -228,20 +228,25 @@
 	return written;
 }
 
+#ifndef __HAVE_PHYS_MEM_ACCESS_PROT
+static pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
+				     unsigned long size, pgprot_t vma_prot)
+{
+#ifdef pgprot_noncached
+	unsigned long offset = pfn << PAGE_SHIFT;
+
+	if (uncached_access(file, offset))
+		return pgprot_noncached(vma_prot);
+#endif
+	return vma_prot;
+}
+#endif
+
 static int mmap_mem(struct file * file, struct vm_area_struct * vma)
 {
-#if defined(__HAVE_PHYS_MEM_ACCESS_PROT)
 	vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff,
 						 vma->vm_end - vma->vm_start,
 						 vma->vm_page_prot);
-#elif defined(pgprot_noncached)
-	unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
-	int uncached;
-
-	uncached = uncached_access(file, offset);
-	if (uncached)
-		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-#endif
 
 	/* Remap-pfn-range will mark the range VM_IO and VM_RESERVED */
 	if (remap_pfn_range(vma,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 1/2] /dev/mem __HAVE_PHYS_MEM_ACCESS_PROT tidy-up
@ 2005-12-13 23:56 ` Bjorn Helgaas
  0 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2005-12-13 23:56 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Tony Luck; +Cc: linux-ia64

Tidy up __HAVE_PHYS_MEM_ACCESS_PROT usage to make mmap_mem() easier to read.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

 drivers/char/mem.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

Index: work5/drivers/char/mem.c
=================================--- work5.orig/drivers/char/mem.c	2005-12-09 15:52:28.000000000 -0700
+++ work5/drivers/char/mem.c	2005-12-09 16:17:50.000000000 -0700
@@ -228,20 +228,25 @@
 	return written;
 }
 
+#ifndef __HAVE_PHYS_MEM_ACCESS_PROT
+static pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
+				     unsigned long size, pgprot_t vma_prot)
+{
+#ifdef pgprot_noncached
+	unsigned long offset = pfn << PAGE_SHIFT;
+
+	if (uncached_access(file, offset))
+		return pgprot_noncached(vma_prot);
+#endif
+	return vma_prot;
+}
+#endif
+
 static int mmap_mem(struct file * file, struct vm_area_struct * vma)
 {
-#if defined(__HAVE_PHYS_MEM_ACCESS_PROT)
 	vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff,
 						 vma->vm_end - vma->vm_start,
 						 vma->vm_page_prot);
-#elif defined(pgprot_noncached)
-	unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
-	int uncached;
-
-	uncached = uncached_access(file, offset);
-	if (uncached)
-		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-#endif
 
 	/* Remap-pfn-range will mark the range VM_IO and VM_RESERVED */
 	if (remap_pfn_range(vma,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch 1/2] /dev/mem __HAVE_PHYS_MEM_ACCESS_PROT tidy-up
  2005-12-13 23:56 ` Bjorn Helgaas
@ 2005-12-14  0:06   ` David S. Miller
  -1 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2005-12-14  0:06 UTC (permalink / raw)
  To: bjorn.helgaas; +Cc: linux-kernel, akpm, tony.luck, linux-ia64

From: Bjorn Helgaas <bjorn.helgaas@hp.com>
Date: Tue, 13 Dec 2005 16:56:11 -0700

> Tidy up __HAVE_PHYS_MEM_ACCESS_PROT usage to make mmap_mem() easier to read.
> 
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

It would be _really_ easy to read if the default implementation
lived in some asm-generic/foo.h header file :-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch 1/2] /dev/mem __HAVE_PHYS_MEM_ACCESS_PROT tidy-up
@ 2005-12-14  0:06   ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2005-12-14  0:06 UTC (permalink / raw)
  To: bjorn.helgaas; +Cc: linux-kernel, akpm, tony.luck, linux-ia64

From: Bjorn Helgaas <bjorn.helgaas@hp.com>
Date: Tue, 13 Dec 2005 16:56:11 -0700

> Tidy up __HAVE_PHYS_MEM_ACCESS_PROT usage to make mmap_mem() easier to read.
> 
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

It would be _really_ easy to read if the default implementation
lived in some asm-generic/foo.h header file :-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-14  0:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-13 23:56 [patch 1/2] /dev/mem __HAVE_PHYS_MEM_ACCESS_PROT tidy-up Bjorn Helgaas
2005-12-13 23:56 ` Bjorn Helgaas
2005-12-14  0:06 ` David S. Miller
2005-12-14  0:06   ` David S. Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.