pci: Utilize device_getenv_int
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 16 Apr 2012 09:16:08 +0000 (17:16 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 16 Apr 2012 09:16:08 +0000 (17:16 +0800)
sys/bus/pci/pci.c

index 125ec84..f752fa1 100644 (file)
@@ -4098,22 +4098,16 @@ pci_alloc_1intr(device_t dev, int msi_enable, int *rid0, u_int *flags0)
 {
        int rid, type;
        u_int flags;
-       char env[64];
 
        rid = 0;
        type = PCI_INTR_TYPE_LEGACY;
        flags = RF_SHAREABLE | RF_ACTIVE;
 
-       ksnprintf(env, sizeof(env), "hw.%s.msi.enable",
-           device_get_nameunit(dev));
-       kgetenv_int(env, &msi_enable);
-
+       device_getenv_int(dev, "msi.enable", &msi_enable);
        if (msi_enable) {
                int cpu = -1;
 
-               ksnprintf(env, sizeof(env), "hw.%s.msi.cpu",
-                   device_get_nameunit(dev));
-               kgetenv_int(env, &cpu);
+               device_getenv_int(dev, "msi.cpu", &cpu);
                if (cpu >= ncpus)
                        cpu = ncpus - 1;