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

ALSA: ppc: 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-50-tiwai@suse.de

+41 -45
+2 -2
sound/ppc/awacs.c
··· 39 39 while (!(in_le32(&chip->awacs->codec_stat) & MASK_VALID)) { 40 40 mdelay(1); 41 41 if (! --timeout) { 42 - snd_printd("snd_pmac_screamer_wait timeout\n"); 42 + dev_dbg(chip->card->dev, "%s timeout\n", __func__); 43 43 break; 44 44 } 45 45 } ··· 58 58 out_le32(&chip->awacs->codec_ctrl, val | (chip->subframe << 22)); 59 59 while (in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) { 60 60 if (! --timeout) { 61 - snd_printd("snd_pmac_awacs_write timeout\n"); 61 + dev_dbg(chip->card->dev, "%s timeout\n", __func__); 62 62 break; 63 63 } 64 64 }
+1 -1
sound/ppc/daca.c
··· 69 69 data[1] |= mix->deemphasis ? 0x40 : 0; 70 70 if (i2c_smbus_write_block_data(mix->i2c.client, DACA_REG_AVOL, 71 71 2, data) < 0) { 72 - snd_printk(KERN_ERR "failed to set volume \n"); 72 + dev_err(&mix->i2c.client->dev, "failed to set volume\n"); 73 73 return -EINVAL; 74 74 } 75 75 return 0;
+3 -2
sound/ppc/keywest.c
··· 113 113 114 114 err = keywest_ctx->init_client(keywest_ctx); 115 115 if (err < 0) { 116 - snd_printk(KERN_ERR "tumbler: %i :cannot initialize the MCS\n", err); 116 + dev_err(&keywest_ctx->client->dev, 117 + "tumbler: %i :cannot initialize the MCS\n", err); 117 118 return err; 118 119 } 119 120 return 0; ··· 137 136 138 137 err = i2c_add_driver(&keywest_driver); 139 138 if (err) { 140 - snd_printk(KERN_ERR "cannot register keywest i2c driver\n"); 139 + dev_err(&i2c->client->dev, "cannot register keywest i2c driver\n"); 141 140 i2c_put_adapter(adap); 142 141 return err; 143 142 }
+24 -28
sound/ppc/pmac.c
··· 269 269 case SNDRV_PCM_TRIGGER_SUSPEND: 270 270 spin_lock(&chip->reg_lock); 271 271 rec->running = 0; 272 - /*printk(KERN_DEBUG "stopped!!\n");*/ 273 272 snd_pmac_dma_stop(rec); 274 273 for (i = 0, cp = rec->cmd.cmds; i < rec->nperiods; i++, cp++) 275 274 out_le16(&cp->command, DBDMA_STOP); ··· 303 304 } 304 305 #endif 305 306 count += rec->cur_period * rec->period_size; 306 - /*printk(KERN_DEBUG "pointer=%d\n", count);*/ 307 307 return bytes_to_frames(subs->runtime, count); 308 308 } 309 309 ··· 382 384 unsigned short req, res ; 383 385 unsigned int phy ; 384 386 385 - /* printk(KERN_WARNING "snd-powermac: DMA died - patching it up!\n"); */ 386 - 387 387 /* to clear DEAD status we must first clear RUN 388 388 set it to quiescent to be on the safe side */ 389 389 (void)in_le32(&rec->dma->status); ··· 452 456 if (! (stat & ACTIVE)) 453 457 break; 454 458 455 - /*printk(KERN_DEBUG "update frag %d\n", rec->cur_period);*/ 456 459 cp->xfer_status = cpu_to_le16(0); 457 460 cp->req_count = cpu_to_le16(rec->period_size); 458 461 /*cp->res_count = cpu_to_le16(0);*/ ··· 765 770 struct snd_pmac *chip = devid; 766 771 int ctrl = in_le32(&chip->awacs->control); 767 772 768 - /*printk(KERN_DEBUG "pmac: control interrupt.. 0x%x\n", ctrl);*/ 769 773 if (ctrl & MASK_PORTCHG) { 770 774 /* do something when headphone is plugged/unplugged? */ 771 775 if (chip->update_automute) ··· 773 779 if (ctrl & MASK_CNTLERR) { 774 780 int err = (in_le32(&chip->awacs->codec_stat) & MASK_ERRCODE) >> 16; 775 781 if (err && chip->model <= PMAC_SCREAMER) 776 - snd_printk(KERN_DEBUG "error %x\n", err); 782 + dev_dbg(chip->card->dev, "%s: error %x\n", __func__, err); 777 783 } 778 784 /* Writing 1s to the CNTLERR and PORTCHG bits clears them... */ 779 785 out_le32(&chip->awacs->control, ctrl); ··· 958 964 if (prop) { 959 965 /* partly deprecate snd-powermac, for those machines 960 966 * that have a layout-id property for now */ 961 - printk(KERN_INFO "snd-powermac no longer handles any " 962 - "machines with a layout-id property " 963 - "in the device-tree, use snd-aoa.\n"); 967 + dev_info(chip->card->dev, 968 + "snd-powermac no longer handles any machines with a layout-id property in the device-tree, use snd-aoa.\n"); 964 969 of_node_put(sound); 965 970 of_node_put(chip->node); 966 971 chip->node = NULL; ··· 1014 1021 */ 1015 1022 macio = macio_find(chip->node, macio_unknown); 1016 1023 if (macio == NULL) 1017 - printk(KERN_WARNING "snd-powermac: can't locate macio !\n"); 1024 + dev_warn(chip->card->dev, "snd-powermac: can't locate macio !\n"); 1018 1025 else { 1019 1026 struct pci_dev *pdev = NULL; 1020 1027 ··· 1027 1034 } 1028 1035 } 1029 1036 if (chip->pdev == NULL) 1030 - printk(KERN_WARNING "snd-powermac: can't locate macio PCI" 1031 - " device !\n"); 1037 + dev_warn(chip->card->dev, 1038 + "snd-powermac: can't locate macio PCI device !\n"); 1032 1039 1033 1040 detect_byte_swap(chip); 1034 1041 ··· 1118 1125 chip->auto_mute = 1; 1119 1126 err = snd_ctl_add(chip->card, snd_ctl_new1(&auto_mute_controls[0], chip)); 1120 1127 if (err < 0) { 1121 - printk(KERN_ERR "snd-powermac: Failed to add automute control\n"); 1128 + dev_err(chip->card->dev, 1129 + "snd-powermac: Failed to add automute control\n"); 1122 1130 return err; 1123 1131 } 1124 1132 chip->hp_detect_ctl = snd_ctl_new1(&auto_mute_controls[1], chip); ··· 1174 1180 for (i = 0; i < 2; i ++) { 1175 1181 if (of_address_to_resource(np->parent, i, 1176 1182 &chip->rsrc[i])) { 1177 - printk(KERN_ERR "snd: can't translate rsrc " 1178 - " %d (%s)\n", i, rnames[i]); 1183 + dev_err(chip->card->dev, 1184 + "snd: can't translate rsrc %d (%s)\n", 1185 + i, rnames[i]); 1179 1186 err = -ENODEV; 1180 1187 goto __error; 1181 1188 } 1182 1189 if (request_mem_region(chip->rsrc[i].start, 1183 1190 resource_size(&chip->rsrc[i]), 1184 1191 rnames[i]) == NULL) { 1185 - printk(KERN_ERR "snd: can't request rsrc " 1186 - " %d (%s: %pR)\n", 1187 - i, rnames[i], &chip->rsrc[i]); 1192 + dev_err(chip->card->dev, 1193 + "snd: can't request rsrc %d (%s: %pR)\n", 1194 + i, rnames[i], &chip->rsrc[i]); 1188 1195 err = -ENODEV; 1189 1196 goto __error; 1190 1197 } ··· 1200 1205 for (i = 0; i < 3; i ++) { 1201 1206 if (of_address_to_resource(np, i, 1202 1207 &chip->rsrc[i])) { 1203 - printk(KERN_ERR "snd: can't translate rsrc " 1204 - " %d (%s)\n", i, rnames[i]); 1208 + dev_err(chip->card->dev, 1209 + "snd: can't translate rsrc %d (%s)\n", 1210 + i, rnames[i]); 1205 1211 err = -ENODEV; 1206 1212 goto __error; 1207 1213 } 1208 1214 if (request_mem_region(chip->rsrc[i].start, 1209 1215 resource_size(&chip->rsrc[i]), 1210 1216 rnames[i]) == NULL) { 1211 - printk(KERN_ERR "snd: can't request rsrc " 1212 - " %d (%s: %pR)\n", 1213 - i, rnames[i], &chip->rsrc[i]); 1217 + dev_err(chip->card->dev, 1218 + "snd: can't request rsrc %d (%s: %pR)\n", 1219 + i, rnames[i], &chip->rsrc[i]); 1214 1220 err = -ENODEV; 1215 1221 goto __error; 1216 1222 } ··· 1229 1233 irq = irq_of_parse_and_map(np, 0); 1230 1234 if (request_irq(irq, snd_pmac_ctrl_intr, 0, 1231 1235 "PMac", (void*)chip)) { 1232 - snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", 1233 - irq); 1236 + dev_err(chip->card->dev, 1237 + "pmac: unable to grab IRQ %d\n", irq); 1234 1238 err = -EBUSY; 1235 1239 goto __error; 1236 1240 } ··· 1238 1242 } 1239 1243 irq = irq_of_parse_and_map(np, 1); 1240 1244 if (request_irq(irq, snd_pmac_tx_intr, 0, "PMac Output", (void*)chip)){ 1241 - snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", irq); 1245 + dev_err(chip->card->dev, "pmac: unable to grab IRQ %d\n", irq); 1242 1246 err = -EBUSY; 1243 1247 goto __error; 1244 1248 } 1245 1249 chip->tx_irq = irq; 1246 1250 irq = irq_of_parse_and_map(np, 2); 1247 1251 if (request_irq(irq, snd_pmac_rx_intr, 0, "PMac Input", (void*)chip)) { 1248 - snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", irq); 1252 + dev_err(chip->card->dev, "pmac: unable to grab IRQ %d\n", irq); 1249 1253 err = -EBUSY; 1250 1254 goto __error; 1251 1255 }
+1 -1
sound/ppc/powermac.c
··· 104 104 goto __error; 105 105 break; 106 106 default: 107 - snd_printk(KERN_ERR "unsupported hardware %d\n", chip->model); 107 + dev_err(&devptr->dev, "unsupported hardware %d\n", chip->model); 108 108 err = -EINVAL; 109 109 goto __error; 110 110 }
+10 -11
sound/ppc/tumbler.c
··· 29 29 #undef DEBUG 30 30 31 31 #ifdef DEBUG 32 - #define DBG(fmt...) printk(KERN_DEBUG fmt) 32 + #define DBG(fmt...) pr_debug(fmt) 33 33 #else 34 34 #define DBG(fmt...) 35 35 #endif ··· 230 230 231 231 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_VOL, 6, 232 232 block) < 0) { 233 - snd_printk(KERN_ERR "failed to set volume \n"); 233 + dev_err(&mix->i2c.client->dev, "failed to set volume\n"); 234 234 return -EINVAL; 235 235 } 236 236 DBG("(I) succeeded to set volume (%u, %u)\n", left_vol, right_vol); ··· 341 341 342 342 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC, 343 343 2, val) < 0) { 344 - snd_printk(KERN_ERR "failed to set DRC\n"); 344 + dev_err(&mix->i2c.client->dev, "failed to set DRC\n"); 345 345 return -EINVAL; 346 346 } 347 347 DBG("(I) succeeded to set DRC (%u, %u)\n", val[0], val[1]); ··· 378 378 379 379 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC, 380 380 6, val) < 0) { 381 - snd_printk(KERN_ERR "failed to set DRC\n"); 381 + dev_err(&mix->i2c.client->dev, "failed to set DRC\n"); 382 382 return -EINVAL; 383 383 } 384 384 DBG("(I) succeeded to set DRC (%u, %u)\n", val[0], val[1]); ··· 503 503 block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff; 504 504 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, info->reg, 505 505 info->bytes, block) < 0) { 506 - snd_printk(KERN_ERR "failed to set mono volume %d\n", 507 - info->index); 506 + dev_err(&mix->i2c.client->dev, "failed to set mono volume %d\n", 507 + info->index); 508 508 return -EINVAL; 509 509 } 510 510 return 0; ··· 643 643 } 644 644 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, reg, 645 645 9, block) < 0) { 646 - snd_printk(KERN_ERR "failed to set mono volume %d\n", reg); 646 + dev_err(&mix->i2c.client->dev, 647 + "failed to set mono volume %d\n", reg); 647 648 return -EINVAL; 648 649 } 649 650 return 0; ··· 1103 1102 node = find_audio_device(device); 1104 1103 if (! node) { 1105 1104 DBG("(W) cannot find audio device %s !\n", device); 1106 - snd_printdd("cannot find device %s\n", device); 1107 1105 return -ENODEV; 1108 1106 } 1109 1107 ··· 1111 1111 base = of_get_property(node, "reg", NULL); 1112 1112 if (!base) { 1113 1113 DBG("(E) cannot find address for device %s !\n", device); 1114 - snd_printd("cannot find address for device %s\n", device); 1115 1114 of_node_put(node); 1116 1115 return -ENODEV; 1117 1116 } ··· 1231 1232 tumbler_reset_audio(chip); 1232 1233 if (mix->i2c.client && mix->i2c.init_client) { 1233 1234 if (mix->i2c.init_client(&mix->i2c) < 0) 1234 - printk(KERN_ERR "tumbler_init_client error\n"); 1235 + dev_err(chip->card->dev, "tumbler_init_client error\n"); 1235 1236 } else 1236 - printk(KERN_ERR "tumbler: i2c is not initialized\n"); 1237 + dev_err(chip->card->dev, "tumbler: i2c is not initialized\n"); 1237 1238 if (chip->model == PMAC_TUMBLER) { 1238 1239 tumbler_set_mono_volume(mix, &tumbler_pcm_vol_info); 1239 1240 tumbler_set_mono_volume(mix, &tumbler_bass_vol_info);