All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Mark Brown <broonie@kernel.org>
Cc: Marek Vasut <marex@denx.de>,
	alsa-devel@alsa-project.org, stable@vger.kernel.org
Subject: Re: [PATCH] ASoC: ops: Shift tested values in snd_soc_put_volsw() by +min
Date: Wed, 23 Feb 2022 17:44:45 +0100	[thread overview]
Message-ID: <s5hfso9y1ky.wl-tiwai@suse.de> (raw)
In-Reply-To: <YhZhkz6gQYsK3Fwd@sirena.org.uk>

On Wed, 23 Feb 2022 17:32:19 +0100,
Mark Brown wrote:
> 
> On Wed, Feb 23, 2022 at 03:55:54PM +0100, Takashi Iwai wrote:
> > 
> > But, more reading the code, I suspect whether the function does work
> > correctly at all...  How is the mask calculation done in that way?
> >   unsigned int mask = (1U << (fls(min + max) - 1)) - 1;
> > What's the difference of this function with snd_soc_put_volsw()?
> 
> Yeah, I'm not clear either - Marek mentioned _SX when he was doing the
> patch but I didn't get the bandwidth to figure out what it's doing
> properly yet.  At this point I'm not clear what _SX is supposed to do,
> I'm hoping it works well for the devices that use it but I don't have
> any of them.

OK, let's hope that...

> > Furthermore, the mask calculation and usage in snd_soc_put_volsw()
> > isn't right, either, I'm afraid; if the range is [-10, 0], max=0, then
> > mask will 0, which will omit all values...
> 
> Indeed, if anyone did that.  Fortunately I don't *think* that's an
> issue.  The whole way that code handles signed bitfields by remapping
> them into unsigned user visible controls is a landmine, it's not even
> obvious that they handle signed bitfields in the first place.

Thanks, then it seems OK as is for now.  I guess the signed bit should
be detected by the helper instead of hard-coding, but it's no urgent
issue.


Takashi

  reply	other threads:[~2022-02-23 16:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 13:06 [PATCH] ASoC: ops: Shift tested values in snd_soc_put_volsw() by +min Marek Vasut
2022-02-16 18:01 ` Mark Brown
2022-02-23 14:55 ` Takashi Iwai
2022-02-23 16:32   ` Mark Brown
2022-02-23 16:44     ` Takashi Iwai [this message]
2022-02-23 16:52     ` Marek Vasut
2022-02-23 16:52       ` Marek Vasut
2022-05-16 23:53       ` Tan N.
2022-05-16 23:53         ` Tan N.
2022-05-17  1:12         ` [PATCH] ASoC: ops: Fix the bounds checking in snd_soc_put_volsw_sx and snd_soc_put_xr_sx Tan Nayir
2022-05-17  1:12           ` Tan Nayir
2022-05-17 13:04           ` Mark Brown
2022-05-17 13:04             ` Mark Brown
2022-05-17 14:25             ` Tan Nayır
2022-05-17 14:25               ` Tan Nayır
2022-05-17 18:20               ` Mark Brown
2022-05-17 18:20                 ` Mark Brown
2022-05-17 19:58                 ` Tan Nayır
2022-05-17 19:58                   ` Tan Nayır
2022-05-18 12:07                   ` Mark Brown
2022-05-18 12:07                     ` Mark Brown
2022-05-18 23:56                     ` Tan Nayır
2022-05-18 23:56                       ` Tan Nayır
2022-05-19 15:47                       ` Mark Brown
2022-05-19 15:47                         ` 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=s5hfso9y1ky.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=marex@denx.de \
    --cc=stable@vger.kernel.org \
    /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.