Skip to content

Commit 1a9451b

Browse files
committed
remap: Some fixes for bulk read/write callbacks in regmap_config support
Merge series from Javier Martinez Canillas <javierm@redhat.com>: 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.
2 parents ad9894a + 1db43c8 commit 1a9451b

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

drivers/base/regmap/regmap.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,8 +1880,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
18801880
*/
18811881
bool regmap_can_raw_write(struct regmap *map)
18821882
{
1883-
return map->bus && map->bus->write && map->format.format_val &&
1884-
map->format.format_reg;
1883+
return map->write && map->format.format_val && map->format.format_reg;
18851884
}
18861885
EXPORT_SYMBOL_GPL(regmap_can_raw_write);
18871886

@@ -2155,10 +2154,9 @@ int regmap_noinc_write(struct regmap *map, unsigned int reg,
21552154
size_t write_len;
21562155
int ret;
21572156

2158-
if (!map->bus)
2159-
return -EINVAL;
2160-
if (!map->bus->write)
2157+
if (!map->write)
21612158
return -ENOTSUPP;
2159+
21622160
if (val_len % map->format.val_bytes)
21632161
return -EINVAL;
21642162
if (!IS_ALIGNED(reg, map->reg_stride))
@@ -2278,7 +2276,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
22782276
* Some devices don't support bulk write, for them we have a series of
22792277
* single write operations.
22802278
*/
2281-
if (!map->bus || !map->format.parse_inplace) {
2279+
if (!map->write || !map->format.parse_inplace) {
22822280
map->lock(map->lock_arg);
22832281
for (i = 0; i < val_count; i++) {
22842282
unsigned int ival;
@@ -2904,6 +2902,9 @@ int regmap_noinc_read(struct regmap *map, unsigned int reg,
29042902
size_t read_len;
29052903
int ret;
29062904

2905+
if (!map->read)
2906+
return -ENOTSUPP;
2907+
29072908
if (val_len % map->format.val_bytes)
29082909
return -EINVAL;
29092910
if (!IS_ALIGNED(reg, map->reg_stride))
@@ -3017,7 +3018,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
30173018
if (val_count == 0)
30183019
return -EINVAL;
30193020

3020-
if (map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) {
3021+
if (map->read && map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) {
30213022
ret = regmap_raw_read(map, reg, val, val_bytes * val_count);
30223023
if (ret != 0)
30233024
return ret;

0 commit comments

Comments
 (0)