alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Mack <zonque@gmail.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, clemens@ladisch.de, Daniel Mack <zonque@gmail.com>
Subject: [PATCH 7/8] ALSA: usb-audio: assume valid clock
Date: Wed, 18 May 2011 11:28:44 +0200	[thread overview]
Message-ID: <1305710925-3857-8-git-send-email-zonque@gmail.com> (raw)
In-Reply-To: <1305710925-3857-1-git-send-email-zonque@gmail.com>

If the interface can't report a clock's validity, assume that it's
valid.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Vicente Joel <vicentejoel@gmail.com>
---
 sound/usb/clock.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 7754a10..075195e 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -104,6 +104,15 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
 	int err;
 	unsigned char data;
 	struct usb_device *dev = chip->dev;
+	struct uac_clock_source_descriptor *cs_desc =
+		snd_usb_find_clock_source(chip->ctrl_intf, source_id);
+
+	if (!cs_desc)
+		return 0;
+
+	/* If a clock source can't tell us whether it's valid, we assume it is */
+	if (!uac2_control_is_readable(cs_desc->bmControls, UAC2_CS_CONTROL_CLOCK_VALID))
+		return 1;
 
 	err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
 			      USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
@@ -114,7 +123,7 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
 	if (err < 0) {
 		snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n",
 			   __func__, source_id);
-		return err;
+		return 0;
 	}
 
 	return !!data;
-- 
1.7.5.1

  parent reply	other threads:[~2011-05-18  9:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-18  9:28 Assorted usb-audio patches Daniel Mack
2011-05-18  9:28 ` [PATCH 1/8] MAINTAINERS: Add entry for Native Instruments sound driver Daniel Mack
2011-05-18  9:28 ` [PATCH 2/8] ALSA: usb-audio: make hwc_debug a noop in case HW_CONST_DEBUG is not set Daniel Mack
2011-05-18  9:28 ` [PATCH 3/8] ALSA: usb-audio: include format.h in format.c Daniel Mack
2011-05-18  9:28 ` [PATCH 4/8] ALSA: usb-audio: remove invalid extra mixers for Komplete Audio 6 Daniel Mack
2011-05-18  9:28 ` [PATCH 5/8] ALSA: usb-audio: Add quirk for KORG PANDORA PX5D MIDI interface Daniel Mack
2011-05-18  9:28 ` [PATCH 6/8] ALSA: usb-audio: add quirks for Roland GR-55 Daniel Mack
2011-05-18  9:28 ` Daniel Mack [this message]
2011-05-18  9:28 ` [PATCH 8/8] ALSA: usb-audio: handle "Fast Track Ultra" with USB_DEVICE_VENDOR_SPEC() Daniel Mack
2011-05-18  9:45 ` Assorted usb-audio patches Takashi Iwai

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=1305710925-3857-8-git-send-email-zonque@gmail.com \
    --to=zonque@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=tiwai@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).