mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-18 02:04:05 +08:00
Merge remote-tracking branches 'regmap/topic/atomic', 'regmap/topic/debugfs' and 'regmap/topic/irq-hdr' into regmap-next
This commit is contained in:
commit
d4a1a317e7
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
@ -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 */
|
||||
@ -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;
|
||||
@ -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",
|
||||
c->base_reg, c->max_reg);
|
||||
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);
|
||||
|
||||
@ -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) {
|
||||
|
@ -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);
|
||||
@ -1787,7 +1797,7 @@ out:
|
||||
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;
|
||||
|
@ -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…
Reference in New Issue
Block a user