Skip to content

Commit

Permalink
drm/nouveau/abi16: introduce locked variant of nouveau_abi16_get()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Skeggs committed Nov 3, 2015
1 parent 09433f2 commit 786a57e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions drivers/gpu/drm/nouveau/nouveau_abi16.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
{
Expand Down

0 comments on commit 786a57e

Please sign in to comment.