From: Takashi Iwai <tiwai@suse.de>
To: linux-sound@vger.kernel.org
Subject: [PATCH 43/54] ALSA: emux: Use standard print API
Date: Wed, 7 Aug 2024 15:34:33 +0200 [thread overview]
Message-ID: <20240807133452.9424-44-tiwai@suse.de> (raw)
In-Reply-To: <20240807133452.9424-1-tiwai@suse.de>
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.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/sound/soundfont.h | 6 ++--
sound/synth/emux/emux_hwdep.c | 6 ++--
sound/synth/emux/emux_oss.c | 11 +++---
sound/synth/emux/emux_seq.c | 13 ++++---
sound/synth/emux/emux_synth.c | 12 +++----
sound/synth/emux/soundfont.c | 67 +++++++++++++++++++----------------
6 files changed, 63 insertions(+), 52 deletions(-)
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h
index 98ed98d89d6d..8a40cc15f66d 100644
--- a/include/sound/soundfont.h
+++ b/include/sound/soundfont.h
@@ -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);
diff --git a/sound/synth/emux/emux_hwdep.c b/sound/synth/emux/emux_hwdep.c
index fd8f978cde1c..9e98c4c73fd1 100644
--- a/sound/synth/emux/emux_hwdep.c
+++ b/sound/synth/emux/emux_hwdep.c
@@ -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 {
diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c
index 04df46b269d3..5f98d5201ba2 100644
--- a/sound/synth/emux/emux_oss.c
+++ b/sound/synth/emux/emux_oss.c
@@ -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;
}
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
index 1adaa75df2f6..9daced0e6c59 100644
--- a/sound/synth/emux/emux_seq.c
+++ b/sound/synth/emux/emux_seq.c
@@ -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;
}
diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c
index 075358a533a0..02e2c69d7f18 100644
--- a/sound/synth/emux/emux_synth.c
+++ b/sound/synth/emux/emux_synth.c
@@ -942,9 +942,9 @@ 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
- "invalid voice for lock %d (state = %x)\n",
- voice, emu->voices[voice].state);
+ 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,9 +960,9 @@ 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
- "invalid voice for unlock %d (state = %x)\n",
- voice, emu->voices[voice].state);
+ 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);
}
diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c
index 2373ed580bf8..b38a4e231790 100644
--- a/sound/synth/emux/soundfont.c
+++ b/sound/synth/emux/soundfont.c
@@ -38,7 +38,8 @@ static struct snd_sf_sample *sf_sample_new(struct snd_sf_list *sflist,
static void sf_sample_delete(struct snd_sf_list *sflist,
struct snd_soundfont *sf, struct snd_sf_sample *sp);
static int load_map(struct snd_sf_list *sflist, const void __user *data, int count);
-static int load_info(struct snd_sf_list *sflist, const void __user *data, long count);
+static int load_info(struct snd_card *card, struct snd_sf_list *sflist,
+ const void __user *data, long count);
static int remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
int bank, int instr);
static void init_voice_info(struct soundfont_voice_info *avp);
@@ -113,7 +114,8 @@ snd_soundfont_close_check(struct snd_sf_list *sflist, int client)
* it wants to do with it.
*/
int
-snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
+snd_soundfont_load(struct snd_card *card,
+ struct snd_sf_list *sflist, const void __user *data,
long count, int client)
{
struct soundfont_patch_info patch;
@@ -121,7 +123,7 @@ snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
int rc;
if (count < (long)sizeof(patch)) {
- snd_printk(KERN_ERR "patch record too small %ld\n", count);
+ dev_err(card->dev, "patch record too small %ld\n", count);
return -EINVAL;
}
if (copy_from_user(&patch, data, sizeof(patch)))
@@ -131,16 +133,16 @@ snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
data += sizeof(patch);
if (patch.key != SNDRV_OSS_SOUNDFONT_PATCH) {
- snd_printk(KERN_ERR "The wrong kind of patch %x\n", patch.key);
+ dev_err(card->dev, "The wrong kind of patch %x\n", patch.key);
return -EINVAL;
}
if (count < patch.len) {
- snd_printk(KERN_ERR "Patch too short %ld, need %d\n",
- count, patch.len);
+ dev_err(card->dev, "Patch too short %ld, need %d\n",
+ count, patch.len);
return -EINVAL;
}
if (patch.len < 0) {
- snd_printk(KERN_ERR "poor length %d\n", patch.len);
+ dev_err(card->dev, "poor length %d\n", patch.len);
return -EINVAL;
}
@@ -164,7 +166,7 @@ snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
rc = -EINVAL;
switch (patch.type) {
case SNDRV_SFNT_LOAD_INFO:
- rc = load_info(sflist, data, count);
+ rc = load_info(card, sflist, data, count);
break;
case SNDRV_SFNT_LOAD_DATA:
rc = load_data(sflist, data, count);
@@ -184,8 +186,8 @@ snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
case SNDRV_SFNT_REMOVE_INFO:
/* patch must be opened */
if (!sflist->currsf) {
- snd_printk(KERN_ERR "soundfont: remove_info: "
- "patch not opened\n");
+ dev_err(card->dev,
+ "soundfont: remove_info: patch not opened\n");
rc = -EINVAL;
} else {
int bank, instr;
@@ -509,7 +511,8 @@ remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
* open soundfont.
*/
static int
-load_info(struct snd_sf_list *sflist, const void __user *data, long count)
+load_info(struct snd_card *card,
+ struct snd_sf_list *sflist, const void __user *data, long count)
{
struct snd_soundfont *sf;
struct snd_sf_zone *zone;
@@ -525,7 +528,7 @@ load_info(struct snd_sf_list *sflist, const void __user *data, long count)
return -EINVAL;
if (count < (long)sizeof(hdr)) {
- printk(KERN_ERR "Soundfont error: invalid patch zone length\n");
+ dev_err(card->dev, "Soundfont error: invalid patch zone length\n");
return -EINVAL;
}
if (copy_from_user((char*)&hdr, data, sizeof(hdr)))
@@ -535,15 +538,15 @@ load_info(struct snd_sf_list *sflist, const void __user *data, long count)
count -= sizeof(hdr);
if (hdr.nvoices <= 0 || hdr.nvoices >= 100) {
- printk(KERN_ERR "Soundfont error: Illegal voice number %d\n",
- hdr.nvoices);
+ dev_err(card->dev, "Soundfont error: Illegal voice number %d\n",
+ hdr.nvoices);
return -EINVAL;
}
if (count < (long)sizeof(struct soundfont_voice_info) * hdr.nvoices) {
- printk(KERN_ERR "Soundfont Error: "
- "patch length(%ld) is smaller than nvoices(%d)\n",
- count, hdr.nvoices);
+ dev_err(card->dev,
+ "Soundfont Error: patch length(%ld) is smaller than nvoices(%d)\n",
+ count, hdr.nvoices);
return -EINVAL;
}
@@ -974,7 +977,8 @@ int snd_sf_vol_table[128] = {
/* load GUS patch */
static int
-load_guspatch(struct snd_sf_list *sflist, const char __user *data, long count)
+load_guspatch(struct snd_card *card,
+ struct snd_sf_list *sflist, const char __user *data, long count)
{
struct patch_info patch;
struct snd_soundfont *sf;
@@ -984,7 +988,7 @@ load_guspatch(struct snd_sf_list *sflist, const char __user *data, long count)
int rc;
if (count < (long)sizeof(patch)) {
- snd_printk(KERN_ERR "patch record too small %ld\n", count);
+ dev_err(card->dev, "patch record too small %ld\n", count);
return -EINVAL;
}
if (copy_from_user(&patch, data, sizeof(patch)))
@@ -1076,10 +1080,10 @@ load_guspatch(struct snd_sf_list *sflist, const char __user *data, long count)
/* panning position; -128 - 127 => 0-127 */
zone->v.pan = (patch.panning + 128) / 2;
#if 0
- snd_printk(KERN_DEBUG
- "gus: basefrq=%d (ofs=%d) root=%d,tune=%d, range:%d-%d\n",
- (int)patch.base_freq, zone->v.rate_offset,
- zone->v.root, zone->v.tune, zone->v.low, zone->v.high);
+ pr_debug(
+ "gus: basefrq=%d (ofs=%d) root=%d,tune=%d, range:%d-%d\n",
+ (int)patch.base_freq, zone->v.rate_offset,
+ zone->v.root, zone->v.tune, zone->v.low, zone->v.high);
#endif
/* detuning is ignored */
@@ -1111,12 +1115,12 @@ load_guspatch(struct snd_sf_list *sflist, const char __user *data, long count)
zone->v.parm.volrelease = 0x8000 | snd_sf_calc_parm_decay(release);
zone->v.attenuation = calc_gus_attenuation(patch.env_offset[0]);
#if 0
- snd_printk(KERN_DEBUG
- "gus: atkhld=%x, dcysus=%x, volrel=%x, att=%d\n",
- zone->v.parm.volatkhld,
- zone->v.parm.voldcysus,
- zone->v.parm.volrelease,
- zone->v.attenuation);
+ dev_dbg(card->dev,
+ "gus: atkhld=%x, dcysus=%x, volrel=%x, att=%d\n",
+ zone->v.parm.volatkhld,
+ zone->v.parm.voldcysus,
+ zone->v.parm.volrelease,
+ zone->v.attenuation);
#endif
}
@@ -1160,12 +1164,13 @@ load_guspatch(struct snd_sf_list *sflist, const char __user *data, long count)
/* load GUS patch */
int
-snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
+snd_soundfont_load_guspatch(struct snd_card *card,
+ struct snd_sf_list *sflist, const char __user *data,
long count)
{
int rc;
lock_preset(sflist);
- rc = load_guspatch(sflist, data, count);
+ rc = load_guspatch(card, sflist, data, count);
unlock_preset(sflist);
return rc;
}
--
2.43.0
next prev parent reply other threads:[~2024-08-07 13:34 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 13:33 [PATCH 00/54] ALSA: Drop legacy snd_print*() Takashi Iwai
2024-08-07 13:33 ` [PATCH 01/54] ALSA: portman2x4: Use standard print API Takashi Iwai
2024-08-07 13:33 ` [PATCH 02/54] ALSA: mts64: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 03/54] ALSA: mpu401: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 04/54] ALSA: mpu401_uart: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 05/54] ALSA: mtpav: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 06/54] ALSA: opl3: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 07/54] ALSA: opl4: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 08/54] ALSA: serial-u16550: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 09/54] ALSA: virmidi: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 10/54] ALSA: vx_core: Drop unused dev field Takashi Iwai
2024-08-07 13:34 ` [PATCH 11/54] ALSA: vx_core: Use standard print API Takashi Iwai
2024-08-07 13:34 ` [PATCH 12/54] ALSA: aloop: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 13/54] ALSA: dummy: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 14/54] ALSA: pcsp: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 15/54] ALSA: i2c: cs8427: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 16/54] ALSA: i2c: pt2258: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 17/54] ALSA: i2c: Drop commented old debug prints Takashi Iwai
2024-08-07 13:34 ` [PATCH 18/54] ALSA: ad1816a: Use standard print API Takashi Iwai
2024-08-07 13:34 ` [PATCH 19/54] ALSA: als100: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 20/54] ALSA: azt2320: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 21/54] ALSA: cmi8328: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 22/54] ALSA: cmi8330: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 23/54] ALSA: cs4236: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 24/54] ALSA: es1688: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 25/54] ALSA: es18xx: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 26/54] ALSA: gus: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 27/54] ALSA: msnd: " Takashi Iwai
2024-08-08 6:43 ` Takashi Iwai
2024-08-07 13:34 ` [PATCH 28/54] ALSA: opl3sa2: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 29/54] ALSA: opti9xx: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 30/54] ALSA: sb: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 31/54] ALSA: control_led: Use dev_err() Takashi Iwai
2024-08-07 13:34 ` [PATCH 32/54] ALSA: pcm: oss: Use pr_debug() Takashi Iwai
2024-08-07 13:34 ` [PATCH 33/54] ALSA: sc6000: Use standard print API Takashi Iwai
2024-08-07 13:34 ` [PATCH 34/54] ALSA: sscape: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 35/54] ALSA: wavefront: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 36/54] ALSA: wss: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 37/54] ALSA: riptide: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 38/54] ALSA: korg1212: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 39/54] ALSA: lx6464es: Cleanup the print API usages Takashi Iwai
2024-08-07 13:34 ` [PATCH 40/54] ALSA: azt3328: Use pr_warn() Takashi Iwai
2024-08-07 13:34 ` [PATCH 41/54] ALSA: emu10k1: Use dev_warn() Takashi Iwai
2024-08-07 13:34 ` [PATCH 42/54] ALSA: trident: Use standard print API Takashi Iwai
2024-08-07 13:34 ` Takashi Iwai [this message]
2024-08-07 13:34 ` [PATCH 44/54] ALSA: usx2y: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 45/54] ALSA: usb-audio: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 46/54] ALSA: intel8x0: Drop unused snd_printd() calls Takashi Iwai
2024-08-07 13:34 ` [PATCH 47/54] ALSA: vxpocket: Use standard print API Takashi Iwai
2024-08-07 13:34 ` [PATCH 48/54] ALSA: pdaudiocf: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 49/54] ALSA: ppc: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 50/54] ALSA: sh: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 51/54] ALSA: sparc: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 52/54] ALSA: asihpi: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 53/54] ALSA: docs: Drop snd_print*() stuff Takashi Iwai
2024-08-07 13:34 ` [PATCH 54/54] ALSA: core: Drop snd_print stuff and co Takashi Iwai
2024-08-07 14:30 ` [PATCH 00/54] ALSA: Drop legacy snd_print*() Jaroslav Kysela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240807133452.9424-44-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-sound@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox