Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1239570imm; Tue, 2 Oct 2018 05:14:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV624M2X26jlYzZNoQChCA1NiQMxu9iUWotnpNgb0WannYSx6faLI7hK0qQy96xzAxZQo+u9l X-Received: by 2002:a17:902:6546:: with SMTP id d6-v6mr16427566pln.139.1538482480373; Tue, 02 Oct 2018 05:14:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538482480; cv=none; d=google.com; s=arc-20160816; b=TVVHfxZ+RmmRaNU12GlKxcTYcV6z/0DIltHZW6EH60oGdpWdb4E9gWU+P7dM1VWtXF DlQneCUYuGu7unGwhr+TYJEDNgbWRmMryoPlRSRy98R6v5gFH7L1UbFyvU2aTIUZ3t8L FwlcN6vaAwMOv8dIvi6KBf8Nh6OVwRQoOipdq7cVRMuJ0LL066xowEByx/z3MQASmyUh lKwb8Q9PHejU3ayc3reYtpqMqoMIFoGnkV+qHcmBLxh91R4T6iOPMEkUe1/aFlhGkkOp u8ZjfC/DZYhd1FEBKz3MTp71z7hGhLFKeTjWSIUBiNsnFLUBKoWiEdccWrZ3hOnV5b4y HSoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=1aWbSzPD2T85/OjYRCVivpkz3B0yili8tFGTZ5e1d54=; b=IEFEBVVdt5UQAhpEUe3/ABAxDO1u79rrg/9I+jrkqZDTLA09KG7sQWHf6NTwU7cseU rOFtBL4sH5JotJqCv0eXlkmND8LmOLnUMiCKSiqRnLL6QipzpVjEZnXyEYg1krkXnLMf 3OKsP6KA2ky9V9V8Zm617o5K0/AaL51NQ8elplogo2Xl6BMu3SQNPnxvTWR8IOwIB78a yUM/buCnHZWCUEIHnj6lFh0vRCkHc+tnfe8QRAMEWuGdfIK4Lb+YsZg0zaWJnwtfXi7Q BLrYPToXI7WwO89R48ZpG5FI0/L6ydl9FZENV1V5pWqUCKGcPYOp2qs2KtnO2YNk8rkM XA0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v129-v6si14094254pgv.504.2018.10.02.05.14.25; Tue, 02 Oct 2018 05:14:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728388AbeJBSz0 (ORCPT + 99 others); Tue, 2 Oct 2018 14:55:26 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:51319 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727562AbeJBSxE (ORCPT ); Tue, 2 Oct 2018 14:53:04 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w92C8egV013766; Tue, 2 Oct 2018 14:09:54 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2msxh6gskx-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 02 Oct 2018 14:09:54 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D2B3234; Tue, 2 Oct 2018 12:09:53 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B7F902A3B; Tue, 2 Oct 2018 12:09:53 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 2 Oct 2018 14:09:53 +0200 Received: from lmecxl0923.lme.st.com (10.48.0.237) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 2 Oct 2018 14:09:53 +0200 From: Ludovic Barre To: Ulf Hansson , Rob Herring CC: Maxime Coquelin , Alexandre Torgue , , Gerald Baeza , Loic Pallardy , , , , , , Ludovic Barre Subject: [PATCH V4 11/25] mmc: mmci: add validate_data callback Date: Tue, 2 Oct 2018 14:09:13 +0200 Message-ID: <1538482167-13819-12-git-send-email-ludovic.Barre@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538482167-13819-1-git-send-email-ludovic.Barre@st.com> References: <1538482167-13819-1-git-send-email-ludovic.Barre@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.48.0.237] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-02_03:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ludovic Barre This patch adds validate_data callback at mmci_host_ops to check specific constraints of variant. Move mmci_validate_data function to regroup mmci_host_ops interfaces. Signed-off-by: Ludovic Barre --- drivers/mmc/host/mmci.c | 39 +++++++++++++++++++++------------------ drivers/mmc/host/mmci.h | 1 + 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 1835d77..c8fdb24 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -233,24 +233,6 @@ static int mmci_card_busy(struct mmc_host *mmc) return busy; } -/* - * Validate mmc prerequisites - */ -static int mmci_validate_data(struct mmci_host *host, - struct mmc_data *data) -{ - if (!data) - return 0; - - if (!is_power_of_2(data->blksz)) { - dev_err(mmc_dev(host->mmc), - "unsupported block size (%d bytes)\n", data->blksz); - return -EINVAL; - } - - return 0; -} - static void mmci_reg_delay(struct mmci_host *host) { /* @@ -384,6 +366,27 @@ void mmci_dma_release(struct mmci_host *host) host->ops->dma_release(host); } +/* + * Validate mmc prerequisites + */ +static int mmci_validate_data(struct mmci_host *host, + struct mmc_data *data) +{ + if (!data) + return 0; + + if (!is_power_of_2(data->blksz)) { + dev_err(mmc_dev(host->mmc), + "unsupported block size (%d bytes)\n", data->blksz); + return -EINVAL; + } + + if (host->ops && host->ops->validate_data) + return host->ops->validate_data(host, data); + + return 0; +} + int mmci_prep_data(struct mmci_host *host, struct mmc_data *data, bool next) { int err; diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 2c9e679..9e701d8 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -273,6 +273,7 @@ struct variant_data { /* mmci variant callbacks */ struct mmci_host_ops { + int (*validate_data)(struct mmci_host *host, struct mmc_data *data); int (*prep_data)(struct mmci_host *host, struct mmc_data *data, bool next); void (*unprep_data)(struct mmci_host *host, struct mmc_data *data, -- 2.7.4