remap: Some fixes for bulk read/write callbacks in regmap_config support
Subsystems (2)
cover remap: Some fixes for bulk read/write callbacks in regmap_config support
Hello,
This series contains fixes for a few issues found while testing the recent support for drivers to define bulk read/write callbacks in regmap_config.
I tested this with drivers/gpu/drm/solomon/ssd130x-spi.c, by converting it to use this new API instead of defining its own regmap bus for bulk write.
Patch #1 and patch #2 are fixes for regresions introduced by that commit and patch #3 adds regmap_config provided bulk write support to functions regmap_noinc_write() and regmap_bulk_write(), that were missed.
Best regards,
Javier
Javier Martinez Canillas (3):
regmap: Re-introduce bulk read support check in regmap_bulk_read()
regmap: Make regmap_noinc_read() return -ENOTSUPP if map->read isn't
set
regmap: Wire up regmap_config provided bulk write in missed functions
drivers/base/regmap/regmap.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
Signature · 1 line
2.36.1
PATCH 1/3 regmap: Re-introduce bulk read support check in regmap_bulk_read()
Support for drivers to define bulk read/write callbacks in regmap_config was introduced by the commit d77e74561368 ("regmap: Add bulk read/write callbacks into regmap_config"), but this commit wrongly dropped a check in regmap_bulk_read() to determine whether bulk reads can be done or not.
Before that commit, it was checked if map->bus was set. Now has to check if a map->read callback has been set.
---
drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -3017,7 +3017,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,if (val_count ==0 )return -EINVAL ; -if (map->format.parse_inplace && (vol || map->cache_type ==REGCACHE_NONE )) { +if (map->read && map->format.parse_inplace && (vol || map->cache_type ==REGCACHE_NONE )) { ret =regmap_raw_read (map, reg, val, val_bytes * val_count);if (ret !=0 )return ret;
Signature · 1 line
2.36.1
Re: [PATCH 1/3] regmap: Re-introduce bulk read support check in regmap_bulk_read()
Quoted 10 lines · Javier Martinez Canillas
Support for drivers to define bulk read/write callbacks in
regmap_configwas introduced by the commitd77e74561368("regmap: Add bulk read/write callbacks intoregmap_config"), but this commit wrongly dropped a check inregmap_bulk_read()to determine whether bulk reads can be done or not.Before that commit, it was checked if
map->buswas set. Now has to check if amap->readcallback has been set.Fixes d77e74561368 ("regmap: Add bulk read/write callbacks into regmap_config")Signed-off-by Javier Martinez Canillas <[email protected]>
PATCH 2/3 regmap: Make regmap_noinc_read() return -ENOTSUPP if map->read isn't set
In reply to Javier Martinez CanillasBefore adding support to define bulk read/write callbacks in regmap_config by the commit d77e74561368 ("regmap: Add bulk read/write callbacks into regmap_config"), the regmap_noinc_read() function returned an errno early a map->bus->read callback wasn't set.
But that commit dropped the check and now a call to _regmap_raw_read() is attempted even when bulk read operations are not supported. That function checks for map->read anyways but there's no point to continue if the read can't succeed.
Also is a fragile assumption to make so is better to make it fail earlier.
---
drivers/base/regmap/regmap.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/base/regmap/regmap.c +3 -0
@@ -2904,6 +2904,9 @@ int regmap_noinc_read(struct regmap *map, unsigned int reg,size_t read_len;int ret; +if (!map->read) +return -ENOTSUPP ; +if (val_len % map->format.val_bytes)return -EINVAL ;if (!IS_ALIGNED (reg, map->reg_stride))
Signature · 1 line
2.36.1
Re: [PATCH 2/3] regmap: Make regmap_noinc_read() return -ENOTSUPP if map->read isn't set
Quoted 10 lines · Javier Martinez Canillas
Before adding support to define bulk read/write callbacks in
regmap_configby the commitd77e74561368("regmap: Add bulk read/write callbacks intoregmap_config"), theregmap_noinc_read()function returned an errno early amap->bus->readcallback wasn't set.But that commit dropped the check and now a call to
_regmap_raw_read()is attempted even when bulk read operations are not supported. That function checks formap->readanyways but there's no point to continue if the read can't succeed.
Quoted 4 lines
Also is a fragile assumption to make so is better to make it fail earlier.
Fixes d77e74561368 ("regmap: Add bulk read/write callbacks into regmap_config")Signed-off-by Javier Martinez Canillas <[email protected]>
PATCH 3/3 regmap: Wire up regmap_config provided bulk write in missed functions
In reply to Javier Martinez CanillasThere are some functions that were missed by commit d77e74561368 ("regmap:
Add bulk read/write callbacks into regmap_config") when support to define bulk read/write callbacks in regmap_config was introduced.
The regmap_bulk_write() and regmap_noinc_write() functions weren't changed to use the added map->write instead of the map->bus->write handler.
Also, the regmap_can_raw_write() was not modified to take map->write into account. So will only return true if a bus with a .write callback is set.
---
drivers/base/regmap/regmap.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/base/regmap/regmap.c +4 -6
@@ -1880,8 +1880,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,*/ bool regmap_can_raw_write (struct regmap *map) { -return map->bus && map->bus->write && map->format.format_val && - map->format.format_reg; +return map->write && map->format.format_val && map->format.format_reg; }EXPORT_SYMBOL_GPL (regmap_can_raw_write);
@@ -2155,10 +2154,9 @@ int regmap_noinc_write(struct regmap *map, unsigned int reg,size_t write_len;int ret; -if (!map->bus) -return -EINVAL ; -if (!map->bus->write) +if (!map->write)return -ENOTSUPP ; +if (val_len % map->format.val_bytes)return -EINVAL ;if (!IS_ALIGNED (reg, map->reg_stride))
@@ -2278,7 +2276,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,* Some devices don't support bulk write, for them we have a series of * single write operations. */ -if (!map->bus || !map->format.parse_inplace) { +if (!map->write || !map->format.parse_inplace) { map->lock (map->lock_arg);for (i =0 ; i < val_count; i++) {unsigned int ival;
Signature · 1 line
2.36.1
Re: [PATCH 3/3] regmap: Wire up regmap_config provided bulk write in missed functions
Quoted 4 lines · Javier Martinez Canillas
There are some functions that were missed by commit
d77e74561368("regmap:
Add bulk read/write callbacks intoregmap_config") when support to define bulk read/write callbacks inregmap_configwas introduced.
Quoted 8 lines
The
regmap_bulk_write()andregmap_noinc_write()functions weren't changed to use the addedmap->writeinstead of themap->bus->writehandler.Also, the
regmap_can_raw_write()was not modified to takemap->writeinto account. So will only return true if a bus with a .write callback is set.Fixes d77e74561368 ("regmap: Add bulk read/write callbacks into regmap_config")Signed-off-by Javier Martinez Canillas <[email protected]>
Mark Brown
maintainerQuoted 11 lines · Javier Martinez Canillas
This series contains fixes for a few issues found while testing the recent support for drivers to define bulk read/write callbacks in
regmap_config.I tested this with
drivers/gpu/drm/solomon/ssd130x-spi.c, by converting it to use this new API instead of defining its own regmap bus for bulk write.Patch #1 and patch #2 are fixes for regresions introduced by that commit and patch #3 adds
regmap_configprovided bulk write support to functionsregmap_noinc_write()andregmap_bulk_write(), that were missed.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] regmap: Re-introduce bulk read support check in regmap_bulk_read()
commit: 5ac01e023a1b0492e159ad2f6734e0a350c1b6b6
[2/3] regmap: Make regmap_noinc_read() return -ENOTSUPP if map->read isn't set
commit: f6e5c3850d1174bf3ca53457d64e6665f48c9041
[3/3] regmap: Wire up regmap_config provided bulk write in missed functions
commit: 1db43c8ad90ce07311a3ef9af7ace758d79224f9All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark