[alsa-devel] [PATCH 0/3] Kill the rest snd_print*() usages
Hi,
it's a small series to get rid of snd_print*() usages in a few PCI sound drivers. There remain still a few, I know, but this is just a matter of cleanup, so let them be there...
[PATCH 1/3] ALSA: ctxfi: Kill the rest snd_print*() [PATCH 2/3] ALSA: pcxhr: Kill the rest snd_print*() [PATCH 3/3] ALSA: au88x0: Kill the rest snd_print*()
Takashi
Use the standard dev_*() instead.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ctxfi/ctatc.c | 6 ++++-- sound/pci/ctxfi/cttimer.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index 632e843fa95e..977a59855fa6 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c @@ -438,7 +438,9 @@ atc_pcm_playback_position(struct ct_atc *atc, struct ct_atc_pcm *apcm) position = src->ops->get_ca(src);
if (position < apcm->vm_block->addr) { - snd_printdd("ctxfi: bad ca - ca=0x%08x, vba=0x%08x, vbs=0x%08x\n", position, apcm->vm_block->addr, apcm->vm_block->size); + dev_dbg(atc->card->dev, + "bad ca - ca=0x%08x, vba=0x%08x, vbs=0x%08x\n", + position, apcm->vm_block->addr, apcm->vm_block->size); position = apcm->vm_block->addr; }
@@ -1295,7 +1297,7 @@ static int atc_identify_card(struct ct_atc *atc, unsigned int ssid) atc->model = CT20K2_UNKNOWN; } atc->model_name = ct_subsys_name[atc->model]; - snd_printd("ctxfi: chip %s model %s (%04x:%04x) is found\n", + dev_info(atc->card->dev, "chip %s model %s (%04x:%04x) is found\n", atc->chip_name, atc->model_name, vendor_id, device_id); return 0; diff --git a/sound/pci/ctxfi/cttimer.c b/sound/pci/ctxfi/cttimer.c index 03fb909085af..a5d460453d7b 100644 --- a/sound/pci/ctxfi/cttimer.c +++ b/sound/pci/ctxfi/cttimer.c @@ -421,12 +421,12 @@ struct ct_timer *ct_timer_new(struct ct_atc *atc) atimer->atc = atc; hw = atc->hw; if (!use_system_timer && hw->set_timer_irq) { - snd_printd(KERN_INFO "ctxfi: Use xfi-native timer\n"); + dev_info(atc->card->dev, "Use xfi-native timer\n"); atimer->ops = &ct_xfitimer_ops; hw->irq_callback_data = atimer; hw->irq_callback = ct_timer_interrupt; } else { - snd_printd(KERN_INFO "ctxfi: Use system timer\n"); + dev_info(atc->card->dev, "Use system timer\n"); atimer->ops = &ct_systimer_ops; } return atimer;
Use the standard dev_*() instead.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/pcxhr/pcxhr.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 7c33c973dbd5..a60293015267 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -501,10 +501,10 @@ int pcxhr_get_external_clock(struct pcxhr_mgr *mgr, /* * start or stop playback/capture substream */ -static int pcxhr_set_stream_state(struct pcxhr_stream *stream) +static int pcxhr_set_stream_state(struct snd_pcxhr *chip, + struct pcxhr_stream *stream) { int err; - struct snd_pcxhr *chip; struct pcxhr_rmh rmh; int stream_mask, start;
@@ -512,8 +512,8 @@ static int pcxhr_set_stream_state(struct pcxhr_stream *stream) start = 1; else { if (stream->status != PCXHR_STREAM_STATUS_SCHEDULE_STOP) { - snd_printk(KERN_ERR "ERROR pcxhr_set_stream_state " - "CANNOT be stopped\n"); + dev_err(chip->card->dev, + "pcxhr_set_stream_state CANNOT be stopped\n"); return -EINVAL; } start = 0; @@ -560,6 +560,7 @@ static int pcxhr_set_format(struct pcxhr_stream *stream) struct pcxhr_rmh rmh; unsigned int header;
+ chip = snd_pcm_substream_chip(stream->substream); switch (stream->format) { case SNDRV_PCM_FORMAT_U8: header = HEADER_FMT_BASE_LIN; @@ -582,11 +583,10 @@ static int pcxhr_set_format(struct pcxhr_stream *stream) header = HEADER_FMT_BASE_FLOAT | HEADER_FMT_INTEL; break; default: - snd_printk(KERN_ERR - "error pcxhr_set_format() : unknown format\n"); + dev_err(chip->card->dev, + "error pcxhr_set_format() : unknown format\n"); return -EINVAL; } - chip = snd_pcm_substream_chip(stream->substream);
sample_rate = chip->mgr->sample_rate; if (sample_rate <= 32000 && sample_rate !=0) { @@ -643,11 +643,11 @@ static int pcxhr_update_r_buffer(struct pcxhr_stream *stream) is_capture = (subs->stream == SNDRV_PCM_STREAM_CAPTURE); stream_num = is_capture ? 0 : subs->number;
- snd_printdd("pcxhr_update_r_buffer(pcm%c%d) : " - "addr(%p) bytes(%zx) subs(%d)\n", - is_capture ? 'c' : 'p', - chip->chip_idx, (void *)(long)subs->runtime->dma_addr, - subs->runtime->dma_bytes, subs->number); + dev_dbg(chip->card->dev, + "pcxhr_update_r_buffer(pcm%c%d) : addr(%p) bytes(%zx) subs(%d)\n", + is_capture ? 'c' : 'p', + chip->chip_idx, (void *)(long)subs->runtime->dma_addr, + subs->runtime->dma_bytes, subs->number);
pcxhr_init_rmh(&rmh, CMD_UPDATE_R_BUFFERS); pcxhr_set_pipe_cmd_params(&rmh, is_capture, stream->pipe->first_audio, @@ -687,7 +687,7 @@ static int pcxhr_pipe_sample_count(struct pcxhr_stream *stream, *sample_count = ((snd_pcm_uframes_t)rmh.stat[0]) << 24; *sample_count += (snd_pcm_uframes_t)rmh.stat[1]; } - snd_printdd("PIPE_SAMPLE_COUNT = %lx\n", *sample_count); + dev_dbg(chip->card->dev, "PIPE_SAMPLE_COUNT = %lx\n", *sample_count); return err; } #endif @@ -779,12 +779,12 @@ static void pcxhr_start_linked_stream(struct pcxhr_mgr *mgr) for (j = 0; j < chip->nb_streams_capt; j++) { stream = &chip->capture_stream[j]; if (pcxhr_stream_scheduled_get_pipe(stream, &pipe)) - err = pcxhr_set_stream_state(stream); + err = pcxhr_set_stream_state(chip, stream); } for (j = 0; j < chip->nb_streams_play; j++) { stream = &chip->playback_stream[j]; if (pcxhr_stream_scheduled_get_pipe(stream, &pipe)) - err = pcxhr_set_stream_state(stream); + err = pcxhr_set_stream_state(chip, stream); } }
@@ -839,12 +839,12 @@ static int pcxhr_trigger(struct snd_pcm_substream *subs, int cmd) { struct pcxhr_stream *stream; struct snd_pcm_substream *s; + struct snd_pcxhr *chip = snd_pcm_substream_chip(subs);
switch (cmd) { case SNDRV_PCM_TRIGGER_START: - snd_printdd("SNDRV_PCM_TRIGGER_START\n"); + dev_dbg(chip->card->dev, "SNDRV_PCM_TRIGGER_START\n"); if (snd_pcm_stream_linked(subs)) { - struct snd_pcxhr *chip = snd_pcm_substream_chip(subs); snd_pcm_group_for_each_entry(s, subs) { if (snd_pcm_substream_chip(s) != chip) continue; @@ -856,7 +856,7 @@ static int pcxhr_trigger(struct snd_pcm_substream *subs, int cmd) pcxhr_start_linked_stream(chip->mgr); } else { stream = subs->runtime->private_data; - snd_printdd("Only one Substream %c %d\n", + dev_dbg(chip->card->dev, "Only one Substream %c %d\n", stream->pipe->is_capture ? 'C' : 'P', stream->pipe->first_audio); if (pcxhr_set_format(stream)) @@ -865,17 +865,17 @@ static int pcxhr_trigger(struct snd_pcm_substream *subs, int cmd) return -EINVAL;
stream->status = PCXHR_STREAM_STATUS_SCHEDULE_RUN; - if (pcxhr_set_stream_state(stream)) + if (pcxhr_set_stream_state(chip, stream)) return -EINVAL; stream->status = PCXHR_STREAM_STATUS_RUNNING; } break; case SNDRV_PCM_TRIGGER_STOP: - snd_printdd("SNDRV_PCM_TRIGGER_STOP\n"); + dev_dbg(chip->card->dev, "SNDRV_PCM_TRIGGER_STOP\n"); snd_pcm_group_for_each_entry(s, subs) { stream = s->runtime->private_data; stream->status = PCXHR_STREAM_STATUS_SCHEDULE_STOP; - if (pcxhr_set_stream_state(stream)) + if (pcxhr_set_stream_state(chip, stream)) return -EINVAL; snd_pcm_trigger_done(s, subs); }
Use the standard dev_*() instead.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/au88x0/au88x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c index e9c3833f6d44..996369134ea8 100644 --- a/sound/pci/au88x0/au88x0.c +++ b/sound/pci/au88x0/au88x0.c @@ -314,7 +314,7 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_VORTEX_SYNTH, sizeof(snd_vortex_synth_arg_t), &wave) < 0 || wave == NULL) { - snd_printk(KERN_ERR "Can't initialize Aureal wavetable synth\n"); + dev_err(card->dev, "Can't initialize Aureal wavetable synth\n"); } else { snd_vortex_synth_arg_t *arg;
On Tue, Oct 28, 2014 at 05:45:12PM +0100, Takashi Iwai wrote:
Hi,
it's a small series to get rid of snd_print*() usages in a few PCI sound drivers. There remain still a few, I know, but this is just a matter of cleanup, so let them be there...
hi, still there is approx. 723 usages of snd_printk (including snd_printk in comments), and including 46 in PCI. shall i do the cleanups for you ?
thanks sudip
[PATCH 1/3] ALSA: ctxfi: Kill the rest snd_print*() [PATCH 2/3] ALSA: pcxhr: Kill the rest snd_print*() [PATCH 3/3] ALSA: au88x0: Kill the rest snd_print*()
Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Fri, 31 Oct 2014 18:15:36 +0530, Sudip Mukherjee wrote:
On Tue, Oct 28, 2014 at 05:45:12PM +0100, Takashi Iwai wrote:
Hi,
it's a small series to get rid of snd_print*() usages in a few PCI sound drivers. There remain still a few, I know, but this is just a matter of cleanup, so let them be there...
hi, still there is approx. 723 usages of snd_printk (including snd_printk in comments), and including 46 in PCI. shall i do the cleanups for you ?
Only you have really free time and gut :) The problem is rather inconsistencies, i.e. if the same module has a mix of dev_*() and snd_printk() (or snd_printd()), they should be replaced as well. If not mixed, we can leave as is for now.
snd_printdd() is a slight different story. It's really a debug print, so do it only when easily possible.
Takashi
On Fri, Oct 31, 2014 at 06:31:23PM +0100, Takashi Iwai wrote:
At Fri, 31 Oct 2014 18:15:36 +0530, Sudip Mukherjee wrote:
On Tue, Oct 28, 2014 at 05:45:12PM +0100, Takashi Iwai wrote:
Hi,
it's a small series to get rid of snd_print*() usages in a few PCI sound drivers. There remain still a few, I know, but this is just a matter of cleanup, so let them be there...
hi, still there is approx. 723 usages of snd_printk (including snd_printk in comments), and including 46 in PCI. shall i do the cleanups for you ?
Only you have really free time and gut :) The problem is rather inconsistencies, i.e. if the same module has a mix of dev_*() and snd_printk() (or snd_printd()), they should be replaced as well. If not mixed, we can leave as is for now.
i am having one doubt. I saw in your patch you have replaced snd_printdd with dev_dbg and snd_printd with dev_info. but when i am checking the macro of snd_printd or snd_printdd , i see that they are also printing the file and line along with the message. snd_printddd is also doing the same thing. then while replacing them with dev_*, the file and line are not required ?
thanks sudip
snd_printdd() is a slight different story. It's really a debug print, so do it only when easily possible.
Takashi
At Sat, 1 Nov 2014 18:45:40 +0530, Sudip Mukherjee wrote:
On Fri, Oct 31, 2014 at 06:31:23PM +0100, Takashi Iwai wrote:
At Fri, 31 Oct 2014 18:15:36 +0530, Sudip Mukherjee wrote:
On Tue, Oct 28, 2014 at 05:45:12PM +0100, Takashi Iwai wrote:
Hi,
it's a small series to get rid of snd_print*() usages in a few PCI sound drivers. There remain still a few, I know, but this is just a matter of cleanup, so let them be there...
hi, still there is approx. 723 usages of snd_printk (including snd_printk in comments), and including 46 in PCI. shall i do the cleanups for you ?
Only you have really free time and gut :) The problem is rather inconsistencies, i.e. if the same module has a mix of dev_*() and snd_printk() (or snd_printd()), they should be replaced as well. If not mixed, we can leave as is for now.
i am having one doubt. I saw in your patch you have replaced snd_printdd with dev_dbg and snd_printd with dev_info. but when i am checking the macro of snd_printd or snd_printdd , i see that they are also printing the file and line along with the message. snd_printddd is also doing the same thing. then while replacing them with dev_*, the file and line are not required ?
Pretty depends on the situation. When the printed text is unique, the file and the line are mostly superfluous. If there are multiple similar messages, they have to be modified somehow to be easily identifiable.
Takashi
On 2014-11-02 09:04, Takashi Iwai wrote:
At Sat, 1 Nov 2014 18:45:40 +0530, Sudip Mukherjee wrote:
On Fri, Oct 31, 2014 at 06:31:23PM +0100, Takashi Iwai wrote:
At Fri, 31 Oct 2014 18:15:36 +0530, Sudip Mukherjee wrote:
On Tue, Oct 28, 2014 at 05:45:12PM +0100, Takashi Iwai wrote:
Hi,
it's a small series to get rid of snd_print*() usages in a few PCI sound drivers. There remain still a few, I know, but this is just a matter of cleanup, so let them be there...
hi, still there is approx. 723 usages of snd_printk (including snd_printk in comments), and including 46 in PCI. shall i do the cleanups for you ?
Only you have really free time and gut :) The problem is rather inconsistencies, i.e. if the same module has a mix of dev_*() and snd_printk() (or snd_printd()), they should be replaced as well. If not mixed, we can leave as is for now.
i am having one doubt. I saw in your patch you have replaced snd_printdd with dev_dbg and snd_printd with dev_info. but when i am checking the macro of snd_printd or snd_printdd , i see that they are also printing the file and line along with the message. snd_printddd is also doing the same thing. then while replacing them with dev_*, the file and line are not required ?
Pretty depends on the situation. When the printed text is unique, the file and the line are mostly superfluous. If there are multiple similar messages, they have to be modified somehow to be easily identifiable.
Also, for dev_dbg, I don't think we should add file and line information - it is already added with CONFIG_DYNAMIC_DEBUG (if enabled). Adding it one more time seems superfluous.
participants (3)
-
David Henningsson
-
Sudip Mukherjee
-
Takashi Iwai