diff mbox

PCI: Unify pci and normal dma direction definition

Message ID 1531463840-34651-1-git-send-email-shunyong.yang@hxt-semitech.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Shunyong Yang July 13, 2018, 6:37 a.m. UTC
Current DMA direction definitions in pci-dma-compat.h and dma-direction.h
are mirrored in value. Unify them to enhance readability and avoid
possible inconsistency.

Cc: Joey Zheng <yu.zheng@hxt-semitech.com>
Signed-off-by: Shunyong Yang <shunyong.yang@hxt-semitech.com>
---
 include/linux/dma-direction.h  | 2 +-
 include/linux/pci-dma-compat.h | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Christoph Hellwig July 17, 2018, 2:03 p.m. UTC | #1
> diff --git a/include/linux/dma-direction.h b/include/linux/dma-direction.h
> index 3649a031893a..9d52716e9218 100644
> --- a/include/linux/dma-direction.h
> +++ b/include/linux/dma-direction.h
> @@ -2,7 +2,7 @@
>  #ifndef _LINUX_DMA_DIRECTION_H
>  #define _LINUX_DMA_DIRECTION_H
>  /*
> - * These definitions mirror those in pci.h, so they can be used
> + * These definitions mirror those in pci-dma-compat.h, so they can be used
>   * interchangeably with their PCI_ counterparts.
>   */

I think we can just drop this comment anymore.

> +#define PCI_DMA_BIDIRECTIONAL	(DMA_BIDIRECTIONAL)
> +#define PCI_DMA_TODEVICE	(DMA_TO_DEVICE)
> +#define PCI_DMA_FROMDEVICE	(DMA_FROM_DEVICE)
> +#define PCI_DMA_NONE		(DMA_NONE)

No need for the braces.
Shunyong Yang July 18, 2018, 12:45 a.m. UTC | #2
Hi, Christoph,

  I will send a v2 according to your comments.

Thanks.
Shunyong.

On Tue, 2018-07-17 at 07:03 -0700, Christoph Hellwig wrote:
> > 
> > diff --git a/include/linux/dma-direction.h b/include/linux/dma-
> > direction.h
> > index 3649a031893a..9d52716e9218 100644
> > --- a/include/linux/dma-direction.h
> > +++ b/include/linux/dma-direction.h
> > @@ -2,7 +2,7 @@
> >  #ifndef _LINUX_DMA_DIRECTION_H
> >  #define _LINUX_DMA_DIRECTION_H
> >  /*
> > - * These definitions mirror those in pci.h, so they can be used
> > + * These definitions mirror those in pci-dma-compat.h, so they can
> > be used
> >   * interchangeably with their PCI_ counterparts.
> >   */
> I think we can just drop this comment anymore.
> 
> > 
> > +#define PCI_DMA_BIDIRECTIONAL	(DMA_BIDIRECTIONAL)
> > +#define PCI_DMA_TODEVICE	(DMA_TO_DEVICE)
> > +#define PCI_DMA_FROMDEVICE	(DMA_FROM_DEVICE)
> > +#define PCI_DMA_NONE		(DMA_NONE)
> No need for the braces.
diff mbox

Patch

diff --git a/include/linux/dma-direction.h b/include/linux/dma-direction.h
index 3649a031893a..9d52716e9218 100644
--- a/include/linux/dma-direction.h
+++ b/include/linux/dma-direction.h
@@ -2,7 +2,7 @@ 
 #ifndef _LINUX_DMA_DIRECTION_H
 #define _LINUX_DMA_DIRECTION_H
 /*
- * These definitions mirror those in pci.h, so they can be used
+ * These definitions mirror those in pci-dma-compat.h, so they can be used
  * interchangeably with their PCI_ counterparts.
  */
 enum dma_data_direction {
diff --git a/include/linux/pci-dma-compat.h b/include/linux/pci-dma-compat.h
index 0dd1a3f7b309..c1c8d49b6072 100644
--- a/include/linux/pci-dma-compat.h
+++ b/include/linux/pci-dma-compat.h
@@ -8,10 +8,10 @@ 
 #include <linux/dma-mapping.h>
 
 /* This defines the direction arg to the DMA mapping routines. */
-#define PCI_DMA_BIDIRECTIONAL	0
-#define PCI_DMA_TODEVICE	1
-#define PCI_DMA_FROMDEVICE	2
-#define PCI_DMA_NONE		3
+#define PCI_DMA_BIDIRECTIONAL	(DMA_BIDIRECTIONAL)
+#define PCI_DMA_TODEVICE	(DMA_TO_DEVICE)
+#define PCI_DMA_FROMDEVICE	(DMA_FROM_DEVICE)
+#define PCI_DMA_NONE		(DMA_NONE)
 
 static inline void *
 pci_alloc_consistent(struct pci_dev *hwdev, size_t size,