Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: remove update from snd_soc_card

snd_soc_card :: update is used only for passing parameters to
dapm_widget_update() like below.

card->update = update;
ret = soc_dapm_xxx(card, ...);
card->update = NULL;

Let's passing it via function parameter and remove update from
snd_soc_card.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87ldubyjz9.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
257a060f 0c4a0639

+21 -28
-1
include/sound/soc.h
··· 1106 1106 /* Generic DAPM context for the card */ 1107 1107 struct snd_soc_dapm_context dapm; 1108 1108 struct snd_soc_dapm_stats dapm_stats; 1109 - struct snd_soc_dapm_update *update; 1110 1109 1111 1110 #ifdef CONFIG_DEBUG_FS 1112 1111 struct dentry *debugfs_card_root;
+21 -27
sound/soc/soc-dapm.c
··· 1743 1743 soc_dapm_async_complete(d); 1744 1744 } 1745 1745 1746 - static void dapm_widget_update(struct snd_soc_card *card) 1746 + static void dapm_widget_update(struct snd_soc_card *card, struct snd_soc_dapm_update *update) 1747 1747 { 1748 - struct snd_soc_dapm_update *update = card->update; 1749 1748 struct snd_soc_dapm_widget_list *wlist; 1750 1749 struct snd_soc_dapm_widget *w = NULL; 1751 1750 unsigned int wi; ··· 1950 1951 * o Input pin to Output pin (bypass, sidetone) 1951 1952 * o DAC to ADC (loopback). 1952 1953 */ 1953 - static int dapm_power_widgets(struct snd_soc_card *card, int event) 1954 + static int dapm_power_widgets(struct snd_soc_card *card, int event, 1955 + struct snd_soc_dapm_update *update) 1954 1956 { 1955 1957 struct snd_soc_dapm_widget *w; 1956 1958 struct snd_soc_dapm_context *d; ··· 2059 2059 /* Power down widgets first; try to avoid amplifying pops. */ 2060 2060 dapm_seq_run(card, &down_list, event, false); 2061 2061 2062 - dapm_widget_update(card); 2062 + dapm_widget_update(card, update); 2063 2063 2064 2064 /* Now power up. */ 2065 2065 dapm_seq_run(card, &up_list, event, true); ··· 2332 2332 2333 2333 /* test and update the power status of a mux widget */ 2334 2334 static int soc_dapm_mux_update_power(struct snd_soc_card *card, 2335 - struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e) 2335 + struct snd_kcontrol *kcontrol, 2336 + struct snd_soc_dapm_update *update, 2337 + int mux, struct soc_enum *e) 2336 2338 { 2337 2339 struct snd_soc_dapm_path *path; 2338 2340 int found = 0; ··· 2355 2353 } 2356 2354 2357 2355 if (found) 2358 - dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP); 2356 + dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP, update); 2359 2357 2360 2358 return found; 2361 2359 } ··· 2368 2366 int ret; 2369 2367 2370 2368 snd_soc_dapm_mutex_lock(card); 2371 - card->update = update; 2372 - ret = soc_dapm_mux_update_power(card, kcontrol, mux, e); 2373 - card->update = NULL; 2369 + ret = soc_dapm_mux_update_power(card, kcontrol, update, mux, e); 2374 2370 snd_soc_dapm_mutex_unlock(card); 2375 2371 if (ret > 0) 2376 2372 snd_soc_dpcm_runtime_update(card); ··· 2379 2379 /* test and update the power status of a mixer or switch widget */ 2380 2380 static int soc_dapm_mixer_update_power(struct snd_soc_card *card, 2381 2381 struct snd_kcontrol *kcontrol, 2382 + struct snd_soc_dapm_update *update, 2382 2383 int connect, int rconnect) 2383 2384 { 2384 2385 struct snd_soc_dapm_path *path; ··· 2419 2418 } 2420 2419 2421 2420 if (found) 2422 - dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP); 2421 + dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP, update); 2423 2422 2424 2423 return found; 2425 2424 } ··· 2432 2431 int ret; 2433 2432 2434 2433 snd_soc_dapm_mutex_lock(card); 2435 - card->update = update; 2436 - ret = soc_dapm_mixer_update_power(card, kcontrol, connect, -1); 2437 - card->update = NULL; 2434 + ret = soc_dapm_mixer_update_power(card, kcontrol, update, connect, -1); 2438 2435 snd_soc_dapm_mutex_unlock(card); 2439 2436 if (ret > 0) 2440 2437 snd_soc_dpcm_runtime_update(card); ··· 2688 2689 if (!snd_soc_card_is_instantiated(dapm->card)) 2689 2690 return 0; 2690 2691 2691 - return dapm_power_widgets(dapm->card, SND_SOC_DAPM_STREAM_NOP); 2692 + return dapm_power_widgets(dapm->card, SND_SOC_DAPM_STREAM_NOP, NULL); 2692 2693 } 2693 2694 EXPORT_SYMBOL_GPL(snd_soc_dapm_sync_unlocked); 2694 2695 ··· 3357 3358 dapm_debugfs_add_widget(w); 3358 3359 } 3359 3360 3360 - dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP); 3361 + dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP, NULL); 3361 3362 snd_soc_dapm_mutex_unlock(card); 3362 3363 return 0; 3363 3364 } ··· 3446 3447 unsigned int val, rval = 0; 3447 3448 int connect, rconnect = -1, change, reg_change = 0; 3448 3449 struct snd_soc_dapm_update update = {}; 3450 + struct snd_soc_dapm_update *pupdate = NULL; 3449 3451 int ret = 0; 3450 3452 3451 3453 val = (ucontrol->value.integer.value[0] & mask); ··· 3495 3495 update.reg = reg; 3496 3496 update.mask = mask << shift; 3497 3497 update.val = val; 3498 - card->update = &update; 3498 + pupdate = &update; 3499 3499 } 3500 - 3501 - ret = soc_dapm_mixer_update_power(card, kcontrol, connect, 3502 - rconnect); 3503 - 3504 - card->update = NULL; 3500 + ret = soc_dapm_mixer_update_power(card, kcontrol, pupdate, connect, rconnect); 3505 3501 } 3506 3502 3507 3503 snd_soc_dapm_mutex_unlock(card); ··· 3564 3568 unsigned int val, change, reg_change = 0; 3565 3569 unsigned int mask; 3566 3570 struct snd_soc_dapm_update update = {}; 3571 + struct snd_soc_dapm_update *pupdate = NULL; 3567 3572 int ret = 0; 3568 3573 3569 3574 if (item[0] >= e->items) ··· 3592 3595 update.reg = e->reg; 3593 3596 update.mask = mask; 3594 3597 update.val = val; 3595 - card->update = &update; 3598 + pupdate = &update; 3596 3599 } 3597 - 3598 - ret = soc_dapm_mux_update_power(card, kcontrol, item[0], e); 3599 - 3600 - card->update = NULL; 3600 + ret = soc_dapm_mux_update_power(card, kcontrol, pupdate, item[0], e); 3601 3601 } 3602 3602 3603 3603 snd_soc_dapm_mutex_unlock(card); ··· 4520 4526 for_each_rtd_dais(rtd, i, dai) 4521 4527 soc_dapm_dai_stream_event(dai, stream, event); 4522 4528 4523 - dapm_power_widgets(rtd->card, event); 4529 + dapm_power_widgets(rtd->card, event, NULL); 4524 4530 } 4525 4531 4526 4532 /**