From patchwork Tue Sep 6 02:55:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "(Exiting) Baolin Wang" X-Patchwork-Id: 9315425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DBEBD60869 for ; Tue, 6 Sep 2016 02:59:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D15D528B17 for ; Tue, 6 Sep 2016 02:59:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5C8628B19; Tue, 6 Sep 2016 02:59:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 261D128B18 for ; Tue, 6 Sep 2016 02:59:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755360AbcIFC5T (ORCPT ); Mon, 5 Sep 2016 22:57:19 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:34604 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753550AbcIFCz5 (ORCPT ); Mon, 5 Sep 2016 22:55:57 -0400 Received: by mail-pf0-f182.google.com with SMTP id p64so69289719pfb.1 for ; Mon, 05 Sep 2016 19:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=wNVaTE6I5Idb8ICfq2Fbrqp4r706cfdiC+k7CdAhfEA=; b=XJbtsTZnUObxAUor6uoMjmN5kHKwOPXZ5vwtaSnq1MZuipRzi2SAlEDdUW7Ua7GYEj LsErnSzZVcF6xlCBqbS48nH2DrucIXbnFI99v0QtVvZtbO/2DDNBSOJm1ldfdYVxTYF9 NRX1IcLnQE8CiLwsTtc1Cnn/ku0qccPW0MhP0= 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; bh=wNVaTE6I5Idb8ICfq2Fbrqp4r706cfdiC+k7CdAhfEA=; b=hXsT3XudUOOC1GdmWWsEtMpm7nFyDiJS7Q37F/vclVCn0Micca+/tnnx4scwSZNavs EQtFX8QRczzJ7Xn/97Yo+T4RbhVZ2hYQ3Vec1pYMJXBdC2CrbjTLYiI8PWbqo8thr6PL rE0isV+DfshLs3gDkoT6q195zwe6SByA4ocQQVofdqLBuWNGjTKjMc5HQd6NcN7CLkab hcvkieFU4pdj5+hqkFBveToQfnkMPFuUO9uT2BVWa7MtJbX6crIjzd0e6IZ4NJ3fpg/3 ld8mr4fLZXBwfpv/IJYLxu3oqdMqONP5INtVLzGB99HCWeVbDCYIQmkHCHS4XwOxuxB4 L5MA== X-Gm-Message-State: AE9vXwMt9zqtmqTK/sUCmDSk3D241KzzjT2pxyFSAhlNQg2u1/FD+7I4mc/215xUEeG4KtnQ X-Received: by 10.98.145.18 with SMTP id l18mr35465691pfe.18.1473130556436; Mon, 05 Sep 2016 19:55:56 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id g15sm139102pfa.48.2016.09.05.19.55.52 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Sep 2016 19:55:55 -0700 (PDT) From: Baolin Wang To: ulf.hansson@linaro.org Cc: adrian.hunter@intel.com, rmk+kernel@arm.linux.org.uk, shawn.lin@rock-chips.com, dianders@chromium.org, heiko@sntech.de, david@protonic.nl, hdegoede@redhat.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, broonie@kernel.org, linus.walleij@linaro.org, baolin.wang@linaro.org Subject: [PATCH v4 1/3] mmc: core: Remove some redundant validations in mmc_erase() function Date: Tue, 6 Sep 2016 10:55:10 +0800 Message-Id: <2b6b5b930d0f37a219d5786a6b56b17516a90abd.1473130123.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Before issuing mmc_erase() function, users always have checked if it can erase with mmc_can_erase/trim/discard() function, thus remove the redundant erase checking in mmc_erase() function. Signed-off-by: Baolin Wang Tested-by: Shawn Lin --- Changes since v3: - Split into 3 separate patches. - Add test tag by Shawn. Changes since v2: - Add nr checking and other optimization in mmc_erase() function. Changes since v1: - Add the alignment if card->erase_size is not power of 2. --- drivers/mmc/core/core.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index e55cde6..7d7209d 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2217,13 +2217,6 @@ int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr, unsigned int rem, to = from + nr; int err; - if (!(card->host->caps & MMC_CAP_ERASE) || - !(card->csd.cmdclass & CCC_ERASE)) - return -EOPNOTSUPP; - - if (!card->erase_size) - return -EOPNOTSUPP; - if (mmc_card_sd(card) && arg != MMC_ERASE_ARG) return -EOPNOTSUPP;