fbdev.c 874 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 *default_device = vga_default_device();
  17. struct pci_dev *pci_dev;
  18. struct resource *res;
  19. if (!device || !dev_is_pci(device))
  20. return 0;
  21. pci_dev = to_pci_dev(device);
  22. if (default_device) {
  23. if (pci_dev == default_device)
  24. return 1;
  25. return 0;
  26. }
  27. res = pci_dev->resource + PCI_ROM_RESOURCE;
  28. if (res->flags & IORESOURCE_ROM_SHADOW)
  29. return 1;
  30. return 0;
  31. }
  32. EXPORT_SYMBOL(fb_is_primary_device);
  33. MODULE_LICENSE("GPL");