All of lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Magnus Damm <magnus.damm@gmail.com>,
	hjk@linutronix.de, gregkh@suse.de, akpm@linux-foundation.org
Subject: [PATCH 03/06] uio: Remove vma->vm_private_data from uio_find_mem()
Date: Fri, 18 Jul 2008 14:04:27 +0900	[thread overview]
Message-ID: <20080718050427.16250.82197.sendpatchset@rx1.opensource.se> (raw)
In-Reply-To: <20080718050402.16250.25213.sendpatchset@rx1.opensource.se>

From: Magnus Damm <damm@igel.co.jp>

Pass along a struct uio_device pointer to uio_find_mem() so we can
remove the vma->vm_private_data usage. This allows us to store
different data in vma->vm_private_data in the future.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 drivers/uio/uio.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- 0003/drivers/uio/uio.c
+++ work/drivers/uio/uio.c	2008-07-18 12:42:21.000000000 +0900
@@ -427,10 +427,10 @@ static ssize_t uio_read(struct file *fil
 	return retval;
 }
 
-static struct uio_mem *uio_find_mem(struct vm_area_struct *vma)
+static struct uio_mem *uio_find_mem(struct uio_device *idev,
+				    struct vm_area_struct *vma)
 {
 	int mi;
-	struct uio_device *idev = vma->vm_private_data;
 
 	for (mi = 0; mi < MAX_UIO_MAPS; mi++) {
 		if (idev->info->mem[mi].size == 0)
@@ -456,7 +456,7 @@ static void uio_vma_close(struct vm_area
 static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	struct uio_device *idev = vma->vm_private_data;
-	struct uio_mem *imem = uio_find_mem(vma);
+	struct uio_mem *imem = uio_find_mem(idev, vma);
 	struct page *page;
 
 	if (!imem)
@@ -507,9 +507,7 @@ static int uio_mmap(struct file *filep, 
 	if (vma->vm_end < vma->vm_start)
 		return -EINVAL;
 
-	vma->vm_private_data = idev;
-
-	imem = uio_find_mem(vma);
+	imem = uio_find_mem(idev, vma);
 	if (!imem)
 		return -EINVAL;
 
@@ -523,6 +521,8 @@ static int uio_mmap(struct file *filep, 
 		return ret;
 	}
 
+	vma->vm_private_data = idev;
+
 	switch (imem->memtype) {
 		case UIO_MEM_PHYS:
 			return uio_mmap_physical(vma, imem);

  parent reply	other threads:[~2008-07-18  5:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18  5:04 [PATCH 00/06] uio: Various minor changes Magnus Damm
2008-07-18  5:04 ` [PATCH 01/06] uio: Use struct_uio_mem instead of index Magnus Damm
2008-07-18  5:04 ` [PATCH 02/06] uio: Pass struct uio_mem to mmap functions Magnus Damm
2008-07-18  5:04 ` Magnus Damm [this message]
2008-07-18  5:04 ` [PATCH 04/06] uio: Store struct uio_mem ptr in vma->vm_private_data Magnus Damm
2008-07-18  5:04 ` [PATCH 05/06] uio: Remove redundant vma->vm_flags setup code Magnus Damm
2008-07-18  5:04 ` [PATCH 06/06] uio: Support multiple UIO_MEM_LOGICAL/VIRTUAL pages Magnus Damm
2008-07-18 15:46 ` [PATCH 00/06] uio: Various minor changes Hans J. Koch
2008-07-25  9:12   ` Magnus Damm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080718050427.16250.82197.sendpatchset@rx1.opensource.se \
    --to=magnus.damm@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=hjk@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.