0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/fb.h>
0010 #include <linux/pci.h>
0011 #include <linux/module.h>
0012 #include <linux/vgaarb.h>
0013
0014 int fb_is_primary_device(struct fb_info *info)
0015 {
0016 struct device *device = info->device;
0017 struct pci_dev *default_device = vga_default_device();
0018 struct pci_dev *pci_dev;
0019 struct resource *res;
0020
0021 if (!device || !dev_is_pci(device))
0022 return 0;
0023
0024 pci_dev = to_pci_dev(device);
0025
0026 if (default_device) {
0027 if (pci_dev == default_device)
0028 return 1;
0029 return 0;
0030 }
0031
0032 res = pci_dev->resource + PCI_ROM_RESOURCE;
0033
0034 if (res->flags & IORESOURCE_ROM_SHADOW)
0035 return 1;
0036
0037 return 0;
0038 }
0039 EXPORT_SYMBOL(fb_is_primary_device);
0040 MODULE_LICENSE("GPL");