From patchwork Tue Dec 15 14:56:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 7855111 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8B215BEEE1 for ; Tue, 15 Dec 2015 14:59:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADDFA2021F for ; Tue, 15 Dec 2015 14:59:38 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4D4CF20219 for ; Tue, 15 Dec 2015 14:59:36 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 42513265DAC; Tue, 15 Dec 2015 15:59:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7D85B264FFB; Tue, 15 Dec 2015 15:56:50 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2A7C9261B01; Tue, 15 Dec 2015 15:56:49 +0100 (CET) Received: from smtp301.phy.lolipop.jp (smtp301.phy.lolipop.jp [210.157.22.84]) by alsa0.perex.cz (Postfix) with ESMTP id A979C264FFB for ; Tue, 15 Dec 2015 15:56:29 +0100 (CET) Received: from smtp301.phy.lolipop.lan (HELO smtp301.phy.lolipop.jp) (172.17.1.84) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp301.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Tue, 15 Dec 2015 23:56:24 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp301.phy.lolipop.jp (LOLIPOP-Fsecure); Tue, 15 Dec 2015 23:56:21 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Tue, 15 Dec 2015 23:56:21 +0900 Message-Id: <1450191381-16352-6-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1450191381-16352-1-git-send-email-o-takashi@sakamocchi.jp> References: <1450191381-16352-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org, ffado-devel@lists.sf.net Subject: [alsa-devel] [PATCH 5/5] ALSA: oxfw: gather model-dependent conditions to a function X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Adding control elements is just for models supported by old firewire-speakers modules. The processing should be in a function to add model-dependent quirk. This commit moves the codes to the function. As a result, the function should handle error state, thus this commit also changes prototype of the function. Signed-off-by: Takashi Sakamoto --- sound/firewire/oxfw/oxfw.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c index 836d757..d4fb3c1 100644 --- a/sound/firewire/oxfw/oxfw.c +++ b/sound/firewire/oxfw/oxfw.c @@ -135,7 +135,7 @@ static void oxfw_card_free(struct snd_card *card) mutex_destroy(&oxfw->mutex); } -static void detect_quirks(struct snd_oxfw *oxfw) +static int detect_quirks(struct snd_oxfw *oxfw) { struct fw_device *fw_dev = fw_parent_device(oxfw->unit); struct fw_csr_iterator it; @@ -143,13 +143,24 @@ static void detect_quirks(struct snd_oxfw *oxfw) int vendor, model; /* + * Add ALSA control elements for two models to keep compatibility to + * old firewire-speaker module. + */ + if (oxfw->entry->vendor_id == VENDOR_GRIFFIN || + oxfw->entry->vendor_id == VENDOR_LACIE) { + oxfw->device_info = + (const struct device_info *)oxfw->entry->driver_data; + return snd_oxfw_add_spkr(oxfw); + } + + /* * TASCAM FireOne has physical control and requires a pair of additional * MIDI ports. */ if (oxfw->entry->vendor_id == VENDOR_TASCAM) { oxfw->midi_input_ports++; oxfw->midi_output_ports++; - return; + return 0; } /* Seek from Root Directory of Config ROM. */ @@ -168,6 +179,8 @@ static void detect_quirks(struct snd_oxfw *oxfw) */ if (vendor == VENDOR_LOUD && model == MODEL_SATELLITE) oxfw->wrong_dbs = true; + + return 0; } static int oxfw_probe(struct fw_unit *unit, @@ -198,7 +211,9 @@ static int oxfw_probe(struct fw_unit *unit, if (err < 0) goto error; - detect_quirks(oxfw); + err = detect_quirks(oxfw); + if (err < 0) + goto error; err = name_card(oxfw); if (err < 0) @@ -208,14 +223,6 @@ static int oxfw_probe(struct fw_unit *unit, if (err < 0) goto error; - if (oxfw->device_info) { - oxfw->device_info = - (const struct device_info *)entry->driver_data; - err = snd_oxfw_add_spkr(oxfw); - if (err < 0) - goto error; - } - snd_oxfw_proc_init(oxfw); err = snd_oxfw_create_midi(oxfw);