ALSA: control: Rename ctl_files_rwlock to controls_rwlock

We'll re-use the existing rwlock for the protection of control list
lookup, too, and now rename it to a more generic name.

This is a preliminary change, only the rename of the struct field
here, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240809104234.8488-2-tiwai@suse.de
This commit is contained in:
Takashi Iwai 2024-08-09 12:42:29 +02:00
parent d3e82ced46
commit f428cc9eac
3 changed files with 7 additions and 7 deletions

View File

@ -99,7 +99,7 @@ struct snd_card {
struct device *ctl_dev; /* control device */
unsigned int last_numid; /* last used numeric ID */
struct rw_semaphore controls_rwsem; /* controls lock (list and values) */
rwlock_t ctl_files_rwlock; /* ctl_files list lock */
rwlock_t controls_rwlock; /* lock for ctl_files list */
int controls_count; /* count of all controls */
size_t user_ctl_alloc_size; // current memory allocation by user controls.
struct list_head controls; /* all controls for this card */

View File

@ -79,7 +79,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
ctl->preferred_subdevice[i] = -1;
ctl->pid = get_pid(task_pid(current));
file->private_data = ctl;
scoped_guard(write_lock_irqsave, &card->ctl_files_rwlock)
scoped_guard(write_lock_irqsave, &card->controls_rwlock)
list_add_tail(&ctl->list, &card->ctl_files);
snd_card_unref(card);
return 0;
@ -117,7 +117,7 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
file->private_data = NULL;
card = ctl->card;
scoped_guard(write_lock_irqsave, &card->ctl_files_rwlock)
scoped_guard(write_lock_irqsave, &card->controls_rwlock)
list_del(&ctl->list);
scoped_guard(rwsem_write, &card->controls_rwsem) {
@ -157,7 +157,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask,
if (card->shutdown)
return;
guard(read_lock_irqsave)(&card->ctl_files_rwlock);
guard(read_lock_irqsave)(&card->controls_rwlock);
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
card->mixer_oss_change_count++;
#endif
@ -2178,7 +2178,7 @@ int snd_ctl_get_preferred_subdevice(struct snd_card *card, int type)
struct snd_ctl_file *kctl;
int subdevice = -1;
guard(read_lock_irqsave)(&card->ctl_files_rwlock);
guard(read_lock_irqsave)(&card->controls_rwlock);
list_for_each_entry(kctl, &card->ctl_files, list) {
if (kctl->pid == task_pid(current)) {
subdevice = kctl->preferred_subdevice[type];
@ -2328,7 +2328,7 @@ static int snd_ctl_dev_disconnect(struct snd_device *device)
struct snd_card *card = device->device_data;
struct snd_ctl_file *ctl;
scoped_guard(read_lock_irqsave, &card->ctl_files_rwlock) {
scoped_guard(read_lock_irqsave, &card->controls_rwlock) {
list_for_each_entry(ctl, &card->ctl_files, list) {
wake_up(&ctl->change_sleep);
snd_kill_fasync(ctl->fasync, SIGIO, POLL_ERR);

View File

@ -315,7 +315,7 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
card->module = module;
INIT_LIST_HEAD(&card->devices);
init_rwsem(&card->controls_rwsem);
rwlock_init(&card->ctl_files_rwlock);
rwlock_init(&card->controls_rwlock);
INIT_LIST_HEAD(&card->controls);
INIT_LIST_HEAD(&card->ctl_files);
#ifdef CONFIG_SND_CTL_FAST_LOOKUP