diff options
author | Sebastian Reichel <sebastian.reichel@collabora.com> | 2020-05-10 01:56:03 +0200 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2020-05-10 01:56:03 +0200 |
commit | bf584e4dbd5bac7b1aaddbd33a7116364f919819 (patch) | |
tree | 1a4ebb22e283da0b363d9ad497f11624a2f4f439 /sound/core | |
parent | power: reset: ltc2952: remove unused variable (diff) | |
parent | regulator: use linear_ranges helper (diff) | |
download | linux-bf584e4dbd5bac7b1aaddbd33a7116364f919819.tar.xz linux-bf584e4dbd5bac7b1aaddbd33a7116364f919819.zip |
Merge tag 'tags/linear-ranges-lib' into psy-next
lib: Add linear ranges helper library and start using it
Series extracts a "linear ranges" helper out of the regulator
framework. Linear ranges helper is intended to help converting
real-world values to register values when conversion is linear. I
suspect this is useful also for power subsystem and possibly for clk.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/oss/pcm_plugin.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c index 59d62f05658f..1545f8fdb4db 100644 --- a/sound/core/oss/pcm_plugin.c +++ b/sound/core/oss/pcm_plugin.c @@ -205,13 +205,14 @@ static snd_pcm_sframes_t calc_dst_frames(struct snd_pcm_substream *plug, plugin = snd_pcm_plug_first(plug); while (plugin && frames > 0) { plugin_next = plugin->next; + if (check_size && plugin->buf_frames && + frames > plugin->buf_frames) + frames = plugin->buf_frames; if (plugin->dst_frames) { frames = plugin->dst_frames(plugin, frames); if (frames < 0) return frames; } - if (check_size && frames > plugin->buf_frames) - frames = plugin->buf_frames; plugin = plugin_next; } return frames; @@ -225,14 +226,15 @@ static snd_pcm_sframes_t calc_src_frames(struct snd_pcm_substream *plug, plugin = snd_pcm_plug_last(plug); while (plugin && frames > 0) { - if (check_size && frames > plugin->buf_frames) - frames = plugin->buf_frames; plugin_prev = plugin->prev; if (plugin->src_frames) { frames = plugin->src_frames(plugin, frames); if (frames < 0) return frames; } + if (check_size && plugin->buf_frames && + frames > plugin->buf_frames) + frames = plugin->buf_frames; plugin = plugin_prev; } return frames; |