diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c index 5a4a2251..753623fa 100644 --- a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | |||
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | struct gk20a_ctrl_priv { | 40 | struct gk20a_ctrl_priv { |
41 | struct device *dev; | 41 | struct device *dev; |
42 | struct gk20a *g; | ||
42 | #ifdef CONFIG_ARCH_TEGRA_18x_SOC | 43 | #ifdef CONFIG_ARCH_TEGRA_18x_SOC |
43 | struct nvgpu_clk_session *clk_session; | 44 | struct nvgpu_clk_session *clk_session; |
44 | #endif | 45 | #endif |
@@ -58,35 +59,42 @@ int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp) | |||
58 | priv = kzalloc(sizeof(struct gk20a_ctrl_priv), GFP_KERNEL); | 59 | priv = kzalloc(sizeof(struct gk20a_ctrl_priv), GFP_KERNEL); |
59 | if (!priv) | 60 | if (!priv) |
60 | return -ENOMEM; | 61 | return -ENOMEM; |
61 | |||
62 | filp->private_data = priv; | 62 | filp->private_data = priv; |
63 | priv->dev = g->dev; | 63 | priv->dev = g->dev; |
64 | /* | ||
65 | * We dont close the arbiter fd's after driver teardown to support | ||
66 | * GPU_LOST events, so we store g here, instead of dereferencing the | ||
67 | * dev structure on teardown | ||
68 | */ | ||
69 | priv->g = g; | ||
64 | 70 | ||
65 | if (!g->gr.sw_ready) { | 71 | if (!g->gr.sw_ready) { |
66 | err = gk20a_busy(g->dev); | 72 | err = gk20a_busy(g->dev); |
67 | if (err) | 73 | if (err) |
68 | return err; | 74 | return err; |
69 | |||
70 | gk20a_idle(g->dev); | 75 | gk20a_idle(g->dev); |
71 | } | 76 | } |
72 | 77 | ||
73 | #ifdef CONFIG_ARCH_TEGRA_18x_SOC | 78 | #ifdef CONFIG_ARCH_TEGRA_18x_SOC |
74 | err = nvgpu_clk_arb_init_session(g, &priv->clk_session); | 79 | err = nvgpu_clk_arb_init_session(g, &priv->clk_session); |
80 | if (err) | ||
81 | return err; | ||
75 | #endif | 82 | #endif |
83 | |||
76 | return err; | 84 | return err; |
77 | } | 85 | } |
78 | |||
79 | int gk20a_ctrl_dev_release(struct inode *inode, struct file *filp) | 86 | int gk20a_ctrl_dev_release(struct inode *inode, struct file *filp) |
80 | { | 87 | { |
81 | struct gk20a_ctrl_priv *priv = filp->private_data; | 88 | struct gk20a_ctrl_priv *priv = filp->private_data; |
89 | struct gk20a *g = priv->g; | ||
82 | 90 | ||
83 | gk20a_dbg_fn(""); | 91 | gk20a_dbg_fn(""); |
84 | 92 | ||
85 | #ifdef CONFIG_ARCH_TEGRA_18x_SOC | 93 | #ifdef CONFIG_ARCH_TEGRA_18x_SOC |
86 | if (priv->clk_session) | 94 | if (priv->clk_session) |
87 | nvgpu_clk_arb_release_session(gk20a_from_dev(priv->dev), | 95 | nvgpu_clk_arb_release_session(g, priv->clk_session); |
88 | priv->clk_session); | ||
89 | #endif | 96 | #endif |
97 | |||
90 | kfree(priv); | 98 | kfree(priv); |
91 | 99 | ||
92 | return 0; | 100 | return 0; |