fbdev.c 895 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file COPYING in the main directory of this archive
  6. * for more details.
  7. *
  8. */
  9. #include <linux/fb.h>
  10. #include <linux/pci.h>
  11. #include <linux/module.h>
  12. #include <linux/vgaarb.h>
  13. int fb_is_primary_device(struct fb_info *info)
  14. {
  15. struct device *device = info->device;
  16. struct pci_dev *pci_dev = NULL;
  17. struct pci_dev *default_device = vga_default_device();
  18. struct resource *res = NULL;
  19. if (device)
  20. pci_dev = to_pci_dev(device);
  21. if (!pci_dev)
  22. return 0;
  23. if (default_device) {
  24. if (pci_dev == default_device)
  25. return 1;
  26. else
  27. return 0;
  28. }
  29. res = &pci_dev->resource[PCI_ROM_RESOURCE];
  30. if (res && res->flags & IORESOURCE_ROM_SHADOW)
  31. return 1;
  32. return 0;
  33. }
  34. EXPORT_SYMBOL(fb_is_primary_device);
  35. MODULE_LICENSE("GPL");