ALSA: control: Rename ctl_files_rwlock to controls_rwlock
authorTakashi Iwai <tiwai@suse.de>
Fri, 9 Aug 2024 10:42:29 +0000 (12:42 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 9 Aug 2024 12:24:55 +0000 (14:24 +0200)
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
include/sound/core.h
sound/core/control.c
sound/core/init.c

index dfef0c9d4b9f7ee74d24e7e85e10e2e3f8e50833..55607e91d5fd7855de2adc9099ea9f97db1bb14b 100644 (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 */
index f64a555f404f0af1952d583a481345e6974e6d0d..7c4410d1eeeb6894bce7a4b02180312143eeefe3 100644 (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);
index b9b708cf980d6dbf9d80992b7af86e761a7bdf71..b92aa7103589e5ab8727dc4606e076a7d2e7c401 100644 (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