All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>,
	Shuah Khan <shuah@kernel.org>,
	alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v1 1/2] kselftest: alsa: Factor out check that values meet constraints
Date: Fri, 17 Dec 2021 14:38:51 +0000	[thread overview]
Message-ID: <Ybyg+x636Y2nMcVb@sirena.org.uk> (raw)
In-Reply-To: <f0caf4d9-5e1d-4b85-9d2c-00b65fa97638@intel.com>

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

On Fri, Dec 17, 2021 at 02:32:24PM +0100, Cezary Rojewski wrote:
> On 2021-12-17 2:02 PM, Mark Brown wrote:

> > +	for (i = 0; i < snd_ctl_elem_info_get_count(ctl->info); i++)
> > +		if (!ctl_value_index_valid(ctl, val, i))
> > +			valid = false;

> Correct me I'm wrong, but it seems a 'return false' would suffice. Is the
> continuation of looping still needed once a single check found above
> evaluates to true?

It doesn't affect the result of the test but it will cause us to print a
diagnostic message for each invalid value rather than just the first one
we see (eg, if both channels in a stereo control have an invalid value)
which seems like it's more helpful to people working with the output
than just the first error.

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

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>,
	alsa-devel@alsa-project.org, Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v1 1/2] kselftest: alsa: Factor out check that values meet constraints
Date: Fri, 17 Dec 2021 14:38:51 +0000	[thread overview]
Message-ID: <Ybyg+x636Y2nMcVb@sirena.org.uk> (raw)
In-Reply-To: <f0caf4d9-5e1d-4b85-9d2c-00b65fa97638@intel.com>

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

On Fri, Dec 17, 2021 at 02:32:24PM +0100, Cezary Rojewski wrote:
> On 2021-12-17 2:02 PM, Mark Brown wrote:

> > +	for (i = 0; i < snd_ctl_elem_info_get_count(ctl->info); i++)
> > +		if (!ctl_value_index_valid(ctl, val, i))
> > +			valid = false;

> Correct me I'm wrong, but it seems a 'return false' would suffice. Is the
> continuation of looping still needed once a single check found above
> evaluates to true?

It doesn't affect the result of the test but it will cause us to print a
diagnostic message for each invalid value rather than just the first one
we see (eg, if both channels in a stereo control have an invalid value)
which seems like it's more helpful to people working with the output
than just the first error.

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

  reply	other threads:[~2021-12-17 14:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 13:02 [PATCH v1 0/2] kselftest: alsa: Small enhancements to mixer-test Mark Brown
2021-12-17 13:02 ` Mark Brown
2021-12-17 13:02 ` [PATCH v1 1/2] kselftest: alsa: Factor out check that values meet constraints Mark Brown
2021-12-17 13:02   ` Mark Brown
2021-12-17 13:32   ` Cezary Rojewski
2021-12-17 13:32     ` Cezary Rojewski
2021-12-17 14:38     ` Mark Brown [this message]
2021-12-17 14:38       ` Mark Brown
2021-12-17 14:54       ` Cezary Rojewski
2021-12-17 14:54         ` Cezary Rojewski
2021-12-17 13:02 ` [PATCH v1 2/2] kselftest: alsa: Validate values read from enumerations Mark Brown
2021-12-17 13:02   ` Mark Brown
2021-12-17 15:01 ` [PATCH v1 0/2] kselftest: alsa: Small enhancements to mixer-test Cezary Rojewski
2021-12-17 15:01   ` Cezary Rojewski
2021-12-25  8:13 ` Takashi Iwai
2021-12-25  8:13   ` Takashi Iwai

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=Ybyg+x636Y2nMcVb@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=cezary.rojewski@intel.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=shuah@kernel.org \
    --cc=tiwai@suse.de \
    /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 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.