diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-23 21:55:46 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-23 21:55:46 +0100 |
commit | 40d90dfd8674c255a45b46bbdc09d497af5b3f50 (patch) | |
tree | 0895bc6f9f180282048a74036f6600fc31f6c713 /src/intel_module.c | |
parent | e3f6c48d18c316899c71b6fc34971039c6f9e5f8 (diff) |
intel: Refactor the common chipset detection/override
Reduce the duplicate messages for which type of chip we by
amalgamating the common code.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/intel_module.c')
-rw-r--r-- | src/intel_module.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/intel_module.c b/src/intel_module.c index a39affbd..845b40eb 100644 --- a/src/intel_module.c +++ b/src/intel_module.c @@ -223,29 +223,38 @@ static const struct pci_id_match intel_device_match[] = { { 0, 0, 0 }, }; -void intel_detect_chipset(ScrnInfoPtr scrn, - struct pci_device *pci, - struct intel_chipset *chipset) +const struct intel_device_info * +intel_detect_chipset(ScrnInfoPtr scrn, + EntityInfoPtr ent, struct pci_device *pci) { + MessageType from = X_PROBED; + const char *name = NULL; int i; - chipset->info = chipset_info; - chipset->name = NULL; + if (ent->device->chipID >= 0) { + xf86DrvMsg(scrn->scrnIndex, from = X_CONFIG, + "ChipID override: 0x%04X\n", + ent->device->chipID); + DEVICE_ID(pci) = ent->device->chipID; + } for (i = 0; intel_chipsets[i].name != NULL; i++) { if (DEVICE_ID(pci) == intel_chipsets[i].token) { - chipset->name = intel_chipsets[i].name; + name = intel_chipsets[i].name; break; } } - if (chipset->name == NULL) { + if (name == NULL) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "unknown chipset\n"); - chipset->name = "unknown"; + name = "unknown"; } else { - xf86DrvMsg(scrn->scrnIndex, X_INFO, + xf86DrvMsg(scrn->scrnIndex, from, "Integrated Graphics Chipset: Intel(R) %s\n", - chipset->name); + name); } + + scrn->chipset = name; + return chipset_info; } /* |