From patchwork Mon Jun 7 08:12:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12302787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A58A4C47082 for ; Mon, 7 Jun 2021 08:14:55 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7271C611ED for ; Mon, 7 Jun 2021 08:14:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7271C611ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D8B191676; Mon, 7 Jun 2021 10:14:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D8B191676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623053692; bh=/ISHuaEZmJ6ziLxJA8mFxCXw3f4RX/7eqxNJDPj2uNU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=emz8SNCX4LHnFp+at/BLWf7Mx3Jcf48aBxM9I2XVXV/em92b3mkipoCQSc6Pmj1ni qx3FA1y+0ACL96rAb8wO97fjKE3g5sA3P4Zs/tA4fAORv93wUMtBWAAhzD+MmTVrC/ qHBZzy6ThVrGTN6F7BFHZcIB3bYnN9gvsF3bJ2mo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8AE8FF804C3; Mon, 7 Jun 2021 10:13:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E9894F804BD; Mon, 7 Jun 2021 10:13:10 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 19B0AF800AF for ; Mon, 7 Jun 2021 10:12:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 19B0AF800AF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="nLN/fIGi"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="odFz0HUf" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 3E2B55C014D; Mon, 7 Jun 2021 04:12:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 07 Jun 2021 04:12:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=jDc0BZFBlp678 pKRtC5H2OYDGRBp2UXsNjZ9puINb90=; b=nLN/fIGiGF87h5JQwfiX6fHvoJvR7 7Wh3tjE504qi03Ixj7QWrM8qscqlLqDvXS2JyYA3mlmmpFTUSlNIIe504g6jVRDM odR78ItcQWowlj7UHHbRQrnqqOWuTC2GUWJlExCno4JP+E4NC7JiZNBtUQQWPVqx iQaJRZKgSsb577cl0OJnLH/JUeWXm2A1khZ2oU2qDhxnY7P/IbjNFxyFAQrdYvUQ zva8cD+5Gr/OsnEfKcQp4XoRuh1pySP/UTRgHy+PchUrCKzD7Ci2XBfdzqMaXwQn 9dS3O8M+vgoV2BJPyWrOokXsd2AjZFItyMzeVy5ZrUkxSagdZGPvtV+Nw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=jDc0BZFBlp678pKRtC5H2OYDGRBp2UXsNjZ9puINb90=; b=odFz0HUf CVZx8TCS6rH/GV40Fs7u5nlEy4rvnUbmpc9gcEyrn7Yb10MnbqA2IRTaYcRwYasP K2ZpIdA2/FylNFHmv6A02lMFijBE1pNND6BpMbEaDd3GQqe8g8auwN4gWZY+aoeE gtlNlcYDjDRg04V4IDMTW3JdoKZXUuS1uGG+1nGiS7MeGPM0nrV9RJhwQzVuuPYB Co9+/EwqkYOJXFEVvIfIqGYIBJb55JgYHqa96gfCAvGJJxeLSPKRBpXQezzkGPMY cn8StwyMo8RdVqc0sN9ETqhnYyHQ6g2rBP8tKW79IAOm3Ztju4ch4C3rn5VaLpWJ jrsmJAIH2yP8Ow== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtjecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertd dtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhi sehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffeektefgve egfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrg hmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Jun 2021 04:12:57 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 1/9] ALSA: bebob: cease from delayed card registration Date: Mon, 7 Jun 2021 17:12:42 +0900 Message-Id: <20210607081250.13397-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210607081250.13397-1-o-takashi@sakamocchi.jp> References: <20210607081250.13397-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The delayed registration of sound card instance brings less benefit than complication of kobject management. This commit ceases from it. Signed-off-by: Takashi Sakamoto --- sound/firewire/bebob/bebob.c | 159 +++++++++++++---------------------- sound/firewire/bebob/bebob.h | 4 - 2 files changed, 57 insertions(+), 106 deletions(-) diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c index 5938aa325f5e..e7dd112c31c5 100644 --- a/sound/firewire/bebob/bebob.c +++ b/sound/firewire/bebob/bebob.c @@ -136,6 +136,9 @@ bebob_card_free(struct snd_card *card) mutex_unlock(&devices_mutex); snd_bebob_stream_destroy_duplex(bebob); + + mutex_destroy(&bebob->mutex); + fw_unit_put(bebob->unit); } static const struct snd_bebob_spec * @@ -163,16 +166,30 @@ check_audiophile_booted(struct fw_unit *unit) return strncmp(name, "FW Audiophile Bootloader", 24) != 0; } -static void -do_registration(struct work_struct *work) +static int bebob_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { - struct snd_bebob *bebob = - container_of(work, struct snd_bebob, dwork.work); unsigned int card_index; + struct snd_card *card; + struct snd_bebob *bebob; + const struct snd_bebob_spec *spec; int err; - if (bebob->registered) - return; + if (entry->vendor_id == VEN_FOCUSRITE && + entry->model_id == MODEL_FOCUSRITE_SAFFIRE_BOTH) + spec = get_saffire_spec(unit); + else if (entry->vendor_id == VEN_MAUDIO1 && + entry->model_id == MODEL_MAUDIO_AUDIOPHILE_BOTH && + !check_audiophile_booted(unit)) + spec = NULL; + else + spec = (const struct snd_bebob_spec *)entry->driver_data; + + if (spec == NULL) { + if (entry->vendor_id == VEN_MAUDIO1 || entry->vendor_id == VEN_MAUDIO2) + return snd_bebob_maudio_load_firmware(unit); + else + return -ENODEV; + } mutex_lock(&devices_mutex); for (card_index = 0; card_index < SNDRV_CARDS; card_index++) { @@ -181,27 +198,36 @@ do_registration(struct work_struct *work) } if (card_index >= SNDRV_CARDS) { mutex_unlock(&devices_mutex); - return; + return -ENOENT; } - err = snd_card_new(&bebob->unit->device, index[card_index], - id[card_index], THIS_MODULE, 0, &bebob->card); + err = snd_card_new(&unit->device, index[card_index], id[card_index], THIS_MODULE, + sizeof(*bebob), &card); if (err < 0) { mutex_unlock(&devices_mutex); - return; + return err; } + card->private_free = bebob_card_free; set_bit(card_index, devices_used); mutex_unlock(&devices_mutex); - bebob->card->private_free = bebob_card_free; - bebob->card->private_data = bebob; + bebob = card->private_data; + bebob->unit = fw_unit_get(unit); + dev_set_drvdata(&unit->device, bebob); + bebob->card = card; + bebob->card_index = card_index; + + bebob->spec = spec; + mutex_init(&bebob->mutex); + spin_lock_init(&bebob->lock); + init_waitqueue_head(&bebob->hwdep_wait); err = name_device(bebob); if (err < 0) goto error; if (bebob->spec == &maudio_special_spec) { - if (bebob->entry->model_id == MODEL_MAUDIO_FW1814) + if (entry->model_id == MODEL_MAUDIO_FW1814) err = snd_bebob_maudio_special_discover(bebob, true); else err = snd_bebob_maudio_special_discover(bebob, false); @@ -214,8 +240,7 @@ do_registration(struct work_struct *work) // M-Audio ProFire Lightbridge has a quirk to transfer packets with discontinuous cycle or // data block counter in early stage of packet streaming. The cycle span from the first // packet with event is variable. - if (bebob->entry->vendor_id == VEN_MAUDIO1 && - bebob->entry->model_id == MODEL_MAUDIO_PROFIRELIGHTBRIDGE) + if (entry->vendor_id == VEN_MAUDIO1 && entry->model_id == MODEL_MAUDIO_PROFIRELIGHTBRIDGE) bebob->discontinuity_quirk = true; err = snd_bebob_stream_init_duplex(bebob); @@ -238,80 +263,26 @@ do_registration(struct work_struct *work) if (err < 0) goto error; - err = snd_card_register(bebob->card); + err = snd_card_register(card); if (err < 0) goto error; - bebob->registered = true; - - return; -error: - snd_card_free(bebob->card); - dev_info(&bebob->unit->device, - "Sound card registration failed: %d\n", err); -} - -static int -bebob_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) -{ - struct snd_bebob *bebob; - const struct snd_bebob_spec *spec; - - if (entry->vendor_id == VEN_FOCUSRITE && - entry->model_id == MODEL_FOCUSRITE_SAFFIRE_BOTH) - spec = get_saffire_spec(unit); - else if (entry->vendor_id == VEN_MAUDIO1 && - entry->model_id == MODEL_MAUDIO_AUDIOPHILE_BOTH && - !check_audiophile_booted(unit)) - spec = NULL; - else - spec = (const struct snd_bebob_spec *)entry->driver_data; - - if (spec == NULL) { - if (entry->vendor_id == VEN_MAUDIO1 || - entry->vendor_id == VEN_MAUDIO2) - return snd_bebob_maudio_load_firmware(unit); - else - return -ENODEV; - } - - /* Allocate this independent of sound card instance. */ - bebob = devm_kzalloc(&unit->device, sizeof(struct snd_bebob), - GFP_KERNEL); - if (!bebob) - return -ENOMEM; - bebob->unit = fw_unit_get(unit); - dev_set_drvdata(&unit->device, bebob); - - bebob->entry = entry; - bebob->spec = spec; - mutex_init(&bebob->mutex); - spin_lock_init(&bebob->lock); - init_waitqueue_head(&bebob->hwdep_wait); - - /* Allocate and register this sound card later. */ - INIT_DEFERRABLE_WORK(&bebob->dwork, do_registration); - - if (entry->vendor_id != VEN_MAUDIO1 || - (entry->model_id != MODEL_MAUDIO_FW1814 && - entry->model_id != MODEL_MAUDIO_PROJECTMIX)) { - snd_fw_schedule_registration(unit, &bebob->dwork); - } else { - /* - * This is a workaround. This bus reset seems to have an effect - * to make devices correctly handling transactions. Without - * this, the devices have gap_count mismatch. This causes much - * failure of transaction. - * - * Just after registration, user-land application receive - * signals from dbus and starts I/Os. To avoid I/Os till the - * future bus reset, registration is done in next update(). - */ - fw_schedule_bus_reset(fw_parent_device(bebob->unit)->card, - false, true); + if (entry->vendor_id == VEN_MAUDIO1 && + (entry->model_id == MODEL_MAUDIO_FW1814 || entry->model_id == MODEL_MAUDIO_PROJECTMIX)) { + // This is a workaround. This bus reset seems to have an effect to make devices + // correctly handling transactions. Without this, the devices have gap_count + // mismatch. This causes much failure of transaction. + // + // Just after registration, user-land application receive signals from dbus and + // starts I/Os. To avoid I/Os till the future bus reset, registration is done in + // next update(). + fw_schedule_bus_reset(fw_parent_device(bebob->unit)->card, false, true); } return 0; +error: + snd_card_free(card); + return err; } /* @@ -338,11 +309,7 @@ bebob_update(struct fw_unit *unit) if (bebob == NULL) return; - /* Postpone a workqueue for deferred registration. */ - if (!bebob->registered) - snd_fw_schedule_registration(unit, &bebob->dwork); - else - fcp_bus_reset(bebob->unit); + fcp_bus_reset(bebob->unit); } static void bebob_remove(struct fw_unit *unit) @@ -352,20 +319,8 @@ static void bebob_remove(struct fw_unit *unit) if (bebob == NULL) return; - /* - * Confirm to stop the work for registration before the sound card is - * going to be released. The work is not scheduled again because bus - * reset handler is not called anymore. - */ - cancel_delayed_work_sync(&bebob->dwork); - - if (bebob->registered) { - // Block till all of ALSA character devices are released. - snd_card_free(bebob->card); - } - - mutex_destroy(&bebob->mutex); - fw_unit_put(bebob->unit); + // Block till all of ALSA character devices are released. + snd_card_free(bebob->card); } static const struct snd_bebob_rate_spec normal_rate_spec = { diff --git a/sound/firewire/bebob/bebob.h b/sound/firewire/bebob/bebob.h index cba6793bfdb2..edd93699ce1a 100644 --- a/sound/firewire/bebob/bebob.h +++ b/sound/firewire/bebob/bebob.h @@ -83,10 +83,6 @@ struct snd_bebob { struct mutex mutex; spinlock_t lock; - bool registered; - struct delayed_work dwork; - - const struct ieee1394_device_id *entry; const struct snd_bebob_spec *spec; unsigned int midi_input_ports; From patchwork Mon Jun 7 08:12:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12302789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86BF9C47082 for ; Mon, 7 Jun 2021 08:14:59 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E032C611ED for ; Mon, 7 Jun 2021 08:14:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E032C611ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7B6B2168B; Mon, 7 Jun 2021 10:14:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7B6B2168B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623053697; bh=z/BG1uSbS3B6aYFbcfW9c6dxn/+GH38EulJ8S7QivwU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=I9ptseTGWJNGVPNOL4QbLwW65ICgY9XTsCdfh0Jj7b19vtzi8V3M2BBCdccnSxk5T cghGpfiLcqyOJiY/ny585I41KkrUeGuSoTkvfXgVCLK1V0m8F1OSGIOIbJOSVaIQXZ dN99Vljwj3WTBaPtiSe38e7DkPUHy5JNXBT/L33s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2C9E3F8020D; Mon, 7 Jun 2021 10:13:18 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 84748F804CF; Mon, 7 Jun 2021 10:13:15 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D1222F8020D for ; Mon, 7 Jun 2021 10:13:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D1222F8020D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="EW7B9Cfj"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="uNtHv8kj" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 0AEF45C0112; Mon, 7 Jun 2021 04:13:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 07 Jun 2021 04:13:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=77rMq5vwDPDPp 8iC+iKVfbUPbzVG1KWCHo3rW16jQMk=; b=EW7B9CfjHvBtF6yAyradeJVOBNrjb VbamlVtALk+Xs2yFBXoQ0XGDD5TU/hH6LqCJkTmn/QEvfBN4rbohOxn0KFZ9nSgA K7O/NkEoaIZMi0afHMeOn64Y7Pe9Q2sB/1YLpJ+ANHaYCd5NQOVLzySTwiS1XCaH +UfXhQjax0tNqBYAMjarIGzmBvZIlinrkorJrd6s4qU0+UHSyqQ3e5wvEoL1q1hD CxSX4lLlP+IJ/xKeOUntNT3LRltzy6/olI0u8By9cOb2Ckc3OP4fSb6sl+tDH15A L8SiYKsXTG2oKMD0oOnNmcs2lMA3WtMxyQueqbKqNBgyhjSQDR3a9AQeQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=77rMq5vwDPDPp8iC+iKVfbUPbzVG1KWCHo3rW16jQMk=; b=uNtHv8kj NDcGCChlV/QJtjZZrk5l0A3vFhPvghtI2OhJfe6Cq6njvl7VHUKt6nkw0VHld7Hi OqjXjO4L+WoutJHlSZ7gHkbdRBA15YYoZ+rFVZV5udbaWs0v9MkUQ9UV8f7Svpbw PqdQOttj9z7MxxCV9XUQfg6YrivUZvC5D22tvajYMcfXMcG7DqkWikOzYTbsz0AF mRD4E4ROWOUyVagt3yvjQAv8PfESbZRy+eiLZHcgMJDqhnENym/WsLRnD2GVun0z GaT5LpvVAsi1Pd5Gx+gU8DZSq9w1RcMEh6NEUUBfIWByui8c6cinixl23N1Dmor4 rICQa5JKTEF6Jw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtjecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertd dtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhi sehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffeektefgve egfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrg hmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Jun 2021 04:12:58 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 2/9] ALSA: fireworks: cease from delayed card registration Date: Mon, 7 Jun 2021 17:12:43 +0900 Message-Id: <20210607081250.13397-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210607081250.13397-1-o-takashi@sakamocchi.jp> References: <20210607081250.13397-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The delayed registration of sound card instance brings less benefit than complication of kobject management. This commit ceases from it. Signed-off-by: Takashi Sakamoto --- sound/firewire/fireworks/fireworks.c | 107 +++++++++------------------ sound/firewire/fireworks/fireworks.h | 3 - 2 files changed, 33 insertions(+), 77 deletions(-) diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c index b1cc013a3540..865dac3b37e6 100644 --- a/sound/firewire/fireworks/fireworks.c +++ b/sound/firewire/fireworks/fireworks.c @@ -194,19 +194,19 @@ efw_card_free(struct snd_card *card) snd_efw_stream_destroy_duplex(efw); snd_efw_transaction_remove_instance(efw); + + mutex_destroy(&efw->mutex); + fw_unit_put(efw->unit); } -static void -do_registration(struct work_struct *work) +static int efw_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { - struct snd_efw *efw = container_of(work, struct snd_efw, dwork.work); unsigned int card_index; + struct snd_card *card; + struct snd_efw *efw; int err; - if (efw->registered) - return; - - /* check registered cards */ + // check registered cards. mutex_lock(&devices_mutex); for (card_index = 0; card_index < SNDRV_CARDS; ++card_index) { if (!test_bit(card_index, devices_used) && enable[card_index]) @@ -214,26 +214,32 @@ do_registration(struct work_struct *work) } if (card_index >= SNDRV_CARDS) { mutex_unlock(&devices_mutex); - return; + return -ENOENT; } - err = snd_card_new(&efw->unit->device, index[card_index], - id[card_index], THIS_MODULE, 0, &efw->card); + err = snd_card_new(&unit->device, index[card_index], id[card_index], THIS_MODULE, + sizeof(*efw), &card); if (err < 0) { mutex_unlock(&devices_mutex); - return; + return err; } + card->private_free = efw_card_free; set_bit(card_index, devices_used); mutex_unlock(&devices_mutex); - efw->card->private_free = efw_card_free; - efw->card->private_data = efw; + efw = card->private_data; + efw->unit = fw_unit_get(unit); + dev_set_drvdata(&unit->device, efw); + efw->card = card; + efw->card_index = card_index; + + mutex_init(&efw->mutex); + spin_lock_init(&efw->lock); + init_waitqueue_head(&efw->hwdep_wait); - /* prepare response buffer */ - snd_efw_resp_buf_size = clamp(snd_efw_resp_buf_size, - SND_EFW_RESPONSE_MAXIMUM_BYTES, 4096U); - efw->resp_buf = devm_kzalloc(&efw->card->card_dev, - snd_efw_resp_buf_size, GFP_KERNEL); + // prepare response buffer. + snd_efw_resp_buf_size = clamp(snd_efw_resp_buf_size, SND_EFW_RESPONSE_MAXIMUM_BYTES, 4096U); + efw->resp_buf = devm_kzalloc(&card->card_dev, snd_efw_resp_buf_size, GFP_KERNEL); if (!efw->resp_buf) { err = -ENOMEM; goto error; @@ -265,80 +271,33 @@ do_registration(struct work_struct *work) if (err < 0) goto error; - err = snd_card_register(efw->card); + err = snd_card_register(card); if (err < 0) goto error; - efw->registered = true; - - return; -error: - snd_card_free(efw->card); - dev_info(&efw->unit->device, - "Sound card registration failed: %d\n", err); -} - -static int -efw_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) -{ - struct snd_efw *efw; - - efw = devm_kzalloc(&unit->device, sizeof(struct snd_efw), GFP_KERNEL); - if (efw == NULL) - return -ENOMEM; - efw->unit = fw_unit_get(unit); - dev_set_drvdata(&unit->device, efw); - - mutex_init(&efw->mutex); - spin_lock_init(&efw->lock); - init_waitqueue_head(&efw->hwdep_wait); - - /* Allocate and register this sound card later. */ - INIT_DEFERRABLE_WORK(&efw->dwork, do_registration); - snd_fw_schedule_registration(unit, &efw->dwork); - return 0; +error: + snd_card_free(card); + return err; } static void efw_update(struct fw_unit *unit) { struct snd_efw *efw = dev_get_drvdata(&unit->device); - /* Postpone a workqueue for deferred registration. */ - if (!efw->registered) - snd_fw_schedule_registration(unit, &efw->dwork); - snd_efw_transaction_bus_reset(efw->unit); - /* - * After registration, userspace can start packet streaming, then this - * code block works fine. - */ - if (efw->registered) { - mutex_lock(&efw->mutex); - snd_efw_stream_update_duplex(efw); - mutex_unlock(&efw->mutex); - } + mutex_lock(&efw->mutex); + snd_efw_stream_update_duplex(efw); + mutex_unlock(&efw->mutex); } static void efw_remove(struct fw_unit *unit) { struct snd_efw *efw = dev_get_drvdata(&unit->device); - /* - * Confirm to stop the work for registration before the sound card is - * going to be released. The work is not scheduled again because bus - * reset handler is not called anymore. - */ - cancel_delayed_work_sync(&efw->dwork); - - if (efw->registered) { - // Block till all of ALSA character devices are released. - snd_card_free(efw->card); - } - - mutex_destroy(&efw->mutex); - fw_unit_put(efw->unit); + // Block till all of ALSA character devices are released. + snd_card_free(efw->card); } static const struct ieee1394_device_id efw_id_table[] = { diff --git a/sound/firewire/fireworks/fireworks.h b/sound/firewire/fireworks/fireworks.h index 49e12cf7c0e3..2c0c7de8b824 100644 --- a/sound/firewire/fireworks/fireworks.h +++ b/sound/firewire/fireworks/fireworks.h @@ -65,9 +65,6 @@ struct snd_efw { struct mutex mutex; spinlock_t lock; - bool registered; - struct delayed_work dwork; - /* for transaction */ u32 seqnum; bool resp_addr_changable; From patchwork Mon Jun 7 08:12:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12302805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58353C47082 for ; Mon, 7 Jun 2021 08:17:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A33DF60FF1 for ; Mon, 7 Jun 2021 08:17:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A33DF60FF1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3A9171690; Mon, 7 Jun 2021 10:16:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3A9171690 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623053849; bh=fg3kwo6hqo9hDYCPl1IEOFa1RBt/PZoB+AakqyKBzxE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Rurf05hkTYlTFxnU0rr3GIuoXe9+SLplI0W1se1zFA5XliY9aA+tZc20wqlMs66rO K5ecljyXVNN8pbfnNiCkgGY+zOkDbNlVbv0DozUBA1tG5GP6FANZ9lDTwiWgD1zrl1 DS9VsKDKCkbPlleIeZWAl4cBy06Ns8LDoccVSOao= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4FF5CF804C2; Mon, 7 Jun 2021 10:13:27 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id ACF00F804CC; Mon, 7 Jun 2021 10:13:17 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1FA90F8026C for ; Mon, 7 Jun 2021 10:13:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1FA90F8026C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="T6LG1HGc"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TSnS5Iv/" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 5492F5C0051; Mon, 7 Jun 2021 04:13:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 07 Jun 2021 04:13:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=r+qHfcEFnnY5a 6LgYQwVfIyufVhbTVYUyqgj60vzq08=; b=T6LG1HGcyJidsSdjV1Kn1GRdjSjRU AWPgOeYVGZ8k8y94Grt49T0bJj4uK+pkGvqhuY0qUTZF5C17A6+5UJeRaXlgmPII lxR3xtpdO7OqFFypcxFkt74yJrANqFJdWGdnWq9d7756uOIa7bVViYulWeevRgUT p7BvJnQKt6cJ/YaCJJoUJXJ40YHeVgLPqDo7ZP/69GlPPmeJO2cxtD3sbs452tR4 1oGWQH2cBDsK8P0viqwAh/kc0vYZhTTiOGUSqkDmqnVnxJlhCoN2MmVjELnMKZth PiDralMCammxrJDbBtsqvzAF0c40C+FmWpCkvtBwCfv1MAw6U3OpHzLvg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=r+qHfcEFnnY5a6LgYQwVfIyufVhbTVYUyqgj60vzq08=; b=TSnS5Iv/ oSO334Y8AXk0MwKVj9x05eloa3doFhW3UjTk5gZrZhIcaze6+NAHFJGNZnBVmDNf EKtK9t6Fa90D3dlek6vY/OpIk3cfTTocX+v/nDG07OqwZs3Qe6qNzJSJI2XZeujP qaFIXrnniyRhXQbxzAjmUve8OB/2/60mG5UcBWFYyW4wA9rbeSi/B3zst9FugaZG GTPInFmEt7ztRisUgcn7ikInD2R8gdC2VwQrb+hkbRTAepH8ROkWH8hdBH/QPjdA 4PTvu/WXN6Gt6WTPASyj14bU5FdYoAW/BdWN+WuEet40fdMHaMFEBLLcKRG3BYZE xMXv/8C7ZxN1yw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtjecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertd dtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhi sehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffeektefgve egfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrg hmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Jun 2021 04:13:00 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 3/9] ALSA: oxfw: cease from delayed card registration Date: Mon, 7 Jun 2021 17:12:44 +0900 Message-Id: <20210607081250.13397-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210607081250.13397-1-o-takashi@sakamocchi.jp> References: <20210607081250.13397-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The delayed registration of sound card instance brings less benefit than complication of kobject management. This commit ceases from it. Signed-off-by: Takashi Sakamoto --- sound/firewire/oxfw/oxfw.c | 128 +++++++++++++------------------------ sound/firewire/oxfw/oxfw.h | 6 +- 2 files changed, 48 insertions(+), 86 deletions(-) diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c index 59bffa32636c..84971d78d152 100644 --- a/sound/firewire/oxfw/oxfw.c +++ b/sound/firewire/oxfw/oxfw.c @@ -60,7 +60,7 @@ static bool detect_loud_models(struct fw_unit *unit) return match_string(models, ARRAY_SIZE(models), model) >= 0; } -static int name_card(struct snd_oxfw *oxfw) +static int name_card(struct snd_oxfw *oxfw, const struct ieee1394_device_id *entry) { struct fw_device *fw_dev = fw_parent_device(oxfw->unit); const struct compat_info *info; @@ -92,9 +92,8 @@ static int name_card(struct snd_oxfw *oxfw) oxfw->quirks |= SND_OXFW_QUIRK_JUMBO_PAYLOAD; /* to apply card definitions */ - if (oxfw->entry->vendor_id == VENDOR_GRIFFIN || - oxfw->entry->vendor_id == VENDOR_LACIE) { - info = (const struct compat_info *)oxfw->entry->driver_data; + if (entry->vendor_id == VENDOR_GRIFFIN || entry->vendor_id == VENDOR_LACIE) { + info = (const struct compat_info *)entry->driver_data; d = info->driver_name; v = info->vendor_name; m = info->model_name; @@ -123,9 +122,12 @@ static void oxfw_card_free(struct snd_card *card) if (oxfw->has_output || oxfw->has_input) snd_oxfw_stream_destroy_duplex(oxfw); + + mutex_destroy(&oxfw->mutex); + fw_unit_put(oxfw->unit); } -static int detect_quirks(struct snd_oxfw *oxfw) +static int detect_quirks(struct snd_oxfw *oxfw, const struct ieee1394_device_id *entry) { struct fw_device *fw_dev = fw_parent_device(oxfw->unit); struct fw_csr_iterator it; @@ -136,17 +138,18 @@ static int detect_quirks(struct snd_oxfw *oxfw) * Add ALSA control elements for two models to keep compatibility to * old firewire-speaker module. */ - if (oxfw->entry->vendor_id == VENDOR_GRIFFIN) + if (entry->vendor_id == VENDOR_GRIFFIN) return snd_oxfw_add_spkr(oxfw, false); - if (oxfw->entry->vendor_id == VENDOR_LACIE) + if (entry->vendor_id == VENDOR_LACIE) return snd_oxfw_add_spkr(oxfw, true); /* * Stanton models supports asynchronous transactions for unique MIDI * messages. */ - if (oxfw->entry->vendor_id == OUI_STANTON) { - if (oxfw->entry->model_id == MODEL_SCS1M) + if (entry->vendor_id == OUI_STANTON) { + oxfw->quirks |= SND_OXFW_QUIRK_SCS_TRANSACTION; + if (entry->model_id == MODEL_SCS1M) oxfw->quirks |= SND_OXFW_QUIRK_BLOCKING_TRANSMISSION; // No physical MIDI ports. @@ -156,14 +159,14 @@ static int detect_quirks(struct snd_oxfw *oxfw) return snd_oxfw_scs1x_add(oxfw); } - if (oxfw->entry->vendor_id == OUI_APOGEE && oxfw->entry->model_id == MODEL_DUET_FW) + if (entry->vendor_id == OUI_APOGEE && entry->model_id == MODEL_DUET_FW) oxfw->quirks |= SND_OXFW_QUIRK_BLOCKING_TRANSMISSION; /* * TASCAM FireOne has physical control and requires a pair of additional * MIDI ports. */ - if (oxfw->entry->vendor_id == VENDOR_TASCAM) { + if (entry->vendor_id == VENDOR_TASCAM) { oxfw->midi_input_ports++; oxfw->midi_output_ports++; return 0; @@ -189,22 +192,30 @@ static int detect_quirks(struct snd_oxfw *oxfw) return 0; } -static void do_registration(struct work_struct *work) +static int oxfw_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { - struct snd_oxfw *oxfw = container_of(work, struct snd_oxfw, dwork.work); + struct snd_card *card; + struct snd_oxfw *oxfw; int err; - if (oxfw->registered) - return; + if (entry->vendor_id == VENDOR_LOUD && entry->model_id == 0 && !detect_loud_models(unit)) + return -ENODEV; - err = snd_card_new(&oxfw->unit->device, -1, NULL, THIS_MODULE, 0, - &oxfw->card); + err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE, sizeof(*oxfw), &card); if (err < 0) - return; - oxfw->card->private_free = oxfw_card_free; - oxfw->card->private_data = oxfw; + return err; + card->private_free = oxfw_card_free; - err = name_card(oxfw); + oxfw = card->private_data; + oxfw->unit = fw_unit_get(unit); + dev_set_drvdata(&unit->device, oxfw); + oxfw->card = card; + + mutex_init(&oxfw->mutex); + spin_lock_init(&oxfw->lock); + init_waitqueue_head(&oxfw->hwdep_wait); + + err = name_card(oxfw, entry); if (err < 0) goto error; @@ -212,7 +223,7 @@ static void do_registration(struct work_struct *work) if (err < 0) goto error; - err = detect_quirks(oxfw); + err = detect_quirks(oxfw, entry); if (err < 0) goto error; @@ -236,85 +247,38 @@ static void do_registration(struct work_struct *work) goto error; } - err = snd_card_register(oxfw->card); + err = snd_card_register(card); if (err < 0) goto error; - oxfw->registered = true; - - return; -error: - snd_card_free(oxfw->card); - dev_info(&oxfw->unit->device, - "Sound card registration failed: %d\n", err); -} - -static int oxfw_probe(struct fw_unit *unit, - const struct ieee1394_device_id *entry) -{ - struct snd_oxfw *oxfw; - - if (entry->vendor_id == VENDOR_LOUD && entry->model_id == 0 && !detect_loud_models(unit)) - return -ENODEV; - - /* Allocate this independent of sound card instance. */ - oxfw = devm_kzalloc(&unit->device, sizeof(struct snd_oxfw), GFP_KERNEL); - if (!oxfw) - return -ENOMEM; - oxfw->unit = fw_unit_get(unit); - dev_set_drvdata(&unit->device, oxfw); - - oxfw->entry = entry; - mutex_init(&oxfw->mutex); - spin_lock_init(&oxfw->lock); - init_waitqueue_head(&oxfw->hwdep_wait); - - /* Allocate and register this sound card later. */ - INIT_DEFERRABLE_WORK(&oxfw->dwork, do_registration); - snd_fw_schedule_registration(unit, &oxfw->dwork); - return 0; +error: + snd_card_free(card); + return err; } static void oxfw_bus_reset(struct fw_unit *unit) { struct snd_oxfw *oxfw = dev_get_drvdata(&unit->device); - if (!oxfw->registered) - snd_fw_schedule_registration(unit, &oxfw->dwork); - fcp_bus_reset(oxfw->unit); - if (oxfw->registered) { - if (oxfw->has_output || oxfw->has_input) { - mutex_lock(&oxfw->mutex); - snd_oxfw_stream_update_duplex(oxfw); - mutex_unlock(&oxfw->mutex); - } - - if (oxfw->entry->vendor_id == OUI_STANTON) - snd_oxfw_scs1x_update(oxfw); + if (oxfw->has_output || oxfw->has_input) { + mutex_lock(&oxfw->mutex); + snd_oxfw_stream_update_duplex(oxfw); + mutex_unlock(&oxfw->mutex); } + + if (oxfw->quirks & SND_OXFW_QUIRK_SCS_TRANSACTION) + snd_oxfw_scs1x_update(oxfw); } static void oxfw_remove(struct fw_unit *unit) { struct snd_oxfw *oxfw = dev_get_drvdata(&unit->device); - /* - * Confirm to stop the work for registration before the sound card is - * going to be released. The work is not scheduled again because bus - * reset handler is not called anymore. - */ - cancel_delayed_work_sync(&oxfw->dwork); - - if (oxfw->registered) { - // Block till all of ALSA character devices are released. - snd_card_free(oxfw->card); - } - - mutex_destroy(&oxfw->mutex); - fw_unit_put(oxfw->unit); + // Block till all of ALSA character devices are released. + snd_card_free(oxfw->card); } static const struct compat_info griffin_firewave = { diff --git a/sound/firewire/oxfw/oxfw.h b/sound/firewire/oxfw/oxfw.h index 853135b5002d..ee47abcb0c90 100644 --- a/sound/firewire/oxfw/oxfw.h +++ b/sound/firewire/oxfw/oxfw.h @@ -40,6 +40,8 @@ enum snd_oxfw_quirk { SND_OXFW_QUIRK_WRONG_DBS = 0x02, // Blocking transmission mode is used. SND_OXFW_QUIRK_BLOCKING_TRANSMISSION = 0x04, + // Stanton SCS1.d and SCS1.m support unique transaction. + SND_OXFW_QUIRK_SCS_TRANSACTION = 0x08, }; /* This is an arbitrary number for convinience. */ @@ -50,9 +52,6 @@ struct snd_oxfw { struct mutex mutex; spinlock_t lock; - bool registered; - struct delayed_work dwork; - // The combination of snd_oxfw_quirk enumeration-constants. unsigned int quirks; bool has_output; @@ -73,7 +72,6 @@ struct snd_oxfw { bool dev_lock_changed; wait_queue_head_t hwdep_wait; - const struct ieee1394_device_id *entry; void *spec; struct amdtp_domain domain; From patchwork Mon Jun 7 08:12:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12302795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C8AFC47082 for ; Mon, 7 Jun 2021 08:16:24 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 379DC61208 for ; Mon, 7 Jun 2021 08:16:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 379DC61208 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8D962168F; Mon, 7 Jun 2021 10:15:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8D962168F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623053781; bh=bTfyxPCpvrtL7SzVNPnx5JrFqFzyOZ7f6KHBjOJdN80=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LmUpI3s+riGymWxz0P1FPUofVN2Os4T1R8QHEcL7e/wQ2OHrgF/G8uGoOuAyt8G3D 6xNHaxzTrosAnbQCcBzeJcOZgRiqenJfh/XDTr3Wiazca1aKf8LfYp3tN5+T14joo3 aVlBTAWlzM17xvZXYr726hELErGf5wu+plmEnYkY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 52F8CF804E2; Mon, 7 Jun 2021 10:13:24 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A5D50F804D0; Mon, 7 Jun 2021 10:13:19 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 77182F8027C for ; Mon, 7 Jun 2021 10:13:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 77182F8027C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="RnFtjur1"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="vdw+AL3O" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A77FE5C0121; Mon, 7 Jun 2021 04:13:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 07 Jun 2021 04:13:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=H1JpwNOLrPdvd SnUhjR3Jx2Ui1yXOQclDS0bL7vgzaE=; b=RnFtjur1lERzZ6VArIIparcoEGutW xi0uTgotSWqFdi1ETlBPGwTDht2FFoljUCWBSIXaAScvy15C+pOMswGVHzKxKMRg 8VGK8vixG9h8dzCDDW+AvSgCkHd9SgTbF0PTRd1AVJt7tADJIO3BDfWDdko1C1bD QIdOMmi5nRguSrkr68hhnTFatzDBb0FT+ZMmfw+a9Opofe7cQAOg0omGr9+cXOyB SXP5zIMCotLM3rZNTvKrotAfNx7v/JmlvVHCCW7kOw25Ll4ZLsS7hvpRlyvnwKQN FdLaJ8wtE1WHslHdonImHA1TCfTV8SbjZCWeiv8tGEEpAwRH4X0qO7deA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=H1JpwNOLrPdvdSnUhjR3Jx2Ui1yXOQclDS0bL7vgzaE=; b=vdw+AL3O 8EYomR1/6s9A5uhr90Ms25qpQhMJzpWj6aUyQcSOsIJbAY7q25EUWm4tRqsV9hDM 2LlC/ZN1Y9ZxnIksg0RLS7Lv2BctlzSLx+dHXy538mNJggi+CAnT33gwjDWiZ/0N +qMFJwK1fRZV3QSy9zXnhqnVhrabRI1Kxz5JYtcqBV24NjZulAw/DZEh0mcgEJY+ R/ZFLizFa6WNEgm8eICmAbJFIb8DeO/tiCkzlPFw2t9QqQjIBr0tSz7L+ASZ9GZ1 68LM6q322Oq1kifqXvnKcLjO1nc7YiFBjolfLht+AXEIY6hx23rXmjxUFsC5MxZI IaPGbrYK5hT83w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtjecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertd dtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhi sehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffeektefgve egfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrg hmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Jun 2021 04:13:01 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 4/9] ALSA: dice: cease from delayed card registration Date: Mon, 7 Jun 2021 17:12:45 +0900 Message-Id: <20210607081250.13397-5-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210607081250.13397-1-o-takashi@sakamocchi.jp> References: <20210607081250.13397-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The delayed registration of sound card instance brings less benefit than complication of kobject management. This commit ceases from it. Signed-off-by: Takashi Sakamoto --- sound/firewire/dice/dice.c | 138 +++++++++++++------------------------ sound/firewire/dice/dice.h | 4 -- 2 files changed, 48 insertions(+), 94 deletions(-) diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c index 239d164b0eea..f75902bc8e74 100644 --- a/sound/firewire/dice/dice.c +++ b/sound/firewire/dice/dice.c @@ -135,22 +135,51 @@ static void dice_card_free(struct snd_card *card) snd_dice_stream_destroy_duplex(dice); snd_dice_transaction_destroy(dice); + + mutex_destroy(&dice->mutex); + fw_unit_put(dice->unit); } -static void do_registration(struct work_struct *work) +static int dice_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { - struct snd_dice *dice = container_of(work, struct snd_dice, dwork.work); + struct snd_card *card; + struct snd_dice *dice; + snd_dice_detect_formats_t detect_formats; int err; - if (dice->registered) - return; + if (!entry->driver_data && entry->vendor_id != OUI_SSL) { + err = check_dice_category(unit); + if (err < 0) + return -ENODEV; + } - err = snd_card_new(&dice->unit->device, -1, NULL, THIS_MODULE, 0, - &dice->card); + err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE, sizeof(*dice), &card); if (err < 0) - return; - dice->card->private_free = dice_card_free; - dice->card->private_data = dice; + return err; + card->private_free = dice_card_free; + + dice = card->private_data; + dice->unit = fw_unit_get(unit); + dev_set_drvdata(&unit->device, dice); + dice->card = card; + + if (!entry->driver_data) + detect_formats = snd_dice_stream_detect_current_formats; + else + detect_formats = (snd_dice_detect_formats_t)entry->driver_data; + + // Below models are compliant to IEC 61883-1/6 and have no quirk at high sampling transfer + // frequency. + // * Avid M-Box 3 Pro + // * M-Audio Profire 610 + // * M-Audio Profire 2626 + if (entry->vendor_id == OUI_MAUDIO || entry->vendor_id == OUI_AVID) + dice->disable_double_pcm_frames = true; + + spin_lock_init(&dice->lock); + mutex_init(&dice->mutex); + init_completion(&dice->clock_accepted); + init_waitqueue_head(&dice->hwdep_wait); err = snd_dice_transaction_init(dice); if (err < 0) @@ -162,7 +191,7 @@ static void do_registration(struct work_struct *work) dice_card_strings(dice); - err = dice->detect_formats(dice); + err = detect_formats(dice); if (err < 0) goto error; @@ -184,105 +213,34 @@ static void do_registration(struct work_struct *work) if (err < 0) goto error; - err = snd_card_register(dice->card); + err = snd_card_register(card); if (err < 0) goto error; - dice->registered = true; - - return; -error: - snd_card_free(dice->card); - dev_info(&dice->unit->device, - "Sound card registration failed: %d\n", err); -} - -static int dice_probe(struct fw_unit *unit, - const struct ieee1394_device_id *entry) -{ - struct snd_dice *dice; - int err; - - if (!entry->driver_data && entry->vendor_id != OUI_SSL) { - err = check_dice_category(unit); - if (err < 0) - return -ENODEV; - } - - /* Allocate this independent of sound card instance. */ - dice = devm_kzalloc(&unit->device, sizeof(struct snd_dice), GFP_KERNEL); - if (!dice) - return -ENOMEM; - dice->unit = fw_unit_get(unit); - dev_set_drvdata(&unit->device, dice); - - if (!entry->driver_data) { - dice->detect_formats = snd_dice_stream_detect_current_formats; - } else { - dice->detect_formats = - (snd_dice_detect_formats_t)entry->driver_data; - } - - // Below models are compliant to IEC 61883-1/6 and have no quirk at high sampling transfer - // frequency. - // * Avid M-Box 3 Pro - // * M-Audio Profire 610 - // * M-Audio Profire 2626 - if (entry->vendor_id == OUI_MAUDIO || entry->vendor_id == OUI_AVID) - dice->disable_double_pcm_frames = true; - - spin_lock_init(&dice->lock); - mutex_init(&dice->mutex); - init_completion(&dice->clock_accepted); - init_waitqueue_head(&dice->hwdep_wait); - - /* Allocate and register this sound card later. */ - INIT_DEFERRABLE_WORK(&dice->dwork, do_registration); - snd_fw_schedule_registration(unit, &dice->dwork); - return 0; +error: + snd_card_free(card); + return err; } static void dice_remove(struct fw_unit *unit) { struct snd_dice *dice = dev_get_drvdata(&unit->device); - /* - * Confirm to stop the work for registration before the sound card is - * going to be released. The work is not scheduled again because bus - * reset handler is not called anymore. - */ - cancel_delayed_work_sync(&dice->dwork); - - if (dice->registered) { - // Block till all of ALSA character devices are released. - snd_card_free(dice->card); - } - - mutex_destroy(&dice->mutex); - fw_unit_put(dice->unit); + // Block till all of ALSA character devices are released. + snd_card_free(dice->card); } static void dice_bus_reset(struct fw_unit *unit) { struct snd_dice *dice = dev_get_drvdata(&unit->device); - /* Postpone a workqueue for deferred registration. */ - if (!dice->registered) - snd_fw_schedule_registration(unit, &dice->dwork); - /* The handler address register becomes initialized. */ snd_dice_transaction_reinit(dice); - /* - * After registration, userspace can start packet streaming, then this - * code block works fine. - */ - if (dice->registered) { - mutex_lock(&dice->mutex); - snd_dice_stream_update_duplex(dice); - mutex_unlock(&dice->mutex); - } + mutex_lock(&dice->mutex); + snd_dice_stream_update_duplex(dice); + mutex_unlock(&dice->mutex); } #define DICE_INTERFACE 0x000001 diff --git a/sound/firewire/dice/dice.h b/sound/firewire/dice/dice.h index 3c967d1b3605..fd440cc625f9 100644 --- a/sound/firewire/dice/dice.h +++ b/sound/firewire/dice/dice.h @@ -78,9 +78,6 @@ struct snd_dice { spinlock_t lock; struct mutex mutex; - bool registered; - struct delayed_work dwork; - /* Offsets for sub-addresses */ unsigned int global_offset; unsigned int rx_offset; @@ -93,7 +90,6 @@ struct snd_dice { unsigned int rx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT]; unsigned int tx_midi_ports[MAX_STREAMS]; unsigned int rx_midi_ports[MAX_STREAMS]; - snd_dice_detect_formats_t detect_formats; struct fw_address_handler notification_handler; int owner_generation; From patchwork Mon Jun 7 08:12:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12302791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFA74C4743C for ; Mon, 7 Jun 2021 08:15:44 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A2E8610A1 for ; Mon, 7 Jun 2021 08:15:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A2E8610A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6077F1672; Mon, 7 Jun 2021 10:14:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6077F1672 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623053741; bh=8edTWF4F1VsKB+4A95aA5daEqKo0Dmb9btcEtpi4Gbk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=D9q6xlf+Qfy+5nXMgwRNyVxvizvHW0let9kKZKVyS6WqdIyMM7FQEEJ3iCkh/piOX XWD7v/se3sSwXPuEEbBuJ+znCLNMHgiYUWQjnh9ntBiDBLDUL6Sfgfc9EMBeFBWy3k AZdhQ+Uk9Kcdgz25/VYJQg+dlO/Qmzv6Zqb2jCyM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0D62EF804D0; Mon, 7 Jun 2021 10:13:22 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0725EF804BD; Mon, 7 Jun 2021 10:13:18 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 492CDF80212 for ; Mon, 7 Jun 2021 10:13:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 492CDF80212 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="laKwiucn"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="sog1DJu8" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E8D075C0150; Mon, 7 Jun 2021 04:13:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 07 Jun 2021 04:13:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=p2Wud12XupASb hQ/UwxPPVfA9mJAS9EpWBQHWAG+UOM=; b=laKwiucnSEGBtEoKNAHqdE4sKUb2G zz7O+10IrQLz+Rhs4lJkIMCwuNXRnraV2KlNfKyU1cNV6URQMtTQ9KbztbtrL2AC ulwoLwcxQOBGDhIOnhD4FBC9cT0ZFQM/EXMxDdYjP2ljKxxORA70NNYGTjBF7diU beR4g5LmGrqWy1lZVRxrgCAesWlfT7e39c2OtVSHR5yens65jvNzV2Q4l2sTEbb0 xYVCTaS/K/69SX/7/q8TvNZHFT1N+GP9lsv/vslga0XI0DDOmhp65jcj0S9U1RaH jI7GU2JcdURQ7xxDQOjq00wP0d530YodKXFLj4sZsKkndUOozkico8i2g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=p2Wud12XupASbhQ/UwxPPVfA9mJAS9EpWBQHWAG+UOM=; b=sog1DJu8 yV4B04MUOPap6pEbraqUpzO15X/j5dis5MCUOCM5ReoLiXh0ZEBeNYfiTMvJT3Kk IHYext+OYLiZbjBdqrxMWCYNPE38QDxaOD75eUat5pJljE+V9X01BH3VgVOJTfXD h7v4DYkrMynZzClX9RXH/UZvjqkQPcy950vHVyqk8TmnIj6qt2C8a5fdvL5wiA8E jybuQN30Xvx9wZObrZaBPC+X50UH215hB/AWZgWglwsmBFfZbTSFSD6dTzJKtsES zjJu3xdbrhUs7OR3NpPmJ7WAuA0QjmL9eYKNhudT1bo5l/Rl7eAffp3xMbj4C6rj UZCX8ABSevCtuQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtjecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertd dtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhi sehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffeektefgve egfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrg hmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Jun 2021 04:13:02 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 5/9] ALSA: firewire-digi00x: cease from delayed card registration Date: Mon, 7 Jun 2021 17:12:46 +0900 Message-Id: <20210607081250.13397-6-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210607081250.13397-1-o-takashi@sakamocchi.jp> References: <20210607081250.13397-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The delayed registration of sound card instance brings less benefit than complication of kobject management. This commit ceases from it. Signed-off-by: Takashi Sakamoto --- sound/firewire/digi00x/digi00x.c | 101 +++++++++---------------------- sound/firewire/digi00x/digi00x.h | 3 - 2 files changed, 29 insertions(+), 75 deletions(-) diff --git a/sound/firewire/digi00x/digi00x.c b/sound/firewire/digi00x/digi00x.c index ab8408966ec3..995302808c27 100644 --- a/sound/firewire/digi00x/digi00x.c +++ b/sound/firewire/digi00x/digi00x.c @@ -47,23 +47,32 @@ static void dg00x_card_free(struct snd_card *card) snd_dg00x_stream_destroy_duplex(dg00x); snd_dg00x_transaction_unregister(dg00x); + + mutex_destroy(&dg00x->mutex); + fw_unit_put(dg00x->unit); } -static void do_registration(struct work_struct *work) +static int snd_dg00x_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { - struct snd_dg00x *dg00x = - container_of(work, struct snd_dg00x, dwork.work); + struct snd_card *card; + struct snd_dg00x *dg00x; int err; - if (dg00x->registered) - return; - - err = snd_card_new(&dg00x->unit->device, -1, NULL, THIS_MODULE, 0, - &dg00x->card); + err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE, sizeof(*dg00x), &card); if (err < 0) - return; - dg00x->card->private_free = dg00x_card_free; - dg00x->card->private_data = dg00x; + return err; + card->private_free = dg00x_card_free; + + dg00x = card->private_data; + dg00x->unit = fw_unit_get(unit); + dev_set_drvdata(&unit->device, dg00x); + dg00x->card = card; + + mutex_init(&dg00x->mutex); + spin_lock_init(&dg00x->lock); + init_waitqueue_head(&dg00x->hwdep_wait); + + dg00x->is_console = entry->model_id == MODEL_CONSOLE; err = name_card(dg00x); if (err < 0) @@ -91,85 +100,33 @@ static void do_registration(struct work_struct *work) if (err < 0) goto error; - err = snd_card_register(dg00x->card); + err = snd_card_register(card); if (err < 0) goto error; - dg00x->registered = true; - - return; -error: - snd_card_free(dg00x->card); - dev_info(&dg00x->unit->device, - "Sound card registration failed: %d\n", err); -} - -static int snd_dg00x_probe(struct fw_unit *unit, - const struct ieee1394_device_id *entry) -{ - struct snd_dg00x *dg00x; - - /* Allocate this independent of sound card instance. */ - dg00x = devm_kzalloc(&unit->device, sizeof(struct snd_dg00x), - GFP_KERNEL); - if (!dg00x) - return -ENOMEM; - - dg00x->unit = fw_unit_get(unit); - dev_set_drvdata(&unit->device, dg00x); - - mutex_init(&dg00x->mutex); - spin_lock_init(&dg00x->lock); - init_waitqueue_head(&dg00x->hwdep_wait); - - dg00x->is_console = entry->model_id == MODEL_CONSOLE; - - /* Allocate and register this sound card later. */ - INIT_DEFERRABLE_WORK(&dg00x->dwork, do_registration); - snd_fw_schedule_registration(unit, &dg00x->dwork); - return 0; +error: + snd_card_free(card); + return err; } static void snd_dg00x_update(struct fw_unit *unit) { struct snd_dg00x *dg00x = dev_get_drvdata(&unit->device); - /* Postpone a workqueue for deferred registration. */ - if (!dg00x->registered) - snd_fw_schedule_registration(unit, &dg00x->dwork); - snd_dg00x_transaction_reregister(dg00x); - /* - * After registration, userspace can start packet streaming, then this - * code block works fine. - */ - if (dg00x->registered) { - mutex_lock(&dg00x->mutex); - snd_dg00x_stream_update_duplex(dg00x); - mutex_unlock(&dg00x->mutex); - } + mutex_lock(&dg00x->mutex); + snd_dg00x_stream_update_duplex(dg00x); + mutex_unlock(&dg00x->mutex); } static void snd_dg00x_remove(struct fw_unit *unit) { struct snd_dg00x *dg00x = dev_get_drvdata(&unit->device); - /* - * Confirm to stop the work for registration before the sound card is - * going to be released. The work is not scheduled again because bus - * reset handler is not called anymore. - */ - cancel_delayed_work_sync(&dg00x->dwork); - - if (dg00x->registered) { - // Block till all of ALSA character devices are released. - snd_card_free(dg00x->card); - } - - mutex_destroy(&dg00x->mutex); - fw_unit_put(dg00x->unit); + // Block till all of ALSA character devices are released. + snd_card_free(dg00x->card); } static const struct ieee1394_device_id snd_dg00x_id_table[] = { diff --git a/sound/firewire/digi00x/digi00x.h b/sound/firewire/digi00x/digi00x.h index 129de8edd5ea..82b647d383c5 100644 --- a/sound/firewire/digi00x/digi00x.h +++ b/sound/firewire/digi00x/digi00x.h @@ -37,9 +37,6 @@ struct snd_dg00x { struct mutex mutex; spinlock_t lock; - bool registered; - struct delayed_work dwork; - struct amdtp_stream tx_stream; struct fw_iso_resources tx_resources; From patchwork Mon Jun 7 08:12:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12302797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A7B3C47082 for ; Mon, 7 Jun 2021 08:16:38 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A51166102A for ; Mon, 7 Jun 2021 08:16:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A51166102A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4353D168D; Mon, 7 Jun 2021 10:15:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4353D168D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623053796; bh=03+LufOL/LGPPDRYGIMcHqBtmtTDGojeLWTdOYpT9+g=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Lx/56NN9ImTDH4v3qAcCZNEaBPpi6TDMrJhFc+Fp8LQP1N/P5c9S2rvV0L/Kwncwh luFeMsP480xf/YJZWPGqPacJfjytukQxw0nQfuvcZpLyGlqaaY5ZrxdwDI+vll8GKg vFjiHV4BoWCyiV4osqiUyTHHTIz/WyMSImIC+qhw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 09439F804E4; Mon, 7 Jun 2021 10:13:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4EC95F802DF; Mon, 7 Jun 2021 10:13:20 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4EF90F80276 for ; Mon, 7 Jun 2021 10:13:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4EF90F80276 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="c14TxnGI"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Jznd8u5X" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 3BCA05C0163; Mon, 7 Jun 2021 04:13:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 07 Jun 2021 04:13:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=ByyAaM+r0fDTE q3Pa3wcsL4rHOFoTELYVuoqyMMKHbQ=; b=c14TxnGIQl+pHbOSFEx4UJ3I9Cpnn kv1P26R+CXjzE1UofRDwHGgU3V9Fel0RqkKhphag/QQcT02yVWhjs62fGaFMLwPx dlH6fo/0M2VIXfi51RubcTZcUeW/pTFNJev0Vy8YwNij46jg80LEiHw0/Uqkfq9a yba8/AaVwPuLFesaClQS3FM7Dlt16tDJlS7KQrm1cL1yyFDFwhiVh7buE9dJ1/Jn tdH1L6r5ndzHVHRJW3fJvZTQ1uMH352PI0mOd02qhUdDgaIhZVZoAa+ot00nrUzN 5MWIzkLjoiQLoznYtr49Q3Tc32Au87SHq2yiU5fOaTiC9s9ZWe1b9eIqw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=ByyAaM+r0fDTEq3Pa3wcsL4rHOFoTELYVuoqyMMKHbQ=; b=Jznd8u5X /MELiTF5Q/eHEmMSnHianTmA4VdgaxLg1p1MPwZQ+gSh17z/60fMW4eWGkvFlRgo i2yYYoKelABYax+4zvfDS1SexqVCKyr2F+86NlqvQfY7sNUe88moSO2GViyOXlLU rSdp6vAagjp1c/jY+lqkwEubiHbuKFSM0qk5xsXBRDT5/Jv31Db9PRHNcfDRPnKi EvP1MMOOM1yuwDrZiDZm6PWusPWYO5zFYatfD4bDgVrSoE1g8odZsR82sT7eX90/ x/k2qFn90lY7qRnhXWVaNxseRisVsPDn8JeLudXA8JMAkTRIa4n56Dec6rCelmYd Mj7Y/9S+7EnTDg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtjecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertd dtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhi sehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffeektefgve egfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushhtvghrufhi iigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrg hmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Jun 2021 04:13:04 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 6/9] ALSA: firewire-tascam: cease from delayed card registration Date: Mon, 7 Jun 2021 17:12:47 +0900 Message-Id: <20210607081250.13397-7-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210607081250.13397-1-o-takashi@sakamocchi.jp> References: <20210607081250.13397-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The delayed registration of sound card instance brings less benefit than complication of kobject management. This commit ceases from it. Signed-off-by: Takashi Sakamoto --- sound/firewire/tascam/tascam.c | 92 +++++++++++----------------------- sound/firewire/tascam/tascam.h | 2 - 2 files changed, 28 insertions(+), 66 deletions(-) diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c index 75f2edd8e78f..eb58d3fcf087 100644 --- a/sound/firewire/tascam/tascam.c +++ b/sound/firewire/tascam/tascam.c @@ -90,19 +90,31 @@ static void tscm_card_free(struct snd_card *card) snd_tscm_transaction_unregister(tscm); snd_tscm_stream_destroy_duplex(tscm); + + mutex_destroy(&tscm->mutex); + fw_unit_put(tscm->unit); } -static void do_registration(struct work_struct *work) +static int snd_tscm_probe(struct fw_unit *unit, + const struct ieee1394_device_id *entry) { - struct snd_tscm *tscm = container_of(work, struct snd_tscm, dwork.work); + struct snd_card *card; + struct snd_tscm *tscm; int err; - err = snd_card_new(&tscm->unit->device, -1, NULL, THIS_MODULE, 0, - &tscm->card); + err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE, sizeof(*tscm), &card); if (err < 0) - return; - tscm->card->private_free = tscm_card_free; - tscm->card->private_data = tscm; + return err; + card->private_free = tscm_card_free; + + tscm = card->private_data; + tscm->unit = fw_unit_get(unit); + dev_set_drvdata(&unit->device, tscm); + tscm->card = card; + + mutex_init(&tscm->mutex); + spin_lock_init(&tscm->lock); + init_waitqueue_head(&tscm->hwdep_wait); err = identify_model(tscm); if (err < 0) @@ -130,81 +142,33 @@ static void do_registration(struct work_struct *work) if (err < 0) goto error; - err = snd_card_register(tscm->card); + err = snd_card_register(card); if (err < 0) goto error; - tscm->registered = true; - - return; -error: - snd_card_free(tscm->card); - dev_info(&tscm->unit->device, - "Sound card registration failed: %d\n", err); -} - -static int snd_tscm_probe(struct fw_unit *unit, - const struct ieee1394_device_id *entry) -{ - struct snd_tscm *tscm; - - /* Allocate this independent of sound card instance. */ - tscm = devm_kzalloc(&unit->device, sizeof(struct snd_tscm), GFP_KERNEL); - if (!tscm) - return -ENOMEM; - tscm->unit = fw_unit_get(unit); - dev_set_drvdata(&unit->device, tscm); - - mutex_init(&tscm->mutex); - spin_lock_init(&tscm->lock); - init_waitqueue_head(&tscm->hwdep_wait); - - /* Allocate and register this sound card later. */ - INIT_DEFERRABLE_WORK(&tscm->dwork, do_registration); - snd_fw_schedule_registration(unit, &tscm->dwork); - return 0; +error: + snd_card_free(card); + return err; } static void snd_tscm_update(struct fw_unit *unit) { struct snd_tscm *tscm = dev_get_drvdata(&unit->device); - /* Postpone a workqueue for deferred registration. */ - if (!tscm->registered) - snd_fw_schedule_registration(unit, &tscm->dwork); - snd_tscm_transaction_reregister(tscm); - /* - * After registration, userspace can start packet streaming, then this - * code block works fine. - */ - if (tscm->registered) { - mutex_lock(&tscm->mutex); - snd_tscm_stream_update_duplex(tscm); - mutex_unlock(&tscm->mutex); - } + mutex_lock(&tscm->mutex); + snd_tscm_stream_update_duplex(tscm); + mutex_unlock(&tscm->mutex); } static void snd_tscm_remove(struct fw_unit *unit) { struct snd_tscm *tscm = dev_get_drvdata(&unit->device); - /* - * Confirm to stop the work for registration before the sound card is - * going to be released. The work is not scheduled again because bus - * reset handler is not called anymore. - */ - cancel_delayed_work_sync(&tscm->dwork); - - if (tscm->registered) { - // Block till all of ALSA character devices are released. - snd_card_free(tscm->card); - } - - mutex_destroy(&tscm->mutex); - fw_unit_put(tscm->unit); + // Block till all of ALSA character devices are released. + snd_card_free(tscm->card); } static const struct ieee1394_device_id snd_tscm_id_table[] = { diff --git a/sound/firewire/tascam/tascam.h b/sound/firewire/tascam/tascam.h index 28dad4eae9c9..d07ffcb27be6 100644 --- a/sound/firewire/tascam/tascam.h +++ b/sound/firewire/tascam/tascam.h @@ -70,8 +70,6 @@ struct snd_tscm { struct mutex mutex; spinlock_t lock; - bool registered; - struct delayed_work dwork; const struct snd_tscm_spec *spec; struct fw_iso_resources tx_resources; From patchwork Mon Jun 7 08:12:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12302807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC100C47082 for ; Mon, 7 Jun 2021 08:17:57 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2CD0761029 for ; Mon, 7 Jun 2021 08:17:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CD0761029 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BE6A9168F; Mon, 7 Jun 2021 10:17:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BE6A9168F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623053875; bh=FSmv/IaGdedwb3zB6fHJcoqACxfAQKGAKE7wjkfOiYk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=HRzqgvNohN+vjHXCnasy5LNy7Jtco+q6V9SMHRsy7IEaGnKBl8kZn0Z0kxC4nmWBg q7ToPTIQ6vGN1G38TKMSStIUgW0SXxj08xFacJg7xy3XXKL3N9TBFnmAmZrudtmpY7 F/kcj+cv7pJazu3AKX3P85dQAEGPdSf1h9BLZWXg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9474EF8050F; Mon, 7 Jun 2021 10:13:30 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 89FEFF804FF; Mon, 7 Jun 2021 10:13:26 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5B334F804C2 for ; Mon, 7 Jun 2021 10:13:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5B334F804C2 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="TiaaCe8R"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DNiCdSnJ" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 811525C0166; Mon, 7 Jun 2021 04:13:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 07 Jun 2021 04:13:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=DZ3n0ba2RGFil /F3MIplbLvjz3DDmqaD1X4BbdIq/ho=; b=TiaaCe8R2z1M81q5PzGxlyiNV6gVU S1Lf9zfBSj09rvYh+Z9NPjCBtqsq4Jch3upDs9VDCaQVKsMXfILcrzdmJPsyJ66W yk+DpOa8dJnQxhv+j/seaTq6T/TRyG25SaQQc0Ybl+qkJLA49hkE4rIq+UXbMURa mi1Bm4uUUMdzdsgvYQvSEvpYazGIbezB4mcBw3WFubsE34M3YIN89/I5HuSSAg5E 1VcwMfSuvj+yhxocrvby/KPJ6tOdXu/iyPM3gqr1n76woJ4A5Pgi8Md18ddvXv6C QhHfGo9G+gwuDLi1MSYGYGIANelNg/bz3ox42Mv8iOoovGM+Bmx9pHNlg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=DZ3n0ba2RGFil/F3MIplbLvjz3DDmqaD1X4BbdIq/ho=; b=DNiCdSnJ 6PYEE74ton5CR3tkU9ttjqgpPDiM6FPn3zZmFbra82uwCRaxaPfP+P4G5FTft42s aXyWIpaLFPmV4mOL+/bKdt/rxXFDU1PFFS0Ouh/7bTPm1ttqMqD9HeP0a/VphgKn o6ykBEWcMelHF2hueeo/YUIIEcKF1XJm/gdiltSWOtV2TVmztay9ZP8Dkd9LDd96 7icjFA4tVaQGREa4O+jmOvbdS/sQAl78WjBZLQxHa2KsyTmJXnETJYstMKwVgWQp Mg2RBP4uyS0b1NmHQxkfyjU1KaO8x2up0pN5bSLh/NuojIcKRp11CSWqekFtxq0X 3uuTC2TMkO5XtA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtjecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertd dtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhi sehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffeektefgve egfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushhtvghrufhi iigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrg hmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Jun 2021 04:13:05 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 7/9] ALSA: firewire-motu: cease from delayed card registration Date: Mon, 7 Jun 2021 17:12:48 +0900 Message-Id: <20210607081250.13397-8-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210607081250.13397-1-o-takashi@sakamocchi.jp> References: <20210607081250.13397-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The delayed registration of sound card instance brings less benefit than complication of kobject management. This commit ceases from it. Signed-off-by: Takashi Sakamoto --- sound/firewire/motu/motu.c | 84 ++++++++++++-------------------------- sound/firewire/motu/motu.h | 3 -- 2 files changed, 25 insertions(+), 62 deletions(-) diff --git a/sound/firewire/motu/motu.c b/sound/firewire/motu/motu.c index 2a8a6ea2d3f1..531eeb36eb87 100644 --- a/sound/firewire/motu/motu.c +++ b/sound/firewire/motu/motu.c @@ -57,22 +57,31 @@ static void motu_card_free(struct snd_card *card) snd_motu_transaction_unregister(motu); snd_motu_stream_destroy_duplex(motu); + + mutex_destroy(&motu->mutex); + fw_unit_put(motu->unit); } -static void do_registration(struct work_struct *work) +static int motu_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { - struct snd_motu *motu = container_of(work, struct snd_motu, dwork.work); + struct snd_card *card; + struct snd_motu *motu; int err; - if (motu->registered) - return; - - err = snd_card_new(&motu->unit->device, -1, NULL, THIS_MODULE, 0, - &motu->card); + err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE, sizeof(*motu), &card); if (err < 0) - return; - motu->card->private_free = motu_card_free; - motu->card->private_data = motu; + return err; + card->private_free = motu_card_free; + + motu = card->private_data; + motu->unit = fw_unit_get(unit); + dev_set_drvdata(&unit->device, motu); + motu->card = card; + + motu->spec = (const struct snd_motu_spec *)entry->driver_data; + mutex_init(&motu->mutex); + spin_lock_init(&motu->lock); + init_waitqueue_head(&motu->hwdep_wait); name_card(motu); @@ -103,71 +112,28 @@ static void do_registration(struct work_struct *work) if (err < 0) goto error; - err = snd_card_register(motu->card); + err = snd_card_register(card); if (err < 0) goto error; - motu->registered = true; - - return; -error: - snd_card_free(motu->card); - dev_info(&motu->unit->device, - "Sound card registration failed: %d\n", err); -} - -static int motu_probe(struct fw_unit *unit, - const struct ieee1394_device_id *entry) -{ - struct snd_motu *motu; - - /* Allocate this independently of sound card instance. */ - motu = devm_kzalloc(&unit->device, sizeof(struct snd_motu), GFP_KERNEL); - if (!motu) - return -ENOMEM; - motu->unit = fw_unit_get(unit); - dev_set_drvdata(&unit->device, motu); - - motu->spec = (const struct snd_motu_spec *)entry->driver_data; - mutex_init(&motu->mutex); - spin_lock_init(&motu->lock); - init_waitqueue_head(&motu->hwdep_wait); - - /* Allocate and register this sound card later. */ - INIT_DEFERRABLE_WORK(&motu->dwork, do_registration); - snd_fw_schedule_registration(unit, &motu->dwork); - return 0; +error: + snd_card_free(card); + return err; } static void motu_remove(struct fw_unit *unit) { struct snd_motu *motu = dev_get_drvdata(&unit->device); - /* - * Confirm to stop the work for registration before the sound card is - * going to be released. The work is not scheduled again because bus - * reset handler is not called anymore. - */ - cancel_delayed_work_sync(&motu->dwork); - - if (motu->registered) { - // Block till all of ALSA character devices are released. - snd_card_free(motu->card); - } - - mutex_destroy(&motu->mutex); - fw_unit_put(motu->unit); + // Block till all of ALSA character devices are released. + snd_card_free(motu->card); } static void motu_bus_update(struct fw_unit *unit) { struct snd_motu *motu = dev_get_drvdata(&unit->device); - /* Postpone a workqueue for deferred registration. */ - if (!motu->registered) - snd_fw_schedule_registration(unit, &motu->dwork); - /* The handler address register becomes initialized. */ snd_motu_transaction_reregister(motu); } diff --git a/sound/firewire/motu/motu.h b/sound/firewire/motu/motu.h index 674e3dc4e45d..c5c0e446deb2 100644 --- a/sound/firewire/motu/motu.h +++ b/sound/firewire/motu/motu.h @@ -54,9 +54,6 @@ struct snd_motu { struct mutex mutex; spinlock_t lock; - bool registered; - struct delayed_work dwork; - /* Model dependent information. */ const struct snd_motu_spec *spec; From patchwork Mon Jun 7 08:12:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12302793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F35BC47082 for ; Mon, 7 Jun 2021 08:15:53 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9BB84611ED for ; Mon, 7 Jun 2021 08:15:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BB84611ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2ABB11690; Mon, 7 Jun 2021 10:15:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2ABB11690 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623053751; bh=DM8bMCqfT9yQTkn1XHVCkTTduYpvUgZxrby5delvPpQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=j3YlIRCLQuzY0G/GUn/D4DZKQC1MDdx+l5OMSE0smOWJcNlz1xDlA8AXZGDa+aKJW 0FJbyDkTSEBVdpWWPpZh3F9ppfHmx/iBl9nh0Z747kGi9ar6GAPFpwAFaiEPqDGwfB UsYvhBYZgk6XANO6cYS5P3TzXqyC1VBAiingNjT8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 696C9F804DA; Mon, 7 Jun 2021 10:13:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 48F3EF804D1; Mon, 7 Jun 2021 10:13:19 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 81465F802DF for ; Mon, 7 Jun 2021 10:13:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 81465F802DF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="1sTUJh0c"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="spmWeEbO" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id C19EF5C013A; Mon, 7 Jun 2021 04:13:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 07 Jun 2021 04:13:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=sfWqAck5aMqeu 6QM4bNtm4xlVwYLtkmjGbdbX/T323A=; b=1sTUJh0cJqUKMsk+i2HUGTxjzWbSf vpnYmWxb7/fO8uA714je0/vsesFqFal5tjI7eerrLPGS7cH9tU8pAPoUDp0HDFSv 2UnAZ7wSMrewGvumusXQIOpl/0qNtSwnY3xkjMjKTbwdWju+UvJg6+QZo6vosrcB HNNEgWXO0FW4kODeNAZGVgN5vuHzY70Oo8z/QXEY5e8ZE8oRVn/ndNVUMPAnp9fi fTFJiVHeOK5K5136vZq3kwakI4YM4/tTb+dti+xdoSzd4kQNYsPGhqTUUMPPdFUW 66KMvVDCNb2IjHRtYhuJE1v2XOfHgCTi4STG1kFKG71o786vXOXPwK/Nw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=sfWqAck5aMqeu6QM4bNtm4xlVwYLtkmjGbdbX/T323A=; b=spmWeEbO O64bCbcPyusiphVr9T0PSjI52Wmm1ELq839l+/2tLV/oVp5GO66Zf5o1/F1jCa3x FCivwlRcmL7kle2XkgZOyZV0OYHzhl2aX4IxnHTevXaLJjMW1/3yxY1myCjT5qnW 7ZPFPJjVSKxSrg8P9T3+HAqD856PFcMKkGEPII4jMx7lR+IqoUl0LgRAMJ4Q22su mLgjf1mx1DiiJ04ZIvESxcK1qT+Ot3Sd8yP1nyjmo3OjVG9iLzZkHXAVAxg5rUam lE5lp6FhUqyIT/Ppz4nQYYYh+/sS85jxuo6K3cpleq5Mx+KhX9unb/ZnzJHGuaBm KYbQ1WxweI4ngQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtjecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertd dtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhi sehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffeektefgve egfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushhtvghrufhi iigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrg hmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Jun 2021 04:13:06 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 8/9] ALSA: fireface: cease from delayed card registration Date: Mon, 7 Jun 2021 17:12:49 +0900 Message-Id: <20210607081250.13397-9-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210607081250.13397-1-o-takashi@sakamocchi.jp> References: <20210607081250.13397-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The delayed registration of sound card instance brings less benefit than complication of kobject management. This commit ceases from it. Signed-off-by: Takashi Sakamoto --- sound/firewire/fireface/ff.c | 90 +++++++++++------------------------- sound/firewire/fireface/ff.h | 3 -- 2 files changed, 28 insertions(+), 65 deletions(-) diff --git a/sound/firewire/fireface/ff.c b/sound/firewire/fireface/ff.c index bc39269415d2..7bf51d062021 100644 --- a/sound/firewire/fireface/ff.c +++ b/sound/firewire/fireface/ff.c @@ -42,22 +42,33 @@ static void ff_card_free(struct snd_card *card) snd_ff_stream_destroy_duplex(ff); snd_ff_transaction_unregister(ff); + + mutex_destroy(&ff->mutex); + fw_unit_put(ff->unit); } -static void do_registration(struct work_struct *work) +static int snd_ff_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { - struct snd_ff *ff = container_of(work, struct snd_ff, dwork.work); + struct snd_card *card; + struct snd_ff *ff; int err; - if (ff->registered) - return; - - err = snd_card_new(&ff->unit->device, -1, NULL, THIS_MODULE, 0, - &ff->card); + err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE, sizeof(*ff), &card); if (err < 0) - return; - ff->card->private_free = ff_card_free; - ff->card->private_data = ff; + return err; + card->private_free = ff_card_free; + + ff = card->private_data; + ff->unit = fw_unit_get(unit); + dev_set_drvdata(&unit->device, ff); + ff->card = card; + + mutex_init(&ff->mutex); + spin_lock_init(&ff->lock); + init_waitqueue_head(&ff->hwdep_wait); + + ff->unit_version = entry->version; + ff->spec = (const struct snd_ff_spec *)entry->driver_data; err = snd_ff_transaction_register(ff); if (err < 0) @@ -83,76 +94,31 @@ static void do_registration(struct work_struct *work) if (err < 0) goto error; - err = snd_card_register(ff->card); + err = snd_card_register(card); if (err < 0) goto error; - ff->registered = true; - - return; -error: - snd_card_free(ff->card); - dev_info(&ff->unit->device, - "Sound card registration failed: %d\n", err); -} - -static int snd_ff_probe(struct fw_unit *unit, - const struct ieee1394_device_id *entry) -{ - struct snd_ff *ff; - - ff = devm_kzalloc(&unit->device, sizeof(struct snd_ff), GFP_KERNEL); - if (!ff) - return -ENOMEM; - ff->unit = fw_unit_get(unit); - dev_set_drvdata(&unit->device, ff); - - mutex_init(&ff->mutex); - spin_lock_init(&ff->lock); - init_waitqueue_head(&ff->hwdep_wait); - - ff->unit_version = entry->version; - ff->spec = (const struct snd_ff_spec *)entry->driver_data; - - /* Register this sound card later. */ - INIT_DEFERRABLE_WORK(&ff->dwork, do_registration); - snd_fw_schedule_registration(unit, &ff->dwork); - return 0; +error: + snd_card_free(card); + return err; } static void snd_ff_update(struct fw_unit *unit) { struct snd_ff *ff = dev_get_drvdata(&unit->device); - /* Postpone a workqueue for deferred registration. */ - if (!ff->registered) - snd_fw_schedule_registration(unit, &ff->dwork); - snd_ff_transaction_reregister(ff); - if (ff->registered) - snd_ff_stream_update_duplex(ff); + snd_ff_stream_update_duplex(ff); } static void snd_ff_remove(struct fw_unit *unit) { struct snd_ff *ff = dev_get_drvdata(&unit->device); - /* - * Confirm to stop the work for registration before the sound card is - * going to be released. The work is not scheduled again because bus - * reset handler is not called anymore. - */ - cancel_work_sync(&ff->dwork.work); - - if (ff->registered) { - // Block till all of ALSA character devices are released. - snd_card_free(ff->card); - } - - mutex_destroy(&ff->mutex); - fw_unit_put(ff->unit); + // Block till all of ALSA character devices are released. + snd_card_free(ff->card); } static const struct snd_ff_spec spec_ff800 = { diff --git a/sound/firewire/fireface/ff.h b/sound/firewire/fireface/ff.h index 705e7df4f929..0535f0b58b67 100644 --- a/sound/firewire/fireface/ff.h +++ b/sound/firewire/fireface/ff.h @@ -69,9 +69,6 @@ struct snd_ff { struct mutex mutex; spinlock_t lock; - bool registered; - struct delayed_work dwork; - enum snd_ff_unit_version unit_version; const struct snd_ff_spec *spec; From patchwork Mon Jun 7 08:12:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12302799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4A79C47082 for ; Mon, 7 Jun 2021 08:17:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4CDA760FF1 for ; Mon, 7 Jun 2021 08:17:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CDA760FF1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BE5F3169C; Mon, 7 Jun 2021 10:16:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BE5F3169C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623053834; bh=0XfFBwrQVJ8UfqvlHfCNZjdCLCp9bDs6bH8/ZL7vAYI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DpDhAo96HKRSpufKf/tmRf0EWb2r2X3G6dXmJjbodJRNFmf/Nz5vMOJOClL5l9CxD febCRrdjRWwvsc0Dbt7dE4l7dH4afuYh5HZeV57a05yhPAdCQo294h6m31LZRgxx92 0BbZjz9Vq5MIi1YFCejhNR2GOivnfJ3yLrmLafSg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3C827F804F3; Mon, 7 Jun 2021 10:13:26 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A5FA9F804D0; Mon, 7 Jun 2021 10:13:21 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C60EEF8032C for ; Mon, 7 Jun 2021 10:13:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C60EEF8032C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="GkQYnCZC"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Skhz1GD2" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 0F4F65C012E; Mon, 7 Jun 2021 04:13:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 07 Jun 2021 04:13:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=NPvg0gQFZoER1 AozOO55g+iRxgN6A5dFR/Q0x/qN2/Q=; b=GkQYnCZCwhx8hFGxixacjQt008YPa d1z1HN63SWeAS+TxoMhTO6boGxzJuJ1JJA98TCjwOHzoU5pg+y2LPSxw3W10/Yv3 qtcs9gfmJGgGruBmGJVhNxojXul2yzHxLH3eJSrP/bTkkl8xh7jZFf8ecSdVGJES udCdeQkdguuUHY9U7k9HlWnWLnnagjHmBqLKc6ph5TfJZy5Uv9umopym1oZIYBhR rld3iTRx+bdlNjtYyuEfJxS1dg8Ykua54JweyyumPymQW+2TIo8fiwhXM57PUk6Z 5V9D772cKI3i9VvE4IKWQEcxsvMUKxFuZHC/M28uZJNSathvE9gMzKVGw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=NPvg0gQFZoER1AozOO55g+iRxgN6A5dFR/Q0x/qN2/Q=; b=Skhz1GD2 mbmUi1tv+M/8JV0ORQkC/mTLAe0qc49DpH8twgWPdJb0zj21lQNNr/tPCQIKfr/S VtydjUhsZlUJ2xpf5gf9gwvQxNqb6AaK4b4LLllWM61nmv3JDLn/qZhfLBF3TFwN iyfUD1CZ8XNyOpf2xNKY8zWY0kp6IuEmtxLhCtbPoUhdbJcOV4nYJ5SaMay5nhnh DD4y/oCK4GuzQZC0MB8sUhdvKqoCINk9erNIKkpy+s5gplFbKrY1SWNUh2u3wvbx ZMt/pkBtexlcvUOLUYoNxQVh9ELlkPSvUr8fiddGWVncQ/V4RSJpAY8KuAm/mN0Z KUVAc35QyLnzqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtjecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertd dtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhi sehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffeektefgve egfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushhtvghrufhi iigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrg hmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Jun 2021 04:13:07 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 9/9] ALSA: firewire-lib: delete unused kernel API Date: Mon, 7 Jun 2021 17:12:50 +0900 Message-Id: <20210607081250.13397-10-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210607081250.13397-1-o-takashi@sakamocchi.jp> References: <20210607081250.13397-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" No driver use snd_fw_schedule_registration(). Let's delete it. Signed-off-by: Takashi Sakamoto --- sound/firewire/lib.c | 32 -------------------------------- sound/firewire/lib.h | 3 --- 2 files changed, 35 deletions(-) diff --git a/sound/firewire/lib.c b/sound/firewire/lib.c index 85c4f4477c7f..e0a2337e8f27 100644 --- a/sound/firewire/lib.c +++ b/sound/firewire/lib.c @@ -67,38 +67,6 @@ int snd_fw_transaction(struct fw_unit *unit, int tcode, } EXPORT_SYMBOL(snd_fw_transaction); -#define PROBE_DELAY_MS (2 * MSEC_PER_SEC) - -/** - * snd_fw_schedule_registration - schedule work for sound card registration - * @unit: an instance for unit on IEEE 1394 bus - * @dwork: delayed work with callback function - * - * This function is not designed for general purposes. When new unit is - * connected to IEEE 1394 bus, the bus is under bus-reset state because of - * topological change. In this state, units tend to fail both of asynchronous - * and isochronous communication. To avoid this problem, this function is used - * to postpone sound card registration after the state. The callers must - * set up instance of delayed work in advance. - */ -void snd_fw_schedule_registration(struct fw_unit *unit, - struct delayed_work *dwork) -{ - u64 now, delay; - - now = get_jiffies_64(); - delay = fw_parent_device(unit)->card->reset_jiffies - + msecs_to_jiffies(PROBE_DELAY_MS); - - if (time_after64(delay, now)) - delay -= now; - else - delay = 0; - - mod_delayed_work(system_wq, dwork, delay); -} -EXPORT_SYMBOL(snd_fw_schedule_registration); - MODULE_DESCRIPTION("FireWire audio helper functions"); MODULE_AUTHOR("Clemens Ladisch "); MODULE_LICENSE("GPL v2"); diff --git a/sound/firewire/lib.h b/sound/firewire/lib.h index dc815dc3933e..664dfdb9e58d 100644 --- a/sound/firewire/lib.h +++ b/sound/firewire/lib.h @@ -23,7 +23,4 @@ static inline bool rcode_is_permanent_error(int rcode) return rcode == RCODE_TYPE_ERROR || rcode == RCODE_ADDRESS_ERROR; } -void snd_fw_schedule_registration(struct fw_unit *unit, - struct delayed_work *dwork); - #endif