diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-02-26 06:05:11 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-26 10:45:31 -0500 |
commit | a54ba0fe9fae3c170638c35f1e6abf27449bcedc (patch) | |
tree | 4daeaa462072b8aafd3910d8dd266f8d1ded73cb /sound/pci | |
parent | b59bb8efd1c1f2eaeed13eccf1fa4e564d2383ae (diff) |
ALSA: hdsp: Use standard printk helpers
Convert with dev_err() and co from snd_printk(), etc.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/rme9652/hdsp.c | 128 |
1 files changed, 79 insertions, 49 deletions
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 825fbbea7f6f..4c6f5d1c9882 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -675,14 +675,15 @@ static int hdsp_check_for_iobox (struct hdsp *hdsp) | |||
675 | if (0 == (hdsp_read(hdsp, HDSP_statusRegister) & | 675 | if (0 == (hdsp_read(hdsp, HDSP_statusRegister) & |
676 | HDSP_ConfigError)) { | 676 | HDSP_ConfigError)) { |
677 | if (i) { | 677 | if (i) { |
678 | snd_printd("Hammerfall-DSP: IO box found after %d ms\n", | 678 | dev_dbg(hdsp->card->dev, |
679 | "IO box found after %d ms\n", | ||
679 | (20 * i)); | 680 | (20 * i)); |
680 | } | 681 | } |
681 | return 0; | 682 | return 0; |
682 | } | 683 | } |
683 | msleep(20); | 684 | msleep(20); |
684 | } | 685 | } |
685 | snd_printk(KERN_ERR "Hammerfall-DSP: no IO box connected!\n"); | 686 | dev_err(hdsp->card->dev, "no IO box connected!\n"); |
686 | hdsp->state &= ~HDSP_FirmwareLoaded; | 687 | hdsp->state &= ~HDSP_FirmwareLoaded; |
687 | return -EIO; | 688 | return -EIO; |
688 | } | 689 | } |
@@ -699,13 +700,13 @@ static int hdsp_wait_for_iobox(struct hdsp *hdsp, unsigned int loops, | |||
699 | if (hdsp_read(hdsp, HDSP_statusRegister) & HDSP_ConfigError) | 700 | if (hdsp_read(hdsp, HDSP_statusRegister) & HDSP_ConfigError) |
700 | msleep(delay); | 701 | msleep(delay); |
701 | else { | 702 | else { |
702 | snd_printd("Hammerfall-DSP: iobox found after %ums!\n", | 703 | dev_dbg(hdsp->card->dev, "iobox found after %ums!\n", |
703 | i * delay); | 704 | i * delay); |
704 | return 0; | 705 | return 0; |
705 | } | 706 | } |
706 | } | 707 | } |
707 | 708 | ||
708 | snd_printk("Hammerfall-DSP: no IO box connected!\n"); | 709 | dev_info(hdsp->card->dev, "no IO box connected!\n"); |
709 | hdsp->state &= ~HDSP_FirmwareLoaded; | 710 | hdsp->state &= ~HDSP_FirmwareLoaded; |
710 | return -EIO; | 711 | return -EIO; |
711 | } | 712 | } |
@@ -728,13 +729,14 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { | |||
728 | 729 | ||
729 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { | 730 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { |
730 | 731 | ||
731 | snd_printk ("Hammerfall-DSP: loading firmware\n"); | 732 | dev_info(hdsp->card->dev, "loading firmware\n"); |
732 | 733 | ||
733 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM); | 734 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM); |
734 | hdsp_write (hdsp, HDSP_fifoData, 0); | 735 | hdsp_write (hdsp, HDSP_fifoData, 0); |
735 | 736 | ||
736 | if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { | 737 | if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { |
737 | snd_printk ("Hammerfall-DSP: timeout waiting for download preparation\n"); | 738 | dev_info(hdsp->card->dev, |
739 | "timeout waiting for download preparation\n"); | ||
738 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200); | 740 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200); |
739 | return -EIO; | 741 | return -EIO; |
740 | } | 742 | } |
@@ -744,7 +746,8 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { | |||
744 | for (i = 0; i < HDSP_FIRMWARE_SIZE / 4; ++i) { | 746 | for (i = 0; i < HDSP_FIRMWARE_SIZE / 4; ++i) { |
745 | hdsp_write(hdsp, HDSP_fifoData, cache[i]); | 747 | hdsp_write(hdsp, HDSP_fifoData, cache[i]); |
746 | if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) { | 748 | if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) { |
747 | snd_printk ("Hammerfall-DSP: timeout during firmware loading\n"); | 749 | dev_info(hdsp->card->dev, |
750 | "timeout during firmware loading\n"); | ||
748 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200); | 751 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200); |
749 | return -EIO; | 752 | return -EIO; |
750 | } | 753 | } |
@@ -760,11 +763,12 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { | |||
760 | hdsp->control2_register = 0; | 763 | hdsp->control2_register = 0; |
761 | #endif | 764 | #endif |
762 | hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); | 765 | hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); |
763 | snd_printk ("Hammerfall-DSP: finished firmware loading\n"); | 766 | dev_info(hdsp->card->dev, "finished firmware loading\n"); |
764 | 767 | ||
765 | } | 768 | } |
766 | if (hdsp->state & HDSP_InitializationComplete) { | 769 | if (hdsp->state & HDSP_InitializationComplete) { |
767 | snd_printk(KERN_INFO "Hammerfall-DSP: firmware loaded from cache, restoring defaults\n"); | 770 | dev_info(hdsp->card->dev, |
771 | "firmware loaded from cache, restoring defaults\n"); | ||
768 | spin_lock_irqsave(&hdsp->lock, flags); | 772 | spin_lock_irqsave(&hdsp->lock, flags); |
769 | snd_hdsp_set_defaults(hdsp); | 773 | snd_hdsp_set_defaults(hdsp); |
770 | spin_unlock_irqrestore(&hdsp->lock, flags); | 774 | spin_unlock_irqrestore(&hdsp->lock, flags); |
@@ -791,7 +795,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) | |||
791 | hdsp_write (hdsp, HDSP_fifoData, 0); | 795 | hdsp_write (hdsp, HDSP_fifoData, 0); |
792 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { | 796 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { |
793 | hdsp->io_type = Multiface; | 797 | hdsp->io_type = Multiface; |
794 | snd_printk("Hammerfall-DSP: Multiface found\n"); | 798 | dev_info(hdsp->card->dev, "Multiface found\n"); |
795 | return 0; | 799 | return 0; |
796 | } | 800 | } |
797 | 801 | ||
@@ -799,7 +803,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) | |||
799 | hdsp_write(hdsp, HDSP_fifoData, 0); | 803 | hdsp_write(hdsp, HDSP_fifoData, 0); |
800 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) { | 804 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) { |
801 | hdsp->io_type = Digiface; | 805 | hdsp->io_type = Digiface; |
802 | snd_printk("Hammerfall-DSP: Digiface found\n"); | 806 | dev_info(hdsp->card->dev, "Digiface found\n"); |
803 | return 0; | 807 | return 0; |
804 | } | 808 | } |
805 | 809 | ||
@@ -808,7 +812,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) | |||
808 | hdsp_write(hdsp, HDSP_fifoData, 0); | 812 | hdsp_write(hdsp, HDSP_fifoData, 0); |
809 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) { | 813 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) { |
810 | hdsp->io_type = Multiface; | 814 | hdsp->io_type = Multiface; |
811 | snd_printk("Hammerfall-DSP: Multiface found\n"); | 815 | dev_info(hdsp->card->dev, "Multiface found\n"); |
812 | return 0; | 816 | return 0; |
813 | } | 817 | } |
814 | 818 | ||
@@ -817,12 +821,12 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) | |||
817 | hdsp_write(hdsp, HDSP_fifoData, 0); | 821 | hdsp_write(hdsp, HDSP_fifoData, 0); |
818 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { | 822 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { |
819 | hdsp->io_type = Multiface; | 823 | hdsp->io_type = Multiface; |
820 | snd_printk("Hammerfall-DSP: Multiface found\n"); | 824 | dev_info(hdsp->card->dev, "Multiface found\n"); |
821 | return 0; | 825 | return 0; |
822 | } | 826 | } |
823 | 827 | ||
824 | hdsp->io_type = RPM; | 828 | hdsp->io_type = RPM; |
825 | snd_printk("Hammerfall-DSP: RPM found\n"); | 829 | dev_info(hdsp->card->dev, "RPM found\n"); |
826 | return 0; | 830 | return 0; |
827 | } else { | 831 | } else { |
828 | /* firmware was already loaded, get iobox type */ | 832 | /* firmware was already loaded, get iobox type */ |
@@ -847,20 +851,18 @@ static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand) | |||
847 | hdsp->state &= ~HDSP_FirmwareLoaded; | 851 | hdsp->state &= ~HDSP_FirmwareLoaded; |
848 | if (! load_on_demand) | 852 | if (! load_on_demand) |
849 | return -EIO; | 853 | return -EIO; |
850 | snd_printk(KERN_ERR "Hammerfall-DSP: firmware not present.\n"); | 854 | dev_err(hdsp->card->dev, "firmware not present.\n"); |
851 | /* try to load firmware */ | 855 | /* try to load firmware */ |
852 | if (! (hdsp->state & HDSP_FirmwareCached)) { | 856 | if (! (hdsp->state & HDSP_FirmwareCached)) { |
853 | if (! hdsp_request_fw_loader(hdsp)) | 857 | if (! hdsp_request_fw_loader(hdsp)) |
854 | return 0; | 858 | return 0; |
855 | snd_printk(KERN_ERR | 859 | dev_err(hdsp->card->dev, |
856 | "Hammerfall-DSP: No firmware loaded nor " | 860 | "No firmware loaded nor cached, please upload firmware.\n"); |
857 | "cached, please upload firmware.\n"); | ||
858 | return -EIO; | 861 | return -EIO; |
859 | } | 862 | } |
860 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { | 863 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { |
861 | snd_printk(KERN_ERR | 864 | dev_err(hdsp->card->dev, |
862 | "Hammerfall-DSP: Firmware loading from " | 865 | "Firmware loading from cache failed, please upload manually.\n"); |
863 | "cache failed, please upload manually.\n"); | ||
864 | return -EIO; | 866 | return -EIO; |
865 | } | 867 | } |
866 | } | 868 | } |
@@ -888,7 +890,8 @@ static int hdsp_fifo_wait(struct hdsp *hdsp, int count, int timeout) | |||
888 | udelay (100); | 890 | udelay (100); |
889 | } | 891 | } |
890 | 892 | ||
891 | snd_printk ("Hammerfall-DSP: wait for FIFO status <= %d failed after %d iterations\n", | 893 | dev_warn(hdsp->card->dev, |
894 | "wait for FIFO status <= %d failed after %d iterations\n", | ||
892 | count, timeout); | 895 | count, timeout); |
893 | return -1; | 896 | return -1; |
894 | } | 897 | } |
@@ -1005,7 +1008,9 @@ static int hdsp_spdif_sample_rate(struct hdsp *hdsp) | |||
1005 | default: | 1008 | default: |
1006 | break; | 1009 | break; |
1007 | } | 1010 | } |
1008 | snd_printk ("Hammerfall-DSP: unknown spdif frequency status; bits = 0x%x, status = 0x%x\n", rate_bits, status); | 1011 | dev_warn(hdsp->card->dev, |
1012 | "unknown spdif frequency status; bits = 0x%x, status = 0x%x\n", | ||
1013 | rate_bits, status); | ||
1009 | return 0; | 1014 | return 0; |
1010 | } | 1015 | } |
1011 | 1016 | ||
@@ -1139,7 +1144,8 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally) | |||
1139 | if (!(hdsp->control_register & HDSP_ClockModeMaster)) { | 1144 | if (!(hdsp->control_register & HDSP_ClockModeMaster)) { |
1140 | if (called_internally) { | 1145 | if (called_internally) { |
1141 | /* request from ctl or card initialization */ | 1146 | /* request from ctl or card initialization */ |
1142 | snd_printk(KERN_ERR "Hammerfall-DSP: device is not running as a clock master: cannot set sample rate.\n"); | 1147 | dev_err(hdsp->card->dev, |
1148 | "device is not running as a clock master: cannot set sample rate.\n"); | ||
1143 | return -1; | 1149 | return -1; |
1144 | } else { | 1150 | } else { |
1145 | /* hw_param request while in AutoSync mode */ | 1151 | /* hw_param request while in AutoSync mode */ |
@@ -1147,11 +1153,14 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally) | |||
1147 | int spdif_freq = hdsp_spdif_sample_rate(hdsp); | 1153 | int spdif_freq = hdsp_spdif_sample_rate(hdsp); |
1148 | 1154 | ||
1149 | if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) | 1155 | if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) |
1150 | snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in double speed mode\n"); | 1156 | dev_info(hdsp->card->dev, |
1157 | "Detected ADAT in double speed mode\n"); | ||
1151 | else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) | 1158 | else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) |
1152 | snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in quad speed mode\n"); | 1159 | dev_info(hdsp->card->dev, |
1160 | "Detected ADAT in quad speed mode\n"); | ||
1153 | else if (rate != external_freq) { | 1161 | else if (rate != external_freq) { |
1154 | snd_printk(KERN_INFO "Hammerfall-DSP: No AutoSync source for requested rate\n"); | 1162 | dev_info(hdsp->card->dev, |
1163 | "No AutoSync source for requested rate\n"); | ||
1155 | return -1; | 1164 | return -1; |
1156 | } | 1165 | } |
1157 | } | 1166 | } |
@@ -1223,7 +1232,8 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally) | |||
1223 | } | 1232 | } |
1224 | 1233 | ||
1225 | if (reject_if_open && (hdsp->capture_pid >= 0 || hdsp->playback_pid >= 0)) { | 1234 | if (reject_if_open && (hdsp->capture_pid >= 0 || hdsp->playback_pid >= 0)) { |
1226 | snd_printk ("Hammerfall-DSP: cannot change speed mode (capture PID = %d, playback PID = %d)\n", | 1235 | dev_warn(hdsp->card->dev, |
1236 | "cannot change speed mode (capture PID = %d, playback PID = %d)\n", | ||
1227 | hdsp->capture_pid, | 1237 | hdsp->capture_pid, |
1228 | hdsp->playback_pid); | 1238 | hdsp->playback_pid); |
1229 | return -EBUSY; | 1239 | return -EBUSY; |
@@ -3785,7 +3795,8 @@ static int snd_hdsp_initialize_memory(struct hdsp *hdsp) | |||
3785 | snd_hammerfall_get_buffer(hdsp->pci, &hdsp->playback_dma_buf, HDSP_DMA_AREA_BYTES) < 0) { | 3795 | snd_hammerfall_get_buffer(hdsp->pci, &hdsp->playback_dma_buf, HDSP_DMA_AREA_BYTES) < 0) { |
3786 | if (hdsp->capture_dma_buf.area) | 3796 | if (hdsp->capture_dma_buf.area) |
3787 | snd_dma_free_pages(&hdsp->capture_dma_buf); | 3797 | snd_dma_free_pages(&hdsp->capture_dma_buf); |
3788 | printk(KERN_ERR "%s: no buffers available\n", hdsp->card_name); | 3798 | dev_err(hdsp->card->dev, |
3799 | "%s: no buffers available\n", hdsp->card_name); | ||
3789 | return -ENOMEM; | 3800 | return -ENOMEM; |
3790 | } | 3801 | } |
3791 | 3802 | ||
@@ -4747,7 +4758,8 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4747 | return err; | 4758 | return err; |
4748 | 4759 | ||
4749 | if (!(hdsp->state & HDSP_FirmwareLoaded)) { | 4760 | if (!(hdsp->state & HDSP_FirmwareLoaded)) { |
4750 | snd_printk(KERN_ERR "Hammerfall-DSP: firmware needs to be uploaded to the card.\n"); | 4761 | dev_err(hdsp->card->dev, |
4762 | "firmware needs to be uploaded to the card.\n"); | ||
4751 | return -EINVAL; | 4763 | return -EINVAL; |
4752 | } | 4764 | } |
4753 | 4765 | ||
@@ -4858,7 +4870,8 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4858 | if (hdsp->state & (HDSP_FirmwareCached | HDSP_FirmwareLoaded)) | 4870 | if (hdsp->state & (HDSP_FirmwareCached | HDSP_FirmwareLoaded)) |
4859 | return -EBUSY; | 4871 | return -EBUSY; |
4860 | 4872 | ||
4861 | snd_printk(KERN_INFO "Hammerfall-DSP: initializing firmware upload\n"); | 4873 | dev_info(hdsp->card->dev, |
4874 | "initializing firmware upload\n"); | ||
4862 | firmware = (struct hdsp_firmware __user *)argp; | 4875 | firmware = (struct hdsp_firmware __user *)argp; |
4863 | 4876 | ||
4864 | if (get_user(firmware_data, &firmware->firmware_data)) | 4877 | if (get_user(firmware_data, &firmware->firmware_data)) |
@@ -4893,7 +4906,8 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4893 | snd_hdsp_initialize_midi_flush(hdsp); | 4906 | snd_hdsp_initialize_midi_flush(hdsp); |
4894 | 4907 | ||
4895 | if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { | 4908 | if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { |
4896 | snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); | 4909 | dev_err(hdsp->card->dev, |
4910 | "error creating alsa devices\n"); | ||
4897 | return err; | 4911 | return err; |
4898 | } | 4912 | } |
4899 | } | 4913 | } |
@@ -4983,7 +4997,8 @@ static int snd_hdsp_enable_io (struct hdsp *hdsp) | |||
4983 | int i; | 4997 | int i; |
4984 | 4998 | ||
4985 | if (hdsp_fifo_wait (hdsp, 0, 100)) { | 4999 | if (hdsp_fifo_wait (hdsp, 0, 100)) { |
4986 | snd_printk(KERN_ERR "Hammerfall-DSP: enable_io fifo_wait failed\n"); | 5000 | dev_err(hdsp->card->dev, |
5001 | "enable_io fifo_wait failed\n"); | ||
4987 | return -EIO; | 5002 | return -EIO; |
4988 | } | 5003 | } |
4989 | 5004 | ||
@@ -5057,25 +5072,29 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp | |||
5057 | int err; | 5072 | int err; |
5058 | 5073 | ||
5059 | if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { | 5074 | if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { |
5060 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating pcm interface\n"); | 5075 | dev_err(card->dev, |
5076 | "Error creating pcm interface\n"); | ||
5061 | return err; | 5077 | return err; |
5062 | } | 5078 | } |
5063 | 5079 | ||
5064 | 5080 | ||
5065 | if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { | 5081 | if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { |
5066 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating first midi interface\n"); | 5082 | dev_err(card->dev, |
5083 | "Error creating first midi interface\n"); | ||
5067 | return err; | 5084 | return err; |
5068 | } | 5085 | } |
5069 | 5086 | ||
5070 | if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { | 5087 | if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { |
5071 | if ((err = snd_hdsp_create_midi(card, hdsp, 1)) < 0) { | 5088 | if ((err = snd_hdsp_create_midi(card, hdsp, 1)) < 0) { |
5072 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating second midi interface\n"); | 5089 | dev_err(card->dev, |
5090 | "Error creating second midi interface\n"); | ||
5073 | return err; | 5091 | return err; |
5074 | } | 5092 | } |
5075 | } | 5093 | } |
5076 | 5094 | ||
5077 | if ((err = snd_hdsp_create_controls(card, hdsp)) < 0) { | 5095 | if ((err = snd_hdsp_create_controls(card, hdsp)) < 0) { |
5078 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating ctl interface\n"); | 5096 | dev_err(card->dev, |
5097 | "Error creating ctl interface\n"); | ||
5079 | return err; | 5098 | return err; |
5080 | } | 5099 | } |
5081 | 5100 | ||
@@ -5088,7 +5107,8 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp | |||
5088 | hdsp->playback_substream = NULL; | 5107 | hdsp->playback_substream = NULL; |
5089 | 5108 | ||
5090 | if ((err = snd_hdsp_set_defaults(hdsp)) < 0) { | 5109 | if ((err = snd_hdsp_set_defaults(hdsp)) < 0) { |
5091 | snd_printk(KERN_ERR "Hammerfall-DSP: Error setting default values\n"); | 5110 | dev_err(card->dev, |
5111 | "Error setting default values\n"); | ||
5092 | return err; | 5112 | return err; |
5093 | } | 5113 | } |
5094 | 5114 | ||
@@ -5098,7 +5118,8 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp | |||
5098 | hdsp->port, hdsp->irq); | 5118 | hdsp->port, hdsp->irq); |
5099 | 5119 | ||
5100 | if ((err = snd_card_register(card)) < 0) { | 5120 | if ((err = snd_card_register(card)) < 0) { |
5101 | snd_printk(KERN_ERR "Hammerfall-DSP: error registering card\n"); | 5121 | dev_err(card->dev, |
5122 | "error registering card\n"); | ||
5102 | return err; | 5123 | return err; |
5103 | } | 5124 | } |
5104 | hdsp->state |= HDSP_InitializationComplete; | 5125 | hdsp->state |= HDSP_InitializationComplete; |
@@ -5141,16 +5162,19 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp) | |||
5141 | fwfile = "digiface_firmware_rev11.bin"; | 5162 | fwfile = "digiface_firmware_rev11.bin"; |
5142 | break; | 5163 | break; |
5143 | default: | 5164 | default: |
5144 | snd_printk(KERN_ERR "Hammerfall-DSP: invalid io_type %d\n", hdsp->io_type); | 5165 | dev_err(hdsp->card->dev, |
5166 | "invalid io_type %d\n", hdsp->io_type); | ||
5145 | return -EINVAL; | 5167 | return -EINVAL; |
5146 | } | 5168 | } |
5147 | 5169 | ||
5148 | if (request_firmware(&fw, fwfile, &hdsp->pci->dev)) { | 5170 | if (request_firmware(&fw, fwfile, &hdsp->pci->dev)) { |
5149 | snd_printk(KERN_ERR "Hammerfall-DSP: cannot load firmware %s\n", fwfile); | 5171 | dev_err(hdsp->card->dev, |
5172 | "cannot load firmware %s\n", fwfile); | ||
5150 | return -ENOENT; | 5173 | return -ENOENT; |
5151 | } | 5174 | } |
5152 | if (fw->size < HDSP_FIRMWARE_SIZE) { | 5175 | if (fw->size < HDSP_FIRMWARE_SIZE) { |
5153 | snd_printk(KERN_ERR "Hammerfall-DSP: too short firmware size %d (expected %d)\n", | 5176 | dev_err(hdsp->card->dev, |
5177 | "too short firmware size %d (expected %d)\n", | ||
5154 | (int)fw->size, HDSP_FIRMWARE_SIZE); | 5178 | (int)fw->size, HDSP_FIRMWARE_SIZE); |
5155 | return -EINVAL; | 5179 | return -EINVAL; |
5156 | } | 5180 | } |
@@ -5167,13 +5191,15 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp) | |||
5167 | return err; | 5191 | return err; |
5168 | 5192 | ||
5169 | if ((err = snd_hdsp_create_hwdep(hdsp->card, hdsp)) < 0) { | 5193 | if ((err = snd_hdsp_create_hwdep(hdsp->card, hdsp)) < 0) { |
5170 | snd_printk(KERN_ERR "Hammerfall-DSP: error creating hwdep device\n"); | 5194 | dev_err(hdsp->card->dev, |
5195 | "error creating hwdep device\n"); | ||
5171 | return err; | 5196 | return err; |
5172 | } | 5197 | } |
5173 | snd_hdsp_initialize_channels(hdsp); | 5198 | snd_hdsp_initialize_channels(hdsp); |
5174 | snd_hdsp_initialize_midi_flush(hdsp); | 5199 | snd_hdsp_initialize_midi_flush(hdsp); |
5175 | if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { | 5200 | if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { |
5176 | snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); | 5201 | dev_err(hdsp->card->dev, |
5202 | "error creating alsa devices\n"); | ||
5177 | return err; | 5203 | return err; |
5178 | } | 5204 | } |
5179 | } | 5205 | } |
@@ -5249,13 +5275,14 @@ static int snd_hdsp_create(struct snd_card *card, | |||
5249 | return err; | 5275 | return err; |
5250 | hdsp->port = pci_resource_start(pci, 0); | 5276 | hdsp->port = pci_resource_start(pci, 0); |
5251 | if ((hdsp->iobase = ioremap_nocache(hdsp->port, HDSP_IO_EXTENT)) == NULL) { | 5277 | if ((hdsp->iobase = ioremap_nocache(hdsp->port, HDSP_IO_EXTENT)) == NULL) { |
5252 | snd_printk(KERN_ERR "Hammerfall-DSP: unable to remap region 0x%lx-0x%lx\n", hdsp->port, hdsp->port + HDSP_IO_EXTENT - 1); | 5278 | dev_err(hdsp->card->dev, "unable to remap region 0x%lx-0x%lx\n", |
5279 | hdsp->port, hdsp->port + HDSP_IO_EXTENT - 1); | ||
5253 | return -EBUSY; | 5280 | return -EBUSY; |
5254 | } | 5281 | } |
5255 | 5282 | ||
5256 | if (request_irq(pci->irq, snd_hdsp_interrupt, IRQF_SHARED, | 5283 | if (request_irq(pci->irq, snd_hdsp_interrupt, IRQF_SHARED, |
5257 | KBUILD_MODNAME, hdsp)) { | 5284 | KBUILD_MODNAME, hdsp)) { |
5258 | snd_printk(KERN_ERR "Hammerfall-DSP: unable to use IRQ %d\n", pci->irq); | 5285 | dev_err(hdsp->card->dev, "unable to use IRQ %d\n", pci->irq); |
5259 | return -EBUSY; | 5286 | return -EBUSY; |
5260 | } | 5287 | } |
5261 | 5288 | ||
@@ -5281,17 +5308,20 @@ static int snd_hdsp_create(struct snd_card *card, | |||
5281 | if userspace is not ready for | 5308 | if userspace is not ready for |
5282 | firmware upload | 5309 | firmware upload |
5283 | */ | 5310 | */ |
5284 | snd_printk(KERN_ERR "Hammerfall-DSP: couldn't get firmware from userspace. try using hdsploader\n"); | 5311 | dev_err(hdsp->card->dev, |
5312 | "couldn't get firmware from userspace. try using hdsploader\n"); | ||
5285 | else | 5313 | else |
5286 | /* init is complete, we return */ | 5314 | /* init is complete, we return */ |
5287 | return 0; | 5315 | return 0; |
5288 | /* we defer initialization */ | 5316 | /* we defer initialization */ |
5289 | snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n"); | 5317 | dev_info(hdsp->card->dev, |
5318 | "card initialization pending : waiting for firmware\n"); | ||
5290 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) | 5319 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) |
5291 | return err; | 5320 | return err; |
5292 | return 0; | 5321 | return 0; |
5293 | } else { | 5322 | } else { |
5294 | snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n"); | 5323 | dev_info(hdsp->card->dev, |
5324 | "Firmware already present, initializing card.\n"); | ||
5295 | if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version2) | 5325 | if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version2) |
5296 | hdsp->io_type = RPM; | 5326 | hdsp->io_type = RPM; |
5297 | else if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) | 5327 | else if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) |