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: 4712441 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2D9789F3EC for ; Tue, 12 Aug 2014 12:04:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12FA42014A for ; Tue, 12 Aug 2014 12:04:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 159B420172 for ; Tue, 12 Aug 2014 12:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752823AbaHLMEb (ORCPT ); Tue, 12 Aug 2014 08:04:31 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:33694 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752814AbaHLMEa (ORCPT ); Tue, 12 Aug 2014 08:04:30 -0400 Received: by mail-pd0-f181.google.com with SMTP id g10so12541305pdj.12 for ; Tue, 12 Aug 2014 05:04:29 -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=4+VpjDJCwn0ePOjzVOGPkxKc2n/QvxBDP579cBxdQkE=; b=fA/+lF7TmhP8/9yMzwCJs7KNG3M/wgThhnQaB27Hy3W1BBRfVOH/dSXBZPdIueqaOM N+sjBl4r6KzhmacJHX1lqA45peETOpKsmbwRtrlHOSbWZuIn+uajSmMKsIFB5mf9kUv1 eoDdQRIcMf64omvhO/q+ccZSi0Nat6MY6p6/j+Q1V1gj13e+Ysx6aLNg2w3W9dzbbV3L 0xnIWHT+1GPe20AMJgeTNj+lxHdBQkeyYUAPJ4VvAk5RrXAvEOBNb6Q+0Ospcnk+CR7W lgBDUMuKGjS6zv6vrFyV04WYeyHvR4ez9ly4+kjlC2zSo42/ee/ZGnEDZb0W7XfhMRM7 m1uQ== X-Gm-Message-State: ALoCoQktYCmmjLZErWRhmY/K96AEvt2tBehXPJDTZnLgggnHe9m7Q3XvT67PJS6jbYsXKrgBC8iN 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 X-Google-Original-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-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, 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 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;