- add an patch from fedora
This commit is contained in:
Stephan Raue 2010-04-14 17:19:18 +02:00
parent 5fc71bac38
commit 3b4dfbee74

View File

@ -0,0 +1,84 @@
diff -Naur linux-2.6.33.2/sound/pci/hda/hda_beep.c linux-2.6.33.2.patch/sound/pci/hda/hda_beep.c
--- linux-2.6.33.2/sound/pci/hda/hda_beep.c 2010-04-02 01:02:33.000000000 +0200
+++ linux-2.6.33.2.patch/sound/pci/hda/hda_beep.c 2010-04-09 03:19:43.846329981 +0200
@@ -1,3 +1,5 @@
+#define __NO_VERSION__
+#include "adriver.h"
/*
* Digital Beep Input Interface for HD-audio codec
*
@@ -92,7 +94,11 @@
static int snd_hda_beep_event(struct input_dev *dev, unsigned int type,
unsigned int code, int hz)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
+ struct hda_beep *beep = dev->private;
+#else
struct hda_beep *beep = input_get_drvdata(dev);
+#endif
switch (code) {
case SND_BELL:
@@ -116,8 +122,13 @@
static void snd_hda_do_detach(struct hda_beep *beep)
{
input_unregister_device(beep->dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
+ kfree(beep->dev);
+#endif
beep->dev = NULL;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
cancel_work_sync(&beep->beep_work);
+#endif
/* turn off beep for sure */
snd_hda_codec_write(beep->codec, beep->nid, 0,
AC_VERB_SET_BEEP_CONTROL, 0);
@@ -129,7 +140,11 @@
struct hda_codec *codec = beep->codec;
int err;
+#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 (!input_dev) {
printk(KERN_INFO "hda_beep: unable to allocate input device\n");
return -ENOMEM;
@@ -147,15 +162,26 @@
input_dev->evbit[0] = BIT_MASK(EV_SND);
input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
input_dev->event = snd_hda_beep_event;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
input_dev->dev.parent = &codec->bus->pci->dev;
input_set_drvdata(input_dev, beep);
+#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
+ input_dev->cdev.dev = &codec->bus->pci->dev;
+#endif
+ input_dev->private = beep;
+#endif /* 2.6.22 */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
err = input_register_device(input_dev);
if (err < 0) {
input_free_device(input_dev);
printk(KERN_INFO "hda_beep: unable to register input device\n");
return err;
}
+#else
+ input_register_device(input_dev);
+#endif
beep->dev = input_dev;
return 0;
}
@@ -255,7 +281,9 @@
{
struct hda_beep *beep = codec->beep;
if (beep) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
cancel_work_sync(&beep->register_work);
+#endif
cancel_delayed_work(&beep->unregister_work);
if (beep->dev)
snd_hda_do_detach(beep);