summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-02-15 20:19:00 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-02-15 20:19:00 +0000
commit172e40e63f12957f3f7f49aef4ad05b16558cc32 (patch)
tree379148c0b2e828d40c2ef037f9437c6746199870 /sys/dev/pci/drm
parent98b42a8d01550cfe373304b0c45d1bed8a30b731 (diff)
Make the pcigart functions return 0 on success and an errno on failure,
instead of 1 on success and zero on failure. I hated that twisty logic.
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r--sys/dev/pci/drm/ati_pcigart.c10
-rw-r--r--sys/dev/pci/drm/r128_cce.c4
-rw-r--r--sys/dev/pci/drm/radeon_cp.c4
3 files changed, 10 insertions, 8 deletions
diff --git a/sys/dev/pci/drm/ati_pcigart.c b/sys/dev/pci/drm/ati_pcigart.c
index 6a16a1654c3..73434d9a533 100644
--- a/sys/dev/pci/drm/ati_pcigart.c
+++ b/sys/dev/pci/drm/ati_pcigart.c
@@ -73,7 +73,7 @@ drm_ati_pcigart_cleanup(struct drm_device *dev,
/* we need to support large memory configurations */
if (dev->sg == NULL) {
DRM_ERROR("no scatter/gather memory!\n");
- return 0;
+ return (EINVAL);
}
if (gart_info->bus_addr) {
@@ -86,7 +86,7 @@ drm_ati_pcigart_cleanup(struct drm_device *dev,
}
}
- return 1;
+ return (0);
}
int
@@ -97,11 +97,12 @@ drm_ati_pcigart_init(struct drm_device *dev,
u_int32_t *pci_gart;
bus_addr_t entry_addr;
u_long pages, max_pages;
- int i, j, ret = 0;
+ int i, j, ret;
/* we need to support large memory configurations */
if (dev->sg == NULL) {
DRM_ERROR("no scatter/gather memory!\n");
+ ret = EINVAL;
goto error;
}
@@ -113,6 +114,7 @@ drm_ati_pcigart_init(struct drm_device *dev,
gart_info->table_size, 0, 0);
if (gart_info->mem == NULL) {
DRM_ERROR("cannot allocate PCI GART page!\n");
+ ret = ENOMEM;
goto error;
}
@@ -142,7 +144,7 @@ drm_ati_pcigart_init(struct drm_device *dev,
DRM_MEMORYBARRIER();
- return (1);
+ return (0);
error:
gart_info->addr = NULL;
diff --git a/sys/dev/pci/drm/r128_cce.c b/sys/dev/pci/drm/r128_cce.c
index 8b029bb1322..9b033000b7a 100644
--- a/sys/dev/pci/drm/r128_cce.c
+++ b/sys/dev/pci/drm/r128_cce.c
@@ -544,7 +544,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
dev_priv->gart_info.addr = NULL;
dev_priv->gart_info.bus_addr = 0;
dev_priv->gart_info.gart_reg_if = DRM_ATI_GART_PCI;
- if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) {
+ if (drm_ati_pcigart_init(dev, &dev_priv->gart_info)) {
DRM_ERROR("failed to init PCI GART!\n");
r128_do_cleanup_cce(dev);
return ENOMEM;
@@ -586,7 +586,7 @@ int r128_do_cleanup_cce(struct drm_device * dev)
#endif
{
if (dev_priv->gart_info.bus_addr)
- if (!drm_ati_pcigart_cleanup(dev, &dev_priv->gart_info))
+ if (drm_ati_pcigart_cleanup(dev, &dev_priv->gart_info))
DRM_ERROR("failed to cleanup PCI GART!\n");
}
diff --git a/sys/dev/pci/drm/radeon_cp.c b/sys/dev/pci/drm/radeon_cp.c
index c894ade0e57..f6c085fb5b5 100644
--- a/sys/dev/pci/drm/radeon_cp.c
+++ b/sys/dev/pci/drm/radeon_cp.c
@@ -1259,7 +1259,7 @@ radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init)
}
}
- if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) {
+ if (drm_ati_pcigart_init(dev, &dev_priv->gart_info)) {
DRM_ERROR("failed to init PCI GART!\n");
radeon_do_cleanup_cp(dev);
return ENOMEM;
@@ -1311,7 +1311,7 @@ radeon_do_cleanup_cp(struct drm_device *dev)
if (dev_priv->gart_info.bus_addr) {
/* Turn off PCI GART */
radeon_set_pcigart(dev_priv, 0);
- if (!drm_ati_pcigart_cleanup(dev, &dev_priv->gart_info))
+ if (drm_ati_pcigart_cleanup(dev, &dev_priv->gart_info))
DRM_ERROR("failed to cleanup PCI GART!\n");
}