Commit fea15107 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: emux: Use standard print API



Use the standard print API with dev_*() instead of the old house-baked
one.  It gives better information and allows dynamically control of
debug prints.

Some functions are changed to receive snd_card object for calling
dev_*() functions, too.

Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240807133452.9424-44-tiwai@suse.de
parent def358f9
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -86,9 +86,11 @@ struct snd_sf_list {
};

/* Prototypes for soundfont.c */
int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
int snd_soundfont_load(struct snd_card *card,
		       struct snd_sf_list *sflist, const void __user *data,
		       long count, int client);
int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
int snd_soundfont_load_guspatch(struct snd_card *card,
				struct snd_sf_list *sflist, const char __user *data,
				long count);
int snd_soundfont_close_check(struct snd_sf_list *sflist, int client);

+4 −2
Original line number Diff line number Diff line
@@ -26,12 +26,14 @@ snd_emux_hwdep_load_patch(struct snd_emux *emu, void __user *arg)
		return -EFAULT;

	if (patch.key == GUS_PATCH)
		return snd_soundfont_load_guspatch(emu->sflist, arg,
		return snd_soundfont_load_guspatch(emu->card, emu->sflist, arg,
						   patch.len + sizeof(patch));

	if (patch.type >= SNDRV_SFNT_LOAD_INFO &&
	    patch.type <= SNDRV_SFNT_PROBE_DATA) {
		err = snd_soundfont_load(emu->sflist, arg, patch.len + sizeof(patch), TMP_CLIENT_ID);
		err = snd_soundfont_load(emu->card, emu->sflist, arg,
					 patch.len + sizeof(patch),
					 TMP_CLIENT_ID);
		if (err < 0)
			return err;
	} else {
+7 −4
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
	p = snd_emux_create_port(emu, tmpname, 32,
				 1, &callback);
	if (p == NULL) {
		snd_printk(KERN_ERR "can't create port\n");
		dev_err(emu->card->dev, "can't create port\n");
		snd_emux_dec_count(emu);
		return -ENOMEM;
	}
@@ -205,7 +205,7 @@ snd_emux_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format,
		return -ENXIO;

	if (format == GUS_PATCH)
		rc = snd_soundfont_load_guspatch(emu->sflist, buf, count);
		rc = snd_soundfont_load_guspatch(emu->card, emu->sflist, buf, count);
	else if (format == SNDRV_OSS_SOUNDFONT_PATCH) {
		struct soundfont_patch_info patch;
		if (count < (int)sizeof(patch))
@@ -214,10 +214,13 @@ snd_emux_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format,
			return -EFAULT;
		if (patch.type >= SNDRV_SFNT_LOAD_INFO &&
		    patch.type <= SNDRV_SFNT_PROBE_DATA)
			rc = snd_soundfont_load(emu->sflist, buf, count, SF_CLIENT_NO(p->chset.port));
			rc = snd_soundfont_load(emu->card, emu->sflist, buf,
						count,
						SF_CLIENT_NO(p->chset.port));
		else {
			if (emu->ops.load_fx)
				rc = emu->ops.load_fx(emu, patch.type, patch.optarg, buf, count);
				rc = emu->ops.load_fx(emu, patch.type,
						      patch.optarg, buf, count);
			else
				rc = -EINVAL;
		}
+6 −7
Original line number Diff line number Diff line
@@ -61,16 +61,17 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
	emu->client = snd_seq_create_kernel_client(card, index,
						   "%s WaveTable", emu->name);
	if (emu->client < 0) {
		snd_printk(KERN_ERR "can't create client\n");
		dev_err(card->dev, "can't create client\n");
		return -ENODEV;
	}

	if (emu->num_ports <= 0) {
		snd_printk(KERN_WARNING "seqports must be greater than zero\n");
		dev_warn(card->dev, "seqports must be greater than zero\n");
		emu->num_ports = 1;
	} else if (emu->num_ports > SNDRV_EMUX_MAX_PORTS) {
		snd_printk(KERN_WARNING "too many ports. "
			   "limited max. ports %d\n", SNDRV_EMUX_MAX_PORTS);
		dev_warn(card->dev,
			 "too many ports. limited max. ports %d\n",
			 SNDRV_EMUX_MAX_PORTS);
		emu->num_ports = SNDRV_EMUX_MAX_PORTS;
	}

@@ -87,7 +88,7 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
		p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS,
					 0, &pinfo);
		if (!p) {
			snd_printk(KERN_ERR "can't create port\n");
			dev_err(card->dev, "can't create port\n");
			return -ENOMEM;
		}

@@ -376,12 +377,10 @@ int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card)
			goto __error;
		}
		emu->vmidi[i] = rmidi;
		/* snd_printk(KERN_DEBUG "virmidi %d ok\n", i); */
	}
	return 0;

__error:
	/* snd_printk(KERN_DEBUG "error init..\n"); */
	snd_emux_delete_virmidi(emu);
	return -ENOMEM;
}
+6 −6
Original line number Diff line number Diff line
@@ -942,7 +942,7 @@ void snd_emux_lock_voice(struct snd_emux *emu, int voice)
	if (emu->voices[voice].state == SNDRV_EMUX_ST_OFF)
		emu->voices[voice].state = SNDRV_EMUX_ST_LOCKED;
	else
		snd_printk(KERN_WARNING
		dev_warn(emu->card->dev,
			 "invalid voice for lock %d (state = %x)\n",
			 voice, emu->voices[voice].state);
	spin_unlock_irqrestore(&emu->voice_lock, flags);
@@ -960,7 +960,7 @@ void snd_emux_unlock_voice(struct snd_emux *emu, int voice)
	if (emu->voices[voice].state == SNDRV_EMUX_ST_LOCKED)
		emu->voices[voice].state = SNDRV_EMUX_ST_OFF;
	else
		snd_printk(KERN_WARNING
		dev_warn(emu->card->dev,
			 "invalid voice for unlock %d (state = %x)\n",
			 voice, emu->voices[voice].state);
	spin_unlock_irqrestore(&emu->voice_lock, flags);
Loading