From patchwork Fri Mar 4 10:25:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 313 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:41:39 -0000 Delivered-To: patches@linaro.org Received: by 10.224.60.68 with SMTP id o4cs9848qah; Fri, 4 Mar 2011 02:25:29 -0800 (PST) Received: by 10.224.76.76 with SMTP id b12mr324290qak.330.1299234329268; Fri, 04 Mar 2011 02:25:29 -0800 (PST) Received: from mail-qy0-f178.google.com (mail-qy0-f178.google.com [209.85.216.178]) by mx.google.com with ESMTPS id 12si4099909qcd.178.2011.03.04.02.25.29 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2011 02:25:29 -0800 (PST) Received-SPF: neutral (google.com: 209.85.216.178 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.216.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.216.178 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) smtp.mail=linus.walleij@linaro.org Received: by qyk2 with SMTP id 2so1909825qyk.16 for ; Fri, 04 Mar 2011 02:25:29 -0800 (PST) MIME-Version: 1.0 Received: by 10.224.11.20 with SMTP id r20mr284773qar.384.1299234329078; Fri, 04 Mar 2011 02:25:29 -0800 (PST) Received: by 10.224.28.201 with HTTP; Fri, 4 Mar 2011 02:25:29 -0800 (PST) In-Reply-To: <1297350496-1263-1-git-send-email-linus.walleij@linaro.org> References: <1297350496-1263-1-git-send-email-linus.walleij@linaro.org> Date: Fri, 4 Mar 2011 11:25:29 +0100 Message-ID: Subject: Fwd: [PATCH 02/11] atmel-mci: conform to DMA-API From: Linus Walleij To: Patch Tracking ---------- Forwarded message ---------- From: Linus Walleij Date: Thu, Feb 10, 2011 at 4:08 PM Subject: [PATCH 02/11] atmel-mci: conform to DMA-API To: linux-mmc@vger.kernel.org, Chris Ball Cc: Dan Williams , Nicolas Ferre , Linus Walleij Fixes the following: - It is perfectly legal for the dma_map_sg() to return fewer  entries than were passed in. - Supply the returned numer of (possibly coalesced) entries to  the device_pre_slave_sg() function. - Use the proper original sg_len when unmapping the sglist  in the error path. Signed-off-by: Linus Walleij ---  drivers/mmc/host/atmel-mci.c |    7 +++----  1 files changed, 3 insertions(+), 4 deletions(-)                goto unmap_exit; @@ -701,7 +700,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)        return 0;  unmap_exit: -       dma_unmap_sg(chan->device->dev, data->sg, sglen, direction); +       dma_unmap_sg(chan->device->dev, data->sg, data->sg_len, direction);        return -ENOMEM;  } -- 1.7.4 diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 045bdbb..df5a135 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -687,10 +687,9 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)        sglen = dma_map_sg(chan->device->dev, data->sg,                           data->sg_len, direction); -       if (sglen != data->sg_len) -               goto unmap_exit; +        desc = chan->device->device_prep_slave_sg(chan, -                       data->sg, data->sg_len, direction, +                       data->sg, sglen, direction,                        DMA_PREP_INTERRUPT | DMA_CTRL_ACK);        if (!desc)