From 69657cffd889bc353cbf8e83f12b46bc48f7321b Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Wed, 13 Nov 2024 11:16:51 -0500 Subject: Update gentoo hosts --- hosts/iroha/gentoo/patches/games-util/xone/48.diff | 16 ----- hosts/iroha/gentoo/patches/games-util/xone/53.diff | 75 ++++++++++++++++++++++ 2 files changed, 75 insertions(+), 16 deletions(-) delete mode 100644 hosts/iroha/gentoo/patches/games-util/xone/48.diff create mode 100644 hosts/iroha/gentoo/patches/games-util/xone/53.diff (limited to 'hosts/iroha/gentoo/patches/games-util') diff --git a/hosts/iroha/gentoo/patches/games-util/xone/48.diff b/hosts/iroha/gentoo/patches/games-util/xone/48.diff deleted file mode 100644 index db6f63d..0000000 --- a/hosts/iroha/gentoo/patches/games-util/xone/48.diff +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/bus/bus.c b/bus/bus.c -index 4a6c64f..8dc9bbb 100644 ---- a/bus/bus.c -+++ b/bus/bus.c -@@ -56,7 +56,11 @@ static struct device_type gip_client_type = { - .release = gip_client_release, - }; - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) - static int gip_bus_match(struct device *dev, struct device_driver *driver) -+#else -+static int gip_bus_match(struct device *dev, const struct device_driver *driver) -+#endif - { - struct gip_client *client; - struct gip_driver *drv; diff --git a/hosts/iroha/gentoo/patches/games-util/xone/53.diff b/hosts/iroha/gentoo/patches/games-util/xone/53.diff new file mode 100644 index 0000000..455452a --- /dev/null +++ b/hosts/iroha/gentoo/patches/games-util/xone/53.diff @@ -0,0 +1,75 @@ +diff --git a/bus/bus.c b/bus/bus.c +index 4a6c64f..8dc9bbb 100644 +--- a/bus/bus.c ++++ b/bus/bus.c +@@ -56,7 +56,11 @@ static struct device_type gip_client_type = { + .release = gip_client_release, + }; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) + static int gip_bus_match(struct device *dev, struct device_driver *driver) ++#else ++static int gip_bus_match(struct device *dev, const struct device_driver *driver) ++#endif + { + struct gip_client *client; + struct gip_driver *drv; +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 + #include ++#include + #include + #include + #include +@@ -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, -- cgit v1.2.3-101-g0448