ALSA: intel8x0: move virtual environment detection code into one place
This is refactoring patch: preparation for add improved detection code. Now all detection code placed in one place. Signed-off-by: Konstantin Ozerkov <kozerkov@parallels.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
55c0008be6
commit
65c397d6b5
@ -2937,6 +2937,24 @@ static unsigned int sis_codec_bits[3] = {
|
|||||||
ICH_PCR, ICH_SCR, ICH_SIS_TCR
|
ICH_PCR, ICH_SCR, ICH_SIS_TCR
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int __devinit snd_intel8x0_inside_vm(void)
|
||||||
|
{
|
||||||
|
int result = inside_vm;
|
||||||
|
|
||||||
|
if (result < 0) {
|
||||||
|
/* detect KVM and Parallels virtual environments */
|
||||||
|
result = kvm_para_available();
|
||||||
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
|
result = result || boot_cpu_has(X86_FEATURE_HYPERVISOR);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
printk(KERN_INFO "intel8x0: enable KVM optimization\n");
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static int __devinit snd_intel8x0_create(struct snd_card *card,
|
static int __devinit snd_intel8x0_create(struct snd_card *card,
|
||||||
struct pci_dev *pci,
|
struct pci_dev *pci,
|
||||||
unsigned long device_type,
|
unsigned long device_type,
|
||||||
@ -3004,9 +3022,7 @@ static int __devinit snd_intel8x0_create(struct snd_card *card,
|
|||||||
if (xbox)
|
if (xbox)
|
||||||
chip->xbox = 1;
|
chip->xbox = 1;
|
||||||
|
|
||||||
chip->inside_vm = inside_vm;
|
chip->inside_vm = snd_intel8x0_inside_vm();
|
||||||
if (inside_vm)
|
|
||||||
printk(KERN_INFO "intel8x0: enable KVM optimization\n");
|
|
||||||
|
|
||||||
if (pci->vendor == PCI_VENDOR_ID_INTEL &&
|
if (pci->vendor == PCI_VENDOR_ID_INTEL &&
|
||||||
pci->device == PCI_DEVICE_ID_INTEL_440MX)
|
pci->device == PCI_DEVICE_ID_INTEL_440MX)
|
||||||
@ -3250,14 +3266,6 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
|
|||||||
buggy_irq = 0;
|
buggy_irq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inside_vm < 0) {
|
|
||||||
/* detect KVM and Parallels virtual environments */
|
|
||||||
inside_vm = kvm_para_available();
|
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
|
||||||
inside_vm = inside_vm || boot_cpu_has(X86_FEATURE_HYPERVISOR);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data,
|
if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data,
|
||||||
&chip)) < 0) {
|
&chip)) < 0) {
|
||||||
snd_card_free(card);
|
snd_card_free(card);
|
||||||
|
Loading…
Reference in New Issue
Block a user