linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] video:fbdev:core:Calculate the buffer alignment if buffer is not IO mapped.
@ 2015-10-30 11:41 Shailendra Verma
  0 siblings, 0 replies; only message in thread
From: Shailendra Verma @ 2015-10-30 11:41 UTC (permalink / raw)
  To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
  Cc: linux-kernel, vidushi.koul

From: Shailendra Verma <Shailendra.v@samsung.com>

Moving the instruction "align = buf->buf_align - 1" just after the
verification of the buffer if it is IP mapped or not as the buffer
alignment is not required if it is IO mapped.Thus it will save an
extra instuction execution when buffer is IO mapped.

Signed-off-by: Shailendra Verma <Shailendra.v@samsung.com>
---
 linux-4.3-rc6/drivers/video/fbdev/core/fbmem.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/linux-4.3-rc6/drivers/video/fbdev/core/fbmem.c b/linux-4.3-rc6/drivers/video/fbdev/core/fbmem.c
index 0705d88..d92ec99 100644
--- a/linux-4.3-rc6/drivers/video/fbdev/core/fbmem.c
+++ b/linux-4.3-rc6/drivers/video/fbdev/core/fbmem.c
@@ -157,7 +157,7 @@ EXPORT_SYMBOL(fb_pad_unaligned_buffer);
  */
 char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size)
 {
-	u32 align = buf->buf_align - 1, offset;
+	u32 align, offset;
 	char *addr = buf->addr;
 
 	/* If IO mapped, we need to sync before access, no sharing of
@@ -169,6 +169,8 @@ char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size
 		return addr;
 	}
 
+	align = buf->buf_align - 1;
+
 	/* See if we fit in the remaining pixmap space */
 	offset = buf->offset + align;
 	offset &= ~align;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-30 11:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-30 11:41 [PATCH] video:fbdev:core:Calculate the buffer alignment if buffer is not IO mapped Shailendra Verma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).