struct device *dev)
{
struct gart_domain *gart_domain = to_gart_domain(domain);
- struct gart_device *gart = gart_domain->gart;
+ struct gart_device *gart = gart_handle;
struct gart_client *client, *c;
int err = 0;
goto fail;
}
gart->active_domain = domain;
+ gart_domain->gart = gart;
list_add(&client->list, &gart->client);
spin_unlock(&gart->client_lock);
dev_dbg(gart->dev, "Attached %s\n", dev_name(dev));
if (c->dev == dev) {
list_del(&c->list);
kfree(c);
- if (list_empty(&gart->client))
+ if (list_empty(&gart->client)) {
gart->active_domain = NULL;
+ gart_domain->gart = NULL;
+ }
dev_dbg(gart->dev, "Detached %s\n", dev_name(dev));
return;
}
if (!gart_domain)
return NULL;
- gart_domain->gart = gart;
gart_domain->domain.geometry.aperture_start = gart->iovmm_base;
gart_domain->domain.geometry.aperture_end = gart->iovmm_base +
gart->page_count * GART_PAGE_SIZE - 1;