aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/rme9652/hdspm.c
diff options
context:
space:
mode:
authorAdrian Knoth <adi@drcomp.erfurt.thur.de>2012-01-04 08:31:16 -0500
committerTakashi Iwai <tiwai@suse.de>2012-01-08 10:05:40 -0500
commit7d53a631ed92abd19d3c948a5daa535e53bd2bff (patch)
tree6fec4787872b5f42cb0a73797aac03cb2aad9ce9 /sound/pci/rme9652/hdspm.c
parent4fa0e81b83503900be277e6273a79651b375e288 (diff)
ALSA: hdspm - Refactor serial number to avoid code duplication
The serial number is used multiple times in hdspm.c. Since it belongs to the card, let's store it in struct hdspm and refer to it whenever necessary. Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/rme9652/hdspm.c')
-rw-r--r--sound/pci/rme9652/hdspm.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index d623451cbf46..16092538e0bb 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -941,6 +941,8 @@ struct hdspm {
941 941
942 cycles_t last_interrupt; 942 cycles_t last_interrupt;
943 943
944 unsigned int serial;
945
944 struct hdspm_peak_rms peak_rms; 946 struct hdspm_peak_rms peak_rms;
945}; 947};
946 948
@@ -4694,7 +4696,7 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry,
4694 4696
4695 snd_iprintf(buffer, "HW Serial: 0x%06x%06x\n", 4697 snd_iprintf(buffer, "HW Serial: 0x%06x%06x\n",
4696 (hdspm_read(hdspm, HDSPM_midiStatusIn1)>>8) & 0xFFFFFF, 4698 (hdspm_read(hdspm, HDSPM_midiStatusIn1)>>8) & 0xFFFFFF,
4697 (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF); 4699 hdspm->serial);
4698 4700
4699 snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n", 4701 snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n",
4700 hdspm->irq, hdspm->port, (unsigned long)hdspm->iobase); 4702 hdspm->irq, hdspm->port, (unsigned long)hdspm->iobase);
@@ -6266,8 +6268,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
6266 hdspm_version.card_type = hdspm->io_type; 6268 hdspm_version.card_type = hdspm->io_type;
6267 strncpy(hdspm_version.cardname, hdspm->card_name, 6269 strncpy(hdspm_version.cardname, hdspm->card_name,
6268 sizeof(hdspm_version.cardname)); 6270 sizeof(hdspm_version.cardname));
6269 hdspm_version.serial = (hdspm_read(hdspm, 6271 hdspm_version.serial = hdspm->serial;
6270 HDSPM_midiStatusIn0)>>8) & 0xFFFFFF;
6271 hdspm_version.firmware_rev = hdspm->firmware_rev; 6272 hdspm_version.firmware_rev = hdspm->firmware_rev;
6272 hdspm_version.addons = 0; 6273 hdspm_version.addons = 0;
6273 if (hdspm->tco) 6274 if (hdspm->tco)
@@ -6866,12 +6867,14 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci,
6866 } 6867 }
6867 6868
6868 if (hdspm->io_type != MADIface) { 6869 if (hdspm->io_type != MADIface) {
6870 hdspm->serial = (hdspm_read(hdspm,
6871 HDSPM_midiStatusIn0)>>8) & 0xFFFFFF;
6869 sprintf(card->shortname, "%s_%x", 6872 sprintf(card->shortname, "%s_%x",
6870 hdspm->card_name, 6873 hdspm->card_name,
6871 (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF); 6874 hdspm->serial);
6872 sprintf(card->longname, "%s S/N 0x%x at 0x%lx, irq %d", 6875 sprintf(card->longname, "%s S/N 0x%x at 0x%lx, irq %d",
6873 hdspm->card_name, 6876 hdspm->card_name,
6874 (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF, 6877 hdspm->serial,
6875 hdspm->port, hdspm->irq); 6878 hdspm->port, hdspm->irq);
6876 } else { 6879 } else {
6877 sprintf(card->shortname, "%s", hdspm->card_name); 6880 sprintf(card->shortname, "%s", hdspm->card_name);