void kgsl_pre_hwaccess(struct kgsl_device *device) { BUG_ON(!mutex_is_locked(&device->mutex)); switch (device->state) { case KGSL_STATE_ACTIVE: return; case KGSL_STATE_NAP: case KGSL_STATE_SLEEP: case KGSL_STATE_SLUMBER: kgsl_pwrctrl_wake(device); break; case KGSL_STATE_SUSPEND: kgsl_check_suspended(device); break; case KGSL_STATE_INIT: case KGSL_STATE_HUNG: case KGSL_STATE_DUMP_AND_RECOVER: if (test_bit(KGSL_PWRFLAGS_CLK_ON, &device->pwrctrl.power_flags)) break; else KGSL_PWR_ERR(device, "hw access while clocks off from state %d\n", device->state); break; default: KGSL_PWR_ERR(device, "hw access while in unknown state %d\n", device->state); break; } }
static int kgsl_runpending_unlocked(struct kgsl_device *device) { int ret; mutex_lock(&device->mutex); kgsl_check_suspended(device); ret = kgsl_runpending(device); mutex_unlock(&device->mutex); return ret; }