@ -31,10 +31,12 @@
# include <linux/pci.h>
# include <linux/acpi.h>
# include <linux/module.h>
# include < asm /uaccess.h>
# include < linux /uaccess.h>
# include <linux/suspend.h>
# include <linux/seq_file.h>
# include <linux/pm_runtime.h>
# include <linux/proc_fs.h>
# include <linux/version.h>
# define BBSWITCH_VERSION "0.8"
@ -285,7 +287,7 @@ static void bbswitch_on(void) {
return ;
pr_info ( " enabling discrete graphics \n " ) ;
//pci_bridge_secondary_bus_reset(dis_dev);
if ( bbswitch_acpi_on ( ) )
pr_warn ( " The discrete card could not be enabled by a _DSM call \n " ) ;
@ -375,6 +377,15 @@ static int bbswitch_pm_handler(struct notifier_block *nbp,
return 0 ;
}
# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
static struct proc_ops bbswitch_fops = {
. proc_open = bbswitch_proc_open ,
. proc_read = seq_read ,
. proc_write = bbswitch_proc_write ,
. proc_lseek = seq_lseek ,
. proc_release = single_release
} ;
# else
static struct file_operations bbswitch_fops = {
. open = bbswitch_proc_open ,
. read = seq_read ,
@ -382,6 +393,7 @@ static struct file_operations bbswitch_fops = {
. llseek = seq_lseek ,
. release = single_release
} ;
# endif
static struct notifier_block nb = {
. notifier_call = & bbswitch_pm_handler
@ -418,12 +430,13 @@ static int __init bbswitch_init(void) {
acpi_get_name ( handle , ACPI_FULL_PATHNAME , & buf ) ;
if ( pdev - > vendor = = PCI_VENDOR_ID_ INTEL ) {
if ( pdev - > vendor = = PCI_VENDOR_ID_ ATI ) {
igd_handle = handle ;
pr_info ( " Found integrated VGA device %s: %s \n " ,
dev_name ( & pdev - > dev ) , ( char * ) buf . pointer ) ;
} else {
dis_dev = pdev ;
pci_d3cold_enable ( pdev ) ;
dis_handle = handle ;
pr_info ( " Found discrete VGA device %s: %s \n " ,
dev_name ( & pdev - > dev ) , ( char * ) buf . pointer ) ;