From patchwork Tue Aug 12 12:03:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 35251 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 49C7C20540 for ; Tue, 12 Aug 2014 12:04:34 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id et14sf70274687pad.2 for ; Tue, 12 Aug 2014 05:04:33 -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=iVizPl1Nj2yOc0jqrGxRQ8IumbtyItvbLlnYeibu93s=; b=QttD28OwDZgq4uAK/dVEBK26T+xSurs7aZacAltAhXR3VGd5LRCBCcLDoely60049m Z9LF15HshMinFbMxBk8McU4h7c0OODkdfWoTwBBmc7O+48EkPPUaH2iBp2Z7tkLD+js1 pmeyVM7Gclfw7Lf9ZBdTQd4NVEuD2L89os1sP3iLeT++6u2w2O5HF+G7yE+Kl1pzFBLV VB8Jc+P9O5yKWKwzL+D/sv8X8uLqJNzvnLqfbH30NsV+Tvz8zdxupV0tz2bqEe4oIijX N7IRLDSEZWYeDuRL74onsXReEv2GB2C5ZpnkqdTdG/Tu1GEteY2K1TmfdXoyYoi8ftdL YGtA== X-Gm-Message-State: ALoCoQnsRMojfiwIy9R7OLBDddsgwC7FwKXIjKpZy3hJUqO5IiDlPqZah4oZJErie1LBrOswPTso X-Received: by 10.70.34.195 with SMTP id b3mr2163691pdj.7.1407845073574; Tue, 12 Aug 2014 05:04:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.148 with SMTP id 20ls81566qgt.86.gmail; Tue, 12 Aug 2014 05:04:33 -0700 (PDT) X-Received: by 10.52.146.17 with SMTP id sy17mr23139350vdb.29.1407845073459; Tue, 12 Aug 2014 05:04:33 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id kc6si8049581vdb.69.2014.08.12.05.04.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Aug 2014 05:04:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so12810990vcb.25 for ; Tue, 12 Aug 2014 05:04:33 -0700 (PDT) X-Received: by 10.52.129.165 with SMTP id nx5mr22830532vdb.25.1407845073339; Tue, 12 Aug 2014 05:04:33 -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 tc5csp242626vcb; Tue, 12 Aug 2014 05:04:32 -0700 (PDT) X-Received: by 10.70.36.135 with SMTP id q7mr3919882pdj.79.1407845072410; Tue, 12 Aug 2014 05:04:32 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sh5si15901335pac.62.2014.08.12.05.04.31 for ; Tue, 12 Aug 2014 05:04:32 -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 S1752821AbaHLMEb (ORCPT + 4 others); Tue, 12 Aug 2014 08:04:31 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:60778 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752495AbaHLMEa (ORCPT ); Tue, 12 Aug 2014 08:04:30 -0400 Received: by mail-pd0-f169.google.com with SMTP id y10so12548427pdj.14 for ; Tue, 12 Aug 2014 05:04:29 -0700 (PDT) X-Received: by 10.66.124.168 with SMTP id mj8mr380250pab.78.1407845069737; Tue, 12 Aug 2014 05:04:29 -0700 (PDT) Received: from localhost.localdomain ([117.198.92.185]) by mx.google.com with ESMTPSA id f1sm20371989pdk.86.2014.08.12.05.03.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Aug 2014 05:03:58 -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 RFC 2/5] mmc: mmci: move block size validation under relevant code Date: Tue, 12 Aug 2014 13:03:49 +0100 Message-Id: <1407845029-8271-1-git-send-email-srinivas.kandadgatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407844950-8072-1-git-send-email-srinivas.kandadgatla@linaro.org> References: <1407844950-8072-1-git-send-email-srinivas.kandadgatla@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.180 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: , From: Srinivas Kandagatla 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 8641572..99fe80a 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -793,15 +793,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;