From: Risto Suominen Allow to compile snd-powermac on older kernels. Signed-off-by: Risto Suominen --- Kernel version < 2.6.16 --- ppc/pmac_old.c.orig 2008-02-05 11:23:23.000000000 +0200 +++ ppc/pmac_old.c 2008-04-15 20:05:56.000000000 +0300 @@ -997,12 +997,14 @@ static int __init snd_pmac_detect(struct chip->can_byte_swap = 0; /* FIXME: check this */ chip->control_mask = MASK_IEPC | 0x11;/* disable IEE */ break; +#ifdef SND_POWERMAC_SUPPORT_TOONIE case 0x3a: chip->num_freqs = ARRAY_SIZE(tumbler_freqs); chip->model = PMAC_TOONIE; chip->can_byte_swap = 0; /* FIXME: check this */ chip->control_mask = MASK_IEPC | 0x11;/* disable IEE */ break; +#endif } } prop = (unsigned int *)get_property(sound, "device-id", NULL); @@ -1019,6 +1021,10 @@ static int __init snd_pmac_detect(struct else { struct pci_dev *pdev = NULL; +#ifndef for_each_pci_dev +#define for_each_pci_dev(d) \ + while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) +#endif for_each_pci_dev(pdev) { struct device_node *np = pci_device_to_OF_node(pdev); if (np && np == macio->of_node) { --- alsa-kernel/ppc/pmac.h.orig 2008-02-05 11:23:24.000000000 +0200 +++ alsa-kernel/ppc/pmac.h 2008-03-31 23:45:36.000000000 +0300 @@ -207,4 +207,11 @@ int snd_pmac_add_automute(struct snd_pmac *chip); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) +#define of_device_is_compatible(dev, s) device_is_compatible(dev, s) +#define input_get_drvdata(dev) (dev->private) +#define i2c_smbus_write_i2c_block_data(client, cmd, len, vals) \ + i2c_smbus_write_block_data(client, cmd, len, vals) +#endif + #endif /* __PMAC_H */ --- acore/memory.c.orig 2008-02-05 11:23:23.000000000 +0200 +++ acore/memory.c 2008-03-31 23:45:36.000000000 +0300 @@ -21,6 +21,9 @@ #ifndef __safe #define __safe #endif +#ifndef __bitwise +#define __bitwise +#endif #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) --- ppc/beep.patch.orig 2008-02-05 11:23:23.000000000 +0200 +++ ppc/beep.patch 2008-03-31 23:45:37.000000000 +0300 @@ -1,5 +1,5 @@ ---- ../alsa-kernel/ppc/beep.c 2007-12-20 11:47:37.000000000 +0100 -+++ beep.c 2007-12-20 12:23:31.000000000 +0100 +--- ../alsa-kernel/ppc/beep.c 2008-02-05 11:23:24.000000000 +0200 ++++ beep.c 2008-03-27 11:56:01.482564272 +0200 @@ -1,3 +1,10 @@ +#define __NO_VERSION__ +#include "adriver.h" @@ -39,7 +39,18 @@ beep->dev = input_dev; beep->buf = dmabuf; -@@ -263,7 +281,12 @@ +@@ -256,14 +274,23 @@ + + chip->beep = beep; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15) + err = input_register_device(beep->dev); + if (err) + goto fail2; ++#else ++ input_register_device(beep->dev); ++#endif + return 0; fail2: snd_ctl_remove(chip->card, beep_ctl); @@ -53,14 +64,15 @@ if (dmabuf) dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, dmabuf, beep->addr); -@@ -275,9 +298,15 @@ +@@ -275,9 +302,16 @@ { if (chip->beep) { input_unregister_device(chip->beep->dev); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15) + kfree(chip->beep->dev); -+#endif ++#else + input_free_device(chip->beep->dev); ++#endif dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, chip->beep->buf, chip->beep->addr); kfree(chip->beep);