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

Commit 3a182c84 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Clean up jackpoll_ms option handling



Currently the jackpoll_ms option value is passed indirectly by
referring to an array in chip->jackpoll_ms although each card needs to
see only the assigned value.  Also, the sanity check is done at each
time in get_jackpoll_interval() although basically jackpoll_ms option
is a read-only, hence we need to evaluate only once at probe time.

This patch is the code simplification about the above points: the jack
polling interval is directly set to chip->jackpoll_interval so that it
can be simply copied to each codec.

No functional change but only code reduction.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 87246f7f
Loading
Loading
Loading
Loading
+1 −22
Original line number Diff line number Diff line
@@ -1223,27 +1223,6 @@ void snd_hda_bus_reset(struct hda_bus *bus)
	bus->in_reset = 0;
}

static int get_jackpoll_interval(struct azx *chip)
{
	int i;
	unsigned int j;

	if (!chip->jackpoll_ms)
		return 0;

	i = chip->jackpoll_ms[chip->dev_index];
	if (i == 0)
		return 0;
	if (i < 50 || i > 60000)
		j = 0;
	else
		j = msecs_to_jiffies(i);
	if (j == 0)
		dev_warn(chip->card->dev,
			 "jackpoll_ms value out of range: %d\n", i);
	return j;
}

/* HD-audio bus initialization */
int azx_bus_init(struct azx *chip, const char *model,
		 const struct hdac_io_ops *io_ops)
@@ -1326,7 +1305,7 @@ int azx_probe_codecs(struct azx *chip, unsigned int max_slots)
			err = snd_hda_codec_new(&chip->bus, chip->card, c, &codec);
			if (err < 0)
				continue;
			codec->jackpoll_interval = get_jackpoll_interval(chip);
			codec->jackpoll_interval = chip->jackpoll_interval;
			codec->beep_mode = chip->beep_mode;
			codecs++;
		}
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ struct azx {
	int capture_streams;
	int capture_index_offset;
	int num_streams;
	const int *jackpoll_ms; /* per-card jack poll interval */
	int jackpoll_interval; /* jack poll interval in jiffies */

	/* Register interaction. */
	const struct hda_controller_ops *ops;
+2 −1
Original line number Diff line number Diff line
@@ -1676,7 +1676,8 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
	chip->driver_type = driver_caps & 0xff;
	check_msi(chip);
	chip->dev_index = dev;
	chip->jackpoll_ms = jackpoll_ms;
	if (jackpoll_ms[dev] >= 50 && jackpoll_ms[dev] <= 60000)
		chip->jackpoll_interval = msecs_to_jiffies(jackpoll_ms[dev]);
	INIT_LIST_HEAD(&chip->pcm_list);
	INIT_WORK(&hda->irq_pending_work, azx_irq_pending_work);
	INIT_LIST_HEAD(&hda->list);