From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965617AbdEOOkQ (ORCPT ); Mon, 15 May 2017 10:40:16 -0400 Received: from smtp-proxy004.phy.lolipop.jp ([157.7.104.45]:48085 "EHLO smtp-proxy004.phy.lolipop.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934616AbdEOOkO (ORCPT ); Mon, 15 May 2017 10:40:14 -0400 Subject: Re: [PATCH 1/2] ALSA: firewire-tascam: Fix infinite loop in snd_tscm_stream_get_rate() To: Geert Uytterhoeven References: <1494836350-28790-1-git-send-email-geert@linux-m68k.org> Cc: ALSA Development Mailing List , Arnd Bergmann , Clemens Ladisch , "linux-kernel@vger.kernel.org" , Takashi Iwai From: Takashi Sakamoto Message-ID: <6d8977cb-05c9-b237-2f2d-8b0ab8077bc6@sakamocchi.jp> Date: Mon, 15 May 2017 23:40:12 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On May 15 2017 23:22, Geert Uytterhoeven wrote: >>> diff --git a/sound/firewire/tascam/tascam-stream.c >>> b/sound/firewire/tascam/tascam-stream.c >>> index f1657a4e0621ef49..e433b92ac6904db5 100644 >>> --- a/sound/firewire/tascam/tascam-stream.c >>> +++ b/sound/firewire/tascam/tascam-stream.c >>> @@ -84,7 +84,7 @@ int snd_tscm_stream_get_rate(struct snd_tscm *tscm, >>> unsigned int *rate) >>> unsigned int trials = 0; >>> int err; >>> >>> - while (data == 0x0 || trials++ < 5) { >>> + while (data == 0x0 && trials++ < 5) { >>> err = get_clock(tscm, &data); >>> if (err < 0) >>> return err; >> >> Yep. It looks a bug. >> >> ...However, removal of the bug causes issue that the driver fails to start a >> pair of capture/playback PCM substream when application requests them mostly >> the same time, like jackd process. >> >> I think I did apply the bug as a makeshift workaround, then forgot itself >> when developing the driver... I'd like to have a bit time for further >> investigation, then post my fix in this development period. > > Probably you need a small delay in the loop? > Why else do you #include ? ;-) I know PDI1394L40 (link layer) has quirks inconvenient to us. Furthermore, the behaviour of on-board FPGAs with unique firmwares are in black boxes to me. I prefer deliberate approach for this kind of work, reverse engineering. Regards Takashi Sakamoto