From patchwork Wed Jan 17 16:28:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124862 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp108139lja; Wed, 17 Jan 2018 08:43:21 -0800 (PST) X-Google-Smtp-Source: ACJfBovs2qMYLwnc4q5dIh8oNbvYl05PAyUpuR4SyYGvbmSTC1kh/xqXWju0q2lxQw8PQijgvfge X-Received: by 10.84.218.194 with SMTP id g2mr28021275plm.147.1516207401330; Wed, 17 Jan 2018 08:43:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207401; cv=none; d=google.com; s=arc-20160816; b=wFwcJ4TlM+XG2FPrbgJo+dYi6rjwWVLQVaYfX3q9crlyYb903JNxBcq2lMjJxpZwcs cUjl3bNWcQj7KdC6mQeFCoVAB1JZCNIQKmvEObIUhRr+zUGVhnibgrG9Nk2pvi9YdTWR EnJhjY5sLIjUTxnGPhV4xR0JklteYYS673BmH6Hdhc5lae/Z0HaNZBSNXVFHV94FIxmU 8f+bpcCfR67LWM2s8E3DDacCIb8A5jCf6QsY/hIvdj3eWQKhCYwTfc9n53fgsj0THElg 1vCbjo8d1FwXLhXI6Z8FlinrOH7zH7H5Ufi/QBazSC2Mg9awabcJWxnOxSYqIiDXJzV9 ZQEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=LNiJLHYJVZ/J4SGc/4rEkIf4U/vWtxJJg3Uo3kjNZOw=; b=AefdyJ9Cf1L+VsIYMUvETAfQDODpARkkJZlAes6VxB+eHtj14pxXql2U6rT34rzntI aoo3bR0eP+DGlb1CO8RSA71L/AZCZ/VMQ7WwNZmgb7s+3kGrikoGLIC+HVXu80cIPe6D lJS0P7cgb4L2OVv8+RhkXPJpNMMeD/eAfhze2BgdlzfRzbxN7YnLcbeKl11Kzrk7HMfE wEoMyuxOZ18V7/JyJk5e6rk1rHD55uN2bUxg6WWmXvtdBN7bZIpv2hdpUdwDeEMbVXe5 NosQAd8d3JSSR4R4KxOjzPc6LTC7SL7HxNeMTdqtnvXqrLc6c/Vf1a6pC248L7KCi9CC hDmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Tq3gaccs; 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 s15si4153362pgf.99.2018.01.17.08.43.21; Wed, 17 Jan 2018 08:43:21 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Tq3gaccs; 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 S1754443AbeAQQmd (ORCPT + 28 others); Wed, 17 Jan 2018 11:42:33 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36685 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753813AbeAQQ3d (ORCPT ); Wed, 17 Jan 2018 11:29:33 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIL1014790; Thu, 18 Jan 2018 01:28:32 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIL1014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206512; bh=LNiJLHYJVZ/J4SGc/4rEkIf4U/vWtxJJg3Uo3kjNZOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tq3gaccs7R1PfCxMYa762qdlVl+jEre+WWVO3efhgSBhPuztE3GXQjwdaNDMxrZFR 69TSQh4GHb5q5qbQZHUhgkfRyhMksqR2F+a5czrEYYqrIegQES0rJ+QNdJeb+0z1Pi kw0Y41/mzqA3mqcczwYXtc+ariRHGo0Qx0xQlYaQviOcua3A6u5vH3lvY3cSAII4N+ lw5uEtXENoXiwpBALsSWXomoEZwvZEVX28N2IMskBhXr9HTSnYO62P2ZANJ9B8OK8E hrRD70srvQHImcWtWfJQ6pQeBHRLNhgC9h7BsCm1H8Ln8oxp5EqwtJAigq6LZ5hLs1 yN1ZnhHezboNg== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 15/16] mmc: tmio: clear force_pio flag before starting data transfer Date: Thu, 18 Jan 2018 01:28:15 +0900 Message-Id: <1516206496-16612-16-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, force_pio is cleared when the driver exits. Then, it resulted in clearing it in multiple places since MMC drivers in general have multiple exit points. tmio_mmc_reset_work - bails out on timeout tmio_process_mrq - error out when it cannot send a command tmio_mmc_finish_request - successful exit This is error-prone since we may miss to cover all bail-out points. To simplify the code, the data structure should be initialized just before used since we have a single entrance. force_pio is only used for data transfer, so tmio_mmc_start_data() will be a suitable place to clear this flag. Signed-off-by: Masahiro Yamada --- Changes in v3: - newly added Changes in v2: None drivers/mmc/host/tmio_mmc_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 731552a..494f0b3 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -278,7 +278,6 @@ static void tmio_mmc_reset_work(struct work_struct *work) host->cmd = NULL; host->data = NULL; - host->force_pio = false; spin_unlock_irqrestore(&host->lock, flags); @@ -759,6 +758,7 @@ static int tmio_mmc_start_data(struct tmio_mmc_host *host, tmio_mmc_init_sg(host, data); host->data = data; + host->force_pio = false; /* Set transfer length / blocksize */ sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz); @@ -850,7 +850,6 @@ static void tmio_process_mrq(struct tmio_mmc_host *host, return; fail: - host->force_pio = false; host->mrq = NULL; mrq->cmd->error = ret; mmc_request_done(host->mmc, mrq); @@ -900,7 +899,6 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host) if (host->cmd != mrq->sbc) { host->cmd = NULL; host->data = NULL; - host->force_pio = false; host->mrq = NULL; }