Skip to content

Commit fa079ba

Browse files
committed
Merge tag 'sound-5.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "The only largish change in this pull request is about the revert of the recent max98090 and its relevant patches due to regressions. Other than that, all small fixes for ALSA core (covering KCSAN fuzzer warnings in ALSA sequencer and rawmidi), Intel SOF HD-audio fixes, AMD ACP fixes, usual HD-audio quirks, and various ASoC fixes" * tag 'sound-5.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda: Use scnprintf() for printing texts for sysfs/procfs ALSA: hda/realtek - Apply quirk for yet another MSI laptop ASoC: sun8i-codec: Fix setting DAI data format ALSA: hda/realtek - Apply quirk for MSI GP63, too ASoC: amd: ACP needs to be powered off in BIOS. ASoC: hdmi-codec: set plugged_cb to NULL when component removing ASoC: dapm: remove snd_soc_dapm_put_enum_double_locked ASoC: max98090: revert invalid fix for handling SHDN ALSA: rawmidi: Avoid bit fields for state flags ALSA: seq: Fix concurrent access to queue current tick/time ALSA: seq: Avoid concurrent access to queue flags ASoC: codec2codec: avoid invalid/double-free of pcm runtime ASoC: amd: Buffer Size instead of MAX Buffer ASoC: SOF: Intel: hda: move i915 init earlier ASoC: SOF: Intel: hda: fix ordering bug in resume flow ALSA: hda: do not override bus codec_mask in link_get() ASoC: atmel: fix atmel_ssc_set_audio link failure ASoC: fsl_sai: Fix exiting path on probing failure
2 parents 0a44cac + 3855360 commit fa079ba

26 files changed

+265
-436
lines changed

include/sound/rawmidi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ struct snd_rawmidi_substream {
7777
struct list_head list; /* list of all substream for given stream */
7878
int stream; /* direction */
7979
int number; /* substream number */
80-
unsigned int opened: 1, /* open flag */
81-
append: 1, /* append flag (merge more streams) */
82-
active_sensing: 1; /* send active sensing when close */
80+
bool opened; /* open flag */
81+
bool append; /* append flag (merge more streams) */
82+
bool active_sensing; /* send active sensing when close */
8383
int use_count; /* use counter (for output) */
8484
size_t bytes;
8585
struct snd_rawmidi *rmidi;

include/sound/soc-dapm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,6 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
392392
struct snd_ctl_elem_value *ucontrol);
393393
int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
394394
struct snd_ctl_elem_value *ucontrol);
395-
int snd_soc_dapm_put_enum_double_locked(struct snd_kcontrol *kcontrol,
396-
struct snd_ctl_elem_value *ucontrol);
397395
int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol,
398396
struct snd_ctl_elem_info *uinfo);
399397
int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,

sound/core/seq/seq_clientmgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ static int update_timestamp_of_queue(struct snd_seq_event *event,
580580
event->queue = queue;
581581
event->flags &= ~SNDRV_SEQ_TIME_STAMP_MASK;
582582
if (real_time) {
583-
event->time.time = snd_seq_timer_get_cur_time(q->timer);
583+
event->time.time = snd_seq_timer_get_cur_time(q->timer, true);
584584
event->flags |= SNDRV_SEQ_TIME_STAMP_REAL;
585585
} else {
586586
event->time.tick = snd_seq_timer_get_cur_tick(q->timer);
@@ -1659,7 +1659,7 @@ static int snd_seq_ioctl_get_queue_status(struct snd_seq_client *client,
16591659
tmr = queue->timer;
16601660
status->events = queue->tickq->cells + queue->timeq->cells;
16611661

1662-
status->time = snd_seq_timer_get_cur_time(tmr);
1662+
status->time = snd_seq_timer_get_cur_time(tmr, true);
16631663
status->tick = snd_seq_timer_get_cur_tick(tmr);
16641664

16651665
status->running = tmr->running;

sound/core/seq/seq_queue.c

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop)
238238
{
239239
unsigned long flags;
240240
struct snd_seq_event_cell *cell;
241+
snd_seq_tick_time_t cur_tick;
242+
snd_seq_real_time_t cur_time;
241243

242244
if (q == NULL)
243245
return;
@@ -254,17 +256,18 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop)
254256

255257
__again:
256258
/* Process tick queue... */
259+
cur_tick = snd_seq_timer_get_cur_tick(q->timer);
257260
for (;;) {
258-
cell = snd_seq_prioq_cell_out(q->tickq,
259-
&q->timer->tick.cur_tick);
261+
cell = snd_seq_prioq_cell_out(q->tickq, &cur_tick);
260262
if (!cell)
261263
break;
262264
snd_seq_dispatch_event(cell, atomic, hop);
263265
}
264266

265267
/* Process time queue... */
268+
cur_time = snd_seq_timer_get_cur_time(q->timer, false);
266269
for (;;) {
267-
cell = snd_seq_prioq_cell_out(q->timeq, &q->timer->cur_time);
270+
cell = snd_seq_prioq_cell_out(q->timeq, &cur_time);
268271
if (!cell)
269272
break;
270273
snd_seq_dispatch_event(cell, atomic, hop);
@@ -392,6 +395,7 @@ int snd_seq_queue_check_access(int queueid, int client)
392395
int snd_seq_queue_set_owner(int queueid, int client, int locked)
393396
{
394397
struct snd_seq_queue *q = queueptr(queueid);
398+
unsigned long flags;
395399

396400
if (q == NULL)
397401
return -EINVAL;
@@ -401,8 +405,10 @@ int snd_seq_queue_set_owner(int queueid, int client, int locked)
401405
return -EPERM;
402406
}
403407

408+
spin_lock_irqsave(&q->owner_lock, flags);
404409
q->locked = locked ? 1 : 0;
405410
q->owner = client;
411+
spin_unlock_irqrestore(&q->owner_lock, flags);
406412
queue_access_unlock(q);
407413
queuefree(q);
408414

@@ -539,15 +545,17 @@ void snd_seq_queue_client_termination(int client)
539545
unsigned long flags;
540546
int i;
541547
struct snd_seq_queue *q;
548+
bool matched;
542549

543550
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
544551
if ((q = queueptr(i)) == NULL)
545552
continue;
546553
spin_lock_irqsave(&q->owner_lock, flags);
547-
if (q->owner == client)
554+
matched = (q->owner == client);
555+
if (matched)
548556
q->klocked = 1;
549557
spin_unlock_irqrestore(&q->owner_lock, flags);
550-
if (q->owner == client) {
558+
if (matched) {
551559
if (q->timer->running)
552560
snd_seq_timer_stop(q->timer);
553561
snd_seq_timer_reset(q->timer);
@@ -739,6 +747,8 @@ void snd_seq_info_queues_read(struct snd_info_entry *entry,
739747
int i, bpm;
740748
struct snd_seq_queue *q;
741749
struct snd_seq_timer *tmr;
750+
bool locked;
751+
int owner;
742752

743753
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
744754
if ((q = queueptr(i)) == NULL)
@@ -750,9 +760,14 @@ void snd_seq_info_queues_read(struct snd_info_entry *entry,
750760
else
751761
bpm = 0;
752762

763+
spin_lock_irq(&q->owner_lock);
764+
locked = q->locked;
765+
owner = q->owner;
766+
spin_unlock_irq(&q->owner_lock);
767+
753768
snd_iprintf(buffer, "queue %d: [%s]\n", q->queue, q->name);
754-
snd_iprintf(buffer, "owned by client : %d\n", q->owner);
755-
snd_iprintf(buffer, "lock status : %s\n", q->locked ? "Locked" : "Free");
769+
snd_iprintf(buffer, "owned by client : %d\n", owner);
770+
snd_iprintf(buffer, "lock status : %s\n", locked ? "Locked" : "Free");
756771
snd_iprintf(buffer, "queued time events : %d\n", snd_seq_prioq_avail(q->timeq));
757772
snd_iprintf(buffer, "queued tick events : %d\n", snd_seq_prioq_avail(q->tickq));
758773
snd_iprintf(buffer, "timer state : %s\n", tmr->running ? "Running" : "Stopped");

sound/core/seq/seq_timer.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,15 @@ int snd_seq_timer_continue(struct snd_seq_timer *tmr)
428428
}
429429

430430
/* return current 'real' time. use timeofday() to get better granularity. */
431-
snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr)
431+
snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr,
432+
bool adjust_ktime)
432433
{
433434
snd_seq_real_time_t cur_time;
434435
unsigned long flags;
435436

436437
spin_lock_irqsave(&tmr->lock, flags);
437438
cur_time = tmr->cur_time;
438-
if (tmr->running) {
439+
if (adjust_ktime && tmr->running) {
439440
struct timespec64 tm;
440441

441442
ktime_get_ts64(&tm);
@@ -452,7 +453,13 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr)
452453
high PPQ values) */
453454
snd_seq_tick_time_t snd_seq_timer_get_cur_tick(struct snd_seq_timer *tmr)
454455
{
455-
return tmr->tick.cur_tick;
456+
snd_seq_tick_time_t cur_tick;
457+
unsigned long flags;
458+
459+
spin_lock_irqsave(&tmr->lock, flags);
460+
cur_tick = tmr->tick.cur_tick;
461+
spin_unlock_irqrestore(&tmr->lock, flags);
462+
return cur_tick;
456463
}
457464

458465

sound/core/seq/seq_timer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ int snd_seq_timer_set_tempo_ppq(struct snd_seq_timer *tmr, int tempo, int ppq);
120120
int snd_seq_timer_set_position_tick(struct snd_seq_timer *tmr, snd_seq_tick_time_t position);
121121
int snd_seq_timer_set_position_time(struct snd_seq_timer *tmr, snd_seq_real_time_t position);
122122
int snd_seq_timer_set_skew(struct snd_seq_timer *tmr, unsigned int skew, unsigned int base);
123-
snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr);
123+
snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr,
124+
bool adjust_ktime);
124125
snd_seq_tick_time_t snd_seq_timer_get_cur_tick(struct snd_seq_timer *tmr);
125126

126127
extern int seq_default_timer_class;

sound/hda/ext/hdac_ext_controller.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all);
254254
int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
255255
struct hdac_ext_link *link)
256256
{
257+
unsigned long codec_mask;
257258
int ret = 0;
258259

259260
mutex_lock(&bus->lock);
@@ -280,9 +281,11 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
280281
* HDA spec section 4.3 - Codec Discovery
281282
*/
282283
udelay(521);
283-
bus->codec_mask = snd_hdac_chip_readw(bus, STATESTS);
284-
dev_dbg(bus->dev, "codec_mask = 0x%lx\n", bus->codec_mask);
285-
snd_hdac_chip_writew(bus, STATESTS, bus->codec_mask);
284+
codec_mask = snd_hdac_chip_readw(bus, STATESTS);
285+
dev_dbg(bus->dev, "codec_mask = 0x%lx\n", codec_mask);
286+
snd_hdac_chip_writew(bus, STATESTS, codec_mask);
287+
if (!bus->codec_mask)
288+
bus->codec_mask = codec_mask;
286289
}
287290

288291
mutex_unlock(&bus->lock);

sound/hda/hdmi_chmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen)
250250

251251
for (i = 0, j = 0; i < ARRAY_SIZE(cea_speaker_allocation_names); i++) {
252252
if (spk_alloc & (1 << i))
253-
j += snprintf(buf + j, buflen - j, " %s",
253+
j += scnprintf(buf + j, buflen - j, " %s",
254254
cea_speaker_allocation_names[i]);
255255
}
256256
buf[j] = '\0'; /* necessary when j == 0 */

sound/pci/hda/hda_codec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4022,7 +4022,7 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen)
40224022

40234023
for (i = 0, j = 0; i < ARRAY_SIZE(bits); i++)
40244024
if (pcm & (AC_SUPPCM_BITS_8 << i))
4025-
j += snprintf(buf + j, buflen - j, " %d", bits[i]);
4025+
j += scnprintf(buf + j, buflen - j, " %d", bits[i]);
40264026

40274027
buf[j] = '\0'; /* necessary when j == 0 */
40284028
}

sound/pci/hda/hda_eld.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen)
360360

361361
for (i = 0, j = 0; i < ARRAY_SIZE(alsa_rates); i++)
362362
if (pcm & (1 << i))
363-
j += snprintf(buf + j, buflen - j, " %d",
363+
j += scnprintf(buf + j, buflen - j, " %d",
364364
alsa_rates[i]);
365365

366366
buf[j] = '\0'; /* necessary when j == 0 */

0 commit comments

Comments
 (0)