From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7BC71C76196 for ; Thu, 6 Apr 2023 07:57:27 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 23BAB832; Thu, 6 Apr 2023 09:56:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 23BAB832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1680767845; bh=U0JHKejH9AvmPl3r0YPdgKy5GPPZRKczQ7MOnjNqTCI=; h=Date:From:To:Subject:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=tVxqcbdIwf2psxI39A3FUz3aRuODQZswPYRplNaqUnuGrlq4fGZUDvRqFt8E+JpwW fJ3AljVnBl/gzxtdwBWmgP/TiIg/vpRVBPV0GHkaLBitC1jfde2Z1OobEtf+kz1ayM fQRgly0dRpYkyp8H0CMS4udYzCAj2hOkBwT5E2nY= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 0A8ADF80246; Thu, 6 Apr 2023 09:56:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BD8B5F80246; Thu, 6 Apr 2023 09:56:09 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2F13DF80149 for ; Thu, 6 Apr 2023 09:56:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2F13DF80149 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=glmt0zl3; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=3ZDYf936 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A42B71FD76; Thu, 6 Apr 2023 07:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680767766; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lNejoVd0cX2l8bsV9GpkjOTU5kVjNcZbLK6zcJ0Aba8=; b=glmt0zl3W0Nb1K+4vX768aaPh1879m+6dlKEvyyZA8dAkTJFlsh+Gr5G7s9B9kOA51zo5L nia5Aq1rVyu/A8KKmu0JamX3nCr7qcgMjXf+mvNg4SQ9jtULRSxcyipeBWv3oJA9Sp6RdZ Ki5Iu4VeBnAAih4RKLwpfboH/Mh6l/0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680767766; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lNejoVd0cX2l8bsV9GpkjOTU5kVjNcZbLK6zcJ0Aba8=; b=3ZDYf9363zWShK6cxPdV2NpNFGRAFF8u3BV+gbrwjrshU39G1HFhvfZgiLRK1KjhR+QTWA itVcQI1YVvauUCAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8555D1351F; Thu, 6 Apr 2023 07:56:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id PfLUHxZ7LmSXUQAAMHmgww (envelope-from ); Thu, 06 Apr 2023 07:56:06 +0000 Date: Thu, 06 Apr 2023 09:56:06 +0200 Message-ID: <87fs9dv3zd.wl-tiwai@suse.de> From: Takashi Iwai To: Oswald Buddenhagen Subject: Re: [PATCH] docs: sound: kernel-api: writing-an-alsa-driver.rst: polishing In-Reply-To: References: <20230405201220.2197863-1-oswald.buddenhagen@gmx.de> <87pm8hv6sg.wl-tiwai@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Message-ID-Hash: LR6ML6PJ2WBKDUION3WIPCD7IZCAVPBP X-Message-ID-Hash: LR6ML6PJ2WBKDUION3WIPCD7IZCAVPBP X-MailFrom: tiwai@suse.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: alsa-devel@alsa-project.org X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 06 Apr 2023 09:33:41 +0200, Oswald Buddenhagen wrote: > > On Thu, Apr 06, 2023 at 08:55:27AM +0200, Takashi Iwai wrote: > > On Wed, 05 Apr 2023 22:12:20 +0200, > > Oswald Buddenhagen wrote: > >> @@ -2262,7 +2156,7 @@ Typical code would be like the following. > >> /* over the period boundary? */ > >> if (chip->size >= runtime->period_size) { > >> /* reset the accumulator */ > >> - chip->size %= runtime->period_size; > >> + chip->size -= runtime->period_size; > >> /* call updater */ > >> spin_unlock(&chip->lock); > >> snd_pcm_period_elapsed(substream); > > > > Hmm, this kind of change shouldn't be sneaked in. > > That's more than the typo fixes etc, > > > true, the patch grew too big and i missed this hunk. > (i only kept it as one patch, because some pieces overlap and i didn't > want to add churn.) Maybe the changes could have been split from the first place, the mechanical changes to drop empty lines before "::", typo fixes, and text improvements, etc. But I guess it's too late and I'm fine to apply this whole change as a single patch with the correction. > > and even worse, it's a wrong replacement. > > > hmm, yeah, if the timer ints are configured to occur too rarely, this > wouldn't do the right thing. > but then, why would they be? that would basically defeat the point of > using many periods in the first place. should i instead change the > text to emphasize that the ints should occur at least once per period? > (i've actually pondered the timer option in the context of the emu10k1 > driver as well, and concluded that there should be two timer ints per > period, so snd_pcm_period_elapsed() is reliably called in the first > half of the next period, which is critical when only two periods are > configured.) No, the point is that, if an irq handler misses the multiple period updates, it has to handle the situation in a single shot, and the offset gets corrected to the value within the period size; using "-=" instead of "%=" may leave the size over the period size in such a case, and this may return an invalid PCM pointer value in the end. The text about the irq handling could be improved, of course. thanks, Takashi