gpu: nvgpu: remove hard coded GPU name

In gk20a_do_idle(), to get pointer to platform_device of gk20a,
we use bus_find_device_by_name() and pass "gk20a.0" to it
But this hard coding fails on gm20b since GPU device name
there is "gpu"

Hence to fix this add a static pointer handle "gk20a_handle"
to struct gk20a in gk20a.c
Now we can access this global pointer inside do_idle()
to get gk20a pointer and from that we can get pointer to
platform_device

Change-Id: I1a65588e34ad36efed0fa587bb365f0ee81e253d
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/486887
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Deepak Nibade
2014-08-22 15:36:31 +05:30
committed by Dan Willemsen
parent 447aab482a
commit d43210cbac

View File

@@ -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) {