regmap: spi: Set regmap max raw r/w from max_transfer_size
Subsystems (2)
PATCH v3 1/1 regmap: spi: Set regmap max raw r/w from max_transfer_size
From: Lucas Tanure <[email protected]>
Set regmap raw read/write from spi max_transfer_size so regmap_raw_read/write can split the access into chunks
---
Changes from v2:
- Fix build warning
v2: https://lore.kernel.org/lkml/[email protected]/
drivers/base/regmap/regmap-spi.c | 36 ++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-)
drivers/base/regmap/regmap-spi.c +32 -4
@@ -109,13 +109,37 @@ static const struct regmap_bus regmap_spi = { .val_format_endian_default = REGMAP_ENDIAN_BIG, }; +static const struct regmap_bus *regmap_get_spi_bus (struct spi_device *spi, +const struct regmap_config *config) +{ +size_t max_size =spi_max_transfer_size (spi); +struct regmap_bus *bus; + +if (max_size !=SIZE_MAX ) { + bus =kmemdup (®map_spi,sizeof (*bus),GFP_KERNEL ); +if (!bus) +return ERR_PTR (-ENOMEM ); + + bus->free_on_exit = true; + bus->max_raw_read = max_size; + bus->max_raw_write = max_size; +return bus; + } + +return ®map_spi; +} +struct regmap *__regmap_init_spi (struct spi_device *spi,const struct regmap_config *config,struct lock_class_key *lock_key,const char *lock_name) { -return __regmap_init (&spi->dev, ®map_spi, &spi->dev, config, - lock_key, lock_name); +const struct regmap_bus *bus =regmap_get_spi_bus (spi, config); + +if (IS_ERR (bus)) +return ERR_CAST (bus); + +return __regmap_init (&spi->dev, bus, &spi->dev, config, lock_key, lock_name); }EXPORT_SYMBOL_GPL (__regmap_init_spi);
@@ -124,8 +148,12 @@ struct regmap *__devm_regmap_init_spi(struct spi_device *spi,struct lock_class_key *lock_key, const char *lock_name) { - return __devm_regmap_init(&spi->dev, ®map_spi, &spi->dev, config, -lock_key ,lock_name ); + const struct regmap_bus *bus = regmap_get_spi_bus(spi, config); + +if (IS_ERR (bus)) +return ERR_CAST (bus); + +return __devm_regmap_init (&spi->dev, bus, &spi->dev, config, lock_key, lock_name); }EXPORT_SYMBOL_GPL (__devm_regmap_init_spi);
Signature · 1 line
2.33.1
Mark Brown
maintainerQuoted 3 lines · André Almeida
Reviewed-by Charles Keepax <[email protected]>[André: fix build warning]Signed-off-by André Almeida <[email protected]>
It wasn't just a warning, as I told Lucas it was a build error given that allmodconfig now has -Werror.
Às 10:54 de 21/10/21, Mark Brown escreveu:
Quoted 9 lines · André Almeida
Quoted 4 lines
Reviewed-by Charles Keepax <[email protected]>[André: fix build warning]Signed-off-by André Almeida <[email protected]>It wasn't just a warning, as I told Lucas it was a build error given that allmodconfig now has -Werror.
Ok, I didn't know that -Werror was around. Should I resend the patch with [André: fix build error]?
Mark Brown
maintainerQuoted 7 lines · André Almeida
Às 10:54 de 21/10/21, Mark Brown escreveu:
Quoted 2 lines
It wasn't just a warning, as I told Lucas it was a build error given that allmodconfig now has -Werror.
Ok, I didn't know that -Werror was around. Should I resend the patch with [André: fix build error]?
No, it doesn't make any practical difference.
Mark Brown
maintainerQuoted 6 lines · André Almeida
From: Lucas Tanure <[email protected]>
Set regmap raw read/write from spi
max_transfer_sizeso regmap_raw_read/write can split the access into chunks
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
Thanks!
[1/1] regmap: spi: Set regmap max raw r/w from max_transfer_size
commit: f231ff38b7b23197013b437128d196710fe282da
All 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