mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Piyush Patle <piyushpatle228@gmail.com>
Cc: Sheetal <sheetal@nvidia.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	linux-sound@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] ASoC: tegra210_adx: simplify byte map get/put logic
Date: Wed, 8 Apr 2026 18:47:33 +0100	[thread overview]
Message-ID: <ae440ab7-e1ba-4f38-8ef9-85371f3236f0@sirena.org.uk> (raw)
In-Reply-To: <20260408170818.70322-2-piyushpatle228@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1128 bytes --]

On Wed, Apr 08, 2026 at 10:38:17PM +0530, Piyush Patle wrote:

> +static int tegra210_adx_write_map_ram(struct tegra210_adx *adx)
>  {
> +	const unsigned int bits_per_mask = BITS_PER_TYPE(*adx->map) * BITS_PER_BYTE;

Why are we multiplying by BITS_PER_BYTE here?  We've got a number of
bits already from BITS_PER_TYPE().

> +	for (i = 0; i < adx->soc_data->ram_depth; i++) {
> +		u32 word = 0;
> +		int b;
> +
> +		for (b = 0; b < TEGRA_ADX_SLOTS_PER_WORD; b++) {
> +			unsigned int slot = i * TEGRA_ADX_SLOTS_PER_WORD + b;
> +			u16 val = adx->map[slot];
> +
> +			if (val >= 256)
> +				continue;
> +
> +			word |= (u32)val << (b * BITS_PER_BYTE);
> +			byte_mask[slot / bits_per_mask] |= 1U << (slot % bits_per_mask);

How big can bits_per_mask get?

> @@ -118,9 +144,7 @@ static int tegra210_adx_runtime_resume(struct device *dev)
>  	regcache_cache_only(adx->regmap, false);
>  	regcache_sync(adx->regmap);
>  
> -	tegra210_adx_write_map_ram(adx);
> -
> -	return 0;
> +	return tegra210_adx_write_map_ram(adx);

We need to unwind at least the regcache_cache_only() above if resume
fails.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2026-04-08 17:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 17:03 [PATCH 0/2] ASoC: tegra210: simplify byte map handling in ADX and AMX Piyush Patle
2026-04-07 17:03 ` [PATCH 1/2] ASoC: tegra210_adx: simplify byte map get/put logic Piyush Patle
2026-04-07 17:03 ` [PATCH 2/2] ASoC: tegra210_amx: " Piyush Patle
2026-04-08 14:08   ` Sheetal .
2026-04-08 17:08   ` [PATCH v2 0/2] ASoC: tegra210: simplify byte map handling in ADX and AMX Piyush Patle
2026-04-08 17:08     ` [PATCH v2 1/2] ASoC: tegra210_adx: simplify byte map get/put logic Piyush Patle
2026-04-08 17:38       ` Jon Hunter
2026-04-08 21:19         ` Piyush Patle
2026-04-08 17:47       ` Mark Brown [this message]
2026-04-08 21:25         ` Piyush Patle
2026-04-08 17:08     ` [PATCH v2 2/2] ASoC: tegra210_amx: " Piyush Patle
2026-04-08 17:49       ` Mark Brown
2026-04-08 17:41     ` [PATCH v2 0/2] ASoC: tegra210: simplify byte map handling in ADX and AMX Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ae440ab7-e1ba-4f38-8ef9-85371f3236f0@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=piyushpatle228@gmail.com \
    --cc=sheetal@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®