Re: [PATCH 2/3] ALSA: ctxfi: Use matching DAIO type for da_desc

From: Takashi Iwai

Date: Wed Apr 01 2026 - 03:57:54 EST


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