1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
--- ../alsa-kernel/ppc/beep.c 2006-08-03 13:34:29.000000000 +0200
+++ beep.c 2006-08-03 15:10:21.000000000 +0200
@@ -1,3 +1,11 @@
+#define __NO_VERSION__
+#include <linux/config.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+#include "beep_old.c"
+#else /* 2.6 kernels */
+
/*
* Beep using pcm
*
@@ -224,7 +232,11 @@
return -ENOMEM;
dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
&beep->addr, GFP_KERNEL);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
input_dev = input_allocate_device();
+#else
+ input_dev = kzalloc(sizeof(*input_dev), GFP_KERNEL);
+#endif
if (! dmabuf || ! input_dev)
goto fail1;
@@ -240,7 +252,9 @@
input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
input_dev->event = snd_pmac_beep_event;
input_dev->private = chip;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
input_dev->cdev.dev = &chip->pdev->dev;
+#endif
beep->dev = input_dev;
beep->buf = dmabuf;
@@ -261,7 +275,12 @@
return 0;
fail2: snd_ctl_remove(chip->card, beep_ctl);
- fail1: input_free_device(input_dev);
+ fail1:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
+ input_free_device(input_dev);
+#else
+ kfree(input_dev);
+#endif
if (dmabuf)
dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
dmabuf, beep->addr);
@@ -273,9 +292,15 @@
{
if (chip->beep) {
input_unregister_device(chip->beep->dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
+ kfree(chip->beep->dev);
+#endif
+ input_free_device(chip->beep->dev);
dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
chip->beep->buf, chip->beep->addr);
kfree(chip->beep);
chip->beep = NULL;
}
}
+
+#endif
|