From patchwork Tue Feb 12 07:25:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10807497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBD7713A4 for ; Tue, 12 Feb 2019 07:29:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1B562A7E4 for ; Tue, 12 Feb 2019 07:29:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F9C82A812; Tue, 12 Feb 2019 07:29:01 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 364AA2A7E4 for ; Tue, 12 Feb 2019 07:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IjNYlB4Uuoswm8AI3x2ZvVyZRgr20DVtKzRcyy1u/u8=; b=Bv1R/8DMxLvz7N 2Asw3NDQfv1vPjd/WCX2shOx4CHF7azrMNqVzfbLcwDCqQiFp+NcJTY+4kvXq2Xu1KKLY65WfPXEy RpZIOuHpdLWPPecWsf4sdWfTuLLkeM5fmQBUyDlucZhwbDCwt2ey041t1ijrVCJlU9Unx4BT44jSg sp4AliaFG6hWD6zzugztrzHYdEgScgm2YOQQD7OsvCkGyndvLwXwQCQe199IXWpRZ7e7LiQ4RcAQ8 BiSqk2Mzvk1LS2AdG6RTKVB+WnxLm/6KeaOrNkuUXg6SScglX1+6uXzxpwapZsPMNf7htIqp0xF8n DZ3wzLEKl2yrligMplEw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtSUv-0005kD-9O; Tue, 12 Feb 2019 07:28:53 +0000 Received: from 089144210182.atnat0019.highway.a1.net ([89.144.210.182] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtSSB-0002rI-FU; Tue, 12 Feb 2019 07:26:03 +0000 From: Christoph Hellwig To: Ulf Hansson Subject: [PATCH 12/14] mmc: sh_mmcif: handle chained sglists Date: Tue, 12 Feb 2019 08:25:26 +0100 Message-Id: <20190212072528.13167-13-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190212072528.13167-1-hch@lst.de> References: <20190212072528.13167-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aaro Koskinen , Nicolas Pitre , linux-mmc@vger.kernel.org, Russell King , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Ben Dooks , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use the proper sg_next() helper to move to the next scatterlist element to support chained scatterlists. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/sh_mmcif.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 24c3f13bafdb..9e59dbe6ef30 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -234,7 +234,6 @@ struct sh_mmcif_host { enum sh_mmcif_wait_for wait_for; struct delayed_work timeout_work; size_t blocksize; - int sg_idx; int sg_blkidx; bool power; bool ccs_enable; /* Command Completion Signal support */ @@ -606,13 +605,13 @@ static bool sh_mmcif_next_block(struct sh_mmcif_host *host) if (host->sg_blkidx == data->sg->length) { host->sg_blkidx = 0; - if (++host->sg_idx < data->sg_len) { - data->sg++; - host->pio_offset = data->sg->offset / 4; - } + data->sg = sg_next(data->sg); + if (!data->sg) + return false; + host->pio_offset = data->sg->offset / 4; } - return host->sg_idx != data->sg_len; + return true; } static void sh_mmcif_single_read(struct sh_mmcif_host *host, @@ -665,7 +664,6 @@ static void sh_mmcif_multi_read(struct sh_mmcif_host *host, BLOCK_SIZE_MASK; host->wait_for = MMCIF_WAIT_FOR_MREAD; - host->sg_idx = 0; host->sg_blkidx = 0; host->pio_offset = data->sg->offset / 4; @@ -752,7 +750,6 @@ static void sh_mmcif_multi_write(struct sh_mmcif_host *host, BLOCK_SIZE_MASK; host->wait_for = MMCIF_WAIT_FOR_MWRITE; - host->sg_idx = 0; host->sg_blkidx = 0; host->pio_offset = data->sg->offset / 4;