quoted hunk ↗ jump to hunk
+ /* Indentify GFX Chip Name */
+ pdev =
+ (struct pci_dev *)pci_get_device(PCI_VIA_VENDOR_ID,
+ UNICHROME_CLE266_DID, NULL);
+ if (pdev != NULL)
+ chip_info.gfx_chip_name = UNICHROME_CLE266;
+
+ pdev =
+ (struct pci_dev *)pci_get_device(PCI_VIA_VENDOR_ID,
+ UNICHROME_K400_DID, NULL);
pci_get_device takes a reference so you need to do a pci_dev_put() on the
result if you have finished with it. Alternatively you could make use of
pci_dev_present()
quoted hunk ↗ jump to hunk
+ case UNICHROME_CLE266:
+ pdev =
+ (struct pci_dev *)pci_get_device(PCI_VIA_VENDOR_ID,
+ UNICHROME_CLE266_DID,
Similar issue here.
quoted hunk ↗ jump to hunk
+void get_fb_info(unsigned int *fb_base, unsigned int *fb_len)
+{
+ struct pci_dev *pdev = NULL;
+
+ switch (chip_info.gfx_chip_name) {
+ case UNICHROME_CLE266:
+ pdev =
+ (struct pci_dev *)pci_get_device(PCI_VIA_VENDOR_ID,
+ UNICHROME_CLE266_DID,
+ NULL);
And here
So it might be better to for example use an array of types and keep the
array reference in the probe function pci_device_id field (which is how a
lot of stuff like libata drivers avoid doing messy lookups)