Patchwork [02/10] x86: add data structures for DMA-API debugging

login
register
mail settings
Submitter Joerg Roedel
Date Nov. 21, 2008, 4:26 p.m.
Message ID <1227284770-19215-3-git-send-email-joerg.roedel@amd.com>
Download mbox | patch
Permalink /patch/10044/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Joerg Roedel - Nov. 21, 2008, 4:26 p.m.
Impact: adds a new header file for DMA-API debugging

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/include/asm/dma_debug.h |   41 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/include/asm/dma_debug.h
Ingo Molnar - Nov. 21, 2008, 4:42 p.m.
* Joerg Roedel <joerg.roedel@amd.com> wrote:

> +#ifndef __ASM_X86_DMA_DEBUG
> +#define __ASM_X86_DMA_DEBUG
> +
> +/* Allocation flags */
> +#define DMA_DEBUG_SINGLE        0
> +#define DMA_DEBUG_SG            1
> +#define DMA_DEBUG_COHERENT      2

please use enum for such internal flags, not define.

> +
> +struct device;
> +struct list_head;
> +
> +struct dma_debug_entry {
> +	struct list_head list;
> +	struct device *dev;
> +	int type;
> +	void *cpu_addr;
> +	u64 dev_addr;
> +	u64 size;
> +	int direction;
> +};

please align new x86/include structures vertically like this:

> +struct dma_debug_entry {
> +	struct list_head	list;
> +	struct device		*dev;
> +	int			type;
> +	void			*cpu_addr;
> +	u64			dev_addr;
> +	u64			size;
> +	int			direction;
> +};

[ for the arts major students reading lkml ;-) ]

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joerg Roedel - Nov. 21, 2008, 4:49 p.m.
On Fri, Nov 21, 2008 at 05:42:54PM +0100, Ingo Molnar wrote:
> 
> * Joerg Roedel <joerg.roedel@amd.com> wrote:
> 
> > +#ifndef __ASM_X86_DMA_DEBUG
> > +#define __ASM_X86_DMA_DEBUG
> > +
> > +/* Allocation flags */
> > +#define DMA_DEBUG_SINGLE        0
> > +#define DMA_DEBUG_SG            1
> > +#define DMA_DEBUG_COHERENT      2
> 
> please use enum for such internal flags, not define.
> 
> > +
> > +struct device;
> > +struct list_head;
> > +
> > +struct dma_debug_entry {
> > +	struct list_head list;
> > +	struct device *dev;
> > +	int type;
> > +	void *cpu_addr;
> > +	u64 dev_addr;
> > +	u64 size;
> > +	int direction;
> > +};
> 
> please align new x86/include structures vertically like this:
> 
> > +struct dma_debug_entry {
> > +	struct list_head	list;
> > +	struct device		*dev;
> > +	int			type;
> > +	void			*cpu_addr;
> > +	u64			dev_addr;
> > +	u64			size;
> > +	int			direction;
> > +};
> 
> [ for the arts major students reading lkml ;-) ]

Ok, I will update the patch :)

Joerg

Patch

diff --git a/arch/x86/include/asm/dma_debug.h b/arch/x86/include/asm/dma_debug.h
new file mode 100644
index 0000000..d79f024
--- /dev/null
+++ b/arch/x86/include/asm/dma_debug.h
@@ -0,0 +1,41 @@ 
+/*
+ * Copyright (C) 2008 Advanced Micro Devices, Inc.
+ *
+ * Author: Joerg Roedel <joerg.roedel@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#ifndef __ASM_X86_DMA_DEBUG
+#define __ASM_X86_DMA_DEBUG
+
+/* Allocation flags */
+#define DMA_DEBUG_SINGLE        0
+#define DMA_DEBUG_SG            1
+#define DMA_DEBUG_COHERENT      2
+
+struct device;
+struct list_head;
+
+struct dma_debug_entry {
+	struct list_head list;
+	struct device *dev;
+	int type;
+	void *cpu_addr;
+	u64 dev_addr;
+	u64 size;
+	int direction;
+};
+
+#endif /* __ASM_X86_DMA_DEBUG */