]>
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; |
88674088 | 17 | struct pci_dev *default_device = vga_default_device(); |
743146db VK |
18 | struct pci_dev *pci_dev; |
19 | struct resource *res; | |
317b3c21 | 20 | |
743146db | 21 | if (!device || !dev_is_pci(device)) |
88674088 MG |
22 | return 0; |
23 | ||
743146db VK |
24 | pci_dev = to_pci_dev(device); |
25 | ||
88674088 MG |
26 | if (default_device) { |
27 | if (pci_dev == default_device) | |
28 | return 1; | |
743146db | 29 | return 0; |
88674088 MG |
30 | } |
31 | ||
743146db | 32 | res = pci_dev->resource + PCI_ROM_RESOURCE; |
317b3c21 | 33 | |
743146db | 34 | if (res->flags & IORESOURCE_ROM_SHADOW) |
88674088 | 35 | return 1; |
317b3c21 | 36 | |
88674088 | 37 | return 0; |
317b3c21 AD |
38 | } |
39 | EXPORT_SYMBOL(fb_is_primary_device); | |
7b04fa01 | 40 | MODULE_LICENSE("GPL"); |