Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'regmap-fix-v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap

Pull regmap fixes from Mark Brown:
"Three fixes here:

- The issues with accounting for register and padding length on raw
buses turn out to be quite widespread in custom buses.

In order to avoid disturbing anything drop the initial fixes and
fall back to a point fix in the SMBus code where the issue was
originally noticed, a more substantial refactoring of the API which
ensures that all buses make the same assumptions will follow.

- The generic regcache code had been forcing on async I/O which did
not work with the new maple tree sync code when used with SPI.

Since that was mainly for the rbtree cache and the assumptions
about hardware that drove the choice are probably not true any more
fix this by pushing the enablement of async down into the rbtree
code.

This probably also makes cache syncs for systems faster though it's
not the point.

- The test code was triggering use of the rbtree and maple tree
caches with dynamic allocation of nodes since all the testing is
with RAM backed caches with no I/O performance issues.

Just disable the locking in the tests to avoid triggering warnings
when allocation debugging is turned on, it's not really what's
being tested"

* tag 'regmap-fix-v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
regmap: Disable locking for RBTREE and MAPLE unit tests
regcache: Push async I/O request down into the rbtree cache
regmap: Account for register length in SMBus I/O limits
regmap: Drop initial version of maximum transfer length fixes

+16 -12
+4
drivers/base/regmap/regcache-rbtree.c
··· 471 471 unsigned int start, end; 472 472 int ret; 473 473 474 + map->async = true; 475 + 474 476 rbtree_ctx = map->cache; 475 477 for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) { 476 478 rbnode = rb_entry(node, struct regcache_rbtree_node, node); ··· 500 498 if (ret != 0) 501 499 return ret; 502 500 } 501 + 502 + map->async = false; 503 503 504 504 return regmap_async_complete(map); 505 505 }
-3
drivers/base/regmap/regcache.c
··· 368 368 if (!map->cache_dirty) 369 369 goto out; 370 370 371 - map->async = true; 372 - 373 371 /* Apply any patch first */ 374 372 map->cache_bypass = true; 375 373 for (i = 0; i < map->patch_regs; i++) { ··· 390 392 391 393 out: 392 394 /* Restore the bypass state */ 393 - map->async = false; 394 395 map->cache_bypass = bypass; 395 396 map->no_sync_defaults = false; 396 397 map->unlock(map->lock_arg);
+4 -4
drivers/base/regmap/regmap-i2c.c
··· 242 242 static const struct regmap_bus regmap_i2c_smbus_i2c_block = { 243 243 .write = regmap_i2c_smbus_i2c_write, 244 244 .read = regmap_i2c_smbus_i2c_read, 245 - .max_raw_read = I2C_SMBUS_BLOCK_MAX, 246 - .max_raw_write = I2C_SMBUS_BLOCK_MAX, 245 + .max_raw_read = I2C_SMBUS_BLOCK_MAX - 1, 246 + .max_raw_write = I2C_SMBUS_BLOCK_MAX - 1, 247 247 }; 248 248 249 249 static int regmap_i2c_smbus_i2c_write_reg16(void *context, const void *data, ··· 299 299 static const struct regmap_bus regmap_i2c_smbus_i2c_block_reg16 = { 300 300 .write = regmap_i2c_smbus_i2c_write_reg16, 301 301 .read = regmap_i2c_smbus_i2c_read_reg16, 302 - .max_raw_read = I2C_SMBUS_BLOCK_MAX, 303 - .max_raw_write = I2C_SMBUS_BLOCK_MAX, 302 + .max_raw_read = I2C_SMBUS_BLOCK_MAX - 2, 303 + .max_raw_write = I2C_SMBUS_BLOCK_MAX - 2, 304 304 }; 305 305 306 306 static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c,
+5
drivers/base/regmap/regmap-kunit.c
··· 58 58 int i; 59 59 struct reg_default *defaults; 60 60 61 + config->disable_locking = config->cache_type == REGCACHE_RBTREE || 62 + config->cache_type == REGCACHE_MAPLE; 63 + 61 64 buf = kmalloc(size, GFP_KERNEL); 62 65 if (!buf) 63 66 return ERR_PTR(-ENOMEM); ··· 892 889 893 890 config->cache_type = test_type->cache_type; 894 891 config->val_format_endian = test_type->val_endian; 892 + config->disable_locking = config->cache_type == REGCACHE_RBTREE || 893 + config->cache_type == REGCACHE_MAPLE; 895 894 896 895 buf = kmalloc(size, GFP_KERNEL); 897 896 if (!buf)
+1 -1
drivers/base/regmap/regmap-spi-avmm.c
··· 660 660 .reg_format_endian_default = REGMAP_ENDIAN_NATIVE, 661 661 .val_format_endian_default = REGMAP_ENDIAN_NATIVE, 662 662 .max_raw_read = SPI_AVMM_VAL_SIZE * MAX_READ_CNT, 663 - .max_raw_write = SPI_AVMM_REG_SIZE + SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT, 663 + .max_raw_write = SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT, 664 664 .free_context = spi_avmm_bridge_ctx_free, 665 665 }; 666 666
+2 -4
drivers/base/regmap/regmap.c
··· 2082 2082 size_t val_count = val_len / val_bytes; 2083 2083 size_t chunk_count, chunk_bytes; 2084 2084 size_t chunk_regs = val_count; 2085 - size_t max_data = map->max_raw_write - map->format.reg_bytes - 2086 - map->format.pad_bytes; 2087 2085 int ret, i; 2088 2086 2089 2087 if (!val_count) ··· 2089 2091 2090 2092 if (map->use_single_write) 2091 2093 chunk_regs = 1; 2092 - else if (map->max_raw_write && val_len > max_data) 2093 - chunk_regs = max_data / val_bytes; 2094 + else if (map->max_raw_write && val_len > map->max_raw_write) 2095 + chunk_regs = map->max_raw_write / val_bytes; 2094 2096 2095 2097 chunk_count = val_count / chunk_regs; 2096 2098 chunk_bytes = chunk_regs * val_bytes;