commit:     fc1f0be76ad80dfd8563061a9086e5c3dff65440
Author:     Sebastian Engel <sighunter <AT> gmx <DOT> de>
AuthorDate: Wed Nov 20 10:12:34 2024 +0000
Commit:     David Roman <davidroman96 <AT> gmail <DOT> com>
CommitDate: Wed Nov 20 10:25:16 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=fc1f0be7

games-util/xone: Add a patch to fix building with kernels 6.12 and newer

Signed-off-by: Sebastian Engel <sighunter <AT> gmx.de>

 .../files/xone-0.3_p20240425-kernel_6.12.patch     | 74 ++++++++++++++++++++++
 games-util/xone/xone-0.3_p20240425.ebuild          |  3 +-
 2 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/games-util/xone/files/xone-0.3_p20240425-kernel_6.12.patch 
b/games-util/xone/files/xone-0.3_p20240425-kernel_6.12.patch
new file mode 100644
index 000000000..ee7175a9b
--- /dev/null
+++ b/games-util/xone/files/xone-0.3_p20240425-kernel_6.12.patch
@@ -0,0 +1,74 @@
+From d88ea1e8b430d4b96134e43ca1892ac48334578e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Torleif=20Sk=C3=A5r?=
+ <[email protected]>
+Date: Mon, 30 Sep 2024 21:07:13 +0200
+Subject: [PATCH] fix: build on kernel v6.12
+
+Upstream "Drop of obsoloted vmalloc PCM buffer helper API";
+https://lore.kernel.org/all/[email protected]/
+
+Code taken from the driver;
+https://lore.kernel.org/all/[email protected]/
+---
+ driver/headset.c | 30 ++++++++++++++++++++++++++----
+ 1 file changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/driver/headset.c b/driver/headset.c
+index ebee92d..c736351 100644
+--- a/driver/headset.c
++++ b/driver/headset.c
+@@ -5,6 +5,7 @@
+ 
+ #include <linux/module.h>
+ #include <linux/hrtimer.h>
++#include <linux/vmalloc.h>
+ #include <sound/core.h>
+ #include <sound/initval.h>
+ #include <sound/pcm.h>
+@@ -90,13 +91,34 @@ static int gip_headset_pcm_close(struct snd_pcm_substream 
*sub)
+ static int gip_headset_pcm_hw_params(struct snd_pcm_substream *sub,
+                                    struct snd_pcm_hw_params *params)
+ {
+-      return snd_pcm_lib_alloc_vmalloc_buffer(sub,
+-                                              params_buffer_bytes(params));
++      struct snd_pcm_runtime *runtime = sub->runtime;
++      size_t size = params_buffer_bytes(params);
++
++      if (runtime->dma_area) {
++              if (runtime->dma_bytes >= size)
++                      return 0; /* Already large enough */
++              vfree(runtime->dma_area);
++      }
++      runtime->dma_area = vzalloc(size);
++      if (!runtime->dma_area)
++              return -ENOMEM;
++      runtime->dma_bytes = size;
++      return 1;
+ }
+ 
+ static int gip_headset_pcm_hw_free(struct snd_pcm_substream *sub)
+ {
+-      return snd_pcm_lib_free_vmalloc_buffer(sub);
++      struct snd_pcm_runtime *runtime = sub->runtime;
++
++      vfree(runtime->dma_area);
++      runtime->dma_area = NULL;
++      return 0;
++}
++
++static struct page *gip_headset_pcm_get_page(struct snd_pcm_substream *sub,
++                                             unsigned long offset)
++{
++      return vmalloc_to_page(sub->runtime->dma_area + offset);
+ }
+ 
+ static int gip_headset_pcm_prepare(struct snd_pcm_substream *sub)
+@@ -157,7 +179,7 @@ static const struct snd_pcm_ops gip_headset_pcm_ops = {
+       .prepare = gip_headset_pcm_prepare,
+       .trigger = gip_headset_pcm_trigger,
+       .pointer = gip_headset_pcm_pointer,
+-      .page = snd_pcm_lib_get_vmalloc_page,
++      .page = gip_headset_pcm_get_page,
+ };
+ 
+ static bool gip_headset_advance_pointer(struct gip_headset_stream *stream,

diff --git a/games-util/xone/xone-0.3_p20240425.ebuild 
b/games-util/xone/xone-0.3_p20240425.ebuild
index e62473764..4936a742d 100644
--- a/games-util/xone/xone-0.3_p20240425.ebuild
+++ b/games-util/xone/xone-0.3_p20240425.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -29,6 +29,7 @@ CONFIG_CHECK="SND CFG80211 INPUT_FF_MEMLESS USB POWER_SUPPLY 
LEDS_CLASS HID"
 MODULES_KERNEL_MIN=5.11
 PATCHES=(
        "${FILESDIR}/${PN}-0.3_p20240425-kernel_6.11.patch"
+       "${FILESDIR}/${PN}-0.3_p20240425-kernel_6.12.patch"
        "${FILESDIR}/${PN}-0.3_p20240425-sysfs_pairing.patch"
 )
 

Reply via email to