aboutsummaryrefslogtreecommitdiff
path: root/linux-core/drm_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core/drm_pci.c')
-rw-r--r--linux-core/drm_pci.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/linux-core/drm_pci.c b/linux-core/drm_pci.c
index ba46f4fa..bde5e07e 100644
--- a/linux-core/drm_pci.c
+++ b/linux-core/drm_pci.c
@@ -2,14 +2,14 @@
/**
* \file drm_pci.h
* \brief Functions and ioctls to manage PCI memory
- *
+ *
* \warning These interfaces aren't stable yet.
- *
+ *
* \todo Implement the remaining ioctl's for the PCI pools.
* \todo Add support to map these buffers.
* \todo The wrappers here are so thin that they would be better off inlined..
*
- * \author Jos�Fonseca <jrfonseca@tungstengraphics.com>
+ * \author Jose Fonseca <jrfonseca@tungstengraphics.com>
* \author Leif Delgass <ldelgass@retinalburn.net>
*/
@@ -37,7 +37,6 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
#include <linux/pci.h>
#include "drmP.h"
@@ -45,13 +44,11 @@
/** \name PCI memory */
/*@{*/
-
/**
* \brief Allocate a PCI consistent memory block, for DMA.
*/
-void *
-drm_pci_alloc(drm_device_t *dev, size_t size, size_t align,
- dma_addr_t maxaddr, dma_addr_t *busaddr)
+void *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align,
+ dma_addr_t maxaddr, dma_addr_t * busaddr)
{
void *address;
#if 0
@@ -70,19 +67,19 @@ drm_pci_alloc(drm_device_t *dev, size_t size, size_t align,
spin_unlock(&drm_mem_lock);
#endif
- /* pci_alloc_consistent only guarantees alignment to the smallest
+ /* pci_alloc_consistent only guarantees alignment to the smallest
* PAGE_SIZE order which is greater than or equal to the requested size.
* Return NULL here for now to make sure nobody tries for larger alignment
*/
if (align > size)
return NULL;
- if (pci_set_dma_mask( dev->pdev, maxaddr ) != 0) {
- DRM_ERROR( "Setting pci dma mask failed\n" );
+ if (pci_set_dma_mask(dev->pdev, maxaddr) != 0) {
+ DRM_ERROR("Setting pci dma mask failed\n");
return NULL;
}
- address = pci_alloc_consistent( dev->pdev, size, busaddr );
+ address = pci_alloc_consistent(dev->pdev, size, busaddr);
#if DRM_DEBUG_MEMORY
if (address == NULL) {
@@ -95,7 +92,7 @@ drm_pci_alloc(drm_device_t *dev, size_t size, size_t align,
spin_lock(&drm_mem_lock);
++drm_mem_stats[area].succeed_count;
drm_mem_stats[area].bytes_allocated += size;
- drm_ram_used += size;
+ drm_ram_used += size;
spin_unlock(&drm_mem_lock);
#else
if (address == NULL)
@@ -106,10 +103,9 @@ drm_pci_alloc(drm_device_t *dev, size_t size, size_t align,
#if 0
/* XXX - Is virt_to_page() legal for consistent mem? */
- /* Reserve */
+ /* Reserve */
for (addr = (unsigned long)address, sz = size;
- sz > 0;
- addr += PAGE_SIZE, sz -= PAGE_SIZE) {
+ sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
SetPageReserved(virt_to_page(addr));
}
#endif
@@ -122,7 +118,7 @@ EXPORT_SYMBOL(drm_pci_alloc);
* \brief Free a PCI consistent memory block.
*/
void
-drm_pci_free(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr)
+drm_pci_free(drm_device_t * dev, size_t size, void *vaddr, dma_addr_t busaddr)
{
#if 0
unsigned long addr;
@@ -141,22 +137,21 @@ drm_pci_free(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr)
} else {
#if 0
/* XXX - Is virt_to_page() legal for consistent mem? */
- /* Unreserve */
+ /* Unreserve */
for (addr = (unsigned long)vaddr, sz = size;
- sz > 0;
- addr += PAGE_SIZE, sz -= PAGE_SIZE) {
+ sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
ClearPageReserved(virt_to_page(addr));
}
#endif
- pci_free_consistent( dev->pdev, size, vaddr, busaddr );
+ pci_free_consistent(dev->pdev, size, vaddr, busaddr);
}
#if DRM_DEBUG_MEMORY
spin_lock(&drm_mem_lock);
- free_count = ++drm_mem_stats[area].free_count;
- alloc_count = drm_mem_stats[area].succeed_count;
+ free_count = ++drm_mem_stats[area].free_count;
+ alloc_count = drm_mem_stats[area].succeed_count;
drm_mem_stats[area].bytes_freed += size;
- drm_ram_used -= size;
+ drm_ram_used -= size;
spin_unlock(&drm_mem_lock);
if (free_count > alloc_count) {
DRM_MEM_ERROR(area,