Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9508bece authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Revert "ALSA: jack: Access input_dev under mutex"



This reverts commit c093b62c which is
commit 1b6a6fc5280e97559287b61eade2d4b363e836f2 upstream.  It breaks the
kernel abi and is not relevant for Android systems.

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Change-Id: I18399bc9d5e48a84f513302e2eabff255e9a931a
parent 205c6fa2
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -80,7 +80,6 @@ struct snd_jack {
	const char *id;
#ifdef CONFIG_SND_JACK_INPUT_DEV
	struct input_dev *input_dev;
	struct mutex input_dev_lock;
	int registered;
	int type;
	char name[100];
+7 −27
Original line number Diff line number Diff line
@@ -52,11 +52,8 @@ static int snd_jack_dev_disconnect(struct snd_device *device)
#ifdef CONFIG_SND_JACK_INPUT_DEV
	struct snd_jack *jack = device->device_data;

	mutex_lock(&jack->input_dev_lock);
	if (!jack->input_dev) {
		mutex_unlock(&jack->input_dev_lock);
	if (!jack->input_dev)
		return 0;
	}

	/* If the input device is registered with the input subsystem
	 * then we need to use a different deallocator. */
@@ -65,7 +62,6 @@ static int snd_jack_dev_disconnect(struct snd_device *device)
	else
		input_free_device(jack->input_dev);
	jack->input_dev = NULL;
	mutex_unlock(&jack->input_dev_lock);
#endif /* CONFIG_SND_JACK_INPUT_DEV */
	return 0;
}
@@ -104,11 +100,8 @@ static int snd_jack_dev_register(struct snd_device *device)
	snprintf(jack->name, sizeof(jack->name), "%s %s",
		 card->shortname, jack->id);

	mutex_lock(&jack->input_dev_lock);
	if (!jack->input_dev) {
		mutex_unlock(&jack->input_dev_lock);
	if (!jack->input_dev)
		return 0;
	}

	jack->input_dev->name = jack->name;

@@ -133,7 +126,6 @@ static int snd_jack_dev_register(struct snd_device *device)
	if (err == 0)
		jack->registered = 1;

	mutex_unlock(&jack->input_dev_lock);
	return err;
}
#endif /* CONFIG_SND_JACK_INPUT_DEV */
@@ -254,11 +246,9 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
		return -ENOMEM;
	}

#ifdef CONFIG_SND_JACK_INPUT_DEV
	mutex_init(&jack->input_dev_lock);

	/* don't create input device for phantom jack */
	/* don't creat input device for phantom jack */
	if (!phantom_jack) {
#ifdef CONFIG_SND_JACK_INPUT_DEV
		int i;

		jack->input_dev = input_allocate_device();
@@ -276,8 +266,8 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
				input_set_capability(jack->input_dev, EV_SW,
						     jack_switch_types[i]);

	}
#endif /* CONFIG_SND_JACK_INPUT_DEV */
	}

	err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops);
	if (err < 0)
@@ -317,14 +307,10 @@ EXPORT_SYMBOL(snd_jack_new);
void snd_jack_set_parent(struct snd_jack *jack, struct device *parent)
{
	WARN_ON(jack->registered);
	mutex_lock(&jack->input_dev_lock);
	if (!jack->input_dev) {
		mutex_unlock(&jack->input_dev_lock);
	if (!jack->input_dev)
		return;
	}

	jack->input_dev->dev.parent = parent;
	mutex_unlock(&jack->input_dev_lock);
}
EXPORT_SYMBOL(snd_jack_set_parent);

@@ -372,8 +358,6 @@ EXPORT_SYMBOL(snd_jack_set_key);

/**
 * snd_jack_report - Report the current status of a jack
 * Note: This function uses mutexes and should be called from a
 * context which can sleep (such as a workqueue).
 *
 * @jack:   The jack to report status for
 * @status: The current status of the jack
@@ -393,11 +377,8 @@ void snd_jack_report(struct snd_jack *jack, int status)
					    status & jack_kctl->mask_bits);

#ifdef CONFIG_SND_JACK_INPUT_DEV
	mutex_lock(&jack->input_dev_lock);
	if (!jack->input_dev) {
		mutex_unlock(&jack->input_dev_lock);
	if (!jack->input_dev)
		return;
	}

	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
		int testbit = SND_JACK_BTN_0 >> i;
@@ -416,7 +397,6 @@ void snd_jack_report(struct snd_jack *jack, int status)
	}

	input_sync(jack->input_dev);
	mutex_unlock(&jack->input_dev_lock);
#endif /* CONFIG_SND_JACK_INPUT_DEV */
}
EXPORT_SYMBOL(snd_jack_report);