summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/enabled.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/enabled.c')
-rw-r--r--drivers/gpu/nvgpu/common/enabled.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/common/enabled.c b/drivers/gpu/nvgpu/common/enabled.c
index cded36c8..00df9e3b 100644
--- a/drivers/gpu/nvgpu/common/enabled.c
+++ b/drivers/gpu/nvgpu/common/enabled.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-18, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -34,8 +34,9 @@ int nvgpu_init_enabled_flags(struct gk20a *g)
34 g->enabled_flags = nvgpu_kzalloc(g, 34 g->enabled_flags = nvgpu_kzalloc(g,
35 BITS_TO_LONGS(NVGPU_MAX_ENABLED_BITS) * 35 BITS_TO_LONGS(NVGPU_MAX_ENABLED_BITS) *
36 sizeof(unsigned long)); 36 sizeof(unsigned long));
37 if (!g->enabled_flags) 37 if (!g->enabled_flags) {
38 return -ENOMEM; 38 return -ENOMEM;
39 }
39 40
40 return 0; 41 return 0;
41} 42}
@@ -55,8 +56,9 @@ bool nvgpu_is_enabled(struct gk20a *g, int flag)
55 56
56bool __nvgpu_set_enabled(struct gk20a *g, int flag, bool state) 57bool __nvgpu_set_enabled(struct gk20a *g, int flag, bool state)
57{ 58{
58 if (state) 59 if (state) {
59 return test_and_set_bit(flag, g->enabled_flags); 60 return test_and_set_bit(flag, g->enabled_flags);
60 else 61 } else {
61 return test_and_clear_bit(flag, g->enabled_flags); 62 return test_and_clear_bit(flag, g->enabled_flags);
63 }
62} 64}