From patchwork Fri Oct 30 11:29:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shailendra Verma X-Patchwork-Id: 7526351 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C99FCBEEA4 for ; Fri, 30 Oct 2015 11:30:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E643420527 for ; Fri, 30 Oct 2015 11:30:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13D2620523 for ; Fri, 30 Oct 2015 11:30:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759444AbbJ3Lau (ORCPT ); Fri, 30 Oct 2015 07:30:50 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:54000 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759339AbbJ3Lat (ORCPT ); Fri, 30 Oct 2015 07:30:49 -0400 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NX102FXE6N7RE60@mailout1.samsung.com>; Fri, 30 Oct 2015 20:30:44 +0900 (KST) X-AuditID: cbfee61a-f79a06d000005c6f-1b-563354e30704 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 8B.D8.23663.3E453365; Fri, 30 Oct 2015 20:30:44 +0900 (KST) Received: from srin.p4 ([107.108.168.37]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NX100K5A6LLI900@mmp2.samsung.com>; Fri, 30 Oct 2015 20:30:43 +0900 (KST) From: Shailendra Verma To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen , linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, vidushi.koul@samsung.com Subject: [PATCH] video:fbdev:core:Calculate the buffer alignment if buffer is not IO mapped. Date: Fri, 30 Oct 2015 16:59:45 +0530 Message-id: <1446204585-23412-1-git-send-email-shailendra.v@samung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHJMWRmVeSWpSXmKPExsVy+t9jQd0nIcZhBo+mMFmc6PvAanF51xw2 i3UPXzBZrJ9/i83i78VLbA6sHq8u3GHx6NuyitHj+I3tTB6fN8kFsERx2aSk5mSWpRbp2yVw Zdy9NIGlYCdXxar/B9kbGM9ydDFyckgImEi83XqbHcIWk7hwbz1bFyMXh5DALEaJHZu2sEM4 rxklbu37xdzFyMHBJmAgselWAEhcRKCZUWJ7VwcjSDezgJXEpP+zWUFqhAXiJBo2ZYOEWQRU Ja4cncUGYvMKuEvsab3OCFIiIaAgMWeSzQRG7gWMDKsYJVILkguKk9JzDfNSy/WKE3OLS/PS 9ZLzczcxgkPhmdQOxoO73A8xCnAwKvHw/kgwChNiTSwrrsw9xCjBwawkwtvjZBwmxJuSWFmV WpQfX1Sak1p8iFGag0VJnFffE6haID2xJDU7NbUgtQgmy8TBKdXAKOV0lHG+XG+JyOE9e6y9 NuqYnckqn/06L9S3eZVitccspvavD/mvcXilMYV1PWf4fLHm/6fcdx+/ie30qfuQUBOZ8SK2 0/TDy7Cq5abzv/UGuByMEd20f5ZIEccNl0WhiS8WWu3tuLy017jntFPQSn2xMlVBy+e/Mg9M C45UVfscITB/gsJPJZbijERDLeai4kQAs5GidQECAAA= Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shailendra Verma 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 --- 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;