diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-11-03 10:55:45 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-11-03 14:57:49 +1000 |
commit | da198203ed2291e2fb0549b00c312fe84fa86929 (patch) | |
tree | 968430e12b77ce7122211bae192aa4180a0378b7 | |
parent | 84c6d799e35234b3f7fe092f73b2e2cf012bf9aa (diff) |
abi16: introduce locked variant of nouveau_abi16_get()
USIF already takes the client mutex, but will need access to ABI16 data
in order to provide some limited interoperability.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drm/nouveau/nouveau_abi16.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drm/nouveau/nouveau_abi16.c b/drm/nouveau/nouveau_abi16.c index c3dea333..998f5cb2 100644 --- a/drm/nouveau/nouveau_abi16.c +++ b/drm/nouveau/nouveau_abi16.c @@ -32,11 +32,10 @@ #include "nouveau_chan.h" #include "nouveau_abi16.h" -struct nouveau_abi16 * -nouveau_abi16_get(struct drm_file *file_priv) +static struct nouveau_abi16 * +nouveau_abi16(struct drm_file *file_priv) { struct nouveau_cli *cli = nouveau_cli(file_priv); - mutex_lock(&cli->mutex); if (!cli->abi16) { struct nouveau_abi16 *abi16; cli->abi16 = abi16 = kzalloc(sizeof(*abi16), GFP_KERNEL); @@ -59,12 +58,21 @@ nouveau_abi16_get(struct drm_file *file_priv) kfree(cli->abi16); cli->abi16 = NULL; } - - mutex_unlock(&cli->mutex); } return cli->abi16; } +struct nouveau_abi16 * +nouveau_abi16_get(struct drm_file *file_priv) +{ + struct nouveau_cli *cli = nouveau_cli(file_priv); + mutex_lock(&cli->mutex); + if (nouveau_abi16(file_priv)) + return cli->abi16; + mutex_unlock(&cli->mutex); + return NULL; +} + int nouveau_abi16_put(struct nouveau_abi16 *abi16, int ret) { |