Changeset 625 for GPL/branches/uniaud32-next/lib32/regcache-rbtree.c
- Timestamp:
- Jan 3, 2021, 7:20:20 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-next/lib32/regcache-rbtree.c
r621 r625 10 10 * published by the Free Software Foundation. 11 11 */ 12 /* from 4.1 4.202*/12 /* from 4.19.163 */ 13 13 14 14 //#include <linux/debugfs.h> … … 24 24 #include "internal.h" 25 25 26 /*static*/ int regcache_rbtree_write(struct regmap *map, unsigned int reg,27 unsigned int value);28 /*static*/ int regcache_rbtree_exit(struct regmap *map);29 30 26 #ifdef TARGET_OS2 31 27 #define UINT_MAX (~0U) 32 #pragma pack(1)33 28 #endif 29 30 /*static inline*/ int regcache_rbtree_write(struct regmap *map, unsigned int reg, 31 unsigned int value); 32 /*static inline*/ int regcache_rbtree_exit(struct regmap *map); 33 34 34 struct regcache_rbtree_node { 35 35 /* block of adjacent registers */ 36 36 void *block; 37 37 /* Which registers are present */ 38 unsignedlong *cache_present;38 long *cache_present; 39 39 /* base register handled by this block */ 40 40 unsigned int base_reg; … … 43 43 /* the actual rbtree node holding this block */ 44 44 struct rb_node node; 45 #ifndef TARGET_OS2 46 } __attribute__ ((packed)); 47 #else 48 }; 49 #pragma pack() 50 #endif 45 } /*__attribute__ ((packed))*/; 51 46 52 47 struct regcache_rbtree_ctx { … … 55 50 }; 56 51 57 /*static inline*/ void regcache_rbtree_get_base_top_reg(52 /*static inline*/ inline void regcache_rbtree_get_base_top_reg( 58 53 struct regmap *map, 59 54 struct regcache_rbtree_node *rbnode, … … 64 59 } 65 60 66 /*static */ unsigned int regcache_rbtree_get_register(struct regmap *map,61 /*static inline*/ unsigned int regcache_rbtree_get_register(struct regmap *map, 67 62 struct regcache_rbtree_node *rbnode, unsigned int idx) 68 63 { … … 70 65 } 71 66 72 /*static */ void regcache_rbtree_set_register(struct regmap *map,67 /*static inline*/ void regcache_rbtree_set_register(struct regmap *map, 73 68 struct regcache_rbtree_node *rbnode, 74 69 unsigned int idx, unsigned int val) … … 78 73 } 79 74 80 /*static */ struct regcache_rbtree_node *regcache_rbtree_lookup(struct regmap *map,75 /*static inline*/ struct regcache_rbtree_node *regcache_rbtree_lookup(struct regmap *map, 81 76 unsigned int reg) 82 77 { … … 108 103 } 109 104 } 105 110 106 return NULL; 111 107 } 112 108 113 /*static */ int regcache_rbtree_insert(struct regmap *map, struct rb_root *root,109 /*static inline*/ int regcache_rbtree_insert(struct regmap *map, struct rb_root *root, 114 110 struct regcache_rbtree_node *rbnode) 115 111 { … … 121 117 parent = NULL; 122 118 new = &root->rb_node; 123 124 119 while (*new) { 125 120 rbnode_tmp = rb_entry(*new, struct regcache_rbtree_node, node); … … 148 143 149 144 #ifdef CONFIG_DEBUG_FS 150 /*static */ int rbtree_show(struct seq_file *s, void *ignored)145 /*static inline*/ int rbtree_show(struct seq_file *s, void *ignored) 151 146 { 152 147 struct regmap *map = s->private; … … 192 187 } 193 188 194 /*static */ int rbtree_open(struct inode *inode, struct file *file)189 /*static inline*/ int rbtree_open(struct inode *inode, struct file *file) 195 190 { 196 191 return single_open(file, rbtree_show, inode->i_private); 197 192 } 198 193 199 /*static */ const struct file_operations rbtree_fops = {194 /*static inline*/ const struct file_operations rbtree_fops = { 200 195 .open = rbtree_open, 201 196 .read = seq_read, … … 204 199 }; 205 200 206 /*static */ void rbtree_debugfs_init(struct regmap *map)201 /*static inline*/ void rbtree_debugfs_init(struct regmap *map) 207 202 { 208 203 debugfs_create_file("rbtree", 0400, map->debugfs, map, &rbtree_fops); … … 210 205 #endif 211 206 212 /*static */ int regcache_rbtree_init(struct regmap *map)207 /*static inline*/ int regcache_rbtree_init(struct regmap *map) 213 208 { 214 209 struct regcache_rbtree_ctx *rbtree_ctx; … … 233 228 #endif 234 229 rbtree_ctx->cached_rbnode = NULL; 230 235 231 for (i = 0; i < map->num_reg_defaults; i++) { 236 232 ret = regcache_rbtree_write(map, … … 248 244 } 249 245 250 /*static */ int regcache_rbtree_exit(struct regmap *map)246 /*static inline*/ int regcache_rbtree_exit(struct regmap *map) 251 247 { 252 248 struct rb_node *next; … … 277 273 } 278 274 279 /*static */ int regcache_rbtree_read(struct regmap *map,275 /*static inline*/ int regcache_rbtree_read(struct regmap *map, 280 276 unsigned int reg, unsigned int *value) 281 277 { … … 292 288 return -ENOENT; 293 289 } 294 return 0; 295 } 296 297 298 /*static*/ int regcache_rbtree_insert_to_block(struct regmap *map, 290 291 return 0; 292 } 293 294 295 /*static inline*/ int regcache_rbtree_insert_to_block(struct regmap *map, 299 296 struct regcache_rbtree_node *rbnode, 300 297 unsigned int base_reg, … … 351 348 } 352 349 353 /*static */ struct regcache_rbtree_node *350 /*static inline*/ struct regcache_rbtree_node * 354 351 regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg) 355 352 { … … 369 366 break; 370 367 } 368 371 369 if (i != map->rd_table->n_yes_ranges) { 372 370 range = &map->rd_table->yes_ranges[i]; … … 376 374 } 377 375 } 376 378 377 if (!rbnode->blklen) { 379 378 rbnode->blklen = 1; … … 401 400 } 402 401 403 /*static */ int regcache_rbtree_write(struct regmap *map, unsigned int reg,402 /*static inline*/ int regcache_rbtree_write(struct regmap *map, unsigned int reg, 404 403 unsigned int value) 405 404 { … … 476 475 new_top_reg, reg, 477 476 value); 478 if (ret) {479 return ret; }477 if (ret) 478 return ret; 480 479 rbtree_ctx->cached_rbnode = rbnode; 481 480 return 0; … … 486 485 */ 487 486 rbnode = regcache_rbtree_node_alloc(map, reg); 488 if (!rbnode) {489 return -ENOMEM; }487 if (!rbnode) 488 return -ENOMEM; 490 489 regcache_rbtree_set_register(map, rbnode, 491 490 reg - rbnode->base_reg, value); … … 493 492 rbtree_ctx->cached_rbnode = rbnode; 494 493 } 495 return 0; 496 } 497 498 /*static*/ int regcache_rbtree_sync(struct regmap *map, unsigned int min, 494 495 return 0; 496 } 497 498 /*static inline*/ int regcache_rbtree_sync(struct regmap *map, unsigned int min, 499 499 unsigned int max) 500 500 { … … 537 537 } 538 538 539 /*static */ int regcache_rbtree_drop(struct regmap *map, unsigned int min,539 /*static inline*/ int regcache_rbtree_drop(struct regmap *map, unsigned int min, 540 540 unsigned int max) 541 541 {
Note:
See TracChangeset
for help on using the changeset viewer.