Loading drivers/base/regmap/internal.h +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ struct regmap { regmap_lock lock; regmap_unlock unlock; void *lock_arg; /* This is passed to lock/unlock functions */ gfp_t alloc_flags; struct device *dev; /* Device we do I/O on */ void *work_buf; /* Scratch buffer used to format I/O */ Loading drivers/base/regmap/regmap-debugfs.c +10 −13 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ static LIST_HEAD(regmap_debugfs_early_list); static DEFINE_MUTEX(regmap_debugfs_early_lock); /* Calculate the length of a fixed format */ static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size) static size_t regmap_calc_reg_len(int max_val) { return snprintf(NULL, 0, "%x", max_val); } Loading Loading @@ -173,8 +173,7 @@ static inline void regmap_calc_tot_len(struct regmap *map, { /* Calculate the length of a fixed format */ if (!map->debugfs_tot_len) { map->debugfs_reg_len = regmap_calc_reg_len(map->max_register, buf, count); map->debugfs_reg_len = regmap_calc_reg_len(map->max_register), map->debugfs_val_len = 2 * map->format.val_bytes; map->debugfs_tot_len = map->debugfs_reg_len + map->debugfs_val_len + 3; /* : \n */ Loading Loading @@ -338,6 +337,7 @@ static ssize_t regmap_reg_ranges_read_file(struct file *file, char *buf; char *entry; int ret; unsigned entry_len; if (*ppos < 0 || !count) return -EINVAL; Loading Loading @@ -365,18 +365,15 @@ static ssize_t regmap_reg_ranges_read_file(struct file *file, p = 0; mutex_lock(&map->cache_lock); list_for_each_entry(c, &map->debugfs_off_cache, list) { snprintf(entry, PAGE_SIZE, "%x-%x", entry_len = snprintf(entry, PAGE_SIZE, "%x-%x\n", c->base_reg, c->max_reg); if (p >= *ppos) { if (buf_pos + 1 + strlen(entry) > count) if (buf_pos + entry_len > count) break; snprintf(buf + buf_pos, count - buf_pos, "%s", entry); buf_pos += strlen(entry); buf[buf_pos] = '\n'; buf_pos++; memcpy(buf + buf_pos, entry, entry_len); buf_pos += entry_len; } p += strlen(entry) + 1; p += entry_len; } mutex_unlock(&map->cache_lock); Loading Loading @@ -420,7 +417,7 @@ static ssize_t regmap_access_read_file(struct file *file, return -ENOMEM; /* Calculate the length of a fixed format */ reg_len = regmap_calc_reg_len(map->max_register, buf, count); reg_len = regmap_calc_reg_len(map->max_register); tot_len = reg_len + 10; /* ': R W V P\n' */ for (i = 0; i <= map->max_register; i += map->reg_stride) { Loading drivers/base/regmap/regmap.c +11 −1 Original line number Diff line number Diff line Loading @@ -561,6 +561,16 @@ struct regmap *__regmap_init(struct device *dev, } map->lock_arg = map; } /* * When we write in fast-paths with regmap_bulk_write() don't allocate * scratch buffers with sleeping allocations. */ if ((bus && bus->fast_io) || config->fast_io) map->alloc_flags = GFP_ATOMIC; else map->alloc_flags = GFP_KERNEL; map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8); map->format.pad_bytes = config->pad_bits / 8; map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8); Loading Loading @@ -1787,7 +1797,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, if (!val_count) return -EINVAL; wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL); wval = kmemdup(val, val_count * val_bytes, map->alloc_flags); if (!wval) { dev_err(map->dev, "Error in memory allocation\n"); return -ENOMEM; Loading include/linux/regmap.h +3 −0 Original line number Diff line number Diff line Loading @@ -794,6 +794,9 @@ struct regmap_irq { unsigned int mask; }; #define REGMAP_IRQ_REG(_irq, _off, _mask) \ [_irq] = { .reg_offset = (_off), .mask = (_mask) } /** * Description of a generic regmap irq_chip. This is not intended to * handle every possible interrupt controller, but it should handle a Loading Loading
drivers/base/regmap/internal.h +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ struct regmap { regmap_lock lock; regmap_unlock unlock; void *lock_arg; /* This is passed to lock/unlock functions */ gfp_t alloc_flags; struct device *dev; /* Device we do I/O on */ void *work_buf; /* Scratch buffer used to format I/O */ Loading
drivers/base/regmap/regmap-debugfs.c +10 −13 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ static LIST_HEAD(regmap_debugfs_early_list); static DEFINE_MUTEX(regmap_debugfs_early_lock); /* Calculate the length of a fixed format */ static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size) static size_t regmap_calc_reg_len(int max_val) { return snprintf(NULL, 0, "%x", max_val); } Loading Loading @@ -173,8 +173,7 @@ static inline void regmap_calc_tot_len(struct regmap *map, { /* Calculate the length of a fixed format */ if (!map->debugfs_tot_len) { map->debugfs_reg_len = regmap_calc_reg_len(map->max_register, buf, count); map->debugfs_reg_len = regmap_calc_reg_len(map->max_register), map->debugfs_val_len = 2 * map->format.val_bytes; map->debugfs_tot_len = map->debugfs_reg_len + map->debugfs_val_len + 3; /* : \n */ Loading Loading @@ -338,6 +337,7 @@ static ssize_t regmap_reg_ranges_read_file(struct file *file, char *buf; char *entry; int ret; unsigned entry_len; if (*ppos < 0 || !count) return -EINVAL; Loading Loading @@ -365,18 +365,15 @@ static ssize_t regmap_reg_ranges_read_file(struct file *file, p = 0; mutex_lock(&map->cache_lock); list_for_each_entry(c, &map->debugfs_off_cache, list) { snprintf(entry, PAGE_SIZE, "%x-%x", entry_len = snprintf(entry, PAGE_SIZE, "%x-%x\n", c->base_reg, c->max_reg); if (p >= *ppos) { if (buf_pos + 1 + strlen(entry) > count) if (buf_pos + entry_len > count) break; snprintf(buf + buf_pos, count - buf_pos, "%s", entry); buf_pos += strlen(entry); buf[buf_pos] = '\n'; buf_pos++; memcpy(buf + buf_pos, entry, entry_len); buf_pos += entry_len; } p += strlen(entry) + 1; p += entry_len; } mutex_unlock(&map->cache_lock); Loading Loading @@ -420,7 +417,7 @@ static ssize_t regmap_access_read_file(struct file *file, return -ENOMEM; /* Calculate the length of a fixed format */ reg_len = regmap_calc_reg_len(map->max_register, buf, count); reg_len = regmap_calc_reg_len(map->max_register); tot_len = reg_len + 10; /* ': R W V P\n' */ for (i = 0; i <= map->max_register; i += map->reg_stride) { Loading
drivers/base/regmap/regmap.c +11 −1 Original line number Diff line number Diff line Loading @@ -561,6 +561,16 @@ struct regmap *__regmap_init(struct device *dev, } map->lock_arg = map; } /* * When we write in fast-paths with regmap_bulk_write() don't allocate * scratch buffers with sleeping allocations. */ if ((bus && bus->fast_io) || config->fast_io) map->alloc_flags = GFP_ATOMIC; else map->alloc_flags = GFP_KERNEL; map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8); map->format.pad_bytes = config->pad_bits / 8; map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8); Loading Loading @@ -1787,7 +1797,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, if (!val_count) return -EINVAL; wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL); wval = kmemdup(val, val_count * val_bytes, map->alloc_flags); if (!wval) { dev_err(map->dev, "Error in memory allocation\n"); return -ENOMEM; Loading
include/linux/regmap.h +3 −0 Original line number Diff line number Diff line Loading @@ -794,6 +794,9 @@ struct regmap_irq { unsigned int mask; }; #define REGMAP_IRQ_REG(_irq, _off, _mask) \ [_irq] = { .reg_offset = (_off), .mask = (_mask) } /** * Description of a generic regmap irq_chip. This is not intended to * handle every possible interrupt controller, but it should handle a Loading