summaryrefslogtreecommitdiff
path: root/radeon_atom.c
diff options
context:
space:
mode:
Diffstat (limited to 'radeon_atom.c')
-rw-r--r--radeon_atom.c50
1 files changed, 15 insertions, 35 deletions
diff --git a/radeon_atom.c b/radeon_atom.c
index 9904b33..e27116f 100644
--- a/radeon_atom.c
+++ b/radeon_atom.c
@@ -16,9 +16,7 @@
*/
#include "radeon_device.h"
-int radeon_atom_init(struct radeon_atom *atom,
- struct idr *idp,
- radeon_atom_emit_t emit)
+int radeon_atom_init(struct radeon_atom *atom, radeon_atom_emit_t emit)
{
int r;
@@ -26,34 +24,6 @@ int radeon_atom_init(struct radeon_atom *atom,
kref_init(&atom->kref);
atom->emit = emit;
atom->nflushes = 0;
- r = idr_pre_get(idp, GFP_KERNEL);
- if (r)
- return r;
- r = idr_get_new(idp, atom, &atom->id);
- if (r)
- return r;
- return 0;
-}
-
-int radeon_atom_find_locked(struct list_head *atoms, u32 id,
- u32 type, struct radeon_atom **atom)
-{
- struct radeon_atom *i;
-
- *atom = NULL;
- list_for_each_entry(i, atoms, list) {
- if (i->id == id)
- break;
- }
- if (i == (struct radeon_atom*)atoms)
- return -EINVAL;
- if (i->type != type) {
- dev_err(rdev->dev, "atom(0x%08X, 0x%08X) not of type 0x%08X\n",
- i->id, i->type, type);
- return -EINVAL;
- }
- *atom = i;
- kref_get(&i->kref);
return 0;
}
@@ -86,10 +56,8 @@ int radeon_atom_flush_add(struct list_head *flushes, struct radeon_bo *bo, u32 f
return 1;
}
-int radeon_atom_emit_default(struct radeon_device *rdev,
- struct radeon_atom *atom,
- void *data,
- struct radeon_ib *ib)
+int radeon_atom_emit_default(struct radeon_device *rdev, struct radeon_atom *atom,
+ void *data, struct radeon_ib *ib)
{
return radeon_ib_copy(ib, atom->pkts, atom->npkts);
}
@@ -129,3 +97,15 @@ void radeon_device_set_bo_list(struct radeon_device *rdev, u32 nbo, struct radeo
memcpy(rdev->bo, bo, sizeof(void*) * nbo);
rdev->nbo = nbo;
}
+
+void radeon_atom_release(struct kref *kref)
+{
+ struct radeon_atom *atom = container_of(kref, struct radeon_atom, kref);
+ int i;
+
+ for (i = 0; i < atom->nbo; i++) {
+ radeon_bo_unref(atom->bo[i]);
+ }
+ free(atom->state);
+ free(atom);
+}