From 33b6885975ce376ff075362b7f0890326043111b Mon Sep 17 00:00:00 2001
From: =?utf8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
Date: Sat, 21 Aug 2021 10:50:21 +0200
Subject: [PATCH] generic: fix debloat dma-buf 5.10 patch
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

The current patch produces the following error when CONFIG_DMABUF_HEAPS is
enabled:
drivers/built-in.a: member drivers/dma-buf/heaps in archive is not an object

Fixes: b10d6044599d ("kernel: add linux 5.10 support")

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 .../generic/hack-5.10/904-debloat_dma_buf.patch    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/target/linux/generic/hack-5.10/904-debloat_dma_buf.patch b/target/linux/generic/hack-5.10/904-debloat_dma_buf.patch
index 4ed40bb63d..a447e6b813 100644
--- a/target/linux/generic/hack-5.10/904-debloat_dma_buf.patch
+++ b/target/linux/generic/hack-5.10/904-debloat_dma_buf.patch
@@ -22,6 +22,16 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	default n
  	select IRQ_WORK
  	help
+--- a/drivers/dma-buf/heaps/Makefile
++++ b/drivers/dma-buf/heaps/Makefile
+@@ -1,4 +1,4 @@
+ # SPDX-License-Identifier: GPL-2.0
+-obj-y					+= heap-helpers.o
+-obj-$(CONFIG_DMABUF_HEAPS_SYSTEM)	+= system_heap.o
+-obj-$(CONFIG_DMABUF_HEAPS_CMA)		+= cma_heap.o
++dma-buf-objs-y					+= heap-helpers.o
++dma-buf-objs-$(CONFIG_DMABUF_HEAPS_SYSTEM)	+= system_heap.o
++dma-buf-objs-$(CONFIG_DMABUF_HEAPS_CMA)		+= cma_heap.o
 --- a/drivers/dma-buf/Makefile
 +++ b/drivers/dma-buf/Makefile
 @@ -1,15 +1,19 @@
@@ -37,8 +47,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 -obj-$(CONFIG_SW_SYNC)		+= sw_sync.o sync_debug.o
 -obj-$(CONFIG_UDMABUF)		+= udmabuf.o
 +dma-buf-objs-$(CONFIG_DMABUF_HEAPS)	+= dma-heap.o
-+dma-buf-objs-$(CONFIG_DMABUF_HEAPS)	+= heaps/
-+dma-buf-objs-$(CONFIG_SYNC_FILE)		+= sync_file.o
++obj-$(CONFIG_DMABUF_HEAPS)		+= heaps/
++dma-buf-objs-$(CONFIG_SYNC_FILE)	+= sync_file.o
 +dma-buf-objs-$(CONFIG_SW_SYNC)		+= sw_sync.o sync_debug.o
 +dma-buf-objs-$(CONFIG_UDMABUF)		+= udmabuf.o
  
-- 
2.30.2