Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6dfb5aff authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: ice17xx: Use standard printk helpers



Convert with dev_err() and co from snd_printk(), etc.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6f002b02
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1937,9 +1937,12 @@ static int aureon_add_controls(struct snd_ice1712 *ice)
		snd_ice1712_save_gpio_status(ice);
		id = aureon_cs8415_get(ice, CS8415_ID);
		if (id != 0x41)
			snd_printk(KERN_INFO "No CS8415 chip. Skipping CS8415 controls.\n");
			dev_info(ice->card->dev,
				 "No CS8415 chip. Skipping CS8415 controls.\n");
		else if ((id & 0x0F) != 0x01)
			snd_printk(KERN_INFO "Detected unsupported CS8415 rev. (%c)\n", (char)((id & 0x0F) + 'A' - 1));
			dev_info(ice->card->dev,
				 "Detected unsupported CS8415 rev. (%c)\n",
				 (char)((id & 0x0F) + 'A' - 1));
		else {
			for (i = 0; i < ARRAY_SIZE(cs8415_controls); i++) {
				struct snd_kcontrol *kctl;
+3 −2
Original line number Diff line number Diff line
@@ -425,7 +425,8 @@ static int snd_ice1712_delta1010lt_wordclock_status_get(struct snd_kcontrol *kco
	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);

	if (snd_i2c_sendbytes(ice->cs8427, &reg, 1) != 1)
		snd_printk(KERN_ERR "unable to send register 0x%x byte to CS8427\n", reg);
		dev_err(ice->card->dev,
			"unable to send register 0x%x byte to CS8427\n", reg);
	snd_i2c_readbytes(ice->cs8427, &reg, 1);
	ucontrol->value.integer.value[0] = (reg & CS8427_UNLOCK) ? 1 : 0;
	return 0;
@@ -637,7 +638,7 @@ static int snd_ice1712_delta_init(struct snd_ice1712 *ice)
	case ICE1712_SUBDEVICE_VX442:
	case ICE1712_SUBDEVICE_DELTA66E:
		if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
			snd_printk(KERN_ERR "unable to create I2C bus\n");
			dev_err(ice->card->dev, "unable to create I2C bus\n");
			return err;
		}
		ice->i2c->private_data = ice;
+7 −5
Original line number Diff line number Diff line
@@ -163,7 +163,8 @@ static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mas

     __error:
	snd_i2c_unlock(ice->i2c);
	snd_printk(KERN_ERR "AK4524 chip select failed, check cable to the front module\n");
	dev_err(ice->card->dev,
		"AK4524 chip select failed, check cable to the front module\n");
	return -EIO;
}

@@ -174,7 +175,7 @@ static void ews88mt_ak4524_lock(struct snd_akm4xxx *ak, int chip)
	unsigned char tmp;
	/* assert AK4524 CS */
	if (snd_ice1712_ews88mt_chip_select(ice, ~(1 << chip) & 0x0f) < 0)
		snd_printk(KERN_ERR "fatal error (ews88mt chip select)\n");
		dev_err(ice->card->dev, "fatal error (ews88mt chip select)\n");
	snd_ice1712_save_gpio_status(ice);
	tmp = ICE1712_EWS88_SERIAL_DATA |
		ICE1712_EWS88_SERIAL_CLOCK |
@@ -456,7 +457,7 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice)

	/* create i2c */
	if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
		snd_printk(KERN_ERR "unable to create I2C bus\n");
		dev_err(ice->card->dev, "unable to create I2C bus\n");
		return err;
	}
	ice->i2c->private_data = ice;
@@ -469,7 +470,8 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice)
					    ICE1712_6FIRE_PCF9554_ADDR,
					    &spec->i2cdevs[EWS_I2C_6FIRE]);
		if (err < 0) {
			snd_printk(KERN_ERR "PCF9554 initialization failed\n");
			dev_err(ice->card->dev,
				"PCF9554 initialization failed\n");
			return err;
		}
		snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80);
@@ -834,7 +836,7 @@ static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg
	byte = 0;
	if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) {
		snd_i2c_unlock(ice->i2c);
		printk(KERN_ERR "cannot read pca\n");
		dev_err(ice->card->dev, "cannot read pca\n");
		return -EIO;
	}
	snd_i2c_unlock(ice->i2c);
+20 −13
Original line number Diff line number Diff line
@@ -394,7 +394,7 @@ int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr)
	err = snd_cs8427_create(ice->i2c, addr,
		(ice->cs8427_timeout * HZ) / 1000, &ice->cs8427);
	if (err < 0) {
		snd_printk(KERN_ERR "CS8427 initialization failed\n");
		dev_err(ice->card->dev, "CS8427 initialization failed\n");
		return err;
	}
	ice->spdif.ops.open = open_cs8427;
@@ -467,7 +467,7 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id)
			u16 pbkstatus;
			struct snd_pcm_substream *substream;
			pbkstatus = inw(ICEDS(ice, INTSTAT));
			/* printk(KERN_DEBUG "pbkstatus = 0x%x\n", pbkstatus); */
			/* dev_dbg(ice->card->dev, "pbkstatus = 0x%x\n", pbkstatus); */
			for (idx = 0; idx < 6; idx++) {
				if ((pbkstatus & (3 << (idx * 2))) == 0)
					continue;
@@ -903,7 +903,8 @@ static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct snd_pcm *
	if (rpcm)
		*rpcm = pcm;

	printk(KERN_WARNING "Consumer PCM code does not work well at the moment --jk\n");
	dev_warn(ice->card->dev,
		 "Consumer PCM code does not work well at the moment --jk\n");

	return 0;
}
@@ -1534,7 +1535,8 @@ static int snd_ice1712_ac97_mixer(struct snd_ice1712 *ice)
		ac97.private_free = snd_ice1712_mixer_free_ac97;
		err = snd_ac97_mixer(pbus, &ac97, &ice->ac97);
		if (err < 0)
			printk(KERN_WARNING "ice1712: cannot initialize ac97 for consumer, skipped\n");
			dev_warn(ice->card->dev,
				 "cannot initialize ac97 for consumer, skipped\n");
		else {
			err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice));
			if (err < 0)
@@ -1552,7 +1554,8 @@ static int snd_ice1712_ac97_mixer(struct snd_ice1712 *ice)
		ac97.private_free = snd_ice1712_mixer_free_ac97;
		err = snd_ac97_mixer(pbus, &ac97, &ice->ac97);
		if (err < 0)
			printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n");
			dev_warn(ice->card->dev,
				 "cannot initialize pro ac97, skipped\n");
		else
			return 0;
	}
@@ -2332,7 +2335,8 @@ static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
			pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device);
			ice->eeprom.subvendor = ((unsigned int)swab16(vendor) << 16) | swab16(device);
			if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) {
				printk(KERN_ERR "ice1712: No valid ID is found\n");
				dev_err(ice->card->dev,
					"No valid ID is found\n");
				return -ENXIO;
			}
		}
@@ -2340,21 +2344,22 @@ static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
	for (tbl = card_tables; *tbl; tbl++) {
		for (c = *tbl; c->subvendor; c++) {
			if (modelname && c->model && !strcmp(modelname, c->model)) {
				printk(KERN_INFO "ice1712: Using board model %s\n", c->name);
				dev_info(ice->card->dev,
					 "Using board model %s\n", c->name);
				ice->eeprom.subvendor = c->subvendor;
			} else if (c->subvendor != ice->eeprom.subvendor)
				continue;
			if (!c->eeprom_size || !c->eeprom_data)
				goto found;
			/* if the EEPROM is given by the driver, use it */
			snd_printdd("using the defined eeprom..\n");
			dev_dbg(ice->card->dev, "using the defined eeprom..\n");
			ice->eeprom.version = 1;
			ice->eeprom.size = c->eeprom_size + 6;
			memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size);
			goto read_skipped;
		}
	}
	printk(KERN_WARNING "ice1712: No matching model found for ID 0x%x\n",
	dev_warn(ice->card->dev, "No matching model found for ID 0x%x\n",
	       ice->eeprom.subvendor);

 found:
@@ -2362,12 +2367,13 @@ static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
	if (ice->eeprom.size < 6)
		ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */
	else if (ice->eeprom.size > 32) {
		snd_printk(KERN_ERR "invalid EEPROM (size = %i)\n", ice->eeprom.size);
		dev_err(ice->card->dev,
			"invalid EEPROM (size = %i)\n", ice->eeprom.size);
		return -EIO;
	}
	ice->eeprom.version = snd_ice1712_read_i2c(ice, dev, 0x05);
	if (ice->eeprom.version != 1) {
		snd_printk(KERN_ERR "invalid EEPROM version %i\n",
		dev_err(ice->card->dev, "invalid EEPROM version %i\n",
			   ice->eeprom.version);
		/* return -EIO; */
	}
@@ -2553,7 +2559,8 @@ static int snd_ice1712_create(struct snd_card *card,
	/* check, if we can restrict PCI DMA transfers to 28 bits */
	if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
	    pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
		snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n");
		dev_err(card->dev,
			"architecture does not support 28bit PCI busmaster DMA\n");
		pci_disable_device(pci);
		return -ENXIO;
	}
@@ -2609,7 +2616,7 @@ static int snd_ice1712_create(struct snd_card *card,

	if (request_irq(pci->irq, snd_ice1712_interrupt, IRQF_SHARED,
			KBUILD_MODNAME, ice)) {
		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
		dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
		snd_ice1712_free(ice);
		return -EIO;
	}
+24 −21
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ static unsigned char snd_vt1724_ac97_ready(struct snd_ice1712 *ice)
			continue;
		return old_cmd;
	}
	snd_printd(KERN_ERR "snd_vt1724_ac97_ready: timeout\n");
	dev_dbg(ice->card->dev, "snd_vt1724_ac97_ready: timeout\n");
	return old_cmd;
}

@@ -156,7 +156,7 @@ static int snd_vt1724_ac97_wait_bit(struct snd_ice1712 *ice, unsigned char bit)
	for (tm = 0; tm < 0x10000; tm++)
		if ((inb(ICEMT1724(ice, AC97_CMD)) & bit) == 0)
			return 0;
	snd_printd(KERN_ERR "snd_vt1724_ac97_wait_bit: timeout\n");
	dev_dbg(ice->card->dev, "snd_vt1724_ac97_wait_bit: timeout\n");
	return -EIO;
}

@@ -430,10 +430,10 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id)
		spin_lock(&ice->reg_lock);
		if (++timeout > 10) {
			status = inb(ICEREG1724(ice, IRQSTAT));
			printk(KERN_ERR "ice1724: Too long irq loop, "
			       "status = 0x%x\n", status);
			dev_err(ice->card->dev,
				"Too long irq loop, status = 0x%x\n", status);
			if (status & VT1724_IRQ_MPU_TX) {
				printk(KERN_ERR "ice1724: Disabling MPU_TX\n");
				dev_err(ice->card->dev, "Disabling MPU_TX\n");
				enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0);
			}
			spin_unlock(&ice->reg_lock);
@@ -801,7 +801,7 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream)
	spin_unlock_irq(&ice->reg_lock);

	/*
	printk(KERN_DEBUG "pro prepare: ch = %d, addr = 0x%x, "
	dev_dbg(ice->card->dev, "pro prepare: ch = %d, addr = 0x%x, "
	       "buffer = 0x%x, period = 0x%x\n",
	       substream->runtime->channels,
	       (unsigned int)substream->runtime->dma_addr,
@@ -821,13 +821,13 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substrea
#if 0 /* read PLAYBACK_ADDR */
	ptr = inl(ICEMT1724(ice, PLAYBACK_ADDR));
	if (ptr < substream->runtime->dma_addr) {
		snd_printd("ice1724: invalid negative ptr\n");
		dev_dbg(ice->card->dev, "invalid negative ptr\n");
		return 0;
	}
	ptr -= substream->runtime->dma_addr;
	ptr = bytes_to_frames(substream->runtime, ptr);
	if (ptr >= substream->runtime->buffer_size) {
		snd_printd("ice1724: invalid ptr %d (size=%d)\n",
		dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n",
			   (int)ptr, (int)substream->runtime->period_size);
		return 0;
	}
@@ -840,7 +840,7 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substrea
	else if (ptr <= substream->runtime->buffer_size)
		ptr = substream->runtime->buffer_size - ptr;
	else {
		snd_printd("ice1724: invalid ptr %d (size=%d)\n",
		dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n",
			   (int)ptr, (int)substream->runtime->buffer_size);
		ptr = 0;
	}
@@ -884,7 +884,7 @@ static snd_pcm_uframes_t snd_vt1724_pcm_pointer(struct snd_pcm_substream *substr
	else if (ptr <= substream->runtime->buffer_size)
		ptr = substream->runtime->buffer_size - ptr;
	else {
		snd_printd("ice1724: invalid ptr %d (size=%d)\n",
		dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n",
			   (int)ptr, (int)substream->runtime->buffer_size);
		ptr = 0;
	}
@@ -1508,7 +1508,8 @@ static int snd_vt1724_ac97_mixer(struct snd_ice1712 *ice)
		ac97.private_data = ice;
		err = snd_ac97_mixer(pbus, &ac97, &ice->ac97);
		if (err < 0)
			printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n");
			dev_warn(ice->card->dev,
				 "cannot initialize pro ac97, skipped\n");
		else
			return 0;
	}
@@ -2271,7 +2272,7 @@ static void wait_i2c_busy(struct snd_ice1712 *ice)
	while ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY) && t--)
		;
	if (t == -1)
		printk(KERN_ERR "ice1724: i2c busy timeout\n");
		dev_err(ice->card->dev, "i2c busy timeout\n");
}

unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
@@ -2287,7 +2288,7 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
	val = inb(ICEREG1724(ice, I2C_DATA));
	mutex_unlock(&ice->i2c_mutex);
	/*
	printk(KERN_DEBUG "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val);
	dev_dbg(ice->card->dev, "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val);
	*/
	return val;
}
@@ -2298,7 +2299,7 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
	mutex_lock(&ice->i2c_mutex);
	wait_i2c_busy(ice);
	/*
	printk(KERN_DEBUG "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data);
	dev_dbg(ice->card->dev, "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data);
	*/
	outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
	outb(data, ICEREG1724(ice, I2C_DATA));
@@ -2335,7 +2336,8 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
				((unsigned int)swab16(vendor) << 16) | swab16(device);
			if (ice->eeprom.subvendor == 0 ||
			    ice->eeprom.subvendor == (unsigned int)-1) {
				printk(KERN_ERR "ice1724: No valid ID is found\n");
				dev_err(ice->card->dev,
					"No valid ID is found\n");
				return -ENXIO;
			}
		}
@@ -2344,7 +2346,8 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
		for (c = *tbl; c->name; c++) {
			if (modelname && c->model &&
			    !strcmp(modelname, c->model)) {
				printk(KERN_INFO "ice1724: Using board model %s\n",
				dev_info(ice->card->dev,
					 "Using board model %s\n",
				       c->name);
				ice->eeprom.subvendor = c->subvendor;
			} else if (c->subvendor != ice->eeprom.subvendor)
@@ -2353,14 +2356,14 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
			if (!c->eeprom_size || !c->eeprom_data)
				goto found;
			/* if the EEPROM is given by the driver, use it */
			snd_printdd("using the defined eeprom..\n");
			dev_dbg(ice->card->dev, "using the defined eeprom..\n");
			ice->eeprom.version = 2;
			ice->eeprom.size = c->eeprom_size + 6;
			memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size);
			goto read_skipped;
		}
	}
	printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n",
	dev_warn(ice->card->dev, "No matching model found for ID 0x%x\n",
	       ice->eeprom.subvendor);
#ifdef CONFIG_PM_SLEEP
	/* assume AC97-only card which can suspend without additional code */
@@ -2372,13 +2375,13 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
	if (ice->eeprom.size < 6)
		ice->eeprom.size = 32;
	else if (ice->eeprom.size > 32) {
		printk(KERN_ERR "ice1724: Invalid EEPROM (size = %i)\n",
		dev_err(ice->card->dev, "Invalid EEPROM (size = %i)\n",
		       ice->eeprom.size);
		return -EIO;
	}
	ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05);
	if (ice->eeprom.version != 1 && ice->eeprom.version != 2)
		printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n",
		dev_warn(ice->card->dev, "Invalid EEPROM version %i\n",
		       ice->eeprom.version);
	size = ice->eeprom.size - 6;
	for (i = 0; i < size; i++)
@@ -2586,7 +2589,7 @@ static int snd_vt1724_create(struct snd_card *card,

	if (request_irq(pci->irq, snd_vt1724_interrupt,
			IRQF_SHARED, KBUILD_MODNAME, ice)) {
		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
		dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
		snd_vt1724_free(ice);
		return -EIO;
	}
Loading