Merge tag 'probes-fixes-v6.5-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-block.git] / arch / x86 / video / fbdev.c
CommitLineData
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 */
94545f27 9
317b3c21 10#include <linux/fb.h>
7c52d551 11#include <linux/module.h>
94545f27 12#include <linux/pci.h>
88674088 13#include <linux/vgaarb.h>
29bf464c 14#include <asm/fb.h>
317b3c21 15
94545f27
TZ
16void fb_pgprotect(struct file *file, struct vm_area_struct *vma, unsigned long off)
17{
18 unsigned long prot;
19
20 prot = pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK;
21 if (boot_cpu_data.x86 > 3)
22 pgprot_val(vma->vm_page_prot) =
23 prot | cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
24}
25EXPORT_SYMBOL(fb_pgprotect);
26
317b3c21
AD
27int fb_is_primary_device(struct fb_info *info)
28{
623e71b0 29 struct device *device = info->device;
743146db 30 struct pci_dev *pci_dev;
317b3c21 31
743146db 32 if (!device || !dev_is_pci(device))
88674088
MG
33 return 0;
34
743146db
VK
35 pci_dev = to_pci_dev(device);
36
5ca1479c 37 if (pci_dev == vga_default_device())
88674088 38 return 1;
88674088 39 return 0;
317b3c21
AD
40}
41EXPORT_SYMBOL(fb_is_primary_device);
94545f27 42
7b04fa01 43MODULE_LICENSE("GPL");