提交 c9116ae4 编写于 作者: C Clemens Ladisch 提交者: Jaroslav Kysela

[ALSA] cmipci: make the test for integrated MIDI port address more robust

Unused bytes in the I/O register range are likely to have the value 0x00
instead of 0xff, so test against both values when checking for the
presence of the integrated MIDI port.
Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
Signed-off-by: NJaroslav Kysela <perex@suse.cz>
上级 dfe495d0
...@@ -2827,7 +2827,7 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc ...@@ -2827,7 +2827,7 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
}; };
unsigned int val = 0; unsigned int val = 0;
long iomidi; long iomidi;
int integrated_midi; int integrated_midi = 0;
int pcm_index, pcm_spdif_index; int pcm_index, pcm_spdif_index;
static struct pci_device_id intel_82437vx[] = { static struct pci_device_id intel_82437vx[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82437VX) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82437VX) },
...@@ -2939,11 +2939,14 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc ...@@ -2939,11 +2939,14 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
return err; return err;
} }
integrated_midi = cm->chip_version > 33 && if (cm->chip_version > 33 && mpu_port[dev] == 1) {
snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1) != 0xff; val = snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1);
if (integrated_midi && mpu_port[dev] == 1) if (val != 0x00 && val != 0xff) {
iomidi = cm->iobase + CM_REG_MPU_PCI; iomidi = cm->iobase + CM_REG_MPU_PCI;
else { integrated_midi = 1;
}
}
if (!integrated_midi) {
iomidi = mpu_port[dev]; iomidi = mpu_port[dev];
switch (iomidi) { switch (iomidi) {
case 0x320: val = CM_VMPU_320; break; case 0x320: val = CM_VMPU_320; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册