msm: kgsl: use more static initializers for struct kgsl_device

There are many fields in kgsl_device that are always initialized
the same way. Move them to a macro, KGSL_DEVICE_COMMON_INIT,
so the correct static initializers can be used by both 3d and 2d.

Change-Id: I8362957548199112517457e0f94bfe2bd5f707f9
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c
index 2ce2f2b..25eda43 100644
--- a/drivers/gpu/msm/kgsl.c
+++ b/drivers/gpu/msm/kgsl.c
@@ -385,7 +385,7 @@
 	idr_remove(&dev_priv->device->context_idr, id);
 }
 
-static void kgsl_timestamp_expired(struct work_struct *work)
+void kgsl_timestamp_expired(struct work_struct *work)
 {
 	struct kgsl_device *device = container_of(work, struct kgsl_device,
 		ts_expired_ws);
@@ -415,6 +415,7 @@
 
 	mutex_unlock(&device->mutex);
 }
+EXPORT_SYMBOL(kgsl_timestamp_expired);
 
 static void kgsl_check_idle_locked(struct kgsl_device *device)
 {
@@ -2417,27 +2418,14 @@
 	dev_set_drvdata(device->parentdev, device);
 
 	/* Generic device initialization */
-	init_waitqueue_head(&device->wait_queue);
-
 	kgsl_cffdump_open(device->id);
 
-	init_completion(&device->hwaccess_gate);
-	init_completion(&device->suspend_gate);
-
-	ATOMIC_INIT_NOTIFIER_HEAD(&device->ts_notifier_list);
-
 	setup_timer(&device->idle_timer, kgsl_timer, (unsigned long) device);
 	ret = kgsl_create_device_workqueue(device);
 	if (ret)
 		goto err_devlist;
 
-	INIT_WORK(&device->idle_check_ws, kgsl_idle_check);
-	INIT_WORK(&device->ts_expired_ws, kgsl_timestamp_expired);
-
-	INIT_LIST_HEAD(&device->events);
-
 	device->last_expired_ctxt_id = KGSL_CONTEXT_INVALID;
-
 	ret = kgsl_mmu_init(device);
 	if (ret != 0)
 		goto err_dest_work_q;
@@ -2450,8 +2438,6 @@
 	pm_qos_add_request(&device->pm_qos_req_dma, PM_QOS_CPU_DMA_LATENCY,
 				PM_QOS_DEFAULT_VALUE);
 
-	idr_init(&device->context_idr);
-
 	/* Initalize the snapshot engine */
 	kgsl_device_snapshot_init(device);