Update of /cvsroot/alsa/alsa-driver/acore
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12394/acore
Modified Files:
memalloc.inc memalloc.patch
Log Message:
- fixes for build with 2.2 kernels.
- moved local stuffs for memalloc from adriver.h to memalloc.inc.
Index: memalloc.inc
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/acore/memalloc.inc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- memalloc.inc 2 Mar 2004 18:09:25 -0000 1.4
+++ memalloc.inc 5 Mar 2004 11:54:05 -0000 1.5
@@ -9,6 +9,7 @@
#endif
#endif
+#include <linux/pci.h>
#include "config.h"
#include "adriver.h"
@@ -28,15 +29,32 @@
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-
static LIST_HEAD(snd_pci_devices);
struct snd_pci_device {
struct list_head *list;
struct device dev;
struct pci_dev *pci;
+ u64 dummy_mask;
};
+static inline struct pci_dev *to_pci_dev(struct device *dev)
+{
+ return dev->d.pci;
+}
+
+static inline void *dma_alloc_coherent(struct device *dev, size_t size,
+ dma_addr_t *dma_handle, int flag)
+{
+ return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle);
+}
+
+static inline void dma_free_coherent(struct device *dev, size_t size,
+ void *vaddr, dma_addr_t dma_handle)
+{
+ pci_free_consistent(to_pci_dev(dev), size, vaddr, dma_handle);
+}
+
struct device *snd_kdevice_pci(struct pci_dev *pci)
{
struct snd_pci_device *pdev;
@@ -53,10 +71,13 @@
return NULL;
}
pdev->dev.d.pci = pci;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
pdev->dev.dma_mask = &pci->dma_mask;
+#else
+ pdev->dev.dma_mask = &pdev->dummy_mask;
+#endif
return &pdev->dev;
}
-EXPORT_SYMBOL(snd_kdevice_pci);
static void snd_kdevice_free_all(void)
{
@@ -69,13 +90,38 @@
}
}
-static const char *snd_kdevice_busid(struct device *dev)
+static const char *snd_pci_dev_name(struct pci_dev *pci)
{
- if (dev->d.pci)
- return dev->d.pci->slot_name;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
+ if (pci) {
+ static char tmp[32];
+ sprintf(tmp, "%02x:%02x:%02x",
+ pci->bus->number,
+ pci->bus->primary,
+ pci->bus->secondary);
+ return tmp;
+ }
+#else
+ if (pci)
+ return pci->slot_name;
+#endif
return "???";
}
-#else
+static const char *snd_kdevice_busid(struct device *dev)
+{
+ return snd_pci_dev_name(dev->d.pci);
+}
+
+#define __GFP_NOWARN 0
+
+#else /* >= 2.5.0 */
+
+static inline struct device *snd_kdevice_pci(struct pci_dev *pci)
+{
+ return &pci->dev;
+}
+
#define snd_kdevice_free_all()
-#endif
+
+#endif /* <2.5.0 */
Index: memalloc.patch
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/acore/memalloc.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- memalloc.patch 2 Mar 2004 15:32:35 -0000 1.4
+++ memalloc.patch 5 Mar 2004 11:54:05 -0000 1.5
@@ -1,11 +1,27 @@
---- memalloc.c.old 2004-03-02 11:09:58.000000000 +0100
-+++ memalloc.c 2004-03-02 11:09:17.000000000 +0100
+--- ../alsa-kernel/core/memalloc.c 2004-03-03 20:53:56.000000000 +0100
++++ memalloc.c 2004-03-05 00:44:35.895900880 +0100
@@ -1,3 +1,4 @@
+#include "memalloc.inc"
/*
* Copyright (c) by Jaroslav Kysela <[EMAIL PROTECTED]>
* Takashi Iwai <[EMAIL PROTECTED]>
-@@ -461,7 +462,7 @@
+@@ -85,6 +86,7 @@
+ * Hacks
+ */
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
+ #if defined(__i386__) || defined(__ppc__) || defined(__x86_64__)
+
+ /*
+@@ -135,6 +137,7 @@
+ #define dma_alloc_coherent snd_dma_hack_alloc_coherent
+
+ #endif /* arch */
++#endif /* >= 2.4.0 */
+
+ /*
+ *
+@@ -462,7 +465,7 @@
#endif
#ifdef CONFIG_PCI
case SNDRV_DMA_TYPE_PCI:
@@ -14,7 +30,7 @@
break;
#endif
case SNDRV_DMA_TYPE_DEV:
-@@ -522,7 +523,7 @@
+@@ -523,7 +526,7 @@
#endif
#ifdef CONFIG_PCI
case SNDRV_DMA_TYPE_PCI:
@@ -23,7 +39,7 @@
break;
#endif
case SNDRV_DMA_TYPE_DEV:
-@@ -569,7 +570,7 @@
+@@ -570,7 +573,7 @@
#endif
#ifdef CONFIG_PCI
case SNDRV_DMA_TYPE_PCI:
@@ -32,7 +48,7 @@
break;
#endif
case SNDRV_DMA_TYPE_DEV:
-@@ -724,6 +725,7 @@
+@@ -725,6 +728,7 @@
kfree(mem);
}
up(&list_mutex);
@@ -40,7 +56,7 @@
}
-@@ -771,7 +773,7 @@
+@@ -772,7 +776,7 @@
{
memset(dev, 0, sizeof(*dev));
dev->type = SNDRV_DMA_TYPE_DEV;
@@ -49,7 +65,20 @@
dev->id = id;
}
-@@ -873,7 +875,11 @@
+@@ -875,7 +879,11 @@
+ if (mem->dev.dev.dev) {
+ len += sprintf(page + len, "%s [%s]",
+ mem->dev.type == SNDRV_DMA_TYPE_PCI_SG
? "PCI" : "PCI-SG",
+- mem->dev.dev.pci->slot_name);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
++ mem->dev.dev.pci->dev.bus_id);
++#else
++ snd_pci_dev_name(mem->dev.dev.pci));
++#endif
+ }
+ break;
+ #endif
+@@ -884,7 +892,11 @@
if (mem->dev.dev.dev) {
len += sprintf(page + len, "%s [%s]",
mem->dev.type == SNDRV_DMA_TYPE_DEV_SG
? "DEV" : "DEV-SG",
@@ -61,7 +90,7 @@
}
break;
default:
-@@ -950,3 +956,5 @@
+@@ -959,3 +971,5 @@
EXPORT_SYMBOL(snd_malloc_pages);
EXPORT_SYMBOL(snd_malloc_pages_fallback);
EXPORT_SYMBOL(snd_free_pages);
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog