Skip to contentSkip to conversation

ALSA: au88x0: added reference of vortex_t

PATCH Superseded Sudip Mukherjee 4 participants 13 messages Oct 10, 2014 – Oct 17, 2014 Sound

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 ALSA: au88x0: added reference of vortex_t

added a pointer of the vortex in the following functions :

vortex_alsafmt_aspfmt
vortex_Vort3D_InitializeSource
a3dsrc_ZeroStateA3D

so that we can have a reference of the vortex in the function. this reference of the vortex will actually be used in a later patch to convert the pr_* macro to dev_*.

---

no change from v1.

 sound/pci/au88x0/au88x0.h      | 4 ++--
 sound/pci/au88x0/au88x0_a3d.c  | 6 +++---
 sound/pci/au88x0/au88x0_core.c | 5 +++--
 sound/pci/au88x0/au88x0_pcm.c  | 2 +-
 4 files changed, 9 insertions(+), 8 deletions(-)
sound/pci/au88x0/au88x0.h +2 -2
index 466a5c8..3a8fefe 100644
@@ -243,7 +243,7 @@ static int vortex_core_init(vortex_t * card);
 static int vortex_core_shutdown(vortex_t * card);
 static void vortex_enable_int(vortex_t * card);
 static irqreturn_t vortex_interrupt(int irq, void *dev_id);
-static int vortex_alsafmt_aspfmt(int alsafmt);
+static int vortex_alsafmt_aspfmt(int alsafmt, vortex_t *v);
 
 /* Connection  stuff. */
 static void vortex_connect_default(vortex_t * vortex, int en);
@@ -278,7 +278,7 @@ static void vortex_mix_setvolumebyte(vortex_t * vortex, unsigned char mix,
 static void vortex_Vort3D_enable(vortex_t * v);
 static void vortex_Vort3D_disable(vortex_t * v);
 static void vortex_Vort3D_connect(vortex_t * vortex, int en);
-static void vortex_Vort3D_InitializeSource(a3dsrc_t * a, int en);
+static void vortex_Vort3D_InitializeSource(a3dsrc_t *a, int en, vortex_t *v);
 #endif
 
 /* Driver stuff. */
sound/pci/au88x0/au88x0_a3d.c +3 -3
index 30f760e..bc9cda3a 100644
@@ -484,7 +484,7 @@ static void a3dsrc_ZeroState(a3dsrc_t * a)
 }
 
 /* Reset entire A3D engine */
-static void a3dsrc_ZeroStateA3D(a3dsrc_t * a)
+static void a3dsrc_ZeroStateA3D(a3dsrc_t *a, vortex_t *v)
 {
 	int i, var, var2;
 
@@ -601,7 +601,7 @@ static void vortex_Vort3D_enable(vortex_t *v)
 	Vort3DRend_Initialize(v, XT_HEADPHONE);
 	for (i = 0; i < NR_A3D; i++) {
 		vortex_A3dSourceHw_Initialize(v, i % 4, i >> 2);
-		a3dsrc_ZeroStateA3D(&(v->a3d[0]));
+		a3dsrc_ZeroStateA3D(&v->a3d[0], v);
 	}
 	/* Register ALSA controls */
 	vortex_a3d_register_controls(v);
@@ -676,7 +676,7 @@ static void vortex_Vort3D_connect(vortex_t * v, int en)
 }
 
 /* Initialize one single A3D source. */
-static void vortex_Vort3D_InitializeSource(a3dsrc_t * a, int en)
+static void vortex_Vort3D_InitializeSource(a3dsrc_t *a, int en, vortex_t *v)
 {
 	if (a->vortex == NULL) {
 		pr_warn
sound/pci/au88x0/au88x0_core.c +3 -2
index 72e8128..00e2096 100644
@@ -2177,7 +2177,8 @@ vortex_adb_allocroute(vortex_t *vortex, int dma, int nr_ch, int dir,
 				return -EBUSY;
 			}
 			/* (De)Initialize A3D hardware source. */
-			vortex_Vort3D_InitializeSource(&(vortex->a3d[a3d]), en);
+			vortex_Vort3D_InitializeSource(&vortex->a3d[a3d], en,
+						       vortex);
 		}
 		/* Make SPDIF out exclusive to "spdif" device when in use. */
 		if ((stream->type == VORTEX_PCM_SPDIF) && (en)) {
@@ -2765,7 +2766,7 @@ static int vortex_core_shutdown(vortex_t * vortex)
 
 /* Alsa support. */
 
-static int vortex_alsafmt_aspfmt(int alsafmt)
+static int vortex_alsafmt_aspfmt(int alsafmt, vortex_t *v)
 {
 	int fmt;
 
sound/pci/au88x0/au88x0_pcm.c +1 -1
index 5adc6b9..bdde182 100644
@@ -332,7 +332,7 @@ static int snd_vortex_pcm_prepare(struct snd_pcm_substream *substream)
 		dir = 1;
 	else
 		dir = 0;
-	fmt = vortex_alsafmt_aspfmt(runtime->format);
+	fmt = vortex_alsafmt_aspfmt(runtime->format, chip);
 	spin_lock_irq(&chip->lock);
 	if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) {
 		vortex_adbdma_setmode(chip, dma, 1, dir, fmt,
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH v2 2/2 ALSA: au88x0: pr_* replaced with dev_*

pr_* macros replaced with dev_* as they are more preffered over pr_*. each file which had pr_* was reviewed manually and replaced with dev_*. here we have actually used the reference of the vortex which was added to some functions in the previous patch of this series.

The prefix of the CARD_NAME and prefix of "vortex:" was also removed as the dev_* will print the device name.

---

change from v1: removed CARD_NAME and "vortex:"

in the probe function there is a email address : [email protected] is it still working ? the archieve shows the last message was in 2006.

 sound/pci/au88x0/au88x0.c        | 33 +++++++-------
 sound/pci/au88x0/au88x0_a3d.c    | 15 ++++---
 sound/pci/au88x0/au88x0_core.c   | 97 +++++++++++++++++++++-------------------
 sound/pci/au88x0/au88x0_eq.c     |  3 +-
 sound/pci/au88x0/au88x0_game.c   |  3 +-
 sound/pci/au88x0/au88x0_mpu401.c |  2 +-
 sound/pci/au88x0/au88x0_pcm.c    |  6 +--
 sound/pci/au88x0/au88x0_synth.c  | 17 ++++---
 8 files changed, 94 insertions(+), 82 deletions(-)
sound/pci/au88x0/au88x0.c +16 -17
index 21ce31f..e9c3833 100644
@@ -48,11 +48,10 @@ static void vortex_fix_latency(struct pci_dev *vortex)
 {
 	int rc;
 	if (!(rc = pci_write_config_byte(vortex, 0x40, 0xff))) {
-			pr_info( CARD_NAME
-			       ": vortex latency is 0xff\n");
+			dev_info(&vortex->dev, "vortex latency is 0xff\n");
 	} else {
-		pr_warn( CARD_NAME
-				": could not set vortex latency: pci error 0x%x\n", rc);
+		dev_warn(&vortex->dev,
+			 "could not set vortex latency: pci error 0x%x\n", rc);
 	}
 }
 
@@ -70,11 +69,10 @@ static void vortex_fix_agp_bridge(struct pci_dev *via)
 	if (!(rc = pci_read_config_byte(via, 0x42, &value))
 			&& ((value & 0x10)
 				|| !(rc = pci_write_config_byte(via, 0x42, value | 0x10)))) {
-		pr_info( CARD_NAME
-				": bridge config is 0x%x\n", value | 0x10);
+		dev_info(&via->dev, "bridge config is 0x%x\n", value | 0x10);
 	} else {
-		pr_warn( CARD_NAME
-				": could not set vortex latency: pci error 0x%x\n", rc);
+		dev_warn(&via->dev,
+			 "could not set vortex latency: pci error 0x%x\n", rc);
 	}
 }
 
@@ -97,7 +95,8 @@ static void snd_vortex_workaround(struct pci_dev *vortex, int fix)
 					PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL);
 		}
 		if (via) {
-			pr_info( CARD_NAME ": Activating latency workaround...\n");
+			dev_info(&vortex->dev,
+				 "Activating latency workaround...\n");
 			vortex_fix_latency(vortex);
 			vortex_fix_agp_bridge(via);
 		}
@@ -153,7 +152,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
 		return err;
 	if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
 	    pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
-		pr_err( "error to set DMA mask\n");
+		dev_err(card->dev, "error to set DMA mask\n");
 		pci_disable_device(pci);
 		return -ENXIO;
 	}
@@ -182,7 +181,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
 
 	chip->mmio = pci_ioremap_bar(pci, 0);
 	if (!chip->mmio) {
-		pr_err( "MMIO area remap failed.\n");
+		dev_err(card->dev, "MMIO area remap failed.\n");
 		err = -ENOMEM;
 		goto ioremap_out;
 	}
@@ -191,14 +190,14 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
 	 * This must be done before we do request_irq otherwise we can get spurious
 	 * interrupts that we do not handle properly and make a mess of things */
 	if ((err = vortex_core_init(chip)) != 0) {
-		pr_err( "hw core init failed\n");
+		dev_err(card->dev, "hw core init failed\n");
 		goto core_out;
 	}
 
 	if ((err = request_irq(pci->irq, vortex_interrupt,
 			       IRQF_SHARED, KBUILD_MODNAME,
 	                       chip)) != 0) {
-		pr_err( "cannot grab irq\n");
+		dev_err(card->dev, "cannot grab irq\n");
 		goto irq_out;
 	}
 	chip->irq = pci->irq;
@@ -342,11 +341,11 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
 	chip->rev = pci->revision;
 #ifdef CHIP_AU8830
 	if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) {
-		pr_alert(
-		       "vortex: The revision (%x) of your card has not been seen before.\n",
+		dev_alert(card->dev,
+			  "The revision (%x) of your card has not been seen before.\n",
 		       chip->rev);
-		pr_alert(
-		       "vortex: Please email the results of 'lspci -vv' to [email protected].\n");
+		dev_alert(card->dev,
+			  "Please email the results of 'lspci -vv' to [email protected].\n");
 		snd_card_free(card);
 		err = -ENODEV;
 		return err;
sound/pci/au88x0/au88x0_a3d.c +8 -7
index bc9cda3a..ab0f873 100644
@@ -489,7 +489,8 @@ static void a3dsrc_ZeroStateA3D(a3dsrc_t *a, vortex_t *v)
 	int i, var, var2;
 
 	if ((a->vortex) == NULL) {
-		pr_err( "vortex: ZeroStateA3D: ERROR: a->vortex is NULL\n");
+		dev_err(v->card->dev,
+			"ZeroStateA3D: ERROR: a->vortex is NULL\n");
 		return;
 	}
 
@@ -628,15 +629,15 @@ static void vortex_Vort3D_connect(vortex_t * v, int en)
 	v->mixxtlk[0] =
 	    vortex_adb_checkinout(v, v->fixed_res, en, VORTEX_RESOURCE_MIXIN);
 	if (v->mixxtlk[0] < 0) {
-		pr_warn
-		    ("vortex: vortex_Vort3D: ERROR: not enough free mixer resources.\n");
+		dev_warn(v->card->dev,
+			 "vortex_Vort3D: ERROR: not enough free mixer resources.\n");
 		return;
 	}
 	v->mixxtlk[1] =
 	    vortex_adb_checkinout(v, v->fixed_res, en, VORTEX_RESOURCE_MIXIN);
 	if (v->mixxtlk[1] < 0) {
-		pr_warn
-		    ("vortex: vortex_Vort3D: ERROR: not enough free mixer resources.\n");
+		dev_warn(v->card->dev,
+			 "vortex_Vort3D: ERROR: not enough free mixer resources.\n");
 		return;
 	}
 #endif
@@ -679,8 +680,8 @@ static void vortex_Vort3D_connect(vortex_t * v, int en)
 static void vortex_Vort3D_InitializeSource(a3dsrc_t *a, int en, vortex_t *v)
 {
 	if (a->vortex == NULL) {
-		pr_warn
-		    ("vortex: Vort3D_InitializeSource: A3D source not initialized\n");
+		dev_warn(v->card->dev,
+			 "Vort3D_InitializeSource: A3D source not initialized\n");
 		return;
 	}
 	if (en) {
sound/pci/au88x0/au88x0_core.c +52 -45

273 lines not on this page · raw message

sound/pci/au88x0/au88x0_eq.c +2 -1
index 9404ba7..9585c5c 100644
@@ -845,7 +845,8 @@ snd_vortex_peaks_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u
 
 	vortex_Eqlzr_GetAllPeaks(vortex, peaks, &count);
 	if (count != 20) {
-		pr_err( "vortex: peak count error 20 != %d \n", count);
+		dev_err(vortex->card->dev,
+			"peak count error 20 != %d\n", count);
 		return -1;
 	}
 	for (i = 0; i < 20; i++)
sound/pci/au88x0/au88x0_game.c +2 -1
index 72daf6c..151815b 100644
@@ -98,7 +98,8 @@ static int vortex_gameport_register(vortex_t *vortex)
 
 	vortex->gameport = gp = gameport_allocate_port();
 	if (!gp) {
-		pr_err( "vortex: cannot allocate memory for gameport\n");
+		dev_err(vortex->card->dev,
+			"cannot allocate memory for gameport\n");
 		return -ENOMEM;
 	}
 
sound/pci/au88x0/au88x0_mpu401.c +1 -1
index 328c194..1025e55 100644
@@ -73,7 +73,7 @@ static int snd_vortex_midi(vortex_t *vortex)
 	/* Check if anything is OK. */
 	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);
 	if (temp != MPU401_ACK /*0xfe */ ) {
-		pr_err( "midi port doesn't acknowledge!\n");
+		dev_err(vortex->card->dev, "midi port doesn't acknowledge!\n");
 		return -ENODEV;
 	}
 	/* Enable MPU401 interrupts. */
sound/pci/au88x0/au88x0_pcm.c +3 -3
index bdde182..a6d6d8d 100644
@@ -227,7 +227,7 @@ snd_vortex_pcm_hw_params(struct snd_pcm_substream *substream,
 	err =
 	    snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
 	if (err < 0) {
-		pr_err( "Vortex: pcm page alloc failed!\n");
+		dev_err(chip->card->dev, "Vortex: pcm page alloc failed!\n");
 		return err;
 	}
 	/*
@@ -371,7 +371,7 @@ static int snd_vortex_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 		}
 #ifndef CHIP_AU8810
 		else {
-			pr_info( "vortex: wt start %d\n", dma);
+			dev_info(chip->card->dev, "wt start %d\n", dma);
 			vortex_wtdma_startfifo(chip, dma);
 		}
 #endif
@@ -384,7 +384,7 @@ static int snd_vortex_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 			vortex_adbdma_stopfifo(chip, dma);
 #ifndef CHIP_AU8810
 		else {
-			pr_info( "vortex: wt stop %d\n", dma);
+			dev_info(chip->card->dev, "wt stop %d\n", dma);
 			vortex_wtdma_stopfifo(chip, dma);
 		}
 #endif
sound/pci/au88x0/au88x0_synth.c +10 -7
index f094bac..78e12f4 100644
@@ -90,7 +90,7 @@ static int vortex_wt_allocroute(vortex_t * vortex, int wt, int nr_ch)
 	hwwrite(vortex->mmio, WT_PARM(wt, 2), 0);
 
 	temp = hwread(vortex->mmio, WT_PARM(wt, 3));
-	pr_debug( "vortex: WT PARM3: %x\n", temp);
+	dev_dbg(vortex->card->dev, "WT PARM3: %x\n", temp);
 	//hwwrite(vortex->mmio, WT_PARM(wt, 3), temp);
 
 	hwwrite(vortex->mmio, WT_DELAY(wt, 0), 0);
@@ -98,7 +98,8 @@ static int vortex_wt_allocroute(vortex_t * vortex, int wt, int nr_ch)
 	hwwrite(vortex->mmio, WT_DELAY(wt, 2), 0);
 	hwwrite(vortex->mmio, WT_DELAY(wt, 3), 0);
 
-	pr_debug( "vortex: WT GMODE: %x\n", hwread(vortex->mmio, WT_GMODE(wt)));
+	dev_dbg(vortex->card->dev, "WT GMODE: %x\n",
+		hwread(vortex->mmio, WT_GMODE(wt)));
 
 	hwwrite(vortex->mmio, WT_PARM(wt, 2), 0xffffffff);
 	hwwrite(vortex->mmio, WT_PARM(wt, 3), 0xcff1c810);
@@ -106,7 +107,8 @@ static int vortex_wt_allocroute(vortex_t * vortex, int wt, int nr_ch)
 	voice->parm0 = voice->parm1 = 0xcfb23e2f;
 	hwwrite(vortex->mmio, WT_PARM(wt, 0), voice->parm0);
 	hwwrite(vortex->mmio, WT_PARM(wt, 1), voice->parm1);
-	pr_debug( "vortex: WT GMODE 2 : %x\n", hwread(vortex->mmio, WT_GMODE(wt)));
+	dev_dbg(vortex->card->dev, "WT GMODE 2 : %x\n",
+		hwread(vortex->mmio, WT_GMODE(wt)));
 	return 0;
 }
 
@@ -196,14 +198,15 @@ vortex_wt_SetReg(vortex_t * vortex, unsigned char reg, int wt,
 
 	if ((reg == 5) || ((reg >= 7) && (reg <= 10)) || (reg == 0xc)) {
 		if (wt >= (NR_WT / NR_WT_PB)) {
-			pr_warn
-			    ("vortex: WT SetReg: bank out of range. reg=0x%x, wt=%d\n",
-			     reg, wt);
+			dev_warn(vortex->card->dev,
+				 "WT SetReg: bank out of range. reg=0x%x, wt=%d\n",
+				 reg, wt);
 			return 0;
 		}
 	} else {
 		if (wt >= NR_WT) {
-			pr_err( "vortex: WT SetReg: voice out of range\n");
+			dev_err(vortex->card->dev,
+				"WT SetReg: voice out of range\n");
 			return 0;
 		}
 	}
Signature · 1 line
1.8.1.2
#2 lore raw

Re: [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

Quoted 16 lines

pr_* macros replaced with dev_* as they are more preffered over pr_*. each file which had pr_* was reviewed manually and replaced with dev_*. here we have actually used the reference of the vortex which was added to some functions in the previous patch of this series.

The prefix of the CARD_NAME and prefix of "vortex:" was also removed as the dev_* will print the device name.

---

static int vortex_core_init(vortex_t *vortex)
{

sound/pci/au88x0/au88x0_core.c static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode) · line 2693

Quoted 2 lines
sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "Vortex: init.... ");
+       dev_info(vortex->card->dev, "init.... ");

Is it possible to add linefeed since "done/n" won't appear in the same line with init nor shutdown?

Quoted 30 lines
        /* Hardware Init. */
        hwwrite(vortex->mmio, VORTEX_CTRL, 0xffffffff);
        msleep(5);
sound/pci/au88x0/au88x0_core.c +3 -3
@@ -2729,7 +2735,7 @@ static int vortex_core_init(vortex_t *vortex)
        //vortex_enable_timer_int(vortex);
        //vortex_disable_timer_int(vortex);
 
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        spin_lock_init(&vortex->lock);
 
        return 0;
@@ -2738,7 +2744,7 @@ static int vortex_core_init(vortex_t *vortex)
 static int vortex_core_shutdown(vortex_t * vortex)
 {
 
-       pr_info( "Vortex: shutdown...");
+       dev_info(vortex->card->dev, "shutdown...");
 #ifndef CHIP_AU8820
        vortex_eq_free(vortex);
        vortex_Vort3D_disable(vortex);
@@ -2760,7 +2766,7 @@ static int vortex_core_shutdown(vortex_t * vortex)
        msleep(5);
        hwwrite(vortex->mmio, VORTEX_IRQ_SOURCE, 0xffff);
 
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        return 0;
 }
 
#3 lore raw

Re: [alsa-devel] [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

Quoted 13 lines · Raymond Yau
Quoted 12 lines

pr_* macros replaced with dev_* as they are more preffered over pr_*. each file which had pr_* was reviewed manually and replaced with dev_*. here we have actually used the reference of the vortex which was added to some functions in the previous patch of this series.

The prefix of the CARD_NAME and prefix of "vortex:" was also removed as the dev_* will print the device name.

---

Quoted 9 lines

sound/pci/au88x0/au88x0_core.c static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode) · line 2693

Quoted 5 lines

static int vortex_core_init(vortex_t *vortex)
{

sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "Vortex: init.... ");
+       dev_info(vortex->card->dev, "init.... ");

Is it possible to add linefeed since "done/n" won't appear in the same line with init nor shutdown?

should we add linefeed ?
as of now it will print init.... then it will print done as the init is complete. so dmesg will show us:

init....done.

same for shutdown.
but if we give linefeed , then it will become :

init....
done.

the meaning will be lost. and many user might just wonder what is done ?

thanks
sudip

Quoted 30 lines
Quoted 30 lines
        /* Hardware Init. */
        hwwrite(vortex->mmio, VORTEX_CTRL, 0xffffffff);
        msleep(5);
sound/pci/au88x0/au88x0_core.c +3 -3
@@ -2729,7 +2735,7 @@ static int vortex_core_init(vortex_t *vortex)
        //vortex_enable_timer_int(vortex);
        //vortex_disable_timer_int(vortex);
 
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        spin_lock_init(&vortex->lock);
 
        return 0;
@@ -2738,7 +2744,7 @@ static int vortex_core_init(vortex_t *vortex)
 static int vortex_core_shutdown(vortex_t * vortex)
 {
 
-       pr_info( "Vortex: shutdown...");
+       dev_info(vortex->card->dev, "shutdown...");
 #ifndef CHIP_AU8820
        vortex_eq_free(vortex);
        vortex_Vort3D_disable(vortex);
@@ -2760,7 +2766,7 @@ static int vortex_core_shutdown(vortex_t * vortex)
        msleep(5);
        hwwrite(vortex->mmio, VORTEX_IRQ_SOURCE, 0xffff);
 
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        return 0;
 }
 
#4 lore raw

Re: [alsa-devel] [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

Quoted 29 lines · Sudip Mukherjee
Quoted 13 lines · Raymond Yau
Quoted 12 lines

pr_* macros replaced with dev_* as they are more preffered over pr_*. each file which had pr_* was reviewed manually and replaced with dev_*. here we have actually used the reference of the vortex which was added to some functions in the previous patch of this series.

The prefix of the CARD_NAME and prefix of "vortex:" was also removed as the dev_* will print the device name.

---

Quoted 9 lines

sound/pci/au88x0/au88x0_core.c static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode) · line 2693

Quoted 5 lines

static int vortex_core_init(vortex_t *vortex)
{

sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "Vortex: init.... ");
+       dev_info(vortex->card->dev, "init.... ");

Is it possible to add linefeed since "done/n" won't appear in the same line with init nor shutdown?

should we add linefeed ?
as of now it will print init.... then it will print done as the init is complete. so dmesg will show us:

init....done.

Quoted 7 lines

same for shutdown.
but if we give linefeed , then it will become :

init....
done.

the meaning will be lost. and many user might just wonder what is done ?

[]

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
sound/pci/au88x0/au88x0_core.c +1 -1
@@ -2738,7 +2744,7 @@ static int vortex_core_init(vortex_t *vortex)
 static int vortex_core_shutdown(vortex_t * vortex)
 {
 
-       pr_info( "Vortex: shutdown...");
+       dev_info(vortex->card->dev, "shutdown...");
 #ifndef CHIP_AU8820
        vortex_eq_free(vortex);
        vortex_Vort3D_disable(vortex);
@@ -2760,7 +2766,7 @@ static int vortex_core_shutdown(vortex_t * vortex)
        msleep(5);
        hwwrite(vortex->mmio, VORTEX_IRQ_SOURCE, 0xffff);
 
Quoted 4 lines
Quoted 4 lines

sound/pci/au88x0/au88x0_core.c static int vortex_core_shutdown(vortex_t * vortex) · line 2771

Quoted 4 lines
sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        return 0;
 }

It's actually on 2 lines before your patch.

	pr_info("a");
	pr_info("b\n");

already emits 2 separate lines.

	pr_info("a");
	pr_cont("b\n");

emits a single line "ab"
(unless some other thread emits something in-between)

pr_cont or a bare printk can be used after a dev_info without a newline to avoid unwanted newlines.

#5 lore raw

Re: [alsa-devel] [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

Quoted 3 lines · Joe Perches
Quoted 2 lines · Sudip Mukherjee
Quoted 1 line · Raymond Yau
Quoted 1 line

<snip>

Quoted 51 lines
Quoted 18 lines
Quoted 12 lines

sound/pci/au88x0/au88x0_core.c static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode) · line 2693

Quoted 8 lines

---

static int vortex_core_init(vortex_t *vortex)
{

sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "Vortex: init.... ");
+       dev_info(vortex->card->dev, "init.... ");

Is it possible to add linefeed since "done/n" won't appear in the same line with init nor shutdown?

should we add linefeed ?
as of now it will print init.... then it will print done as the init is complete. so dmesg will show us:

init....done.

Quoted 7 lines

same for shutdown.
but if we give linefeed , then it will become :

init....
done.

the meaning will be lost. and many user might just wonder what is done ?

[]

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
sound/pci/au88x0/au88x0_core.c +1 -1
@@ -2738,7 +2744,7 @@ static int vortex_core_init(vortex_t *vortex)
 static int vortex_core_shutdown(vortex_t * vortex)
 {
 
-       pr_info( "Vortex: shutdown...");
+       dev_info(vortex->card->dev, "shutdown...");
 #ifndef CHIP_AU8820
        vortex_eq_free(vortex);
        vortex_Vort3D_disable(vortex);
@@ -2760,7 +2766,7 @@ static int vortex_core_shutdown(vortex_t * vortex)
        msleep(5);
        hwwrite(vortex->mmio, VORTEX_IRQ_SOURCE, 0xffff);
 
Quoted 4 lines
Quoted 4 lines

sound/pci/au88x0/au88x0_core.c static int vortex_core_shutdown(vortex_t * vortex) · line 2771

Quoted 4 lines
sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        return 0;
 }

It's actually on 2 lines before your patch.

	pr_info("a");
	pr_info("b\n");

already emits 2 separate lines.

Quoted 8 lines
	pr_info("a");
	pr_cont("b\n");

emits a single line "ab"
(unless some other thread emits something in-between)

pr_cont or a bare printk can be used after a dev_info without a newline to avoid unwanted newlines.

i think i was not thinking while writing the previous mail. pr_info("a");
pr_info("b\n");
should print as "ab" , considering no other threads prints in between. but after converting it to dev_info it will become :
"dev: adev: b".
and for our "init.... done" , it will become
"au88x0: init.... au88x0: done." ( i have ommited the driver name)

can't we do some thing like :
dev_info(vortex->card->dev, "init.... started\n"); dev_info(vortex->card->dev, "init....done\n");
then even if some other thread prints , then we will not loose the reference.

thanks
sudip

#6 lore raw

Re: [alsa-devel] [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

Quoted 59 lines · Sudip Mukherjee
Quoted 3 lines · Joe Perches
Quoted 2 lines · Sudip Mukherjee
Quoted 1 line · Raymond Yau
Quoted 1 line

<snip>

Quoted 54 lines
Quoted 18 lines
Quoted 12 lines

sound/pci/au88x0/au88x0_core.c static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode) · line 2693

Quoted 8 lines

---

static int vortex_core_init(vortex_t *vortex)
{

sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "Vortex: init.... ");
+       dev_info(vortex->card->dev, "init.... ");

Is it possible to add linefeed since "done/n" won't appear in the same line with init nor shutdown?

should we add linefeed ?
as of now it will print init.... then it will print done as the init is complete. so dmesg will show us:

init....done.

Quoted 7 lines

same for shutdown.
but if we give linefeed , then it will become :

init....
done.

the meaning will be lost. and many user might just wonder what is done ?

[]

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
sound/pci/au88x0/au88x0_core.c +1 -1
@@ -2738,7 +2744,7 @@ static int vortex_core_init(vortex_t *vortex)
 static int vortex_core_shutdown(vortex_t * vortex)
 {
 
-       pr_info( "Vortex: shutdown...");
+       dev_info(vortex->card->dev, "shutdown...");
 #ifndef CHIP_AU8820
        vortex_eq_free(vortex);
        vortex_Vort3D_disable(vortex);
@@ -2760,7 +2766,7 @@ static int vortex_core_shutdown(vortex_t * vortex)
        msleep(5);
        hwwrite(vortex->mmio, VORTEX_IRQ_SOURCE, 0xffff);
 
Quoted 4 lines
Quoted 4 lines

sound/pci/au88x0/au88x0_core.c static int vortex_core_shutdown(vortex_t * vortex) · line 2771

Quoted 4 lines
sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        return 0;
 }

It's actually on 2 lines before your patch.

	pr_info("a");
	pr_info("b\n");

already emits 2 separate lines.

	pr_info("a");
	pr_cont("b\n");
Quoted 7 lines
Quoted 5 lines

emits a single line "ab"
(unless some other thread emits something in-between)

pr_cont or a bare printk can be used after a dev_info without a newline to avoid unwanted newlines.

i think i was not thinking while writing the previous mail.

It seems you were thinking then and now, but unfortunately, you are assuming a bit more than you have actual experience or knowledge of printk inner workings.

Quoted 3 lines

pr_info("a");
pr_info("b\n");
should print as "ab" ,

This is not true.

All pr_<level> uses but pr_cont always start on a new line by emitting a newline if the last line did not have one.

The difference between using:

pr_info("a")
pr_info("b\n")

and

pr_info("a\n")
pr_info("b\n")

is not emitted line count.

The first may unintentionally be continued by another thread using a printk that does not start with a KERN_<LEVEL>.

printk has had this behavior for ~5 years since these 2 commits:

commit e28d713704117bca0820c732210df6075b09f13b

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 11:02:28 2009 -0700

printk: Add KERN_DEFAULT printk log-level

This adds a KERN_DEFAULT loglevel marker, for when you cannot decide which loglevel you want, and just want to keep an existing printk with the default loglevel.

The difference between having KERN_DEFAULT and having no log-level marker at all is two-fold:

- having the log-level marker will now force a new-line if the previous printout had not added one (perhaps because it forgot, but perhaps because it expected a continuation)

- having a log-level marker is required if you are printing out a message that otherwise itself could perhaps otherwise be mistaken for a log-level.

and

commit 5fd29d6ccbc98884569d6f3105aeca70858b3e0f

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 10:57:02 2009 -0700

printk: clean up handling of log-levels and newlines

It used to be that we would only look at the log-level in a printk() after explicit newlines, which can cause annoying problems when the previous printk() did not end with a '\n'. In that case, the log-level marker would be just printed out in the middle of the line, and be seen as just noise rather than change the logging level.

This changes things to always look at the log-level in the first bytes of the printout. If a log level marker is found, it is always used as the log-level. Additionally, if no newline existed, one is added (unless the log-level is the explicit KERN_CONT marker, to explicitly show that it's a continuation of a previous line).

#7 lore raw

Re: [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

Quoted 10 lines · Joe Perches
Quoted 8 lines · Sudip Mukherjee
Quoted 3 lines · Joe Perches
Quoted 2 lines · Sudip Mukherjee
Quoted 1 line · Raymond Yau
Quoted 1 line

<snip>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

---

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

sound/pci/au88x0/au88x0_core.c static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode) · line 2693

Quoted 5 lines

static int vortex_core_init(vortex_t *vortex)
{

sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "Vortex: init.... ");
+       dev_info(vortex->card->dev, "init.... ");

Is it possible to add linefeed since "done/n" won't appear in

the same

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

line with init nor shutdown?

should we add linefeed ?
as of now it will print init.... then it will print done as the

init is complete.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

so dmesg will show us:

init....done.

same for shutdown.
but if we give linefeed , then it will become :

init....
done.

the meaning will be lost. and many user might just wonder what is

done ?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[]

Quoted 1 line
Quoted 1 line

Review static int vortex_core_init(vortex_t

Quoted 1 line
(quoted diff) +0 -0
@@ -2738,7 +2744,7 @@ static int vortex_core_init(vortex_t

*vortex)

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

sound/pci/au88x0/au88x0_core.c static int vortex_core_shutdown(vortex_t

Quoted 9 lines
sound/pci/au88x0/au88x0_core.c +1 -1
 static int vortex_core_shutdown(vortex_t * vortex)
 {
 
-       pr_info( "Vortex: shutdown...");
+       dev_info(vortex->card->dev, "shutdown...");
 #ifndef CHIP_AU8820
        vortex_eq_free(vortex);
        vortex_Vort3D_disable(vortex);
@@ -2760,7 +2766,7 @@ static int vortex_core_shutdown(vortex_t

* vortex)

Quoted 35 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines
Quoted 7 lines

sound/pci/au88x0/au88x0_core.c static int vortex_core_shutdown(vortex_t * vortex) · line 2771

Quoted 7 lines
sound/pci/au88x0/au88x0_core.c +1 -1
        msleep(5);
        hwwrite(vortex->mmio, VORTEX_IRQ_SOURCE, 0xffff);
 
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        return 0;
 }

It's actually on 2 lines before your patch.

    pr_info("a");
    pr_info("b\n");

already emits 2 separate lines.

    pr_info("a");
    pr_cont("b\n");
Quoted 7 lines
Quoted 5 lines

emits a single line "ab"
(unless some other thread emits something in-between)

pr_cont or a bare printk can be used after a dev_info without a newline to avoid unwanted newlines.

i think i was not thinking while writing the previous mail.

It seems you were thinking then and now, but unfortunately, you are assuming a bit more than you have actual experience or knowledge of printk inner workings.

Quoted 3 lines

pr_info("a");
pr_info("b\n");
should print as "ab" ,

Quoted 5 lines

This is not true.

All pr_<level> uses but pr_cont always start on a new line by emitting a newline if the last line did not have one.

oops... i have never tried with pr_* without a \n. I was thinking it will work like printf. sorry for the noise i created.
and thanks for the information about those 2 commits.
so, now in this case what will you suggest - shutdown and done both terminated by \n or some thing like : "shutdown process started" and then "shutdown done"....

thanks
sudip

Quoted 63 lines

The difference between using:

pr_info("a")
pr_info("b\n")

and

pr_info("a\n")
pr_info("b\n")

is not emitted line count.

The first may unintentionally be continued by another thread using a printk that does not start with a KERN_<LEVEL>.

printk has had this behavior for ~5 years since these 2 commits:

commit e28d713704117bca0820c732210df6075b09f13b

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 11:02:28 2009 -0700

printk: Add KERN_DEFAULT printk log-level

This adds a KERN_DEFAULT loglevel marker, for when you cannot decide which loglevel you want, and just want to keep an existing printk with the default loglevel.

The difference between having KERN_DEFAULT and having no log-level marker at all is two-fold:

- having the log-level marker will now force a new-line if the previous printout had not added one (perhaps because it forgot, but perhaps because it expected a continuation)

- having a log-level marker is required if you are printing out a message that otherwise itself could perhaps otherwise be mistaken for a log-level.

and

commit 5fd29d6ccbc98884569d6f3105aeca70858b3e0f

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 10:57:02 2009 -0700

printk: clean up handling of log-levels and newlines

It used to be that we would only look at the log-level in a printk() after explicit newlines, which can cause annoying problems when the previous printk() did not end with a '\n'. In that case, the log-level marker would be just printed out in the middle of the line, and be seen as just noise rather than change the logging level.

This changes things to always look at the log-level in the first bytes of the printout. If a log level marker is found, it is always used as the log-level. Additionally, if no newline existed, one is added (unless the log-level is the explicit KERN_CONT marker, to explicitly show that it's a continuation of a previous line).

#8 lore raw

Re: [alsa-devel] [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

Quoted 3 lines · Sudip Mukherjee

now in this case what will you suggest - shutdown and done both terminated by \n or some thing like : "shutdown process started" and then "shutdown done"....

I think it doesn't matter one way or another as it's only useful when there's a hang in the init or shutdown.

It is better though to have complete messages terminated with newlines so that it is not possible for other threads to confusingly interleave output.

#9 lore raw

Re: [alsa-devel] [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

In reply to Joe Perches
Quoted 77 lines · Joe Perches
Quoted 59 lines · Sudip Mukherjee
Quoted 3 lines · Joe Perches
Quoted 2 lines · Sudip Mukherjee
Quoted 1 line · Raymond Yau
Quoted 1 line

<snip>

Quoted 54 lines
Quoted 18 lines
Quoted 12 lines

sound/pci/au88x0/au88x0_core.c static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode) · line 2693

Quoted 8 lines

---

static int vortex_core_init(vortex_t *vortex)
{

sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "Vortex: init.... ");
+       dev_info(vortex->card->dev, "init.... ");

Is it possible to add linefeed since "done/n" won't appear in the same line with init nor shutdown?

should we add linefeed ?
as of now it will print init.... then it will print done as the init is complete. so dmesg will show us:

init....done.

Quoted 7 lines

same for shutdown.
but if we give linefeed , then it will become :

init....
done.

the meaning will be lost. and many user might just wonder what is done ?

[]

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
sound/pci/au88x0/au88x0_core.c +1 -1
@@ -2738,7 +2744,7 @@ static int vortex_core_init(vortex_t *vortex)
 static int vortex_core_shutdown(vortex_t * vortex)
 {
 
-       pr_info( "Vortex: shutdown...");
+       dev_info(vortex->card->dev, "shutdown...");
 #ifndef CHIP_AU8820
        vortex_eq_free(vortex);
        vortex_Vort3D_disable(vortex);
@@ -2760,7 +2766,7 @@ static int vortex_core_shutdown(vortex_t * vortex)
        msleep(5);
        hwwrite(vortex->mmio, VORTEX_IRQ_SOURCE, 0xffff);
 
Quoted 4 lines
Quoted 4 lines

sound/pci/au88x0/au88x0_core.c static int vortex_core_shutdown(vortex_t * vortex) · line 2771

Quoted 4 lines
sound/pci/au88x0/au88x0_core.c +1 -1
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        return 0;
 }

It's actually on 2 lines before your patch.

	pr_info("a");
	pr_info("b\n");

already emits 2 separate lines.

	pr_info("a");
	pr_cont("b\n");
Quoted 7 lines
Quoted 5 lines

emits a single line "ab"
(unless some other thread emits something in-between)

pr_cont or a bare printk can be used after a dev_info without a newline to avoid unwanted newlines.

i think i was not thinking while writing the previous mail.

It seems you were thinking then and now, but unfortunately, you are assuming a bit more than you have actual experience or knowledge of printk inner workings.

Quoted 3 lines

pr_info("a");
pr_info("b\n");
should print as "ab" ,

Quoted 6 lines

This is not true.

All pr_<level> uses but pr_cont always start on a new line by emitting a newline if the last line did not have one.

oops... i have never tried with pr_* without a \n. I was thinking it will work like printf. sorry for the noise i created.
and thanks for the information about those 2 commits.
so, now in this case what will you suggest - shutdown and done both terminated by \n or some thing like : "shutdown process started" and then "shutdown done"....

thanks
sudip

Quoted 62 lines

The difference between using:

pr_info("a")
pr_info("b\n")

and

pr_info("a\n")
pr_info("b\n")

is not emitted line count.

The first may unintentionally be continued by another thread using a printk that does not start with a KERN_<LEVEL>.

printk has had this behavior for ~5 years since these 2 commits:

commit e28d713704117bca0820c732210df6075b09f13b

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 11:02:28 2009 -0700

printk: Add KERN_DEFAULT printk log-level

This adds a KERN_DEFAULT loglevel marker, for when you cannot decide which loglevel you want, and just want to keep an existing printk with the default loglevel.

The difference between having KERN_DEFAULT and having no log-level marker at all is two-fold:

- having the log-level marker will now force a new-line if the previous printout had not added one (perhaps because it forgot, but perhaps because it expected a continuation)

- having a log-level marker is required if you are printing out a message that otherwise itself could perhaps otherwise be mistaken for a log-level.

and

commit 5fd29d6ccbc98884569d6f3105aeca70858b3e0f

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 10:57:02 2009 -0700

printk: clean up handling of log-levels and newlines

It used to be that we would only look at the log-level in a printk() after explicit newlines, which can cause annoying problems when the previous printk() did not end with a '\n'. In that case, the log-level marker would be just printed out in the middle of the line, and be seen as just noise rather than change the logging level.

This changes things to always look at the log-level in the first bytes of the printout. If a log level marker is found, it is always used as the log-level. Additionally, if no newline existed, one is added (unless the log-level is the explicit KERN_CONT marker, to explicitly show that it's a continuation of a previous line).

#10 lore raw

Re: [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

<snip>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

---

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Review

Quoted 5 lines

static int vortex_core_init(vortex_t *vortex)
{

(quoted diff) +1 -1
-       pr_info( "Vortex: init.... ");
+       dev_info(vortex->card->dev, "init.... ");

Is it possible to add linefeed since "done/n" won't appear in

the same

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

line with init nor shutdown?

should we add linefeed ?
as of now it will print init.... then it will print done as the

init is complete.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

so dmesg will show us:

init....done.

same for shutdown.
but if we give linefeed , then it will become :

init....
done.

the meaning will be lost. and many user might just wonder what is

done ?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[]

Quoted 1 line
Quoted 1 line

Review static int vortex_core_init(vortex_t

Quoted 1 line
(quoted diff) +0 -0
@@ -2738,7 +2744,7 @@ static int vortex_core_init(vortex_t

*vortex)

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Review static int

Quoted 9 lines
(quoted diff) +1 -1
 static int vortex_core_shutdown(vortex_t * vortex)
 {
 
-       pr_info( "Vortex: shutdown...");
+       dev_info(vortex->card->dev, "shutdown...");
 #ifndef CHIP_AU8820
        vortex_eq_free(vortex);
        vortex_Vort3D_disable(vortex);
@@ -2760,7 +2766,7 @@ static int

vortex_core_shutdown(vortex_t * vortex)

Quoted 49 lines
Quoted 35 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines
Quoted 7 lines

Review static int · line 2771

Quoted 7 lines
(quoted diff) +1 -1
        msleep(5);
        hwwrite(vortex->mmio, VORTEX_IRQ_SOURCE, 0xffff);
 
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        return 0;
 }

It's actually on 2 lines before your patch.

  pr_info("a");
  pr_info("b\n");

already emits 2 separate lines.

  pr_info("a");
  pr_cont("b\n");
Quoted 7 lines
Quoted 5 lines

emits a single line "ab"
(unless some other thread emits something in-between)

pr_cont or a bare printk can be used after a dev_info without a newline to avoid unwanted newlines.

i think i was not thinking while writing the previous mail.

It seems you were thinking then and now, but unfortunately, you are assuming a bit more than you have actual experience or knowledge of printk inner workings.

Quoted 3 lines

pr_info("a");
pr_info("b\n");
should print as "ab" ,

Quoted 6 lines

This is not true.

All pr_<level> uses but pr_cont always start on a new line by emitting a newline if the last line did not have one.

oops... i have never tried with pr_* without a \n. I was thinking it will work like printf. sorry for the noise i created.
and thanks for the information about those 2 commits.
so, now in this case what will you suggest - shutdown and done both terminated by \n or some thing like : "shutdown process started" and then "shutdown done"....

Quoted 55 lines

thanks
sudip

Quoted 51 lines

The difference between using:

pr_info("a")
pr_info("b\n")

and

pr_info("a\n")
pr_info("b\n")

is not emitted line count.

The first may unintentionally be continued by another thread using a printk that does not start with a KERN_<LEVEL>.

printk has had this behavior for ~5 years since these 2 commits:

commit e28d713704117bca0820c732210df6075b09f13b

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 11:02:28 2009 -0700

printk: Add KERN_DEFAULT printk log-level

This adds a KERN_DEFAULT loglevel marker, for when you cannot decide which loglevel you want, and just want to keep an existing printk with the default loglevel.

The difference between having KERN_DEFAULT and having no log-level marker at all is two-fold:

- having the log-level marker will now force a new-line if the previous printout had not added one (perhaps because it forgot, but perhaps because it expected a continuation)

- having a log-level marker is required if you are printing out a message that otherwise itself could perhaps otherwise be mistaken for a log-level.

and

commit 5fd29d6ccbc98884569d6f3105aeca70858b3e0f

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 10:57:02 2009 -0700

printk: clean up handling of log-levels and newlines

It used to be that we would only look at the log-level in a printk() after explicit newlines, which can cause annoying problems when the previous printk() did not end with a '\n'. In that case, the

log-level

Quoted 11 lines
Quoted 11 lines

marker would be just printed out in the middle of the line, and be seen as just noise rather than change the logging level.

This changes things to always look at the log-level in the first bytes of the printout. If a log level marker is found, it is always used as the log-level. Additionally, if no newline existed, one is added (unless the log-level is the explicit KERN_CONT marker, to explicitly show that it's a continuation of a previous line).

Do the driver still need two dev_info at startup and shutdown since most pci drivers won't print anything to system log when the driver is loaded or unloaded ?

The only case when the driver is not loaded without any error message when user specify snd-au8830 index=0 but the other sound card (e.g. snd-usb-audio already loaded as card 0)

#11 lore raw

Re: [alsa-devel] [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

At Thu, 16 Oct 2014 11:04:34 +0800,

Quoted 161 lines · Raymond Yau
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

<snip>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

---

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Review

Quoted 5 lines

static int vortex_core_init(vortex_t *vortex)
{

(quoted diff) +1 -1
-       pr_info( "Vortex: init.... ");
+       dev_info(vortex->card->dev, "init.... ");

Is it possible to add linefeed since "done/n" won't appear in

the same

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

line with init nor shutdown?

should we add linefeed ?
as of now it will print init.... then it will print done as the

init is complete.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

so dmesg will show us:

init....done.

same for shutdown.
but if we give linefeed , then it will become :

init....
done.

the meaning will be lost. and many user might just wonder what is

done ?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[]

Quoted 1 line
Quoted 1 line

Review static int vortex_core_init(vortex_t

Quoted 1 line
(quoted diff) +0 -0
@@ -2738,7 +2744,7 @@ static int vortex_core_init(vortex_t

*vortex)

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Review static int

Quoted 9 lines
(quoted diff) +1 -1
 static int vortex_core_shutdown(vortex_t * vortex)
 {
 
-       pr_info( "Vortex: shutdown...");
+       dev_info(vortex->card->dev, "shutdown...");
 #ifndef CHIP_AU8820
        vortex_eq_free(vortex);
        vortex_Vort3D_disable(vortex);
@@ -2760,7 +2766,7 @@ static int

vortex_core_shutdown(vortex_t * vortex)

Quoted 49 lines
Quoted 35 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines
Quoted 7 lines

Review static int · line 2771

Quoted 7 lines
(quoted diff) +1 -1
        msleep(5);
        hwwrite(vortex->mmio, VORTEX_IRQ_SOURCE, 0xffff);
 
-       pr_info( "done.\n");
+       dev_info(vortex->card->dev, "done.\n");
        return 0;
 }

It's actually on 2 lines before your patch.

  pr_info("a");
  pr_info("b\n");

already emits 2 separate lines.

  pr_info("a");
  pr_cont("b\n");
Quoted 7 lines
Quoted 5 lines

emits a single line "ab"
(unless some other thread emits something in-between)

pr_cont or a bare printk can be used after a dev_info without a newline to avoid unwanted newlines.

i think i was not thinking while writing the previous mail.

It seems you were thinking then and now, but unfortunately, you are assuming a bit more than you have actual experience or knowledge of printk inner workings.

Quoted 3 lines

pr_info("a");
pr_info("b\n");
should print as "ab" ,

Quoted 6 lines

This is not true.

All pr_<level> uses but pr_cont always start on a new line by emitting a newline if the last line did not have one.

oops... i have never tried with pr_* without a \n. I was thinking it will work like printf. sorry for the noise i created.
and thanks for the information about those 2 commits.
so, now in this case what will you suggest - shutdown and done both terminated by \n or some thing like : "shutdown process started" and then "shutdown done"....

Quoted 55 lines

thanks
sudip

Quoted 51 lines

The difference between using:

pr_info("a")
pr_info("b\n")

and

pr_info("a\n")
pr_info("b\n")

is not emitted line count.

The first may unintentionally be continued by another thread using a printk that does not start with a KERN_<LEVEL>.

printk has had this behavior for ~5 years since these 2 commits:

commit e28d713704117bca0820c732210df6075b09f13b

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 11:02:28 2009 -0700

printk: Add KERN_DEFAULT printk log-level

This adds a KERN_DEFAULT loglevel marker, for when you cannot decide which loglevel you want, and just want to keep an existing printk with the default loglevel.

The difference between having KERN_DEFAULT and having no log-level marker at all is two-fold:

- having the log-level marker will now force a new-line if the previous printout had not added one (perhaps because it forgot, but perhaps because it expected a continuation)

- having a log-level marker is required if you are printing out a message that otherwise itself could perhaps otherwise be mistaken for a log-level.

and

commit 5fd29d6ccbc98884569d6f3105aeca70858b3e0f

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 10:57:02 2009 -0700

printk: clean up handling of log-levels and newlines

It used to be that we would only look at the log-level in a printk() after explicit newlines, which can cause annoying problems when the previous printk() did not end with a '\n'. In that case, the

log-level

Quoted 11 lines
Quoted 11 lines

marker would be just printed out in the middle of the line, and be seen as just noise rather than change the logging level.

This changes things to always look at the log-level in the first bytes of the printout. If a log level marker is found, it is always used as the log-level. Additionally, if no newline existed, one is added (unless the log-level is the explicit KERN_CONT marker, to explicitly show that it's a continuation of a previous line).

Quoted 3 lines

Do the driver still need two dev_info at startup and shutdown since most pci drivers won't print anything to system log when the driver is loaded or unloaded ?

Definitely not needed, but the intention of this patch is to convert to dev_*(). There are some cleanups, but it's for removing redundant strings, so it's a bit different from changing the log level of the original code. You can submit an additional patch to adjust the log levels more appropriately.

Takashi

#12 lore raw

Re: [alsa-devel] [PATCH v2 2/2] ALSA: au88x0: pr_* replaced with dev_*

Quoted 2 lines · Takashi Iwai

At Thu, 16 Oct 2014 11:04:34 +0800,
Raymond Yau wrote:

<snip>

Quoted 51 lines
Quoted 47 lines
Quoted 29 lines
Quoted 29 lines

since these 2 commits:

commit e28d713704117bca0820c732210df6075b09f13b

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 11:02:28 2009 -0700

printk: Add KERN_DEFAULT printk log-level

This adds a KERN_DEFAULT loglevel marker, for when you cannot decide which loglevel you want, and just want to keep an existing printk with the default loglevel.

The difference between having KERN_DEFAULT and having no log-level marker at all is two-fold:

- having the log-level marker will now force a new-line if the previous printout had not added one (perhaps because it forgot, but perhaps because it expected a continuation)

- having a log-level marker is required if you are printing out a message that otherwise itself could perhaps otherwise be mistaken for a log-level.

and

commit 5fd29d6ccbc98884569d6f3105aeca70858b3e0f

Author: Linus Torvalds <[email protected]>
Date:   Tue Jun 16 10:57:02 2009 -0700
Quoted 5 lines
Quoted 5 lines

printk: clean up handling of log-levels and newlines

It used to be that we would only look at the log-level in a printk() after explicit newlines, which can cause annoying problems when the previous printk() did not end with a '\n'. In that case, the

log-level

Quoted 11 lines
Quoted 11 lines

marker would be just printed out in the middle of the line, and be seen as just noise rather than change the logging level.

This changes things to always look at the log-level in the first bytes of the printout. If a log level marker is found, it is always used as the log-level. Additionally, if no newline existed, one is added (unless the log-level is the explicit KERN_CONT marker, to explicitly show that it's a continuation of a previous line).

Quoted 3 lines

Do the driver still need two dev_info at startup and shutdown since most pci drivers won't print anything to system log when the driver is loaded or unloaded ?

Quoted 6 lines

Definitely not needed, but the intention of this patch is to convert to dev_*(). There are some cleanups, but it's for removing redundant strings, so it's a bit different from changing the log level of the original code. You can submit an additional patch to adjust the log levels more appropriately.

sure , I will submit a separate patch for cleaning up these extra dev_info.

thanks
sudip

Quoted 2 lines

Takashi