From patchwork Mon Feb 16 15:25:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 5833431 Return-Path: X-Original-To: patchwork-alsa-devel@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 C1EFABF440 for ; Mon, 16 Feb 2015 15:28:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 02ED7201B9 for ; Mon, 16 Feb 2015 15:28:51 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 0F9A520148 for ; Mon, 16 Feb 2015 15:28:50 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 08FB32606C5; Mon, 16 Feb 2015 16:28:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A45612606A5; Mon, 16 Feb 2015 16:28:21 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 66B232606A6; Mon, 16 Feb 2015 16:28:20 +0100 (CET) Received: from opensource.wolfsonmicro.com (opensource.wolfsonmicro.com [80.75.67.52]) by alsa0.perex.cz (Postfix) with ESMTP id 7586A260699 for ; Mon, 16 Feb 2015 16:28:13 +0100 (CET) Received: from localhost.localdomain (unknown [87.246.78.26]) by opensource.wolfsonmicro.com (Postfix) with ESMTPSA id 625FB7500C2; Mon, 16 Feb 2015 15:28:08 +0000 (GMT) From: Charles Keepax To: broonie@kernel.org Date: Mon, 16 Feb 2015 15:25:49 +0000 Message-Id: <1424100349-10520-2-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1424100349-10520-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> References: <1424100349-10520-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> Cc: nikesh.oswal@wolfsonmicro.com, patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com, alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 2/2] ASoC: wm_adsp: Improve round to next 4-byte boundary X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Whilst the existing code does correctly round to the next 4-byte boundary it does so rather inefficiently. This patch changes the rounding to be simpler and more efficient. Signed-off-by: Charles Keepax --- sound/soc/codecs/wm_adsp.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 185ee85..d01c209 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -1184,7 +1184,6 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) int ret, pos, blocks, type, offset, reg; char *file; struct wm_adsp_buf *buf; - int tmp; file = kzalloc(PAGE_SIZE, GFP_KERNEL); if (file == NULL) @@ -1334,12 +1333,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) } } - tmp = le32_to_cpu(blk->len) % 4; - if (tmp) - pos += le32_to_cpu(blk->len) + (4 - tmp) + sizeof(*blk); - else - pos += le32_to_cpu(blk->len) + sizeof(*blk); - + pos += (le32_to_cpu(blk->len) + sizeof(*blk) + 3) & ~0x03; blocks++; }