Update of /cvsroot/alsa/alsa-driver/acore
In directory sc8-pr-cvs1:/tmp/cvs-serv12496/acore
Modified Files:
memalloc.inc1 pci_compat_22.c
Log Message:
- added pci_request/release_regions() wrapper for 2.2 kernels.
- fixed pci_resource_flags() wrapper.
Index: memalloc.inc1
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/acore/memalloc.inc1,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- memalloc.inc1 31 May 2003 11:09:05 -0000 1.1
+++ memalloc.inc1 20 Nov 2003 10:47:30 -0000 1.2
@@ -16,6 +16,10 @@
EXPORT_SYMBOL(snd_pci_compat_get_driver_data);
EXPORT_SYMBOL(snd_pci_compat_set_driver_data);
EXPORT_SYMBOL(snd_pci_compat_get_pci_driver);
+EXPORT_SYMBOL(snd_pci_compat_request_region);
+EXPORT_SYMBOL(snd_pci_compat_release_region);
+EXPORT_SYMBOL(snd_pci_compat_request_regions);
+EXPORT_SYMBOL(snd_pci_compat_release_regions);
#endif
#ifndef CONFIG_HAVE_VMALLOC_TO_PAGE
Index: pci_compat_22.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/acore/pci_compat_22.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- pci_compat_22.c 17 Nov 2003 18:31:41 -0000 1.5
+++ pci_compat_22.c 20 Nov 2003 10:47:30 -0000 1.6
@@ -199,10 +199,11 @@
dev->device == broken_addr[foo].device)
return broken_addr[foo].flags;
- if (foo == 0)
- flags |= IORESOURCE_MEM;
- if (foo == 1)
+ foo = dev->base_address[n_base] & PCI_BASE_ADDRESS_SPACE;
+ if (foo & 1)
flags |= IORESOURCE_IO;
+ else
+ flags |= IORESOURCE_MEM;
return flags;
}
@@ -340,3 +341,63 @@
return 1;
}
+/*
+ */
+int snd_pci_compat_pci_request_region(struct pci_dev *pdev, int bar, char *res_name)
+{
+ int flags;
+
+ if (pci_resource_len(pdev, bar) == 0)
+ return 0;
+ flags = snd_pci_compat_get_flags(pdev, bar);
+ if (flags & IORESOURCE_IO) {
+ if (!request_region(pci_resource_start(pdev, bar),
+ pci_resource_len(pdev, bar), res_name))
+ goto err_out;
+ } else if (flags & IORESOURCE_MEM) {
+ if (!request_mem_region(pci_resource_start(pdev, bar),
+ pci_resource_len(pdev, bar), res_name))
+ goto err_out;
+ }
+
+ return 0;
+
+err_out:
+ printk(KERN_WARNING "PCI: Unable to reserve %s region #%d:[EMAIL PROTECTED]
for device %s\n",
+ flags & IORESOURCE_IO ? "I/O" : "mem",
+ bar + 1, /* PCI BAR # */
+ pci_resource_len(pdev, bar), pci_resource_start(pdev, bar),
+ pci_name(pdev));
+ return -EBUSY;
+}
+
+void snd_pci_compat_release_region(struct pci_dev *pci, int bar)
+{
+ int flags;
+ if (pci_resource_len(pdev, bar) == 0)
+ return;
+ flags = snd_pci_compat_get_flags(pdev, bar);
+ if (flags & IORESOURCE_IO)
+ release_region(pci_resource_start(pdev, bar),
+ pci_resource_len(pdev, bar));
+ else if (flags & IORESOURCE_MEM)
+ release_mem_region(pci_resource_start(pdev, bar),
+ pci_resource_len(pdev, bar));
+}
+
+int snd_pci_compat_request_regions(struct pci_dev *pdev, char *res_name)
+{
+ int i;
+
+ for (i = 0; i < 6; i++)
+ if (pci_request_region(pdev, i, res_name))
+ return -EBUSY;
+ return 0;
+}
+
+void snd_pci_compat_release_regions(struct pci_dev *pdev)
+{
+ int i;
+ for (i = 0; i < 6; i++)
+ snd_pci_compat_release_region(pdev, i);
+}
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog