44
44
45
45
#include "ttm_module.h"
46
46
47
- static void ttm_bo_global_kobj_release (struct kobject * kobj );
48
-
49
47
/*
50
48
* ttm_global_mutex - protecting the global BO state
51
49
*/
@@ -54,11 +52,6 @@ unsigned ttm_bo_glob_use_count;
54
52
struct ttm_bo_global ttm_bo_glob ;
55
53
EXPORT_SYMBOL (ttm_bo_glob );
56
54
57
- static struct attribute ttm_bo_count = {
58
- .name = "bo_count" ,
59
- .mode = S_IRUGO
60
- };
61
-
62
55
/* default destructor */
63
56
static void ttm_bo_default_destroy (struct ttm_buffer_object * bo )
64
57
{
@@ -84,32 +77,6 @@ static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo,
84
77
}
85
78
}
86
79
87
- static ssize_t ttm_bo_global_show (struct kobject * kobj ,
88
- struct attribute * attr ,
89
- char * buffer )
90
- {
91
- struct ttm_bo_global * glob =
92
- container_of (kobj , struct ttm_bo_global , kobj );
93
-
94
- return snprintf (buffer , PAGE_SIZE , "%d\n" ,
95
- atomic_read (& glob -> bo_count ));
96
- }
97
-
98
- static struct attribute * ttm_bo_global_attrs [] = {
99
- & ttm_bo_count ,
100
- NULL
101
- };
102
-
103
- static const struct sysfs_ops ttm_bo_global_ops = {
104
- .show = & ttm_bo_global_show
105
- };
106
-
107
- static struct kobj_type ttm_bo_glob_kobj_type = {
108
- .release = & ttm_bo_global_kobj_release ,
109
- .sysfs_ops = & ttm_bo_global_ops ,
110
- .default_attrs = ttm_bo_global_attrs
111
- };
112
-
113
80
static void ttm_bo_del_from_lru (struct ttm_buffer_object * bo )
114
81
{
115
82
struct ttm_bo_device * bdev = bo -> bdev ;
@@ -1228,14 +1195,6 @@ size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev,
1228
1195
}
1229
1196
EXPORT_SYMBOL (ttm_bo_dma_acc_size );
1230
1197
1231
- static void ttm_bo_global_kobj_release (struct kobject * kobj )
1232
- {
1233
- struct ttm_bo_global * glob =
1234
- container_of (kobj , struct ttm_bo_global , kobj );
1235
-
1236
- __free_page (glob -> dummy_read_page );
1237
- }
1238
-
1239
1198
static void ttm_bo_global_release (void )
1240
1199
{
1241
1200
struct ttm_bo_global * glob = & ttm_bo_glob ;
@@ -1247,6 +1206,7 @@ static void ttm_bo_global_release(void)
1247
1206
kobject_del (& glob -> kobj );
1248
1207
kobject_put (& glob -> kobj );
1249
1208
ttm_mem_global_release (& ttm_mem_glob );
1209
+ __free_page (glob -> dummy_read_page );
1250
1210
memset (glob , 0 , sizeof (* glob ));
1251
1211
out :
1252
1212
mutex_unlock (& ttm_global_mutex );
@@ -1279,10 +1239,8 @@ static int ttm_bo_global_init(void)
1279
1239
INIT_LIST_HEAD (& glob -> device_list );
1280
1240
atomic_set (& glob -> bo_count , 0 );
1281
1241
1282
- ret = kobject_init_and_add (
1283
- & glob -> kobj , & ttm_bo_glob_kobj_type , ttm_get_kobj (), "buffer_objects" );
1284
- if (unlikely (ret != 0 ))
1285
- kobject_put (& glob -> kobj );
1242
+ debugfs_create_atomic_t ("buffer_objects" , 0444 , ttm_debugfs_root ,
1243
+ & glob -> bo_count );
1286
1244
out :
1287
1245
mutex_unlock (& ttm_global_mutex );
1288
1246
return ret ;
0 commit comments