Commit | Line | Data |
---|---|---|
317b3c21 | 1 | /* |
317b3c21 AD |
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> | |
7c52d551 | 11 | #include <linux/module.h> |
88674088 | 12 | #include <linux/vgaarb.h> |
317b3c21 AD |
13 | |
14 | int fb_is_primary_device(struct fb_info *info) | |
15 | { | |
623e71b0 | 16 | struct device *device = info->device; |
317b3c21 | 17 | struct pci_dev *pci_dev = NULL; |
88674088 | 18 | struct pci_dev *default_device = vga_default_device(); |
317b3c21 | 19 | struct resource *res = NULL; |
317b3c21 | 20 | |
317b3c21 AD |
21 | if (device) |
22 | pci_dev = to_pci_dev(device); | |
23 | ||
88674088 MG |
24 | if (!pci_dev) |
25 | return 0; | |
26 | ||
27 | if (default_device) { | |
28 | if (pci_dev == default_device) | |
29 | return 1; | |
30 | else | |
31 | return 0; | |
32 | } | |
33 | ||
34 | res = &pci_dev->resource[PCI_ROM_RESOURCE]; | |
317b3c21 AD |
35 | |
36 | if (res && res->flags & IORESOURCE_ROM_SHADOW) | |
88674088 | 37 | return 1; |
317b3c21 | 38 | |
88674088 | 39 | return 0; |
317b3c21 AD |
40 | } |
41 | EXPORT_SYMBOL(fb_is_primary_device); | |
7b04fa01 | 42 | MODULE_LICENSE("GPL"); |