Ignore:
Timestamp:
Jan 24, 2021, 8:40:08 AM (5 years ago)
Author:
Paul Smedley
Message:

Update regmap & regcache to 5.10.10 kernel code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/lib32/regcache-rbtree.c

    r647 r652  
    1 /*
    2  * Register cache access API - rbtree caching support
    3  *
    4  * Copyright 2011 Wolfson Microelectronics plc
    5  *
    6  * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
    7  *
    8  * This program is free software; you can redistribute it and/or modify
    9  * it under the terms of the GNU General Public License version 2 as
    10  * published by the Free Software Foundation.
    11  */
    12 /* from 4.19.163 */
     1// SPDX-License-Identifier: GPL-2.0
     2//
     3// Register cache access API - rbtree caching support
     4//
     5// Copyright 2011 Wolfson Microelectronics plc
     6//
     7// Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
     8
     9/* from 5.10.10 */
    1310
    1411//#include <linux/debugfs.h>
     
    1714#include <linux/seq_file.h>
    1815#include <linux/slab.h>
    19 #include <linux/module.h>
    20 #include <linux/workqueue.h>
    21 #include <linux/byteorder/little_endian.h>
    22 #include <linux/printk.h>
    23 
     16#ifdef TARGET_OS2
     17#include <linux/bitmap.h>
     18#endif
    2419#include "internal.h"
    2520
    26 /*static inline*/ int regcache_rbtree_write(struct regmap *map, unsigned int reg,
     21static int regcache_rbtree_write(struct regmap *map, unsigned int reg,
    2722                                 unsigned int value);
    28 /*static inline*/ int regcache_rbtree_exit(struct regmap *map);
     23static int regcache_rbtree_exit(struct regmap *map);
    2924
    3025struct regcache_rbtree_node {
     
    3934        /* the actual rbtree node holding this block */
    4035        struct rb_node node;
    41 } /*__attribute__ ((packed))*/;
     36};
    4237
    4338struct regcache_rbtree_ctx {
     
    4641};
    4742
    48 /*static inline*/ inline void regcache_rbtree_get_base_top_reg(
     43static inline void regcache_rbtree_get_base_top_reg(
    4944        struct regmap *map,
    5045        struct regcache_rbtree_node *rbnode,
     
    5550}
    5651
    57 /*static inline*/ unsigned int regcache_rbtree_get_register(struct regmap *map,
     52static unsigned int regcache_rbtree_get_register(struct regmap *map,
    5853        struct regcache_rbtree_node *rbnode, unsigned int idx)
    5954{
     
    6156}
    6257
    63 /*static inline*/ void regcache_rbtree_set_register(struct regmap *map,
     58static void regcache_rbtree_set_register(struct regmap *map,
    6459                                         struct regcache_rbtree_node *rbnode,
    6560                                         unsigned int idx, unsigned int val)
     
    6964}
    7065
    71 /*static inline*/ struct regcache_rbtree_node *regcache_rbtree_lookup(struct regmap *map,
     66static struct regcache_rbtree_node *regcache_rbtree_lookup(struct regmap *map,
    7267                                                           unsigned int reg)
    7368{
     
    10398}
    10499
    105 /*static inline*/ int regcache_rbtree_insert(struct regmap *map, struct rb_root *root,
     100static int regcache_rbtree_insert(struct regmap *map, struct rb_root *root,
    106101                                  struct regcache_rbtree_node *rbnode)
    107102{
     
    139134
    140135#ifdef CONFIG_DEBUG_FS
    141 /*static inline*/ int rbtree_show(struct seq_file *s, void *ignored)
     136static int rbtree_show(struct seq_file *s, void *ignored)
    142137{
    143138        struct regmap *map = s->private;
     
    183178}
    184179
    185 /*static inline*/ int rbtree_open(struct inode *inode, struct file *file)
    186 {
    187         return single_open(file, rbtree_show, inode->i_private);
    188 }
    189 
    190 /*static inline*/ const struct file_operations rbtree_fops = {
    191         .open           = rbtree_open,
    192         .read           = seq_read,
    193         .llseek         = seq_lseek,
    194         .release        = single_release,
    195 };
    196 
    197 /*static inline*/ void rbtree_debugfs_init(struct regmap *map)
     180DEFINE_SHOW_ATTRIBUTE(rbtree);
     181
     182static void rbtree_debugfs_init(struct regmap *map)
    198183{
    199184        debugfs_create_file("rbtree", 0400, map->debugfs, map, &rbtree_fops);
     
    201186#endif
    202187
    203 /*static inline*/ int regcache_rbtree_init(struct regmap *map)
     188static int regcache_rbtree_init(struct regmap *map)
    204189{
    205190        struct regcache_rbtree_ctx *rbtree_ctx;
    206191        int i;
    207192        int ret;
     193
    208194#ifdef TARGET_OS2
    209195        // 2020-11-17 SHL FIXME patched struct rb_root
     
    240226}
    241227
    242 /*static inline*/ int regcache_rbtree_exit(struct regmap *map)
     228static int regcache_rbtree_exit(struct regmap *map)
    243229{
    244230        struct rb_node *next;
     
    269255}
    270256
    271 /*static inline*/ int regcache_rbtree_read(struct regmap *map,
     257static int regcache_rbtree_read(struct regmap *map,
    272258                                unsigned int reg, unsigned int *value)
    273259{
     
    289275
    290276
    291 /*static inline*/ int regcache_rbtree_insert_to_block(struct regmap *map,
     277static int regcache_rbtree_insert_to_block(struct regmap *map,
    292278                                           struct regcache_rbtree_node *rbnode,
    293279                                           unsigned int base_reg,
     
    324310                       * sizeof(*present));
    325311        } else {
    326                 present = (unsigned long *)rbnode->cache_present;
     312                present = rbnode->cache_present;
    327313        }
    328314
     
    338324        rbnode->blklen = blklen;
    339325        rbnode->base_reg = base_reg;
    340         rbnode->cache_present = (long*)present;
     326        rbnode->cache_present = present;
    341327
    342328        regcache_rbtree_set_register(map, rbnode, pos, value);
     
    344330}
    345331
    346 /*static inline*/ struct regcache_rbtree_node *
     332static struct regcache_rbtree_node *
    347333regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg)
    348334{
     
    396382}
    397383
    398 /*static inline*/ int regcache_rbtree_write(struct regmap *map, unsigned int reg,
     384static int regcache_rbtree_write(struct regmap *map, unsigned int reg,
    399385                                 unsigned int value)
    400386{
     
    492478}
    493479
    494 /*static inline*/ int regcache_rbtree_sync(struct regmap *map, unsigned int min,
     480static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
    495481                                unsigned int max)
    496482{
     
    524510
    525511                ret = regcache_sync_block(map, rbnode->block,
    526                                           (unsigned long *)rbnode->cache_present,
     512                                          rbnode->cache_present,
    527513                                          rbnode->base_reg, start, end);
    528514                if (ret != 0)
     
    533519}
    534520
    535 /*static inline*/ int regcache_rbtree_drop(struct regmap *map, unsigned int min,
     521static int regcache_rbtree_drop(struct regmap *map, unsigned int min,
    536522                                unsigned int max)
    537523{
     
    563549                        end = rbnode->blklen;
    564550
    565                 bitmap_clear((unsigned long *)rbnode->cache_present, start, end - start);
     551                bitmap_clear(rbnode->cache_present, start, end - start);
    566552        }
    567553
Note: See TracChangeset for help on using the changeset viewer.