msm: kgsl: Change the prototype of MMU function pointers
Change the prototype of the MMU function pointers to take the mmu
pointer as an argument instead of the device pointer.
Change-Id: I4ecafefcc8f755c23dac6e3a15a1a74a74e3db00
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
diff --git a/drivers/gpu/msm/kgsl_iommu.c b/drivers/gpu/msm/kgsl_iommu.c
index b7f7b0a..bf2a4ee 100644
--- a/drivers/gpu/msm/kgsl_iommu.c
+++ b/drivers/gpu/msm/kgsl_iommu.c
@@ -166,17 +166,15 @@
return ret;
}
-static void kgsl_iommu_setstate(struct kgsl_device *device,
+static void kgsl_iommu_setstate(struct kgsl_mmu *mmu,
struct kgsl_pagetable *pagetable)
{
- struct kgsl_mmu *mmu = &device->mmu;
-
if (mmu->flags & KGSL_FLAGS_STARTED) {
/* page table not current, then setup mmu to use new
* specified page table
*/
if (mmu->hwpagetable != pagetable) {
- kgsl_idle(device, KGSL_TIMEOUT_DEFAULT);
+ kgsl_idle(mmu->device, KGSL_TIMEOUT_DEFAULT);
kgsl_detach_pagetable_iommu_domain(mmu);
mmu->hwpagetable = pagetable;
if (mmu->hwpagetable)
@@ -185,7 +183,7 @@
}
}
-static int kgsl_iommu_init(struct kgsl_device *device)
+static int kgsl_iommu_init(struct kgsl_mmu *mmu)
{
/*
* intialize device mmu
@@ -193,11 +191,8 @@
* call this with the global lock held
*/
int status = 0;
- struct kgsl_mmu *mmu = &device->mmu;
struct kgsl_iommu *iommu;
- mmu->device = device;
-
iommu = kzalloc(sizeof(struct kgsl_iommu), GFP_KERNEL);
if (!iommu) {
KGSL_CORE_ERR("kzalloc(%d) failed\n",
@@ -205,27 +200,26 @@
return -ENOMEM;
}
- status = kgsl_get_iommu_ctxt(iommu, device);
+ status = kgsl_get_iommu_ctxt(iommu, mmu->device);
if (status) {
kfree(iommu);
iommu = NULL;
}
mmu->priv = iommu;
- dev_info(device->dev, "|%s| MMU type set for device is IOMMU\n",
+ dev_info(mmu->device->dev, "|%s| MMU type set for device is IOMMU\n",
__func__);
return status;
}
-static int kgsl_iommu_start(struct kgsl_device *device)
+static int kgsl_iommu_start(struct kgsl_mmu *mmu)
{
int status;
- struct kgsl_mmu *mmu = &device->mmu;
if (mmu->flags & KGSL_FLAGS_STARTED)
return 0;
- kgsl_regwrite(device, MH_MMU_CONFIG, 0x00000000);
+ kgsl_regwrite(mmu->device, MH_MMU_CONFIG, 0x00000000);
if (mmu->defaultpagetable == NULL)
mmu->defaultpagetable =
kgsl_mmu_getpagetable(KGSL_MMU_GLOBAL_PT);
@@ -304,14 +298,13 @@
return ret;
}
-static int kgsl_iommu_stop(struct kgsl_device *device)
+static int kgsl_iommu_stop(struct kgsl_mmu *mmu)
{
/*
* stop device mmu
*
* call this with the global lock held
*/
- struct kgsl_mmu *mmu = &device->mmu;
if (mmu->flags & KGSL_FLAGS_STARTED) {
/* detach iommu attachment */
@@ -323,9 +316,8 @@
return 0;
}
-static int kgsl_iommu_close(struct kgsl_device *device)
+static int kgsl_iommu_close(struct kgsl_mmu *mmu)
{
- struct kgsl_mmu *mmu = &device->mmu;
if (mmu->defaultpagetable)
kgsl_mmu_putpagetable(mmu->defaultpagetable);
@@ -333,13 +325,13 @@
}
static unsigned int
-kgsl_iommu_get_current_ptbase(struct kgsl_device *device)
+kgsl_iommu_get_current_ptbase(struct kgsl_mmu *mmu)
{
/* Current base is always the hwpagetables domain as we
* do not use per process pagetables right not for iommu.
* This will change when we switch to per process pagetables.
*/
- return (unsigned int)device->mmu.hwpagetable->priv;
+ return (unsigned int)mmu->hwpagetable->priv;
}
struct kgsl_mmu_ops iommu_ops = {