* [PATCH] ASoC: codecs: Use min() to simplify aw_dev_dsp_update_container()
@ 2025-04-29 7:10 Thorsten Blum
2025-04-30 12:37 ` Andy Shevchenko
2025-04-30 22:51 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2025-04-29 7:10 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Weidong Wang, Colin Ian King, Eric Biggers, Ard Biesheuvel,
Andy Shevchenko, Zhu Jun, Heiko Stuebner, Uwe Kleine-König
Cc: Thorsten Blum, linux-sound, linux-kernel
Use min() to simplify aw_dev_dsp_update_container() and improve its
readability.
No functional changes intended.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
sound/soc/codecs/aw88166.c | 7 ++-----
sound/soc/codecs/aw88395/aw88395_device.c | 7 ++-----
sound/soc/codecs/aw88399.c | 7 ++-----
3 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/sound/soc/codecs/aw88166.c b/sound/soc/codecs/aw88166.c
index 6c50c4a18b6a..4f76ebe11cc7 100644
--- a/sound/soc/codecs/aw88166.c
+++ b/sound/soc/codecs/aw88166.c
@@ -11,6 +11,7 @@
#include <linux/firmware.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
+#include <linux/minmax.h>
#include <linux/regmap.h>
#include <sound/soc.h>
#include "aw88166.h"
@@ -909,11 +910,7 @@ static int aw_dev_dsp_update_container(struct aw_device *aw_dev,
goto error_operation;
for (i = 0; i < len; i += AW88166_MAX_RAM_WRITE_BYTE_SIZE) {
- if ((len - i) < AW88166_MAX_RAM_WRITE_BYTE_SIZE)
- tmp_len = len - i;
- else
- tmp_len = AW88166_MAX_RAM_WRITE_BYTE_SIZE;
-
+ tmp_len = min(len - i, AW88166_MAX_RAM_WRITE_BYTE_SIZE);
ret = regmap_raw_write(aw_dev->regmap, AW88166_DSPMDAT_REG,
&data[i], tmp_len);
if (ret)
diff --git a/sound/soc/codecs/aw88395/aw88395_device.c b/sound/soc/codecs/aw88395/aw88395_device.c
index b7ea8be0d0cb..e1430940015d 100644
--- a/sound/soc/codecs/aw88395/aw88395_device.c
+++ b/sound/soc/codecs/aw88395/aw88395_device.c
@@ -10,6 +10,7 @@
#include <linux/crc32.h>
#include <linux/i2c.h>
+#include <linux/minmax.h>
#include <linux/regmap.h>
#include "aw88395_device.h"
#include "aw88395_reg.h"
@@ -1114,11 +1115,7 @@ static int aw_dev_dsp_update_container(struct aw_device *aw_dev,
goto error_operation;
for (i = 0; i < len; i += AW88395_MAX_RAM_WRITE_BYTE_SIZE) {
- if ((len - i) < AW88395_MAX_RAM_WRITE_BYTE_SIZE)
- tmp_len = len - i;
- else
- tmp_len = AW88395_MAX_RAM_WRITE_BYTE_SIZE;
-
+ tmp_len = min(len - i, AW88395_MAX_RAM_WRITE_BYTE_SIZE);
ret = regmap_raw_write(aw_dev->regmap, AW88395_DSPMDAT_REG,
&data[i], tmp_len);
if (ret)
diff --git a/sound/soc/codecs/aw88399.c b/sound/soc/codecs/aw88399.c
index ee3cc2a95f85..4b90133e5ab4 100644
--- a/sound/soc/codecs/aw88399.c
+++ b/sound/soc/codecs/aw88399.c
@@ -11,6 +11,7 @@
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/firmware.h>
+#include <linux/minmax.h>
#include <linux/regmap.h>
#include <sound/soc.h>
#include "aw88399.h"
@@ -872,11 +873,7 @@ static int aw_dev_dsp_update_container(struct aw_device *aw_dev,
goto error_operation;
for (i = 0; i < len; i += AW88399_MAX_RAM_WRITE_BYTE_SIZE) {
- if ((len - i) < AW88399_MAX_RAM_WRITE_BYTE_SIZE)
- tmp_len = len - i;
- else
- tmp_len = AW88399_MAX_RAM_WRITE_BYTE_SIZE;
-
+ tmp_len = min(len - i, AW88399_MAX_RAM_WRITE_BYTE_SIZE);
ret = regmap_raw_write(aw_dev->regmap, AW88399_DSPMDAT_REG,
&data[i], tmp_len);
if (ret)
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: codecs: Use min() to simplify aw_dev_dsp_update_container()
2025-04-29 7:10 [PATCH] ASoC: codecs: Use min() to simplify aw_dev_dsp_update_container() Thorsten Blum
@ 2025-04-30 12:37 ` Andy Shevchenko
2025-04-30 22:51 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2025-04-30 12:37 UTC (permalink / raw)
To: Thorsten Blum
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Weidong Wang, Colin Ian King, Eric Biggers, Ard Biesheuvel,
Zhu Jun, Heiko Stuebner, Uwe Kleine-König, linux-sound,
linux-kernel
On Tue, Apr 29, 2025 at 09:10:13AM +0200, Thorsten Blum wrote:
> Use min() to simplify aw_dev_dsp_update_container() and improve its
> readability.
>
> No functional changes intended.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: codecs: Use min() to simplify aw_dev_dsp_update_container()
2025-04-29 7:10 [PATCH] ASoC: codecs: Use min() to simplify aw_dev_dsp_update_container() Thorsten Blum
2025-04-30 12:37 ` Andy Shevchenko
@ 2025-04-30 22:51 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-04-30 22:51 UTC (permalink / raw)
To: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Weidong Wang,
Colin Ian King, Eric Biggers, Ard Biesheuvel, Andy Shevchenko,
Zhu Jun, Heiko Stuebner, Uwe Kleine-König, Thorsten Blum
Cc: linux-sound, linux-kernel
On Tue, 29 Apr 2025 09:10:13 +0200, Thorsten Blum wrote:
> Use min() to simplify aw_dev_dsp_update_container() and improve its
> readability.
>
> No functional changes intended.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: codecs: Use min() to simplify aw_dev_dsp_update_container()
commit: 84dea31d33e0f4651eff6ee2e1e02804ff2529d2
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-30 22:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 7:10 [PATCH] ASoC: codecs: Use min() to simplify aw_dev_dsp_update_container() Thorsten Blum
2025-04-30 12:37 ` Andy Shevchenko
2025-04-30 22:51 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.