mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Denis Orlov <denorl2009@gmail.com>
To: barebox@lists.infradead.org
Cc: Denis Orlov <denorl2009@gmail.com>
Subject: [PATCH 4/4] MIPS: dma: simplify source structure
Date: Fri, 10 Feb 2023 17:47:45 +0300	[thread overview]
Message-ID: <20230210144745.915720-5-denorl2009@gmail.com> (raw)
In-Reply-To: <20230210144745.915720-1-denorl2009@gmail.com>

There is no reason to keep code from 'dma-mapping.h' in a separate file,
so merge it into 'dma.h'.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 arch/mips/include/asm/dma-mapping.h | 40 -----------------------------
 arch/mips/include/asm/dma.h         | 31 +++++++++++++++++++++-
 2 files changed, 30 insertions(+), 41 deletions(-)
 delete mode 100644 arch/mips/include/asm/dma-mapping.h

diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
deleted file mode 100644
index 9f6ec03e3b..0000000000
--- a/arch/mips/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef _ASM_DMA_MAPPING_H
-#define _ASM_DMA_MAPPING_H
-
-#include <common.h>
-#include <xfuncs.h>
-#include <asm/addrspace.h>
-#include <asm/types.h>
-#include <malloc.h>
-#include <asm/io.h>
-
-#define dma_alloc_coherent dma_alloc_coherent
-static inline void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle)
-{
-	void *ret;
-
-	ret = xmemalign(PAGE_SIZE, size);
-
-	memset(ret, 0, size);
-
-	if (dma_handle)
-		*dma_handle = CPHYSADDR(ret);
-
-	dma_flush_range((unsigned long)ret, (unsigned long)(ret + size));
-
-	return (void *)CKSEG1ADDR(ret);
-}
-
-#define dma_free_coherent dma_free_coherent
-static inline void dma_free_coherent(void *vaddr, dma_addr_t dma_handle,
-				     size_t size)
-{
-	if (IS_ENABLED(CONFIG_MMU) && vaddr)
-		free((void *)CKSEG0ADDR(vaddr));
-	else
-		free(vaddr);
-}
-
-#endif /* _ASM_DMA_MAPPING_H */
diff --git a/arch/mips/include/asm/dma.h b/arch/mips/include/asm/dma.h
index 49eeaac1a2..62d9c7c548 100644
--- a/arch/mips/include/asm/dma.h
+++ b/arch/mips/include/asm/dma.h
@@ -7,8 +7,12 @@
 #define __ASM_DMA_H
 
 #include <common.h>
+#include <malloc.h>
 #include <xfuncs.h>
+#include <asm/addrspace.h>
 #include <asm/cpu-info.h>
+#include <asm/io.h>
+#include <asm/types.h>
 
 #define dma_alloc dma_alloc
 static inline void *dma_alloc(size_t size)
@@ -18,6 +22,31 @@ static inline void *dma_alloc(size_t size)
 	return xmemalign(max_linesz, ALIGN(size, max_linesz));
 }
 
-#include "asm/dma-mapping.h"
+#define dma_alloc_coherent dma_alloc_coherent
+static inline void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle)
+{
+	void *ret;
+
+	ret = xmemalign(PAGE_SIZE, size);
+
+	memset(ret, 0, size);
+
+	if (dma_handle)
+		*dma_handle = CPHYSADDR(ret);
+
+	dma_flush_range((unsigned long)ret, (unsigned long)(ret + size));
+
+	return (void *)CKSEG1ADDR(ret);
+}
+
+#define dma_free_coherent dma_free_coherent
+static inline void dma_free_coherent(void *vaddr, dma_addr_t dma_handle,
+				     size_t size)
+{
+	if (IS_ENABLED(CONFIG_MMU) && vaddr)
+		free((void *)CKSEG0ADDR(vaddr));
+	else
+		free(vaddr);
+}
 
 #endif /* __ASM_DMA_H */
-- 
2.30.2




  parent reply	other threads:[~2023-02-10 14:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 14:47 [PATCH 0/4] MIPS: dma: random fixes and improvements Denis Orlov
2023-02-10 14:47 ` [PATCH 1/4] MIPS: dma: fix nullptr handling in dma_free_coherent Denis Orlov
2023-02-10 14:47 ` [PATCH 2/4] MIPS: dma: remove unnecessary ifdefs Denis Orlov
2023-02-10 14:47 ` [PATCH 3/4] MIPS: dma: add arch-specific dma_alloc() implementation Denis Orlov
2023-02-10 14:47 ` Denis Orlov [this message]
2023-02-13  9:02 ` [PATCH 0/4] MIPS: dma: random fixes and improvements Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230210144745.915720-5-denorl2009@gmail.com \
    --to=denorl2009@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox