diff options
author | Thomas Fleury <tfleury@nvidia.com> | 2017-10-26 19:41:24 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-11-06 16:41:36 -0500 |
commit | 94feb18de8a687bef7c94999161b6bebaa382709 (patch) | |
tree | 8bea74e24b9e29e5e0a920b956abbe73e90edff3 /drivers/gpu/nvgpu/boardobj/boardobj.h | |
parent | 4e7c9c3008e8bd354afa471e1d97ba88b12194da (diff) |
gpu: nvgpu: call destructor for boardobj and boardobjgrp
Maintain a list of boardobj and boardobjgrp, so that we can free
related objects when removing pmu support. A flag is added in
boardobj so that the destructor can determine if it should free
the object. This 'allocated' flag is false when the object is
embedded into another structure, which should be freed through
other means.
JIRA EVLR-1959
Bug 200352099
Change-Id: I6a3ff3c57f7428dd145deacf98f2992a9be9796d
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1586596
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/boardobj/boardobj.h')
-rw-r--r-- | drivers/gpu/nvgpu/boardobj/boardobj.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/boardobj/boardobj.h b/drivers/gpu/nvgpu/boardobj/boardobj.h index 5c1b4b81..a433fda8 100644 --- a/drivers/gpu/nvgpu/boardobj/boardobj.h +++ b/drivers/gpu/nvgpu/boardobj/boardobj.h | |||
@@ -71,6 +71,8 @@ struct boardobj { | |||
71 | 71 | ||
72 | u8 type; /*type of the device*/ | 72 | u8 type; /*type of the device*/ |
73 | u8 idx; /*index of boardobj within in its group*/ | 73 | u8 idx; /*index of boardobj within in its group*/ |
74 | /* true if allocated in constructor. destructor should free */ | ||
75 | u8 allocated; | ||
74 | u32 type_mask; /*mask of types this boardobjimplements*/ | 76 | u32 type_mask; /*mask of types this boardobjimplements*/ |
75 | boardobj_implements *implements; | 77 | boardobj_implements *implements; |
76 | boardobj_destruct *destruct; | 78 | boardobj_destruct *destruct; |
@@ -79,6 +81,7 @@ struct boardobj { | |||
79 | * that inherit from BOARDOBJ | 81 | * that inherit from BOARDOBJ |
80 | */ | 82 | */ |
81 | boardobj_pmudatainit *pmudatainit; | 83 | boardobj_pmudatainit *pmudatainit; |
84 | struct nvgpu_list_node node; | ||
82 | }; | 85 | }; |
83 | 86 | ||
84 | boardobj_construct boardobj_construct_super; | 87 | boardobj_construct boardobj_construct_super; |
@@ -89,4 +92,11 @@ boardobj_pmudatainit boardobj_pmudatainit_super; | |||
89 | #define BOARDOBJ_GET_TYPE(pobj) (((struct boardobj *)(pobj))->type) | 92 | #define BOARDOBJ_GET_TYPE(pobj) (((struct boardobj *)(pobj))->type) |
90 | #define BOARDOBJ_GET_IDX(pobj) (((struct boardobj *)(pobj))->idx) | 93 | #define BOARDOBJ_GET_IDX(pobj) (((struct boardobj *)(pobj))->idx) |
91 | 94 | ||
95 | static inline struct boardobj * | ||
96 | boardobj_from_node(struct nvgpu_list_node *node) | ||
97 | { | ||
98 | return (struct boardobj *) | ||
99 | ((uintptr_t)node - offsetof(struct boardobj, node)); | ||
100 | }; | ||
101 | |||
92 | #endif | 102 | #endif |