Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: wss: 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.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240807133452.9424-37-tiwai@suse.de

+90 -88
+90 -88
sound/isa/wss/wss_lib.c
··· 187 187 snd_wss_wait(chip); 188 188 #ifdef CONFIG_SND_DEBUG 189 189 if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) 190 - snd_printk(KERN_DEBUG "out: auto calibration time out " 191 - "- reg = 0x%x, value = 0x%x\n", reg, value); 190 + dev_dbg(chip->card->dev, 191 + "out: auto calibration time out - reg = 0x%x, value = 0x%x\n", 192 + reg, value); 192 193 #endif 193 194 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); 194 195 wss_outb(chip, CS4231P(REG), value); 195 196 chip->image[reg] = value; 196 197 mb(); 197 - snd_printdd("codec out - reg 0x%x = 0x%x\n", 198 - chip->mce_bit | reg, value); 198 + dev_dbg(chip->card->dev, "codec out - reg 0x%x = 0x%x\n", 199 + chip->mce_bit | reg, value); 199 200 } 200 201 EXPORT_SYMBOL(snd_wss_out); 201 202 ··· 205 204 snd_wss_wait(chip); 206 205 #ifdef CONFIG_SND_DEBUG 207 206 if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) 208 - snd_printk(KERN_DEBUG "in: auto calibration time out " 209 - "- reg = 0x%x\n", reg); 207 + dev_dbg(chip->card->dev, 208 + "in: auto calibration time out - reg = 0x%x\n", reg); 210 209 #endif 211 210 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); 212 211 mb(); ··· 223 222 wss_outb(chip, CS4231P(REG), val); 224 223 chip->eimage[CS4236_REG(reg)] = val; 225 224 #if 0 226 - printk(KERN_DEBUG "ext out : reg = 0x%x, val = 0x%x\n", reg, val); 225 + dev_dbg(chip->card->dev, "ext out : reg = 0x%x, val = 0x%x\n", reg, val); 227 226 #endif 228 227 } 229 228 EXPORT_SYMBOL(snd_cs4236_ext_out); ··· 239 238 { 240 239 unsigned char res; 241 240 res = wss_inb(chip, CS4231P(REG)); 242 - printk(KERN_DEBUG "ext in : reg = 0x%x, val = 0x%x\n", 243 - reg, res); 241 + dev_dbg(chip->card->dev, "ext in : reg = 0x%x, val = 0x%x\n", 242 + reg, res); 244 243 return res; 245 244 } 246 245 #endif ··· 251 250 252 251 static void snd_wss_debug(struct snd_wss *chip) 253 252 { 254 - printk(KERN_DEBUG 253 + dev_dbg(chip->card->dev, 255 254 "CS4231 REGS: INDEX = 0x%02x " 256 255 " STATUS = 0x%02x\n", 257 256 wss_inb(chip, CS4231P(REGSEL)), 258 257 wss_inb(chip, CS4231P(STATUS))); 259 - printk(KERN_DEBUG 258 + dev_dbg(chip->card->dev, 260 259 " 0x00: left input = 0x%02x " 261 260 " 0x10: alt 1 (CFIG 2) = 0x%02x\n", 262 261 snd_wss_in(chip, 0x00), 263 262 snd_wss_in(chip, 0x10)); 264 - printk(KERN_DEBUG 263 + dev_dbg(chip->card->dev, 265 264 " 0x01: right input = 0x%02x " 266 265 " 0x11: alt 2 (CFIG 3) = 0x%02x\n", 267 266 snd_wss_in(chip, 0x01), 268 267 snd_wss_in(chip, 0x11)); 269 - printk(KERN_DEBUG 268 + dev_dbg(chip->card->dev, 270 269 " 0x02: GF1 left input = 0x%02x " 271 270 " 0x12: left line in = 0x%02x\n", 272 271 snd_wss_in(chip, 0x02), 273 272 snd_wss_in(chip, 0x12)); 274 - printk(KERN_DEBUG 273 + dev_dbg(chip->card->dev, 275 274 " 0x03: GF1 right input = 0x%02x " 276 275 " 0x13: right line in = 0x%02x\n", 277 276 snd_wss_in(chip, 0x03), 278 277 snd_wss_in(chip, 0x13)); 279 - printk(KERN_DEBUG 278 + dev_dbg(chip->card->dev, 280 279 " 0x04: CD left input = 0x%02x " 281 280 " 0x14: timer low = 0x%02x\n", 282 281 snd_wss_in(chip, 0x04), 283 282 snd_wss_in(chip, 0x14)); 284 - printk(KERN_DEBUG 283 + dev_dbg(chip->card->dev, 285 284 " 0x05: CD right input = 0x%02x " 286 285 " 0x15: timer high = 0x%02x\n", 287 286 snd_wss_in(chip, 0x05), 288 287 snd_wss_in(chip, 0x15)); 289 - printk(KERN_DEBUG 288 + dev_dbg(chip->card->dev, 290 289 " 0x06: left output = 0x%02x " 291 290 " 0x16: left MIC (PnP) = 0x%02x\n", 292 291 snd_wss_in(chip, 0x06), 293 292 snd_wss_in(chip, 0x16)); 294 - printk(KERN_DEBUG 293 + dev_dbg(chip->card->dev, 295 294 " 0x07: right output = 0x%02x " 296 295 " 0x17: right MIC (PnP) = 0x%02x\n", 297 296 snd_wss_in(chip, 0x07), 298 297 snd_wss_in(chip, 0x17)); 299 - printk(KERN_DEBUG 298 + dev_dbg(chip->card->dev, 300 299 " 0x08: playback format = 0x%02x " 301 300 " 0x18: IRQ status = 0x%02x\n", 302 301 snd_wss_in(chip, 0x08), 303 302 snd_wss_in(chip, 0x18)); 304 - printk(KERN_DEBUG 303 + dev_dbg(chip->card->dev, 305 304 " 0x09: iface (CFIG 1) = 0x%02x " 306 305 " 0x19: left line out = 0x%02x\n", 307 306 snd_wss_in(chip, 0x09), 308 307 snd_wss_in(chip, 0x19)); 309 - printk(KERN_DEBUG 308 + dev_dbg(chip->card->dev, 310 309 " 0x0a: pin control = 0x%02x " 311 310 " 0x1a: mono control = 0x%02x\n", 312 311 snd_wss_in(chip, 0x0a), 313 312 snd_wss_in(chip, 0x1a)); 314 - printk(KERN_DEBUG 313 + dev_dbg(chip->card->dev, 315 314 " 0x0b: init & status = 0x%02x " 316 315 " 0x1b: right line out = 0x%02x\n", 317 316 snd_wss_in(chip, 0x0b), 318 317 snd_wss_in(chip, 0x1b)); 319 - printk(KERN_DEBUG 318 + dev_dbg(chip->card->dev, 320 319 " 0x0c: revision & mode = 0x%02x " 321 320 " 0x1c: record format = 0x%02x\n", 322 321 snd_wss_in(chip, 0x0c), 323 322 snd_wss_in(chip, 0x1c)); 324 - printk(KERN_DEBUG 323 + dev_dbg(chip->card->dev, 325 324 " 0x0d: loopback = 0x%02x " 326 325 " 0x1d: var freq (PnP) = 0x%02x\n", 327 326 snd_wss_in(chip, 0x0d), 328 327 snd_wss_in(chip, 0x1d)); 329 - printk(KERN_DEBUG 328 + dev_dbg(chip->card->dev, 330 329 " 0x0e: ply upr count = 0x%02x " 331 330 " 0x1e: ply lwr count = 0x%02x\n", 332 331 snd_wss_in(chip, 0x0e), 333 332 snd_wss_in(chip, 0x1e)); 334 - printk(KERN_DEBUG 333 + dev_dbg(chip->card->dev, 335 334 " 0x0f: rec upr count = 0x%02x " 336 335 " 0x1f: rec lwr count = 0x%02x\n", 337 336 snd_wss_in(chip, 0x0f), ··· 366 365 snd_wss_wait(chip); 367 366 #ifdef CONFIG_SND_DEBUG 368 367 if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) 369 - snd_printk(KERN_DEBUG 370 - "mce_up - auto calibration time out (0)\n"); 368 + dev_dbg(chip->card->dev, 369 + "mce_up - auto calibration time out (0)\n"); 371 370 #endif 372 371 spin_lock_irqsave(&chip->reg_lock, flags); 373 372 chip->mce_bit |= CS4231_MCE; 374 373 timeout = wss_inb(chip, CS4231P(REGSEL)); 375 374 if (timeout == 0x80) 376 - snd_printk(KERN_DEBUG "mce_up [0x%lx]: " 377 - "serious init problem - codec still busy\n", 378 - chip->port); 375 + dev_dbg(chip->card->dev, 376 + "mce_up [0x%lx]: serious init problem - codec still busy\n", 377 + chip->port); 379 378 if (!(timeout & CS4231_MCE)) 380 379 wss_outb(chip, CS4231P(REGSEL), 381 380 chip->mce_bit | (timeout & 0x1f)); ··· 394 393 395 394 #ifdef CONFIG_SND_DEBUG 396 395 if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) 397 - snd_printk(KERN_DEBUG "mce_down [0x%lx] - " 398 - "auto calibration time out (0)\n", 399 - (long)CS4231P(REGSEL)); 396 + dev_dbg(chip->card->dev, 397 + "mce_down [0x%lx] - auto calibration time out (0)\n", 398 + (long)CS4231P(REGSEL)); 400 399 #endif 401 400 spin_lock_irqsave(&chip->reg_lock, flags); 402 401 chip->mce_bit &= ~CS4231_MCE; ··· 404 403 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); 405 404 spin_unlock_irqrestore(&chip->reg_lock, flags); 406 405 if (timeout == 0x80) 407 - snd_printk(KERN_DEBUG "mce_down [0x%lx]: " 408 - "serious init problem - codec still busy\n", 409 - chip->port); 406 + dev_dbg(chip->card->dev, 407 + "mce_down [0x%lx]: serious init problem - codec still busy\n", 408 + chip->port); 410 409 if ((timeout & CS4231_MCE) == 0 || !(chip->hardware & hw_mask)) 411 410 return; 412 411 ··· 417 416 */ 418 417 msleep(1); 419 418 420 - snd_printdd("(1) jiffies = %lu\n", jiffies); 419 + dev_dbg(chip->card->dev, "(1) jiffies = %lu\n", jiffies); 421 420 422 421 /* check condition up to 250 ms */ 423 422 end_time = jiffies + msecs_to_jiffies(250); ··· 425 424 CS4231_CALIB_IN_PROGRESS) { 426 425 427 426 if (time_after(jiffies, end_time)) { 428 - snd_printk(KERN_ERR "mce_down - " 429 - "auto calibration time out (2)\n"); 427 + dev_err(chip->card->dev, 428 + "mce_down - auto calibration time out (2)\n"); 430 429 return; 431 430 } 432 431 msleep(1); 433 432 } 434 433 435 - snd_printdd("(2) jiffies = %lu\n", jiffies); 434 + dev_dbg(chip->card->dev, "(2) jiffies = %lu\n", jiffies); 436 435 437 436 /* check condition up to 100 ms */ 438 437 end_time = jiffies + msecs_to_jiffies(100); 439 438 while (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) { 440 439 if (time_after(jiffies, end_time)) { 441 - snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); 440 + dev_err(chip->card->dev, 441 + "mce_down - auto calibration time out (3)\n"); 442 442 return; 443 443 } 444 444 msleep(1); 445 445 } 446 446 447 - snd_printdd("(3) jiffies = %lu\n", jiffies); 448 - snd_printd("mce_down - exit = 0x%x\n", wss_inb(chip, CS4231P(REGSEL))); 447 + dev_dbg(chip->card->dev, "(3) jiffies = %lu\n", jiffies); 448 + dev_dbg(chip->card->dev, "mce_down - exit = 0x%x\n", 449 + wss_inb(chip, CS4231P(REGSEL))); 449 450 } 450 451 EXPORT_SYMBOL(snd_wss_mce_down); 451 452 ··· 546 543 if (channels > 1) 547 544 rformat |= CS4231_STEREO; 548 545 #if 0 549 - snd_printk(KERN_DEBUG "get_format: 0x%x (mode=0x%x)\n", format, mode); 546 + dev_dbg(chip->card->dev, "get_format: 0x%x (mode=0x%x)\n", format, mode); 550 547 #endif 551 548 return rformat; 552 549 } ··· 796 793 snd_wss_mce_down(chip); 797 794 798 795 #ifdef SNDRV_DEBUG_MCE 799 - snd_printk(KERN_DEBUG "init: (1)\n"); 796 + dev_dbg(chip->card->dev, "init: (1)\n"); 800 797 #endif 801 798 snd_wss_mce_up(chip); 802 799 spin_lock_irqsave(&chip->reg_lock, flags); ··· 811 808 snd_wss_mce_down(chip); 812 809 813 810 #ifdef SNDRV_DEBUG_MCE 814 - snd_printk(KERN_DEBUG "init: (2)\n"); 811 + dev_dbg(chip->card->dev, "init: (2)\n"); 815 812 #endif 816 813 817 814 snd_wss_mce_up(chip); ··· 824 821 snd_wss_mce_down(chip); 825 822 826 823 #ifdef SNDRV_DEBUG_MCE 827 - snd_printk(KERN_DEBUG "init: (3) - afei = 0x%x\n", 828 - chip->image[CS4231_ALT_FEATURE_1]); 824 + dev_dbg(chip->card->dev, "init: (3) - afei = 0x%x\n", 825 + chip->image[CS4231_ALT_FEATURE_1]); 829 826 #endif 830 827 831 828 spin_lock_irqsave(&chip->reg_lock, flags); ··· 841 838 snd_wss_mce_down(chip); 842 839 843 840 #ifdef SNDRV_DEBUG_MCE 844 - snd_printk(KERN_DEBUG "init: (4)\n"); 841 + dev_dbg(chip->card->dev, "init: (4)\n"); 845 842 #endif 846 843 847 844 snd_wss_mce_up(chip); ··· 854 851 snd_wss_calibrate_mute(chip, 0); 855 852 856 853 #ifdef SNDRV_DEBUG_MCE 857 - snd_printk(KERN_DEBUG "init: (5)\n"); 854 + dev_dbg(chip->card->dev, "init: (5)\n"); 858 855 #endif 859 856 } 860 857 ··· 1259 1256 break; /* this is valid value */ 1260 1257 } 1261 1258 } 1262 - snd_printdd("wss: port = 0x%lx, id = 0x%x\n", chip->port, id); 1259 + dev_dbg(chip->card->dev, "wss: port = 0x%lx, id = 0x%x\n", 1260 + chip->port, id); 1263 1261 if (id != 0x0a) 1264 1262 return -ENODEV; /* no valid device found */ 1265 1263 1266 1264 rev = snd_wss_in(chip, CS4231_VERSION) & 0xe7; 1267 - snd_printdd("CS4231: VERSION (I25) = 0x%x\n", rev); 1265 + dev_dbg(chip->card->dev, "CS4231: VERSION (I25) = 0x%x\n", rev); 1268 1266 if (rev == 0x80) { 1269 1267 unsigned char tmp = snd_wss_in(chip, 23); 1270 1268 snd_wss_out(chip, 23, ~tmp); ··· 1284 1280 } else if (rev == 0x03) { 1285 1281 chip->hardware = WSS_HW_CS4236B; 1286 1282 } else { 1287 - snd_printk(KERN_ERR 1288 - "unknown CS chip with version 0x%x\n", rev); 1283 + dev_err(chip->card->dev, 1284 + "unknown CS chip with version 0x%x\n", rev); 1289 1285 return -ENODEV; /* unknown CS4231 chip? */ 1290 1286 } 1291 1287 } ··· 1344 1340 snd_cs4236_ext_out(chip, CS4236_VERSION, 0xff); 1345 1341 id = snd_cs4236_ext_in(chip, CS4236_VERSION); 1346 1342 snd_cs4236_ext_out(chip, CS4236_VERSION, rev); 1347 - snd_printdd("CS4231: ext version; rev = 0x%x, id = 0x%x\n", rev, id); 1343 + dev_dbg(chip->card->dev, 1344 + "CS4231: ext version; rev = 0x%x, id = 0x%x\n", 1345 + rev, id); 1348 1346 if ((id & 0x1f) == 0x1d) { /* CS4235 */ 1349 1347 chip->hardware = WSS_HW_CS4235; 1350 1348 switch (id >> 5) { ··· 1355 1349 case 6: 1356 1350 break; 1357 1351 default: 1358 - snd_printk(KERN_WARNING 1359 - "unknown CS4235 chip " 1360 - "(enhanced version = 0x%x)\n", 1361 - id); 1352 + dev_warn(chip->card->dev, 1353 + "unknown CS4235 chip (enhanced version = 0x%x)\n", 1354 + id); 1362 1355 } 1363 1356 } else if ((id & 0x1f) == 0x0b) { /* CS4236/B */ 1364 1357 switch (id >> 5) { ··· 1368 1363 chip->hardware = WSS_HW_CS4236B; 1369 1364 break; 1370 1365 default: 1371 - snd_printk(KERN_WARNING 1372 - "unknown CS4236 chip " 1373 - "(enhanced version = 0x%x)\n", 1374 - id); 1366 + dev_warn(chip->card->dev, 1367 + "unknown CS4236 chip (enhanced version = 0x%x)\n", 1368 + id); 1375 1369 } 1376 1370 } else if ((id & 0x1f) == 0x08) { /* CS4237B */ 1377 1371 chip->hardware = WSS_HW_CS4237B; ··· 1381 1377 case 7: 1382 1378 break; 1383 1379 default: 1384 - snd_printk(KERN_WARNING 1385 - "unknown CS4237B chip " 1386 - "(enhanced version = 0x%x)\n", 1387 - id); 1380 + dev_warn(chip->card->dev, 1381 + "unknown CS4237B chip (enhanced version = 0x%x)\n", 1382 + id); 1388 1383 } 1389 1384 } else if ((id & 0x1f) == 0x09) { /* CS4238B */ 1390 1385 chip->hardware = WSS_HW_CS4238B; ··· 1393 1390 case 7: 1394 1391 break; 1395 1392 default: 1396 - snd_printk(KERN_WARNING 1397 - "unknown CS4238B chip " 1398 - "(enhanced version = 0x%x)\n", 1399 - id); 1393 + dev_warn(chip->card->dev, 1394 + "unknown CS4238B chip (enhanced version = 0x%x)\n", 1395 + id); 1400 1396 } 1401 1397 } else if ((id & 0x1f) == 0x1e) { /* CS4239 */ 1402 1398 chip->hardware = WSS_HW_CS4239; ··· 1405 1403 case 6: 1406 1404 break; 1407 1405 default: 1408 - snd_printk(KERN_WARNING 1409 - "unknown CS4239 chip " 1410 - "(enhanced version = 0x%x)\n", 1411 - id); 1406 + dev_warn(chip->card->dev, 1407 + "unknown CS4239 chip (enhanced version = 0x%x)\n", 1408 + id); 1412 1409 } 1413 1410 } else { 1414 - snd_printk(KERN_WARNING 1415 - "unknown CS4236/CS423xB chip " 1416 - "(enhanced version = 0x%x)\n", id); 1411 + dev_warn(chip->card->dev, 1412 + "unknown CS4236/CS423xB chip (enhanced version = 0x%x)\n", 1413 + id); 1417 1414 } 1418 1415 } 1419 1416 } ··· 1645 1644 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); 1646 1645 spin_unlock_irqrestore(&chip->reg_lock, flags); 1647 1646 if (timeout == 0x80) 1648 - snd_printk(KERN_ERR "down [0x%lx]: serious init problem " 1649 - "- codec still busy\n", chip->port); 1647 + dev_err(chip->card->dev 1648 + "down [0x%lx]: serious init problem - codec still busy\n", 1649 + chip->port); 1650 1650 if ((timeout & CS4231_MCE) == 0 || 1651 1651 !(chip->hardware & (WSS_HW_CS4231_MASK | WSS_HW_CS4232_MASK))) { 1652 1652 return; ··· 1759 1757 1760 1758 chip->res_port = devm_request_region(card->dev, port, 4, "WSS"); 1761 1759 if (!chip->res_port) { 1762 - snd_printk(KERN_ERR "wss: can't grab port 0x%lx\n", port); 1760 + dev_err(chip->card->dev, "wss: can't grab port 0x%lx\n", port); 1763 1761 return -EBUSY; 1764 1762 } 1765 1763 chip->port = port; ··· 1767 1765 chip->res_cport = devm_request_region(card->dev, cport, 8, 1768 1766 "CS4232 Control"); 1769 1767 if (!chip->res_cport) { 1770 - snd_printk(KERN_ERR 1768 + dev_err(chip->card->dev, 1771 1769 "wss: can't grab control port 0x%lx\n", cport); 1772 1770 return -ENODEV; 1773 1771 } ··· 1776 1774 if (!(hwshare & WSS_HWSHARE_IRQ)) 1777 1775 if (devm_request_irq(card->dev, irq, snd_wss_interrupt, 0, 1778 1776 "WSS", (void *) chip)) { 1779 - snd_printk(KERN_ERR "wss: can't grab IRQ %d\n", irq); 1777 + dev_err(chip->card->dev, "wss: can't grab IRQ %d\n", irq); 1780 1778 return -EBUSY; 1781 1779 } 1782 1780 chip->irq = irq; 1783 1781 card->sync_irq = chip->irq; 1784 1782 if (!(hwshare & WSS_HWSHARE_DMA1) && 1785 1783 snd_devm_request_dma(card->dev, dma1, "WSS - 1")) { 1786 - snd_printk(KERN_ERR "wss: can't grab DMA1 %d\n", dma1); 1784 + dev_err(chip->card->dev, "wss: can't grab DMA1 %d\n", dma1); 1787 1785 return -EBUSY; 1788 1786 } 1789 1787 chip->dma1 = dma1; 1790 1788 if (!(hwshare & WSS_HWSHARE_DMA2) && dma1 != dma2 && dma2 >= 0 && 1791 1789 snd_devm_request_dma(card->dev, dma2, "WSS - 2")) { 1792 - snd_printk(KERN_ERR "wss: can't grab DMA2 %d\n", dma2); 1790 + dev_err(chip->card->dev, "wss: can't grab DMA2 %d\n", dma2); 1793 1791 return -EBUSY; 1794 1792 } 1795 1793 if (dma1 == dma2 || dma2 < 0) { ··· 1812 1810 #if 0 1813 1811 if (chip->hardware & WSS_HW_CS4232_MASK) { 1814 1812 if (chip->res_cport == NULL) 1815 - snd_printk(KERN_ERR "CS4232 control port features are " 1816 - "not accessible\n"); 1813 + dev_err(chip->card->dev, 1814 + "CS4232 control port features are not accessible\n"); 1817 1815 } 1818 1816 #endif 1819 1817