summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/oss/pcm_oss.c5
-rw-r--r--sound/core/pcm_native.c2
-rw-r--r--sound/pci/hda/hda_intel.c4
-rw-r--r--sound/soc/fsl/fsl_dma.c2
-rw-r--r--sound/usb/clock.c128
5 files changed, 60 insertions, 81 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 481ab0e94ffa..1980f68246cb 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1128,13 +1128,14 @@ static int snd_pcm_oss_get_active_substream(struct snd_pcm_oss_file *pcm_oss_fil
}
/* call with params_lock held */
+/* NOTE: this always call PREPARE unconditionally no matter whether
+ * runtime->oss.prepare is set or not
+ */
static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream)
{
int err;
struct snd_pcm_runtime *runtime = substream->runtime;
- if (!runtime->oss.prepare)
- return 0;
err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL);
if (err < 0) {
pcm_dbg(substream->pcm,
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index b84554893fab..35ffccea94c3 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -617,7 +617,7 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
changed = snd_pcm_hw_param_first(pcm, params, *v, NULL);
else
changed = snd_pcm_hw_param_last(pcm, params, *v, NULL);
- if (snd_BUG_ON(changed < 0))
+ if (changed < 0)
return changed;
if (changed == 0)
continue;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 7720e3102bcc..7a111a1b5836 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -987,7 +987,7 @@ static int param_set_xint(const char *val, const struct kernel_param *kp)
#define azx_del_card_list(chip) /* NOP */
#endif /* CONFIG_PM */
-#if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO)
+#ifdef CONFIG_PM_SLEEP
/*
* power management
*/
@@ -1068,9 +1068,7 @@ static int azx_resume(struct device *dev)
trace_azx_resume(chip);
return 0;
}
-#endif /* CONFIG_PM_SLEEP || SUPPORT_VGA_SWITCHEROO */
-#ifdef CONFIG_PM_SLEEP
/* put codec down to D3 at hibernation for Intel SKL+;
* otherwise BIOS may still access the codec and screw up the driver
*/
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index fce2010d3c53..78871de35086 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -886,7 +886,7 @@ static const struct snd_pcm_ops fsl_dma_ops = {
};
static int fsl_soc_dma_probe(struct platform_device *pdev)
- {
+{
struct dma_object *dma;
struct device_node *np = pdev->dev.of_node;
struct device_node *ssi_np;
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index ab39ccb974c6..0b030d8fe3fa 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -35,105 +35,85 @@
#include "clock.h"
#include "quirks.h"
-static struct uac_clock_source_descriptor *
- snd_usb_find_clock_source(struct usb_host_interface *ctrl_iface,
- int clock_id)
+static void *find_uac_clock_desc(struct usb_host_interface *iface, int id,
+ bool (*validator)(void *, int), u8 type)
{
- struct uac_clock_source_descriptor *cs = NULL;
+ void *cs = NULL;
- while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
- ctrl_iface->extralen,
- cs, UAC2_CLOCK_SOURCE))) {
- if (cs->bLength >= sizeof(*cs) && cs->bClockID == clock_id)
+ while ((cs = snd_usb_find_csint_desc(iface->extra, iface->extralen,
+ cs, type))) {
+ if (validator(cs, id))
return cs;
}
return NULL;
}
-static struct uac3_clock_source_descriptor *
- snd_usb_find_clock_source_v3(struct usb_host_interface *ctrl_iface,
- int clock_id)
+static bool validate_clock_source_v2(void *p, int id)
{
- struct uac3_clock_source_descriptor *cs = NULL;
-
- while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
- ctrl_iface->extralen,
- cs, UAC3_CLOCK_SOURCE))) {
- if (cs->bClockID == clock_id)
- return cs;
- }
-
- return NULL;
+ struct uac_clock_source_descriptor *cs = p;
+ return cs->bLength == sizeof(*cs) && cs->bClockID == id;
}
-static struct uac_clock_selector_descriptor *
- snd_usb_find_clock_selector(struct usb_host_interface *ctrl_iface,
- int clock_id)
+static bool validate_clock_source_v3(void *p, int id)
{
- struct uac_clock_selector_descriptor *cs = NULL;
-
- while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
- ctrl_iface->extralen,
- cs, UAC2_CLOCK_SELECTOR))) {
- if (cs->bLength >= sizeof(*cs) && cs->bClockID == clock_id) {
- if (cs->bLength < 5 + cs->bNrInPins)
- return NULL;
- return cs;
- }
- }
-
- return NULL;
+ struct uac3_clock_source_descriptor *cs = p;
+ return cs->bLength == sizeof(*cs) && cs->bClockID == id;
}
-static struct uac3_clock_selector_descriptor *
- snd_usb_find_clock_selector_v3(struct usb_host_interface *ctrl_iface,
- int clock_id)
+static bool validate_clock_selector_v2(void *p, int id)
{
- struct uac3_clock_selector_descriptor *cs = NULL;
-
- while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
- ctrl_iface->extralen,
- cs, UAC3_CLOCK_SELECTOR))) {
- if (cs->bClockID == clock_id)
- return cs;
- }
-
- return NULL;
+ struct uac_clock_selector_descriptor *cs = p;
+ return cs->bLength >= sizeof(*cs) && cs->bClockID == id &&
+ cs->bLength == 7 + cs->bNrInPins;
}
-static struct uac_clock_multiplier_descriptor *
- snd_usb_find_clock_multiplier(struct usb_host_interface *ctrl_iface,
- int clock_id)
+static bool validate_clock_selector_v3(void *p, int id)
{
- struct uac_clock_multiplier_descriptor *cs = NULL;
-
- while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
- ctrl_iface->extralen,
- cs, UAC2_CLOCK_MULTIPLIER))) {
- if (cs->bLength >= sizeof(*cs) && cs->bClockID == clock_id)
- return cs;
- }
-
- return NULL;
+ struct uac3_clock_selector_descriptor *cs = p;
+ return cs->bLength >= sizeof(*cs) && cs->bClockID == id &&
+ cs->bLength == 11 + cs->bNrInPins;
}
-static struct uac3_clock_multiplier_descriptor *
- snd_usb_find_clock_multiplier_v3(struct usb_host_interface *ctrl_iface,
- int clock_id)
+static bool validate_clock_multiplier_v2(void *p, int id)
{
- struct uac3_clock_multiplier_descriptor *cs = NULL;
+ struct uac_clock_multiplier_descriptor *cs = p;
+ return cs->bLength == sizeof(*cs) && cs->bClockID == id;
+}
- while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
- ctrl_iface->extralen,
- cs, UAC3_CLOCK_MULTIPLIER))) {
- if (cs->bClockID == clock_id)
- return cs;
- }
+static bool validate_clock_multiplier_v3(void *p, int id)
+{
+ struct uac3_clock_multiplier_descriptor *cs = p;
+ return cs->bLength == sizeof(*cs) && cs->bClockID == id;
+}
- return NULL;
+#define DEFINE_FIND_HELPER(name, obj, validator, type) \
+static obj *name(struct usb_host_interface *iface, int id) \
+{ \
+ return find_uac_clock_desc(iface, id, validator, type); \
}
+DEFINE_FIND_HELPER(snd_usb_find_clock_source,
+ struct uac_clock_source_descriptor,
+ validate_clock_source_v2, UAC2_CLOCK_SOURCE);
+DEFINE_FIND_HELPER(snd_usb_find_clock_source_v3,
+ struct uac3_clock_source_descriptor,
+ validate_clock_source_v3, UAC3_CLOCK_SOURCE);
+
+DEFINE_FIND_HELPER(snd_usb_find_clock_selector,
+ struct uac_clock_selector_descriptor,
+ validate_clock_selector_v2, UAC2_CLOCK_SELECTOR);
+DEFINE_FIND_HELPER(snd_usb_find_clock_selector_v3,
+ struct uac3_clock_selector_descriptor,
+ validate_clock_selector_v3, UAC3_CLOCK_SELECTOR);
+
+DEFINE_FIND_HELPER(snd_usb_find_clock_multiplier,
+ struct uac_clock_multiplier_descriptor,
+ validate_clock_multiplier_v2, UAC2_CLOCK_MULTIPLIER);
+DEFINE_FIND_HELPER(snd_usb_find_clock_multiplier_v3,
+ struct uac3_clock_multiplier_descriptor,
+ validate_clock_multiplier_v3, UAC3_CLOCK_MULTIPLIER);
+
static int uac_clock_selector_get_val(struct snd_usb_audio *chip, int selector_id)
{
unsigned char buf;