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

ASoC: expand snd_soc_dapm_mutex_lock/unlock()

soc.h has snd_soc_dapm_mutex_lock/unlock() definition and
many drivers are using it, but soc-dapm.c is not.

1st reason is snd_soc_dapm_mutex_lock/unlock() requests
snd_soc_dapm_context pointer as parameter (A), but sometimes soc-dapm.c
needs to use snd_soc_card (B).

(A) static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
{
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
} ^^^^^^^^^^

(B) mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
^^^^

2nd reason is it want to use SND_SOC_DAPM_CLASS_INIT for mutex_lock_nested(),
but helper is using _RUNTIME (A).

The conclusion is we want to use "dapm vs card" and "_RUNTIME vs _INIT"
for dapm lock/unlock. To enable this selfish request, this patch uses
_Generic macro. We can use snd_soc_dapm_mutex_lock/unlock() for both
dapm and card case.

snd_soc_dapm_mutex_lock(dapm); snd_soc_dapm_mutex_unlock(dapm);
snd_soc_dapm_mutex_lock(card); snd_soc_dapm_mutex_unlock(card);

Current soc-dapm.c is using both mutex_lock() and mutex_lock_nested().
This patch handles mutex_lock() as mutex_lock_nested(..., 0),
in other words, handles below as same.

mutex_lock(&card->dapm_mutex);
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);

Because people might misunderstand that _init() is mutex initialization,
this patch renames _INIT to _ROOT and adds new
snd_soc_dapm_mutex_lock_root() for it.

This patch also moves snd_soc_dapm_subclass definition from soc-dapm.h
to soc.h to keep related code together.

Because very complex soc.h vs soc-dapm.h relationship,
it is difficult/impossible to define these helper into soc-dapm.h.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87cz4hx3v0.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
4a778bdc fc0b096c

+113 -71
-5
include/sound/soc-dapm.h
··· 527 527 SND_SOC_DAPM_TYPE_COUNT 528 528 }; 529 529 530 - enum snd_soc_dapm_subclass { 531 - SND_SOC_DAPM_CLASS_INIT = 0, 532 - SND_SOC_DAPM_CLASS_RUNTIME = 1, 533 - }; 534 - 535 530 /* 536 531 * DAPM audio route definition. 537 532 *
+55 -5
include/sound/soc.h
··· 1364 1364 1365 1365 extern const struct dev_pm_ops snd_soc_pm_ops; 1366 1366 1367 - /* Helper functions */ 1368 - static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm) 1367 + /* 1368 + * DAPM helper functions 1369 + */ 1370 + enum snd_soc_dapm_subclass { 1371 + SND_SOC_DAPM_CLASS_ROOT = 0, 1372 + SND_SOC_DAPM_CLASS_RUNTIME = 1, 1373 + }; 1374 + 1375 + static inline void _snd_soc_dapm_mutex_lock_root_c(struct snd_soc_card *card) 1369 1376 { 1370 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 1377 + mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_ROOT); 1371 1378 } 1372 1379 1373 - static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm) 1380 + static inline void _snd_soc_dapm_mutex_lock_c(struct snd_soc_card *card) 1374 1381 { 1375 - mutex_unlock(&dapm->card->dapm_mutex); 1382 + mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 1376 1383 } 1384 + 1385 + static inline void _snd_soc_dapm_mutex_unlock_c(struct snd_soc_card *card) 1386 + { 1387 + mutex_unlock(&card->dapm_mutex); 1388 + } 1389 + 1390 + static inline void _snd_soc_dapm_mutex_assert_held_c(struct snd_soc_card *card) 1391 + { 1392 + lockdep_assert_held(&card->dapm_mutex); 1393 + } 1394 + 1395 + static inline void _snd_soc_dapm_mutex_lock_root_d(struct snd_soc_dapm_context *dapm) 1396 + { 1397 + _snd_soc_dapm_mutex_lock_root_c(dapm->card); 1398 + } 1399 + 1400 + static inline void _snd_soc_dapm_mutex_lock_d(struct snd_soc_dapm_context *dapm) 1401 + { 1402 + _snd_soc_dapm_mutex_lock_c(dapm->card); 1403 + } 1404 + 1405 + static inline void _snd_soc_dapm_mutex_unlock_d(struct snd_soc_dapm_context *dapm) 1406 + { 1407 + _snd_soc_dapm_mutex_unlock_c(dapm->card); 1408 + } 1409 + 1410 + static inline void _snd_soc_dapm_mutex_assert_held_d(struct snd_soc_dapm_context *dapm) 1411 + { 1412 + _snd_soc_dapm_mutex_assert_held_c(dapm->card); 1413 + } 1414 + 1415 + #define snd_soc_dapm_mutex_lock_root(x) _Generic((x), \ 1416 + struct snd_soc_card * : _snd_soc_dapm_mutex_lock_root_c, \ 1417 + struct snd_soc_dapm_context * : _snd_soc_dapm_mutex_lock_root_d)(x) 1418 + #define snd_soc_dapm_mutex_lock(x) _Generic((x), \ 1419 + struct snd_soc_card * : _snd_soc_dapm_mutex_lock_c, \ 1420 + struct snd_soc_dapm_context * : _snd_soc_dapm_mutex_lock_d)(x) 1421 + #define snd_soc_dapm_mutex_unlock(x) _Generic((x), \ 1422 + struct snd_soc_card * : _snd_soc_dapm_mutex_unlock_c, \ 1423 + struct snd_soc_dapm_context * : _snd_soc_dapm_mutex_unlock_d)(x) 1424 + #define snd_soc_dapm_mutex_assert_held(x) _Generic((x), \ 1425 + struct snd_soc_card * : _snd_soc_dapm_mutex_assert_held_c, \ 1426 + struct snd_soc_dapm_context * : _snd_soc_dapm_mutex_assert_held_d)(x) 1377 1427 1378 1428 #include <sound/soc-component.h> 1379 1429 #include <sound/soc-card.h>
+58 -61
sound/soc/soc-dapm.c
··· 150 150 static void dapm_assert_locked(struct snd_soc_dapm_context *dapm) 151 151 { 152 152 if (snd_soc_card_is_instantiated(dapm->card)) 153 - lockdep_assert_held(&dapm->card->dapm_mutex); 153 + snd_soc_dapm_mutex_assert_held(dapm); 154 154 } 155 155 156 156 static void pop_wait(u32 pop_time) ··· 302 302 { 303 303 struct snd_soc_dapm_widget *w; 304 304 305 - mutex_lock(&card->dapm_mutex); 305 + snd_soc_dapm_mutex_lock_root(card); 306 306 307 307 for_each_card_widgets(card, w) { 308 308 if (w->is_ep) { ··· 314 314 } 315 315 } 316 316 317 - mutex_unlock(&card->dapm_mutex); 317 + snd_soc_dapm_mutex_unlock(card); 318 318 } 319 319 EXPORT_SYMBOL_GPL(dapm_mark_endpoints_dirty); 320 320 ··· 604 604 { 605 605 struct snd_soc_dapm_widget *w; 606 606 607 - lockdep_assert_held(&card->dapm_mutex); 607 + snd_soc_dapm_mutex_assert_held(card); 608 608 609 609 memset(&card->dapm_stats, 0, sizeof(card->dapm_stats)); 610 610 ··· 1302 1302 int paths; 1303 1303 int ret; 1304 1304 1305 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 1305 + snd_soc_dapm_mutex_lock(card); 1306 1306 1307 1307 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 1308 1308 invalidate_paths_ep(w, SND_SOC_DAPM_DIR_OUT); ··· 1322 1322 paths = ret; 1323 1323 1324 1324 trace_snd_soc_dapm_connected(paths, stream); 1325 - mutex_unlock(&card->dapm_mutex); 1325 + snd_soc_dapm_mutex_unlock(card); 1326 1326 1327 1327 return paths; 1328 1328 } ··· 1952 1952 enum snd_soc_bias_level bias; 1953 1953 int ret; 1954 1954 1955 - lockdep_assert_held(&card->dapm_mutex); 1955 + snd_soc_dapm_mutex_assert_held(card); 1956 1956 1957 1957 trace_snd_soc_dapm_start(card); 1958 1958 ··· 2090 2090 size_t count, loff_t *ppos) 2091 2091 { 2092 2092 struct snd_soc_dapm_widget *w = file->private_data; 2093 - struct snd_soc_card *card = w->dapm->card; 2094 2093 enum snd_soc_dapm_direction dir, rdir; 2095 2094 char *buf; 2096 2095 int in, out; ··· 2100 2101 if (!buf) 2101 2102 return -ENOMEM; 2102 2103 2103 - mutex_lock(&card->dapm_mutex); 2104 + snd_soc_dapm_mutex_lock_root(w->dapm); 2104 2105 2105 2106 /* Supply widgets are not handled by is_connected_{input,output}_ep() */ 2106 2107 if (w->is_supply) { ··· 2144 2145 } 2145 2146 } 2146 2147 2147 - mutex_unlock(&card->dapm_mutex); 2148 + snd_soc_dapm_mutex_unlock(w->dapm); 2148 2149 2149 2150 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); 2150 2151 ··· 2265 2266 int found = 0; 2266 2267 bool connect; 2267 2268 2268 - lockdep_assert_held(&card->dapm_mutex); 2269 + snd_soc_dapm_mutex_assert_held(card); 2269 2270 2270 2271 /* find dapm widget path assoc with kcontrol */ 2271 2272 dapm_kcontrol_for_each_path(path, kcontrol) { ··· 2292 2293 struct snd_soc_card *card = dapm->card; 2293 2294 int ret; 2294 2295 2295 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 2296 + snd_soc_dapm_mutex_lock(card); 2296 2297 card->update = update; 2297 2298 ret = soc_dapm_mux_update_power(card, kcontrol, mux, e); 2298 2299 card->update = NULL; 2299 - mutex_unlock(&card->dapm_mutex); 2300 + snd_soc_dapm_mutex_unlock(card); 2300 2301 if (ret > 0) 2301 2302 snd_soc_dpcm_runtime_update(card); 2302 2303 return ret; ··· 2311 2312 struct snd_soc_dapm_path *path; 2312 2313 int found = 0; 2313 2314 2314 - lockdep_assert_held(&card->dapm_mutex); 2315 + snd_soc_dapm_mutex_assert_held(card); 2315 2316 2316 2317 /* find dapm widget path assoc with kcontrol */ 2317 2318 dapm_kcontrol_for_each_path(path, kcontrol) { ··· 2357 2358 struct snd_soc_card *card = dapm->card; 2358 2359 int ret; 2359 2360 2360 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 2361 + snd_soc_dapm_mutex_lock(card); 2361 2362 card->update = update; 2362 2363 ret = soc_dapm_mixer_update_power(card, kcontrol, connect, -1); 2363 2364 card->update = NULL; 2364 - mutex_unlock(&card->dapm_mutex); 2365 + snd_soc_dapm_mutex_unlock(card); 2365 2366 if (ret > 0) 2366 2367 snd_soc_dpcm_runtime_update(card); 2367 2368 return ret; ··· 2440 2441 struct snd_soc_dai *codec_dai; 2441 2442 int i, count = 0; 2442 2443 2443 - mutex_lock(&rtd->card->dapm_mutex); 2444 + snd_soc_dapm_mutex_lock_root(rtd->card); 2444 2445 2445 2446 for_each_rtd_codec_dais(rtd, i, codec_dai) { 2446 2447 struct snd_soc_component *cmpnt = codec_dai->component; ··· 2448 2449 count = dapm_widget_show_component(cmpnt, buf, count); 2449 2450 } 2450 2451 2451 - mutex_unlock(&rtd->card->dapm_mutex); 2452 + snd_soc_dapm_mutex_unlock(rtd->card); 2452 2453 2453 2454 return count; 2454 2455 } ··· 2631 2632 { 2632 2633 int ret; 2633 2634 2634 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 2635 + snd_soc_dapm_mutex_lock(dapm); 2635 2636 ret = snd_soc_dapm_sync_unlocked(dapm); 2636 - mutex_unlock(&dapm->card->dapm_mutex); 2637 + snd_soc_dapm_mutex_unlock(dapm); 2637 2638 return ret; 2638 2639 } 2639 2640 EXPORT_SYMBOL_GPL(snd_soc_dapm_sync); ··· 2702 2703 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 2703 2704 int ret; 2704 2705 2705 - mutex_lock_nested(&rtd->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 2706 + snd_soc_dapm_mutex_lock(rtd->card); 2706 2707 ret = dapm_update_dai_unlocked(substream, params, dai); 2707 - mutex_unlock(&rtd->card->dapm_mutex); 2708 + snd_soc_dapm_mutex_unlock(rtd->card); 2708 2709 2709 2710 return ret; 2710 2711 } ··· 3089 3090 { 3090 3091 int i, ret = 0; 3091 3092 3092 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 3093 + snd_soc_dapm_mutex_lock(dapm); 3093 3094 for (i = 0; i < num; i++) { 3094 3095 int r = snd_soc_dapm_add_route(dapm, route); 3095 3096 if (r < 0) 3096 3097 ret = r; 3097 3098 route++; 3098 3099 } 3099 - mutex_unlock(&dapm->card->dapm_mutex); 3100 + snd_soc_dapm_mutex_unlock(dapm); 3100 3101 3101 3102 return ret; 3102 3103 } ··· 3115 3116 { 3116 3117 int i; 3117 3118 3118 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 3119 + snd_soc_dapm_mutex_lock(dapm); 3119 3120 for (i = 0; i < num; i++) { 3120 3121 snd_soc_dapm_del_route(dapm, route); 3121 3122 route++; 3122 3123 } 3123 - mutex_unlock(&dapm->card->dapm_mutex); 3124 + snd_soc_dapm_mutex_unlock(dapm); 3124 3125 3125 3126 return 0; 3126 3127 } ··· 3193 3194 int i; 3194 3195 int ret = 0; 3195 3196 3196 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); 3197 + snd_soc_dapm_mutex_lock_root(dapm); 3197 3198 for (i = 0; i < num; i++) { 3198 3199 int err = snd_soc_dapm_weak_route(dapm, route); 3199 3200 if (err) 3200 3201 ret = err; 3201 3202 route++; 3202 3203 } 3203 - mutex_unlock(&dapm->card->dapm_mutex); 3204 + snd_soc_dapm_mutex_unlock(dapm); 3204 3205 3205 3206 return ret; 3206 3207 } ··· 3219 3220 struct snd_soc_dapm_widget *w; 3220 3221 unsigned int val; 3221 3222 3222 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); 3223 + snd_soc_dapm_mutex_lock_root(card); 3223 3224 3224 3225 for_each_card_widgets(card, w) 3225 3226 { ··· 3231 3232 sizeof(struct snd_kcontrol *), 3232 3233 GFP_KERNEL); 3233 3234 if (!w->kcontrols) { 3234 - mutex_unlock(&card->dapm_mutex); 3235 + snd_soc_dapm_mutex_unlock(card); 3235 3236 return -ENOMEM; 3236 3237 } 3237 3238 } ··· 3274 3275 } 3275 3276 3276 3277 dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP); 3277 - mutex_unlock(&card->dapm_mutex); 3278 + snd_soc_dapm_mutex_unlock(card); 3278 3279 return 0; 3279 3280 } 3280 3281 EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets); ··· 3292 3293 struct snd_ctl_elem_value *ucontrol) 3293 3294 { 3294 3295 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); 3295 - struct snd_soc_card *card = dapm->card; 3296 3296 struct soc_mixer_control *mc = 3297 3297 (struct soc_mixer_control *)kcontrol->private_value; 3298 3298 int reg = mc->reg; ··· 3302 3304 unsigned int invert = mc->invert; 3303 3305 unsigned int reg_val, val, rval = 0; 3304 3306 3305 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 3307 + snd_soc_dapm_mutex_lock(dapm); 3306 3308 if (dapm_kcontrol_is_powered(kcontrol) && reg != SND_SOC_NOPM) { 3307 3309 reg_val = soc_dapm_read(dapm, reg); 3308 3310 val = (reg_val >> shift) & mask; ··· 3319 3321 if (snd_soc_volsw_is_stereo(mc)) 3320 3322 rval = (reg_val >> width) & mask; 3321 3323 } 3322 - mutex_unlock(&card->dapm_mutex); 3324 + snd_soc_dapm_mutex_unlock(dapm); 3323 3325 3324 3326 if (invert) 3325 3327 ucontrol->value.integer.value[0] = max - val; ··· 3377 3379 rval = max - rval; 3378 3380 } 3379 3381 3380 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 3382 + snd_soc_dapm_mutex_lock(card); 3381 3383 3382 3384 /* This assumes field width < (bits in unsigned int / 2) */ 3383 3385 if (width > sizeof(unsigned int) * 8 / 2) ··· 3419 3421 card->update = NULL; 3420 3422 } 3421 3423 3422 - mutex_unlock(&card->dapm_mutex); 3424 + snd_soc_dapm_mutex_unlock(card); 3423 3425 3424 3426 if (ret > 0) 3425 3427 snd_soc_dpcm_runtime_update(card); ··· 3441 3443 struct snd_ctl_elem_value *ucontrol) 3442 3444 { 3443 3445 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); 3444 - struct snd_soc_card *card = dapm->card; 3445 3446 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 3446 3447 unsigned int reg_val, val; 3447 3448 3448 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 3449 + snd_soc_dapm_mutex_lock(dapm); 3449 3450 if (e->reg != SND_SOC_NOPM && dapm_kcontrol_is_powered(kcontrol)) { 3450 3451 reg_val = soc_dapm_read(dapm, e->reg); 3451 3452 } else { 3452 3453 reg_val = dapm_kcontrol_get_value(kcontrol); 3453 3454 } 3454 - mutex_unlock(&card->dapm_mutex); 3455 + snd_soc_dapm_mutex_unlock(dapm); 3455 3456 3456 3457 val = (reg_val >> e->shift_l) & e->mask; 3457 3458 ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val); ··· 3497 3500 mask |= e->mask << e->shift_r; 3498 3501 } 3499 3502 3500 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 3503 + snd_soc_dapm_mutex_lock(card); 3501 3504 3502 3505 change = dapm_kcontrol_set_value(kcontrol, val); 3503 3506 ··· 3518 3521 card->update = NULL; 3519 3522 } 3520 3523 3521 - mutex_unlock(&card->dapm_mutex); 3524 + snd_soc_dapm_mutex_unlock(card); 3522 3525 3523 3526 if (ret > 0) 3524 3527 snd_soc_dpcm_runtime_update(card); ··· 3559 3562 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); 3560 3563 const char *pin = (const char *)kcontrol->private_value; 3561 3564 3562 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 3565 + snd_soc_dapm_mutex_lock(card); 3563 3566 3564 3567 ucontrol->value.integer.value[0] = 3565 3568 snd_soc_dapm_get_pin_status(&card->dapm, pin); 3566 3569 3567 - mutex_unlock(&card->dapm_mutex); 3570 + snd_soc_dapm_mutex_unlock(card); 3568 3571 3569 3572 return 0; 3570 3573 } ··· 3583 3586 const char *pin = (const char *)kcontrol->private_value; 3584 3587 int ret; 3585 3588 3586 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 3589 + snd_soc_dapm_mutex_lock(card); 3587 3590 ret = __snd_soc_dapm_set_pin(&card->dapm, pin, 3588 3591 !!ucontrol->value.integer.value[0]); 3589 - mutex_unlock(&card->dapm_mutex); 3592 + snd_soc_dapm_mutex_unlock(card); 3590 3593 3591 3594 snd_soc_dapm_sync(&card->dapm); 3592 3595 return ret; ··· 3759 3762 { 3760 3763 struct snd_soc_dapm_widget *w; 3761 3764 3762 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 3765 + snd_soc_dapm_mutex_lock(dapm); 3763 3766 w = snd_soc_dapm_new_control_unlocked(dapm, widget); 3764 - mutex_unlock(&dapm->card->dapm_mutex); 3767 + snd_soc_dapm_mutex_unlock(dapm); 3765 3768 3766 3769 return w; 3767 3770 } ··· 3784 3787 int i; 3785 3788 int ret = 0; 3786 3789 3787 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); 3790 + snd_soc_dapm_mutex_lock_root(dapm); 3788 3791 for (i = 0; i < num; i++) { 3789 3792 struct snd_soc_dapm_widget *w = snd_soc_dapm_new_control_unlocked(dapm, widget); 3790 3793 if (IS_ERR(w)) { ··· 3793 3796 } 3794 3797 widget++; 3795 3798 } 3796 - mutex_unlock(&dapm->card->dapm_mutex); 3799 + snd_soc_dapm_mutex_unlock(dapm); 3797 3800 return ret; 3798 3801 } 3799 3802 EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls); ··· 4496 4499 { 4497 4500 struct snd_soc_card *card = rtd->card; 4498 4501 4499 - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 4502 + snd_soc_dapm_mutex_lock(card); 4500 4503 soc_dapm_stream_event(rtd, stream, event); 4501 - mutex_unlock(&card->dapm_mutex); 4504 + snd_soc_dapm_mutex_unlock(card); 4502 4505 } 4503 4506 4504 4507 void snd_soc_dapm_stream_stop(struct snd_soc_pcm_runtime *rtd, int stream) ··· 4559 4562 { 4560 4563 int ret; 4561 4564 4562 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 4565 + snd_soc_dapm_mutex_lock(dapm); 4563 4566 4564 4567 ret = snd_soc_dapm_set_pin(dapm, pin, 1); 4565 4568 4566 - mutex_unlock(&dapm->card->dapm_mutex); 4569 + snd_soc_dapm_mutex_unlock(dapm); 4567 4570 4568 4571 return ret; 4569 4572 } ··· 4627 4630 { 4628 4631 int ret; 4629 4632 4630 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 4633 + snd_soc_dapm_mutex_lock(dapm); 4631 4634 4632 4635 ret = snd_soc_dapm_force_enable_pin_unlocked(dapm, pin); 4633 4636 4634 - mutex_unlock(&dapm->card->dapm_mutex); 4637 + snd_soc_dapm_mutex_unlock(dapm); 4635 4638 4636 4639 return ret; 4637 4640 } ··· 4671 4674 { 4672 4675 int ret; 4673 4676 4674 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 4677 + snd_soc_dapm_mutex_lock(dapm); 4675 4678 4676 4679 ret = snd_soc_dapm_set_pin(dapm, pin, 0); 4677 4680 4678 - mutex_unlock(&dapm->card->dapm_mutex); 4681 + snd_soc_dapm_mutex_unlock(dapm); 4679 4682 4680 4683 return ret; 4681 4684 } ··· 4722 4725 { 4723 4726 int ret; 4724 4727 4725 - mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 4728 + snd_soc_dapm_mutex_lock(dapm); 4726 4729 4727 4730 ret = snd_soc_dapm_set_pin(dapm, pin, 0); 4728 4731 4729 - mutex_unlock(&dapm->card->dapm_mutex); 4732 + snd_soc_dapm_mutex_unlock(dapm); 4730 4733 4731 4734 return ret; 4732 4735 } ··· 4823 4826 LIST_HEAD(down_list); 4824 4827 int powerdown = 0; 4825 4828 4826 - mutex_lock(&card->dapm_mutex); 4829 + snd_soc_dapm_mutex_lock_root(card); 4827 4830 4828 4831 for_each_card_widgets(dapm->card, w) { 4829 4832 if (w->dapm != dapm) ··· 4848 4851 SND_SOC_BIAS_STANDBY); 4849 4852 } 4850 4853 4851 - mutex_unlock(&card->dapm_mutex); 4854 + snd_soc_dapm_mutex_unlock(card); 4852 4855 } 4853 4856 4854 4857 /*