From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 360F9C43382 for ; Tue, 25 Sep 2018 08:18:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E68AA21480 for ; Tue, 25 Sep 2018 08:18:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E68AA21480 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728240AbeIYOYx (ORCPT ); Tue, 25 Sep 2018 10:24:53 -0400 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:16525 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbeIYOYw (ORCPT ); Tue, 25 Sep 2018 10:24:52 -0400 X-IronPort-AV: E=Sophos;i="5.54,301,1534834800"; d="scan'208";a="17720714" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 25 Sep 2018 01:18:29 -0700 Received: from localhost.localdomain (10.10.76.4) by chn-sv-exch07.mchp-main.com (10.10.76.108) with Microsoft SMTP Server id 14.3.352.0; Tue, 25 Sep 2018 01:18:28 -0700 Subject: Re: [PATCH] mtd: spi-nor: cadence-quadspi: Use proper enum for dma_unmap_single To: Nathan Chancellor CC: Marek Vasut , David Woodhouse , Brian Norris , Boris Brezillon , Richard Weinberger , , References: <20180921102944.27968-1-natechancellor@gmail.com> <5e1d2e30-764f-f3a9-d0c1-7a6c81f296b7@microchip.com> <20180925073438.GA24068@flashbox> From: Tudor Ambarus Message-ID: <7afdc8a3-61e9-2c06-1ecf-ab62a2466f5e@microchip.com> Date: Tue, 25 Sep 2018 11:18:16 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20180925073438.GA24068@flashbox> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/25/2018 10:34 AM, Nathan Chancellor wrote: > On Tue, Sep 25, 2018 at 10:24:04AM +0300, Tudor Ambarus wrote: >> Hi, Nathan, >> >> On 09/21/2018 01:29 PM, Nathan Chancellor wrote: >>> Clang warns when one enumerated type is converted implicitly to another. >>> >>> drivers/mtd/spi-nor/cadence-quadspi.c:962:47: warning: implicit >>> conversion from enumeration type 'enum dma_transfer_direction' to >>> different enumeration type 'enum dma_data_direction' [-Wenum-conversion] >>> dma_dst = dma_map_single(nor->dev, buf, len, DMA_DEV_TO_MEM); >>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ >>> ./include/linux/dma-mapping.h:428:66: note: expanded from macro >>> 'dma_map_single' >>> #define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, 0) >>> ~~~~~~~~~~~~~~~~~~~~ ^ >>> drivers/mtd/spi-nor/cadence-quadspi.c:997:43: warning: implicit >>> conversion from enumeration type 'enum dma_transfer_direction' to >>> different enumeration type 'enum dma_data_direction' [-Wenum-conversion] >>> dma_unmap_single(nor->dev, dma_dst, len, DMA_DEV_TO_MEM); >>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ >>> ./include/linux/dma-mapping.h:429:70: note: expanded from macro >>> 'dma_unmap_single' >>> #define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, 0) >>> ~~~~~~~~~~~~~~~~~~~~~~ ^ >>> 2 warnings generated. >>> >>> Use the proper enums from dma_data_direction to satisfy Clang. >>> >>> DMA_TO_DEVICE = DMA_MEM_TO_DEV = 1 >>> DMA_FROM_DEVICE = DMA_DEV_TO_MEM = 2 >>> >>> Link: https://github.com/ClangBuiltLinux/linux/issues/108 >>> Signed-off-by: Nathan Chancellor >>> --- >>> drivers/mtd/spi-nor/cadence-quadspi.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c >>> index 8e714fbfa521..d0e57ac81098 100644 >>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c >>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c >>> @@ -959,7 +959,7 @@ static int cqspi_direct_read_execute(struct spi_nor *nor, u_char *buf, >>> return 0; >>> } >>> >>> - dma_dst = dma_map_single(nor->dev, buf, len, DMA_DEV_TO_MEM); >>> + dma_dst = dma_map_single(nor->dev, buf, len, DMA_FROM_DEVICE); >>> if (dma_mapping_error(nor->dev, dma_dst)) { >>> dev_err(nor->dev, "dma mapping failed\n"); >>> return -ENOMEM; >>> @@ -994,7 +994,7 @@ static int cqspi_direct_read_execute(struct spi_nor *nor, u_char *buf, >>> } >>> >>> err_unmap: >>> - dma_unmap_single(nor->dev, dma_dst, len, DMA_DEV_TO_MEM); >>> + dma_unmap_single(nor->dev, dma_dst, len, DMA_TO_DEVICE); >> >> Should have used DMA_FROM_DEVICE, as you did above. Otherwise looks good. >> >> Cheers, >> ta > > Thank you very much for catching this, did several of these conversions > back to back and didn't look closely at this. I just sent a v2, I > appreciate the review! I guess I have some problems with my email server. I receive just some of the emails sent to linux-mtd@lists.infradead.org. I haven't received your v2 and I can't add my Reviewed-by tag there. But I checked v2 on https://patchwork.ozlabs.org/patch/974269/, looks good, so: Reviewed-by: Tudor Ambarus for v2! :) Best, ta