2007-07-17 18:05:28 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file COPYING in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <linux/fb.h>
|
|
|
|
#include <linux/pci.h>
|
2011-05-27 23:33:10 +07:00
|
|
|
#include <linux/module.h>
|
2012-04-17 03:26:04 +07:00
|
|
|
#include <linux/vgaarb.h>
|
2007-07-17 18:05:28 +07:00
|
|
|
|
|
|
|
int fb_is_primary_device(struct fb_info *info)
|
|
|
|
{
|
2007-07-17 18:05:28 +07:00
|
|
|
struct device *device = info->device;
|
2007-07-17 18:05:28 +07:00
|
|
|
struct pci_dev *pci_dev = NULL;
|
2012-04-17 03:26:04 +07:00
|
|
|
struct pci_dev *default_device = vga_default_device();
|
2007-07-17 18:05:28 +07:00
|
|
|
struct resource *res = NULL;
|
|
|
|
|
|
|
|
if (device)
|
|
|
|
pci_dev = to_pci_dev(device);
|
|
|
|
|
2012-04-17 03:26:04 +07:00
|
|
|
if (!pci_dev)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (default_device) {
|
|
|
|
if (pci_dev == default_device)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = &pci_dev->resource[PCI_ROM_RESOURCE];
|
2007-07-17 18:05:28 +07:00
|
|
|
|
|
|
|
if (res && res->flags & IORESOURCE_ROM_SHADOW)
|
2012-04-17 03:26:04 +07:00
|
|
|
return 1;
|
2007-07-17 18:05:28 +07:00
|
|
|
|
2012-04-17 03:26:04 +07:00
|
|
|
return 0;
|
2007-07-17 18:05:28 +07:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(fb_is_primary_device);
|
2008-05-03 03:32:32 +07:00
|
|
|
MODULE_LICENSE("GPL");
|