diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 3499cc894..a6a51de5c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -84,6 +84,8 @@ u32 gk20a_dbg_ftrace; #define GK20A_WAIT_FOR_IDLE_MS 2000 +static struct gk20a *gk20a_handle; + static int gk20a_pm_finalize_poweron(struct device *dev); static int gk20a_pm_prepare_poweroff(struct device *dev); @@ -1445,6 +1447,7 @@ static int gk20a_probe(struct platform_device *dev) set_gk20a(dev, gk20a); gk20a->dev = dev; + gk20a_handle = gk20a; gk20a->irq_stall = platform_get_irq(dev, 0); gk20a->irq_nonstall = platform_get_irq(dev, 1); @@ -1600,6 +1603,7 @@ static int __exit gk20a_remove(struct platform_device *dev) gk20a_user_deinit(dev); + gk20a_handle = NULL; set_gk20a(dev, 0); #ifdef CONFIG_DEBUG_FS debugfs_remove(g->debugfs_ltc_enabled); @@ -1748,10 +1752,8 @@ void gk20a_reset(struct gk20a *g, u32 units) */ int gk20a_do_idle(void) { - struct platform_device *pdev = to_platform_device( - bus_find_device_by_name(&platform_bus_type, - NULL, "gk20a.0")); - struct gk20a *g = get_gk20a(pdev); + struct gk20a *g = gk20a_handle; + struct platform_device *pdev = g->dev; struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); unsigned long timeout = jiffies + msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS); @@ -1831,10 +1833,8 @@ fail_timeout: */ int gk20a_do_unidle(void) { - struct platform_device *pdev = to_platform_device( - bus_find_device_by_name(&platform_bus_type, - NULL, "gk20a.0")); - struct gk20a *g = get_gk20a(pdev); + struct gk20a *g = gk20a_handle; + struct platform_device *pdev = g->dev; struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); if (g->forced_reset) {