* [PATCH] mtd: spi-nor: cadence-quadspi: Use proper enum for dma_unmap_single @ 2018-09-21 10:29 Nathan Chancellor 2018-09-25 7:24 ` Tudor Ambarus 2018-09-25 7:32 ` [PATCH v2] " Nathan Chancellor 0 siblings, 2 replies; 5+ messages in thread From: Nathan Chancellor @ 2018-09-21 10:29 UTC (permalink / raw) To: Marek Vasut, David Woodhouse, Brian Norris, Boris Brezillon Cc: Richard Weinberger, linux-mtd, linux-kernel, Nathan Chancellor 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 <natechancellor@gmail.com> --- 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); return 0; } -- 2.19.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spi-nor: cadence-quadspi: Use proper enum for dma_unmap_single 2018-09-21 10:29 [PATCH] mtd: spi-nor: cadence-quadspi: Use proper enum for dma_unmap_single Nathan Chancellor @ 2018-09-25 7:24 ` Tudor Ambarus 2018-09-25 7:34 ` Nathan Chancellor 2018-09-25 7:32 ` [PATCH v2] " Nathan Chancellor 1 sibling, 1 reply; 5+ messages in thread From: Tudor Ambarus @ 2018-09-25 7:24 UTC (permalink / raw) To: Nathan Chancellor, Marek Vasut, David Woodhouse, Brian Norris, Boris Brezillon Cc: Richard Weinberger, linux-mtd, linux-kernel 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 <natechancellor@gmail.com> > --- > 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spi-nor: cadence-quadspi: Use proper enum for dma_unmap_single 2018-09-25 7:24 ` Tudor Ambarus @ 2018-09-25 7:34 ` Nathan Chancellor 2018-09-25 8:18 ` Tudor Ambarus 0 siblings, 1 reply; 5+ messages in thread From: Nathan Chancellor @ 2018-09-25 7:34 UTC (permalink / raw) To: Tudor Ambarus Cc: Marek Vasut, David Woodhouse, Brian Norris, Boris Brezillon, Richard Weinberger, linux-mtd, linux-kernel 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 <natechancellor@gmail.com> > > --- > > 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! Nathan ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spi-nor: cadence-quadspi: Use proper enum for dma_unmap_single 2018-09-25 7:34 ` Nathan Chancellor @ 2018-09-25 8:18 ` Tudor Ambarus 0 siblings, 0 replies; 5+ messages in thread From: Tudor Ambarus @ 2018-09-25 8:18 UTC (permalink / raw) To: Nathan Chancellor Cc: Marek Vasut, David Woodhouse, Brian Norris, Boris Brezillon, Richard Weinberger, linux-mtd, linux-kernel 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 <natechancellor@gmail.com> >>> --- >>> 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 <tudor.ambarus@microchip.com> for v2! :) Best, ta ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] mtd: spi-nor: cadence-quadspi: Use proper enum for dma_unmap_single 2018-09-21 10:29 [PATCH] mtd: spi-nor: cadence-quadspi: Use proper enum for dma_unmap_single Nathan Chancellor 2018-09-25 7:24 ` Tudor Ambarus @ 2018-09-25 7:32 ` Nathan Chancellor 1 sibling, 0 replies; 5+ messages in thread From: Nathan Chancellor @ 2018-09-25 7:32 UTC (permalink / raw) To: Marek Vasut, David Woodhouse, Brian Norris, Boris Brezillon Cc: Richard Weinberger, linux-mtd, linux-kernel, Nathan Chancellor 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_FROM_DEVICE = DMA_DEV_TO_MEM = 2 Link: https://github.com/ClangBuiltLinux/linux/issues/108 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> --- v1 -> v2: * Fix second half of patch (previously incorrectly used DMA_TO_DEVICE), thanks to Tudor Ambarus for catching this. 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..e24db817154e 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_FROM_DEVICE); return 0; } -- 2.19.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-09-25 8:18 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-09-21 10:29 [PATCH] mtd: spi-nor: cadence-quadspi: Use proper enum for dma_unmap_single Nathan Chancellor 2018-09-25 7:24 ` Tudor Ambarus 2018-09-25 7:34 ` Nathan Chancellor 2018-09-25 8:18 ` Tudor Ambarus 2018-09-25 7:32 ` [PATCH v2] " Nathan Chancellor
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).