summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2014-08-22 06:06:31 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:11:02 -0400
commitd43210cbac2ab83dfb257c27050131edfcbc9e1b (patch)
tree8ca735af233aed566261735eec97a3899f8fb67f
parent447aab482a68be70cece649da88c656919d155d1 (diff)
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>
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 3499cc89..a6a51de5 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -84,6 +84,8 @@ u32 gk20a_dbg_ftrace;
84 84
85#define GK20A_WAIT_FOR_IDLE_MS 2000 85#define GK20A_WAIT_FOR_IDLE_MS 2000
86 86
87static struct gk20a *gk20a_handle;
88
87static int gk20a_pm_finalize_poweron(struct device *dev); 89static int gk20a_pm_finalize_poweron(struct device *dev);
88static int gk20a_pm_prepare_poweroff(struct device *dev); 90static int gk20a_pm_prepare_poweroff(struct device *dev);
89 91
@@ -1445,6 +1447,7 @@ static int gk20a_probe(struct platform_device *dev)
1445 1447
1446 set_gk20a(dev, gk20a); 1448 set_gk20a(dev, gk20a);
1447 gk20a->dev = dev; 1449 gk20a->dev = dev;
1450 gk20a_handle = gk20a;
1448 1451
1449 gk20a->irq_stall = platform_get_irq(dev, 0); 1452 gk20a->irq_stall = platform_get_irq(dev, 0);
1450 gk20a->irq_nonstall = platform_get_irq(dev, 1); 1453 gk20a->irq_nonstall = platform_get_irq(dev, 1);
@@ -1600,6 +1603,7 @@ static int __exit gk20a_remove(struct platform_device *dev)
1600 1603
1601 gk20a_user_deinit(dev); 1604 gk20a_user_deinit(dev);
1602 1605
1606 gk20a_handle = NULL;
1603 set_gk20a(dev, 0); 1607 set_gk20a(dev, 0);
1604#ifdef CONFIG_DEBUG_FS 1608#ifdef CONFIG_DEBUG_FS
1605 debugfs_remove(g->debugfs_ltc_enabled); 1609 debugfs_remove(g->debugfs_ltc_enabled);
@@ -1748,10 +1752,8 @@ void gk20a_reset(struct gk20a *g, u32 units)
1748 */ 1752 */
1749int gk20a_do_idle(void) 1753int gk20a_do_idle(void)
1750{ 1754{
1751 struct platform_device *pdev = to_platform_device( 1755 struct gk20a *g = gk20a_handle;
1752 bus_find_device_by_name(&platform_bus_type, 1756 struct platform_device *pdev = g->dev;
1753 NULL, "gk20a.0"));
1754 struct gk20a *g = get_gk20a(pdev);
1755 struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); 1757 struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev);
1756 unsigned long timeout = jiffies + 1758 unsigned long timeout = jiffies +
1757 msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS); 1759 msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS);
@@ -1831,10 +1833,8 @@ fail_timeout:
1831 */ 1833 */
1832int gk20a_do_unidle(void) 1834int gk20a_do_unidle(void)
1833{ 1835{
1834 struct platform_device *pdev = to_platform_device( 1836 struct gk20a *g = gk20a_handle;
1835 bus_find_device_by_name(&platform_bus_type, 1837 struct platform_device *pdev = g->dev;
1836 NULL, "gk20a.0"));
1837 struct gk20a *g = get_gk20a(pdev);
1838 struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); 1838 struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev);
1839 1839
1840 if (g->forced_reset) { 1840 if (g->forced_reset) {