public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Harin Lee <me@harin.net>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] ALSA: ctxfi: Use matching DAIO type for da_desc
Date: Wed, 01 Apr 2026 09:57:37 +0200	[thread overview]
Message-ID: <87wlyrqfim.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260331153507.2934795-3-me@harin.net>

On Tue, 31 Mar 2026 17:35:06 +0200,
Harin Lee wrote:
> @@ -1121,7 +1121,8 @@ static int atc_spdif_out_unmute(struct ct_atc *atc, unsigned char state)
>  
>  static int atc_spdif_in_unmute(struct ct_atc *atc, unsigned char state)
>  {
> -	return atc_daio_unmute(atc, state, SPDIFIO);
> +	return atc_daio_unmute(atc, state, (atc->model == CTSB073X) ?
> +		SPDIFI_BAY : SPDIFIO);

It's error-prone to use ternary operators as open code in many places.
Better to define a function instead.

>  }
>  
>  static int atc_spdif_out_get_status(struct ct_atc *atc, unsigned int *status)
> @@ -1429,12 +1430,9 @@ static int atc_get_resources(struct ct_atc *atc)
>  	for (i = 0; i < NUM_DAIOTYP; i++) {
>  		if (((i == MIC) && !cap.dedicated_mic) ||
>  		    ((i == RCA) && !cap.dedicated_rca) ||
> -		    i == SPDIFI_BAY)
> +		    (i == ((atc->model == CTSB073X) ? SPDIFIO : SPDIFI_BAY)))

... and this is even reversed value assignment which is rather
confusing.  Rather write with a simple if/else, such as:

		 if ((i == SPDFIO && atc->model == CTSB073X) ||
		     (i == SPDIFI_BAY && atc->model != CTSB073X))
			continue;

>  	atc_connect_dai(atc->rsc_mgrs[SRC], dai,
> -			(struct src **)&atc->srcs[0],
> -			(struct srcimp **)&atc->srcimps[0]);
> +		(struct src **)&atc->srcs[0],
> +		(struct srcimp **)&atc->srcimps[0]);

Avoid unnecessary spacing changes.  The previous code is fine about
indentation.


thanks,

Takashi

  reply	other threads:[~2026-04-01  7:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 15:35 [PATCH 0/3] ALSA: ctxfi: Clean up DAIO resource allocation Harin Lee
2026-03-31 15:35 ` [PATCH 1/3] ALSA: ctxfi: Rename SPDIFI1 to SPDIFI_BAY Harin Lee
2026-03-31 15:35 ` [PATCH 2/3] ALSA: ctxfi: Use matching DAIO type for da_desc Harin Lee
2026-04-01  7:57   ` Takashi Iwai [this message]
2026-03-31 15:35 ` [PATCH 3/3] ALSA: ctxfi: Precompute SRC allocation loop bound Harin Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wlyrqfim.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=me@harin.net \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox