Skip to content

Commit 99fff44

Browse files
committed
Merge branch 'for-linus' into for-next
Back-merge the 5.1 devel branch for the further HD-audio development. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 parents 6b580f5 + 183ab39 commit 99fff44

56 files changed

Lines changed: 847 additions & 311 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎include/sound/soc.h‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,13 @@ struct snd_soc_component_driver {
802802
int probe_order;
803803
int remove_order;
804804

805-
/* signal if the module handling the component cannot be removed */
806-
unsigned int ignore_module_refcount:1;
805+
/*
806+
* signal if the module handling the component should not be removed
807+
* if a pcm is open. Setting this would prevent the module
808+
* refcount being incremented in probe() but allow it be incremented
809+
* when a pcm is opened and decremented when it is closed.
810+
*/
811+
unsigned int module_get_upon_open:1;
807812

808813
/* bits */
809814
unsigned int idle_bias_on:1;
@@ -1083,6 +1088,8 @@ struct snd_soc_card {
10831088
struct mutex mutex;
10841089
struct mutex dapm_mutex;
10851090

1091+
spinlock_t dpcm_lock;
1092+
10861093
bool instantiated;
10871094
bool topology_shortname_created;
10881095

‎include/uapi/sound/asound.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#ifndef __KERNEL__
3434
#include <stdlib.h>
35+
#include <time.h>
3536
#endif
3637

3738
/*

‎sound/core/oss/pcm_oss.c‎

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,28 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
940940
oss_frame_size = snd_pcm_format_physical_width(params_format(params)) *
941941
params_channels(params) / 8;
942942

943+
err = snd_pcm_oss_period_size(substream, params, sparams);
944+
if (err < 0)
945+
goto failure;
946+
947+
n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size);
948+
err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, n, NULL);
949+
if (err < 0)
950+
goto failure;
951+
952+
err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIODS,
953+
runtime->oss.periods, NULL);
954+
if (err < 0)
955+
goto failure;
956+
957+
snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
958+
959+
err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams);
960+
if (err < 0) {
961+
pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err);
962+
goto failure;
963+
}
964+
943965
#ifdef CONFIG_SND_PCM_OSS_PLUGINS
944966
snd_pcm_oss_plugin_clear(substream);
945967
if (!direct) {
@@ -974,27 +996,6 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
974996
}
975997
#endif
976998

977-
err = snd_pcm_oss_period_size(substream, params, sparams);
978-
if (err < 0)
979-
goto failure;
980-
981-
n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size);
982-
err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, n, NULL);
983-
if (err < 0)
984-
goto failure;
985-
986-
err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIODS,
987-
runtime->oss.periods, NULL);
988-
if (err < 0)
989-
goto failure;
990-
991-
snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
992-
993-
if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams)) < 0) {
994-
pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err);
995-
goto failure;
996-
}
997-
998999
if (runtime->oss.trigger) {
9991000
sw_params->start_threshold = 1;
10001001
} else {

‎sound/core/pcm_native.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,8 +1445,15 @@ static int snd_pcm_pause(struct snd_pcm_substream *substream, int push)
14451445
static int snd_pcm_pre_suspend(struct snd_pcm_substream *substream, int state)
14461446
{
14471447
struct snd_pcm_runtime *runtime = substream->runtime;
1448-
if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
1448+
switch (runtime->status->state) {
1449+
case SNDRV_PCM_STATE_SUSPENDED:
14491450
return -EBUSY;
1451+
/* unresumable PCM state; return -EBUSY for skipping suspend */
1452+
case SNDRV_PCM_STATE_OPEN:
1453+
case SNDRV_PCM_STATE_SETUP:
1454+
case SNDRV_PCM_STATE_DISCONNECTED:
1455+
return -EBUSY;
1456+
}
14501457
runtime->trigger_master = substream;
14511458
return 0;
14521459
}

‎sound/core/rawmidi.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/module.h>
3131
#include <linux/delay.h>
3232
#include <linux/mm.h>
33+
#include <linux/nospec.h>
3334
#include <sound/rawmidi.h>
3435
#include <sound/info.h>
3536
#include <sound/control.h>
@@ -601,6 +602,7 @@ static int __snd_rawmidi_info_select(struct snd_card *card,
601602
return -ENXIO;
602603
if (info->stream < 0 || info->stream > 1)
603604
return -EINVAL;
605+
info->stream = array_index_nospec(info->stream, 2);
604606
pstr = &rmidi->streams[info->stream];
605607
if (pstr->substream_count == 0)
606608
return -ENOENT;

‎sound/core/seq/oss/seq_oss_synth.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,13 +617,14 @@ int
617617
snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_info *inf)
618618
{
619619
struct seq_oss_synth *rec;
620+
struct seq_oss_synthinfo *info = get_synthinfo_nospec(dp, dev);
620621

621-
if (dev < 0 || dev >= dp->max_synthdev)
622+
if (!info)
622623
return -ENXIO;
623624

624-
if (dp->synths[dev].is_midi) {
625+
if (info->is_midi) {
625626
struct midi_info minf;
626-
snd_seq_oss_midi_make_info(dp, dp->synths[dev].midi_mapped, &minf);
627+
snd_seq_oss_midi_make_info(dp, info->midi_mapped, &minf);
627628
inf->synth_type = SYNTH_TYPE_MIDI;
628629
inf->synth_subtype = 0;
629630
inf->nr_voices = 16;

‎sound/core/seq/seq_clientmgr.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client,
12791279

12801280
/* fill the info fields */
12811281
if (client_info->name[0])
1282-
strlcpy(client->name, client_info->name, sizeof(client->name));
1282+
strscpy(client->name, client_info->name, sizeof(client->name));
12831283

12841284
client->filter = client_info->filter;
12851285
client->event_lost = client_info->event_lost;
@@ -1557,7 +1557,7 @@ static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, void *arg)
15571557
/* set queue name */
15581558
if (!info->name[0])
15591559
snprintf(info->name, sizeof(info->name), "Queue-%d", q->queue);
1560-
strlcpy(q->name, info->name, sizeof(q->name));
1560+
strscpy(q->name, info->name, sizeof(q->name));
15611561
snd_use_lock_free(&q->use_lock);
15621562

15631563
return 0;
@@ -1619,7 +1619,7 @@ static int snd_seq_ioctl_set_queue_info(struct snd_seq_client *client,
16191619
queuefree(q);
16201620
return -EPERM;
16211621
}
1622-
strlcpy(q->name, info->name, sizeof(q->name));
1622+
strscpy(q->name, info->name, sizeof(q->name));
16231623
queuefree(q);
16241624

16251625
return 0;

‎sound/hda/ext/hdac_ext_bus.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
107107
INIT_LIST_HEAD(&bus->hlink_list);
108108
bus->idx = idx++;
109109

110-
mutex_init(&bus->lock);
111110
bus->cmd_dma_state = true;
112111

113112
return 0;

‎sound/hda/hdac_bus.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
3838
INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events);
3939
spin_lock_init(&bus->reg_lock);
4040
mutex_init(&bus->cmd_mutex);
41+
mutex_init(&bus->lock);
4142
bus->irq = -1;
4243
return 0;
4344
}

‎sound/hda/hdac_component.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable)
6969

7070
dev_dbg(bus->dev, "display power %s\n",
7171
enable ? "enable" : "disable");
72+
73+
mutex_lock(&bus->lock);
7274
if (enable)
7375
set_bit(idx, &bus->display_power_status);
7476
else
7577
clear_bit(idx, &bus->display_power_status);
7678

7779
if (!acomp || !acomp->ops)
78-
return;
80+
goto unlock;
7981

8082
if (bus->display_power_status) {
8183
if (!bus->display_power_active) {
@@ -92,6 +94,8 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable)
9294
bus->display_power_active = false;
9395
}
9496
}
97+
unlock:
98+
mutex_unlock(&bus->lock);
9599
}
96100
EXPORT_SYMBOL_GPL(snd_hdac_display_power);
97101

0 commit comments

Comments
 (0)