All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhaowei Yuan <zhaowei.yuan@samsung.com>
To: linux-media@vger.kernel.org, k.debski@samsung.com,
	kyungmin.park@samsung.com, jtp.park@samsung.com
Cc: linux-samsung-soc@vger.kernel.org, m.chehab@samsung.com
Subject: [PATCH] media: v4l2: make alloction alogthim more robust and flexible
Date: Wed, 30 Jul 2014 11:55:32 +0800	[thread overview]
Message-ID: <1406692532-31800-1-git-send-email-zhaowei.yuan@samsung.com> (raw)

Current algothim relies on the fact that caller will align the
size to PAGE_SIZE, otherwise order will be decreased to negative
when remain size is less than PAGE_SIZE, it makes the function
hard to be migrated.
This patch sloves the hidden problem.

Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
---
 drivers/media/v4l2-core/videobuf2-dma-sg.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c
index adefc31..40d18aa 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c
@@ -58,7 +58,7 @@ static int vb2_dma_sg_alloc_compacted(struct vb2_dma_sg_buf *buf,

 		order = get_order(size);
 		/* Dont over allocate*/
-		if ((PAGE_SIZE << order) > size)
+		if (order > 0 && (PAGE_SIZE << order) > size)
 			order--;

 		pages = NULL;
--
1.7.9.5


             reply	other threads:[~2014-07-30  3:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30  3:55 Zhaowei Yuan [this message]
2014-07-30 14:07 ` [PATCH] media: v4l2: make alloction alogthim more robust and flexible Andreas Färber
2014-11-11 11:13 ` Sakari Ailus

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=1406692532-31800-1-git-send-email-zhaowei.yuan@samsung.com \
    --to=zhaowei.yuan@samsung.com \
    --cc=jtp.park@samsung.com \
    --cc=k.debski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    /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.