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: 35582 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f69.google.com (mail-oi0-f69.google.com [209.85.218.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2682120523 for ; Tue, 19 Aug 2014 11:16:29 +0000 (UTC) Received: by mail-oi0-f69.google.com with SMTP id h136sf36438533oig.8 for ; Tue, 19 Aug 2014 04:16:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=7oC4Qi/Mf1w/cDdn2ITYU7aswrraW7Z/q6SF/cLXxwc=; b=ZgTtab+sdmoRg2IqCR8KuT96weXkC2gqAOzJsZTzg7gRpZ88soEjqJDdz1cGM82F7o jjwSCfgo0Fspwh2L5fG72+1BTiAvc15JNRzSM7dvnBpeFbQ7L+xWSMoaUGyks2WMm3vM pEQj1g4dWowEEqpLgNlk/uiCoJLWykuiIr5zkdtqkFrhQMae3MQ4NZUHyRVe33OL+okA JhYrVxNHNs+gpMMoYWucV+PZh4qiagC9mmD9lRXiTL95v2r7gB3n1t5k67RWiodwkQK9 0Yn2FwwNePnzHg92+w7vNqtjNTtFny5z5kkG/V+9iWBlZZs4JDklbY1ntPjDq2j+z9W2 hKTg== X-Gm-Message-State: ALoCoQn2rlPzFDQahDS+xzqOeU9DM288GwHM02rEQatVpx5CoPuRfSgYOWPTborFydmVO8oYLuJg X-Received: by 10.42.130.70 with SMTP id u6mr22925397ics.2.1408446988750; Tue, 19 Aug 2014 04:16:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.231 with SMTP id v94ls1439324qgd.14.gmail; Tue, 19 Aug 2014 04:16:28 -0700 (PDT) X-Received: by 10.52.245.101 with SMTP id xn5mr11526553vdc.32.1408446988664; Tue, 19 Aug 2014 04:16:28 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id xk3si4388827vdb.7.2014.08.19.04.16.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 04:16:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id im17so7196498vcb.17 for ; Tue, 19 Aug 2014 04:16:28 -0700 (PDT) X-Received: by 10.220.44.80 with SMTP id z16mr29603489vce.7.1408446988570; Tue, 19 Aug 2014 04:16:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp229695vcb; Tue, 19 Aug 2014 04:16:27 -0700 (PDT) X-Received: by 10.70.60.197 with SMTP id j5mr48557693pdr.145.1408446987346; Tue, 19 Aug 2014 04:16:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ua4si26380721pac.100.2014.08.19.04.16.18 for ; Tue, 19 Aug 2014 04:16:18 -0700 (PDT) Received-SPF: none (google.com: linux-arm-msm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752846AbaHSLOz (ORCPT + 5 others); 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-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: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;