From patchwork Tue Aug 19 11:14:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 4742031 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 048F3C033A for ; Tue, 19 Aug 2014 11:17:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3475E200F4 for ; Tue, 19 Aug 2014 11:17:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D0D42015D for ; Tue, 19 Aug 2014 11:17:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752846AbaHSLOz (ORCPT ); Tue, 19 Aug 2014 07:14:55 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:53901 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752664AbaHSLOx (ORCPT ); Tue, 19 Aug 2014 07:14:53 -0400 Received: by mail-pd0-f181.google.com with SMTP id g10so9525920pdj.12 for ; Tue, 19 Aug 2014 04:14:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZGqKiQ0JyFT9MIwUhG98QIUQeoDd6Sw9WIpW2tUj21w=; b=BwtssaQQ9QevIaHvHwRRcLuAM/sJfSJto7qrvVIopNLZEHqpCEjmWRCARfqT3jOrdp qDsy5W6lu7g1kz2BvsD3XOeqB3XBJ+joHZvggmtUw1+X6GuXR4PjIFQTKqHOkWpRoeQi XoG6a47j1Fy6Pp3rZLrC6Y53M4JlTzZ91HIxZo+uvy+yKLOplI2Kkcr/6cm82vtqHFcA f6U+i3GZcmsWuD2SF+G5LsUPjO+2fQHImdKBMWICMGRtOTfHaF4EIEtoP11wHUiHvzLy 1M8vnqv2cpUbDc7bB6uESG0+CPAFlwxCGl66ByIohUbWZjr+/ioCotMfJ5Tkqw+WE8a7 0C4w== X-Gm-Message-State: ALoCoQk9CRBNvO29K588xTfCLGVBJRvIZX/RReNvZqY5BchgU4ECYC7YX6OMICUNx2MoH3Rq8pJJ X-Received: by 10.66.246.229 with SMTP id xz5mr43453638pac.119.1408446890623; Tue, 19 Aug 2014 04:14:50 -0700 (PDT) Received: from localhost.localdomain ([117.203.126.32]) by mx.google.com with ESMTPSA id h4sm28937920pdi.30.2014.08.19.04.14.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Aug 2014 04:14:49 -0700 (PDT) From: Srinivas Kandagatla To: linux-mmc@vger.kernel.org Cc: Linus Walleij , Chris Ball , Ulf Hansson , Russell King , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v2 2/4] mmc: mmci: move block size validation under relevant code Date: Tue, 19 Aug 2014 12:14:26 +0100 Message-Id: <1408446866-1649-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408446785-1399-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1408446785-1399-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 This code moves a BUG_ON condition to relevant if block, this check is not necessary for IPs which can set any arbitrary block size in a given range. This patch is necessary for SDIO which sets block sizes that are exactly not power of 2. Original issue detected while testing WLAN ath6kl on Qualcomm APQ8064 SOC. Signed-off-by: Srinivas Kandagatla --- drivers/mmc/host/mmci.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 3089fba..1c99195 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -800,15 +800,16 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) writel(timeout, base + MMCIDATATIMER); writel(host->size, base + MMCIDATALENGTH); - blksz_bits = ffs(data->blksz) - 1; - BUG_ON(1 << blksz_bits != data->blksz); - if (variant->blksz_datactrl16) + if (variant->blksz_datactrl16) { datactrl = MCI_DPSM_ENABLE | (data->blksz << 16); - else if (variant->blksz_datactrl4) + } else if (variant->blksz_datactrl4) { datactrl = MCI_DPSM_ENABLE | (data->blksz << 4); - else + } else { + blksz_bits = ffs(data->blksz) - 1; + BUG_ON(1 << blksz_bits != data->blksz); datactrl = MCI_DPSM_ENABLE | blksz_bits << 4; + } if (data->flags & MMC_DATA_READ) datactrl |= MCI_DPSM_DIRECTION;