static void powerdown_handler(struct work_struct *work) { struct nvhost_module *mod; mod = container_of(to_delayed_work(work), struct nvhost_module, powerdown); mutex_lock(&mod->lock); if ((atomic_read(&mod->refcount) == 0) && mod->powered) { if (mod->desc->prepare_poweroff && mod->desc->prepare_poweroff(mod)) { /* If poweroff fails, retry */ mutex_unlock(&mod->lock); schedule_delayed_work(&mod->powerdown, msecs_to_jiffies( mod->desc->powerdown_delay)); return; } clock_disable(mod); powergate(mod); mod->powered = false; if (mod->parent) nvhost_module_idle(mod->parent); } mutex_unlock(&mod->lock); }
static void powerdown_handler(struct work_struct *work) { struct nvhost_module *mod; mod = container_of(to_delayed_work(work), struct nvhost_module, powerdown); mutex_lock(&mod->lock); if ((atomic_read(&mod->refcount) == 0) && mod->powered) { if (mod->desc->prepare_poweroff) mod->desc->prepare_poweroff(mod); clock_disable(mod); powergate(mod); mod->powered = false; if (mod->parent) nvhost_module_idle(mod->parent); } mutex_unlock(&mod->lock); }